📄 wap_codec.c
字号:
(T_WAP_FUNCTION)M_WAP_MMI_NEW_KEY_IND,
(T_WAP_FUNCTION)M_WAP_MMI_INPUT_DIALOG_REQ ,
(T_WAP_FUNCTION)M_WAP_MMI_PASSWORD_DIALOG_REQ,
(T_WAP_FUNCTION)M_WAP_MMI_CONFIRM_DIALOG_REQ,
(T_WAP_FUNCTION)M_WAP_MMI_INFO_DIALOG_REQ,
(T_WAP_FUNCTION)M_WAP_MMI_NEW_CARD_IND,
(T_WAP_FUNCTION)M_WAP_MMI_DRAW_CARD_IND,
(T_WAP_FUNCTION)M_WAP_MMI_CLEAR_CARD_IND,
(T_WAP_FUNCTION)M_WAP_MMI_SEND_TEXT_IND,
(T_WAP_FUNCTION)M_WAP_MMI_SEND_IMAGE_IND,
(T_WAP_FUNCTION)M_WAP_MMI_SEND_TABLE_IND,
(T_WAP_FUNCTION)M_WAP_MMI_CARD_DRAW_COMPLETED_IND,
(T_WAP_FUNCTION)M_WAP_MMI_CONNECT_REQ,
(T_WAP_FUNCTION)M_WAP_MMI_DISCONNECTED_IND,
(T_WAP_FUNCTION)M_WAP_MMI_READY_CNF
#ifdef MMS_WAP_ENABLED
/*talcon add for mms*/
,
(T_WAP_FUNCTION)M_MMI_WAP_MMSSTART_IND,
(T_WAP_FUNCTION)M_MMI_WAP_MMSTERMINATE_IND,
(T_WAP_FUNCTION)M_MMI_WAP_POSTCONTENT_IND,
(T_WAP_FUNCTION)M_WAP_MMI_CONTENT_REQ,
(T_WAP_FUNCTION)M_MMI_WAP_POSTMORECONTENT_IND,
(T_WAP_FUNCTION)M_WAP_MMI_ACKPOSTCONTENT_REQ,
(T_WAP_FUNCTION)M_MMI_WAP_GETCONTENT_IND,
(T_WAP_FUNCTION)M_MMI_WAP_ACKCONTENT_IND,
(T_WAP_FUNCTION)M_MMI_WAP_CANCELCONTENT_IND
#endif
};
#endif
#ifndef WAP_TASK
trace("mmi_decoder_unpack_event");
#else
trace("wap_decoder_unpack_event");
#endif
/* Calculate the offset table */
#ifdef WAP_TASK
wap_offset_table(event_id, offset_table, ¶m_size);
#else
tempLcdStatus = dspl_Enable(0);
mmi_offset_table(event_id, offset_table, ¶m_size);
#endif
/* Using the offset table, reconnect the pointers of the structure to the other data blocks */
total_size = 0;
parameter = event_store+sizeof(U32); /* 'parameter' is data to be passed to function */
destPtr = parameter; /* Point to start of data block */
for (offsetIndex = 0; offset_table[offsetIndex][0] != 0xFFFF; offsetIndex++)
{
trace_P1("Reconnecting pointer %d", offsetIndex);
srcPtr = parameter + offset_table[offsetIndex][0]+sizeof(U32); /* Point to next pointer to be changed */
block_size = *(destPtr-4)+256*(*(destPtr-3)); /* Size of block in bytes */
total_size += block_size+sizeof(U32);
destPtr += block_size+sizeof(U32); /* Point to beginning of next data block */
memcpy(srcPtr, &destPtr, sizeof(UBYTE*)); /* Copy the pointer */
}
block_size = *(destPtr-4)+256*(*(destPtr-3)); /* Size of last block in bytes */
total_size += block_size+sizeof(U32);
WAP_TRACE_EVENT(( "Size of packet received: %d", total_size));
/* Call the required function */
(*functionList[event_id]) (parameter);
#ifndef WAP_TASK
dspl_Enable(tempLcdStatus);
#endif
return;
}
/*******************************************************************************
$Function: wap_offset_table
$Description: The data structure that is transmitted in the event will have pointers
that point to blocks of data (e.g. text). These blocks are bundled
together with the data structure itself and sent, but on receipt the
pointers are no longer correct. The offset table stores the *position*
of these pointers in the data structure, relative to the base address
of the data structure itself. This permits the decoder to correctly
reassign these pointers.
$Returns: None.
$Arguments: struct_size - pointer to ushort variable that holds length of structure
in bytes
*******************************************************************************/
#ifdef WAP_TASK
void wap_offset_table(UBYTE event_id, USHORT offset_table[][2], USHORT *struct_size) {
#else
void mmi_offset_table(UBYTE event_id, USHORT offset_table[][2], USHORT *struct_size) {
#endif
UBYTE offsetIndex;
/* On receiving the event, we need to have access to the data structures
* in order to decode the data block we receive.
*/
T_MMI_WAP_NEW_VIEW_IND *newView;
T_MMI_WAP_CONFIGURE_IND *configure;
T_MMI_WAP_CONNECTION_CONFIGURE_IND *connectionConfigure;
T_MMI_WAP_DOWNLOAD_URL_IND *downloadURL;
T_MMI_WAP_INPUT_DIALOG_CNF *inputDialogCnf;
T_MMI_WAP_PASSWORD_DIALOG_CNF *passwordDialogCnf;
T_WAP_MMI_NEW_KEY_IND *newKey;
T_WAP_MMI_INPUT_DIALOG_REQ *inputDialogReq;
T_WAP_MMI_PASSWORD_DIALOG_REQ *passwordDialogReq;
T_WAP_MMI_CONFIRM_DIALOG_REQ *confirmDialogReq;
T_WAP_MMI_INFO_DIALOG_REQ *infoDialogReq;
T_WAP_MMI_NEW_CARD_IND *newCard;
T_WAP_MMI_SEND_TEXT_IND *sendText;
T_WAP_MMI_SEND_IMAGE_IND *sendImage;
T_WAP_MMI_SEND_TABLE_IND *sendTable;
#ifdef WAP_TASK
trace("wap_offset_table");
#else
trace("mmi_offset_table");
#endif
/* Which type of event is it? */
switch(event_id)
{
/* These types have dynamic fields. */
case WAP_NEW_VIEW_IND_ID:
offset_table[0][0] = (USHORT)&newView->font_width_length - (USHORT)newView;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = 0xFFFF;
*struct_size = (USHORT)sizeof(T_MMI_WAP_NEW_VIEW_IND);
break;
case WAP_CONFIGURE_IND_ID:
offset_table[0][0] = (USHORT)&configure->length - (USHORT)configure;
offset_table[0][1] = sizeof(char);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_MMI_WAP_CONFIGURE_IND);
break;
case WAP_CONNECTION_CONFIGURE_IND_ID:
offset_table[0][0] = (USHORT)&connectionConfigure->length - (USHORT)connectionConfigure;
offset_table[0][1] = sizeof(char);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_MMI_WAP_CONNECTION_CONFIGURE_IND);
break;
case WAP_DOWNLOAD_URL_IND_ID:
offset_table[0][0] = (USHORT)&downloadURL->url_length - (USHORT)downloadURL;
offset_table[0][1] = sizeof(char);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_MMI_WAP_DOWNLOAD_URL_IND);
break;
case WAP_INPUT_DIALOG_CNF_ID:
offset_table[0][0] = (USHORT)&inputDialogCnf->text_length - (USHORT)inputDialogCnf;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_MMI_WAP_INPUT_DIALOG_CNF);
break;
case WAP_PASSWORD_DIALOG_CNF_ID:
offset_table[0][0] = (USHORT)&passwordDialogCnf->input_length - (USHORT)passwordDialogCnf;
offset_table[0][1] = sizeof(char);
offset_table[1][0] = (USHORT)&passwordDialogCnf->password_length - (USHORT)passwordDialogCnf;
offset_table[1][1] = sizeof(char);
offset_table[2][0] = 0xFFFF;
*struct_size = sizeof(T_MMI_WAP_PASSWORD_DIALOG_CNF);
break;
/* These types do not have any dynamic fields. */
case WAP_READY_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_READY_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_START_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_START_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_TERMINATE_IND_ID:
*struct_size = sizeof(T_MMI_WAP_TERMINATE_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CLOSE_VIEW_IND_ID:
*struct_size = sizeof(T_MMI_WAP_CLOSE_VIEW_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_BROWSE_CONTROL_IND_ID:
*struct_size = sizeof(T_MMI_WAP_BROWSE_CONTROL_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_KEY_SELECTED_IND_ID:
*struct_size = sizeof(T_MMI_WAP_KEY_SELECTED_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CONFIRM_DIALOG_CNF_ID:
*struct_size = sizeof(T_MMI_WAP_CONFIRM_DIALOG_CNF);
offset_table[0][0] = 0xFFFF;
break;
case WAP_INFO_DIALOG_CNF_ID:
*struct_size = sizeof(T_MMI_WAP_INFO_DIALOG_CNF);
offset_table[0][0] = 0xFFFF;
break;
case WAP_DRAW_CARD_REQ_ID:
*struct_size = sizeof(T_MMI_WAP_DRAW_CARD_REQ);
offset_table[0][0] = 0xFFFF;
break;
case WAP_DISCONNECT_IND_ID:
*struct_size = sizeof(T_MMI_WAP_DISCONNECT_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CONNECT_CNF_ID:
*struct_size = sizeof(T_MMI_WAP_CONNECT_CNF);
offset_table[0][0] = 0xFFFF;
break;
case WAP_READY_CNF_ID:
*struct_size = (USHORT)sizeof(T_WAP_MMI_READY_CNF);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CACHE_PREPARE_IND_ID:
*struct_size = sizeof(T_MMI_WAP_CACHE_PREPARE_IND);
offset_table[0][0] = 0xFFFF;
break;
/* These types have dynamic fields. */
case WAP_NEW_KEY_IND_ID:
offset_table[0][0] = (USHORT)&newKey->label_length - (USHORT)newKey;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_NEW_KEY_IND);
break;
case WAP_INPUT_DIALOG_REQ_ID:
offset_table[0][0] = (USHORT)&inputDialogReq->title_length - (USHORT)inputDialogReq;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = (USHORT)&inputDialogReq->input_length - (USHORT)inputDialogReq;
offset_table[1][1] = sizeof(USHORT);
offset_table[2][0] = (USHORT)&inputDialogReq->format_length - (USHORT)inputDialogReq;
offset_table[2][1] = sizeof(USHORT);
offset_table[3][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_INPUT_DIALOG_REQ);
break;
case WAP_PASSWORD_DIALOG_REQ_ID:
/* SPR#2393 - SH - Change parameters of password event */
offset_table[0][0] = (USHORT)&passwordDialogReq->realm_length - (USHORT)passwordDialogReq;
offset_table[0][1] = sizeof(char);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_PASSWORD_DIALOG_REQ);
break;
case WAP_CONFIRM_DIALOG_REQ_ID:
offset_table[0][0] = (USHORT)&confirmDialogReq->message_length - (USHORT)confirmDialogReq;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = (USHORT)&confirmDialogReq->ok_key_length - (USHORT)confirmDialogReq;
offset_table[1][1] = sizeof(USHORT);
offset_table[2][0] = (USHORT)&confirmDialogReq->cancel_key_length - (USHORT)confirmDialogReq;
offset_table[2][1] = sizeof(USHORT);
offset_table[3][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_CONFIRM_DIALOG_REQ);
break;
case WAP_INFO_DIALOG_REQ_ID:
offset_table[0][0] = (USHORT)&infoDialogReq->message_length - (USHORT)infoDialogReq;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_INFO_DIALOG_REQ);
break;
case WAP_NEW_CARD_IND_ID:
offset_table[0][0] = (USHORT)&newCard->title_length - (USHORT)newCard;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = (USHORT)&newCard->url_length - (USHORT)newCard;
offset_table[1][1] = sizeof(char);
offset_table[2][0] = (USHORT)&newCard->history_length - (USHORT)newCard;
offset_table[2][1] = sizeof(U32);
offset_table[3][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_NEW_CARD_IND);
break;
case WAP_SEND_TEXT_IND_ID:
offset_table[0][0] = (USHORT)&sendText->text_length - (USHORT)sendText;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_SEND_TEXT_IND);
break;
case WAP_SEND_IMAGE_IND_ID:
offset_table[0][0] = (USHORT)&sendImage->image_length - (USHORT)sendImage;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_SEND_IMAGE_IND);
break;
case WAP_SEND_TABLE_IND_ID:
offset_table[0][0] = (USHORT)&sendTable->title_length - (USHORT)sendTable;
offset_table[0][1] = sizeof(USHORT);
offset_table[1][0] = (USHORT)&sendTable->cols_length - (USHORT)sendTable;
offset_table[1][1] = sizeof(SHORT);
offset_table[2][0] = (USHORT)&sendTable->rows_length - (USHORT)sendTable;
offset_table[2][1] = sizeof(SHORT);
offset_table[3][0] = 0xFFFF;
*struct_size = sizeof(T_WAP_MMI_SEND_TABLE_IND);
break;
/* These types do not have any dynamic fields. */
case WAP_CONTROL_IND_ID:
*struct_size = sizeof(T_WAP_MMI_CONTROL_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_DRAW_CARD_IND_ID:
*struct_size = sizeof(T_WAP_MMI_DRAW_CARD_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CLEAR_CARD_IND_ID:
*struct_size = sizeof(T_WAP_MMI_CLEAR_CARD_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CARD_DRAW_COMPLETED_IND_ID:
*struct_size = sizeof(T_WAP_MMI_CARD_DRAW_COMPLETED_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CONNECT_REQ_ID:
*struct_size = sizeof(T_WAP_MMI_CONNECT_REQ);
offset_table[0][0] = 0xFFFF;
break;
case WAP_DISCONNECTED_IND_ID:
*struct_size = sizeof(T_WAP_MMI_DISCONNECTED_IND);
offset_table[0][0] = 0xFFFF;
break;
#ifdef MMS_WAP_ENABLED
/*talcon add for mms*/
case WAP_MMSSTART_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_MMSSTART_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_MMSTERMINATE_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_MMSTERMINATE_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_POSTCONTENT_IND_ID:
{
T_MMI_WAP_POSTCONTENT_IND *postContent = 0;
*struct_size = (USHORT)sizeof(T_MMI_WAP_POSTCONTENT_IND);
offset_table[0][0] = (USHORT)&postContent->addr_length - (USHORT)postContent;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = (USHORT)&postContent->acceptHeader_length - (USHORT)postContent;
offset_table[1][1] = sizeof(UBYTE);
offset_table[2][0] = (USHORT)&postContent->data_length - (USHORT)postContent;
offset_table[2][1] = sizeof(UBYTE);
offset_table[3][0] = (USHORT)&postContent->contentType_length - (USHORT)postContent;
offset_table[3][1] = sizeof(UBYTE);
offset_table[4][0] = (USHORT)&postContent->contentDisp_length - (USHORT)postContent;
offset_table[4][1] = sizeof(UBYTE);
offset_table[5][0] = 0xFFFF;
}
break;
case WAP_CONTENT_REQ_ID:
{
T_WAP_MMI_CONTENT_REQ *contentReq;
*struct_size = (USHORT)sizeof(T_WAP_MMI_CONTENT_REQ);
offset_table[0][0] = (USHORT)&contentReq->data_length - (USHORT)contentReq;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = (USHORT)&contentReq->contentType_length - (USHORT)contentReq;
offset_table[1][1] = sizeof(UBYTE);
offset_table[2][0] = 0xFFFF;
}
break;
case WAP_POSTMORECONTENT_IND_ID:
{
T_MMI_WAP_POSTMORECONTENT_IND *postMoreContent;
*struct_size = (USHORT)sizeof(T_MMI_WAP_POSTMORECONTENT_IND);
offset_table[0][0] = (USHORT)&postMoreContent->data_length - (USHORT)postMoreContent;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = 0xFFFF;
}
break;
case WAP_ACKPOSTCONTENT_REQ_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_MMSTERMINATE_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_GETCONTENT_IND_ID:
{
T_MMI_WAP_GETCONTENT_IND *getContent;
*struct_size = (USHORT)sizeof(T_MMI_WAP_GETCONTENT_IND);
offset_table[0][0] = (USHORT)&getContent->addr_length- (USHORT)getContent;
offset_table[0][1] = sizeof(UBYTE);
offset_table[1][0] = (USHORT)&getContent->acceptHeader_length - (USHORT)getContent;
offset_table[1][1] = sizeof(UBYTE);
offset_table[2][0] = 0xFFFF;
}
break;
case WAP_ACKCONTENT_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_ACKCONTENT_IND);
offset_table[0][0] = 0xFFFF;
break;
case WAP_CANCELCONTENT_IND_ID:
*struct_size = (USHORT)sizeof(T_MMI_WAP_CANCELCONTENT_IND);
offset_table[0][0] = 0xFFFF;
break;
/*end talcon add*/
#endif
}
#ifdef WAP_TASK
trace("wap_offset_table end");
#else
trace("mmi_offset_table end");
#endif
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -