MTK短信相关函数.doc

1、全局变量和资源

短信箱容量

[\custom\ps\IWIT23_07A_PMJ_BB\customer_ps_inc.h]

 
#define CM_SMS_MAX_MSG_NUM 400 // 手机 + SIM卡

[\custom\common\PLUTO_MMI\nvram_common_defs.h]

#define NVRAM_EF_SMSAL_SMS_TOTAL 200 // 手机

信箱和索引表

[\custom\common\mmi_msg_context.c]

unsigned short mmi_frm_sms_inbox_list[CM_SMS_MAX_MSG_NUM];// 收件箱索引表
unsigned short mmi_frm_sms_outbox_list[CM_SMS_MAX_MSG_NUM]; // 发件箱索引表
mmi_frm_sms_msgbox_struct mmi_frm_sms_msg_box[CM_SMS_MAX_MSG_NUM];// 信箱

[\plutommi\mmi\miscframework\miscframeworkinc\SMSApi.h]

mmi_frm_sms_app_msgbox_enum // 信箱类型枚举
MMI_FRM_SMS_APP_INBOX = 0x02,
MMI_FRM_SMS_APP_OUTBOX = 0x04

[\plutommi\mmi\miscframework\miscframeworkinc\SMSStruct.h]

 
mmi_frm_sms_msgbox_enum // 信箱类型枚举
MMI_FRM_SMS_INBOX = 0x02,
MMI_FRM_SMS_OUTBOX = 0x04,

索引表mmi_frm_sms_inbox_list和索引表mmi_frm_sms_outbox_list,分别对应【消息】菜单中的【收件箱】和【发件箱】。

信箱mmi_frm_sms_msg_box 保存的只是短信副本,用于显示和其它处理,直接更改其数据对实际的短信无效,必须向L4层发送消息才能生效。

通过索引列表(mmi_frm_sms_xxbox_list)在短信箱菜单和短信之间建立关联:

> 菜单

> 消息

> 收件箱

> 短信1 --> mmi_frm_sms_inbox_list[itemIndex] --> smsIndex

> 短信2

[...]

> 短信n

短信箱(字串/屏幕)资源

[plutommi\mmi\Messages\MessagesInc\MessagesResourceData.h]

 
STR_INBOX_MENUENTRY // “收件箱”
STR_OUTBOX_MENUENTRY, // “发件箱”
SCR_ID_MSG_INBOX_LIST // 收件箱屏
SCR_ID_MSG_OUTBOX_LIST,// 发件箱屏幕
STR_SCR6028_CAPTION // “消息选单”

2、发短信

2.1、发送过程 SmsMoMtGuiInterface.c

 

SmsMoMtGuiInterface

SmsPsHandler

SMSCore

SMSMsg

 

1

mmi_msg_highlight_done

短信编辑[完成]

 

 

 

 

 

mmi_msg_entry_send_option

进入[发送选项]

 

 

 

 

2

mmi_msg_highlight_send_only

高亮[()发送]选项

 

 

 

 

3

mmi_msg_send_msg_to_only_entry

进入[()发送]选项

 

 

 

 

4

 

mmi_msg_send_msg_req

 

 

 

 

 

 

mmi_frm_sms_send_sms

 

 

 

 

 

mmi_frm_sms_write_action

 

 

 

 

 

mmi_frm_sms_read_action

 

 

5

 

 

 

mmi_frm_sms_pre_send_sms

 

6

 

 

 

 mmi_frm_sms_send_sms_req

 

 

 

 

 

mmi_frm_sms_send_sms_seg

 

 

 

 

 

[... ...]

 

7

 

 

 

mmi_frm_sms_send_sms_rsp

 

 

 

 

 

mmi_msg_send_msg_rsp

 

 

HighlightWMessageHandler

回到[写短信]菜单项

 

 

 

 

 

 

 

 

 

2.2、发送过程详解:

2.2.1、短信编辑【完成】

短信编辑编辑【完成】后,按[完成]键盘进入发送选项单:

[SmsMoMtGuiInterface.c]

void mmi_msg_highlight_done(void)

{

mmi_msg_highlight_generic(

STR_GLOBAL_OK,

IMG_GLOBAL_OK,

STR_GLOBAL_BACK,

IMG_GLOBAL_BACK,

mmi_msg_entry_send_option,

GoBackHistory);

[...]

}

进入[发送选项],将默认发送选项设为(仅)发送(SEND ONLY):

[SmsMoMtGuiInterface.c]

void mmi_msg_entry_send_option(void)

{

[...]

if (g_msg_cntx.sendMessageCase != SEND_CASE_SEND_FROM_OTHER_APP)

{

g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY; /* reset */

}

[...]

}

2.2.1、选择发送选项

以(仅)发送(SEND ONLY)为例。在高亮事件中注册ENTRY函数:

[SmsMoMtGuiInterface.c]

void mmi_msg_highlight_send_only(void)

{

#ifdef __MMI_SEND_BY_SEARCH_NAME__

[...]

#else /* __MMI_SEND_BY_SEARCH_NAME__ */

mmi_msg_highlight_generic(

STR_GLOBAL_OK,

IMG_GLOBAL_OK,

STR_GLOBAL_BACK,

IMG_GLOBAL_BACK,

mmi_msg_send_msg_to_only_entry,

GoBackHistory);

#endif /* __MMI_SEND_BY_SEARCH_NAME__ */

}

2.2.2、进入【(仅)发送】选项

[SmsMoMtGuiInterface.c]

void mmi_msg_send_msg_to_only_entry(void)

{

[...]

g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;

g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 1;

[...]

else if (g_msg_cntx.sendMessageCase != SEND_CASE_SEND_FROM_PHB)

{

memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);

[...]

}

mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 0);

}

2.2.3、设置短信发送请求标志

[SmsPsHandler.c]

void mmi_msg_send_msg_req(U8 *number, U16 replyindex, U8 hidenumscreen)

{

mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));

memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));

#ifdef __MMI_UNIFIED_MESSAGE__

if (!(mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT && GetExitScrnID() == SCR_ID_MSG_OUTBOX_OPTION))

#else

if (GetMessagesCurrScrnID() != SCR_ID_MSG_OUTBOX_SEND_OPTION)

#endif

{

sendData->sendrequire = MMI_FRM_SMS_SAVE_AFTER_FAIL; /*ML: to control if we can release EMS or not*/

}

[...]

mmi_frm_sms_send_sms(mmi_msg_send_msg_rsp, MOD_MMI, sendData);

OslMfree(sendData);

}

2.3.4、注册短信发送回调函数

注册短信发送回调函数(callback, mmi_msg_send_msg_rsp), 调用短信发送预处理函

数(action, mmi_frm_sms_pre_send_sms)

[SMSCore.c]

void mmi_frm_sms_send_sms(PsFuncPtrU16 callback, module_type mod_src, mmi_frm_sms_send_struct *sendData)

{

mmi_frm_sms_send_struct *data = OslMalloc(sizeof(mmi_frm_sms_send_struct));

memcpy((S8*) data, (S8*) sendData, sizeof(mmi_frm_sms_send_struct));

mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_pre_send_sms);

}

U8 mmi_frm_sms_write_action(PsFuncPtrU16 callback, module_type mod_src, void *data, PsFuncPtr function)

{

mmi_frm_sms_action_struct action;

action.mod_src = mod_src;

action.data = data;

action.callback = callback;

action.action = function;

[...]

mmi_frm_sms_action_num++;

[...]

if (mmi_frm_sms_action_curr == MMI_FRM_SMS_INVALID_NUM)

{

mmi_frm_sms_read_action();

}

return TRUE;

}

U8 mmi_frm_sms_read_action(void)

{

PsFuncPtr currFuncPtr = mmi_frm_sms_action[mmi_frm_sms_action_head].action;

void *currFuncData = mmi_frm_sms_action[mmi_frm_sms_action_head].data;

[...]

mmi_frm_sms_action_num--;

[...]

if (currFuncPtr != NULL)

{

(*currFuncPtr) (currFuncData);

}

[...]

return TRUE;

}

2.3.5、短信发送预处理

[SMSMsg.c]

void mmi_frm_sms_pre_send_sms(void *inMsg)

{

mmi_frm_sms_send_struct *sendData = (mmi_frm_sms_send_struct*) inMsg;

[...]

mmi_frm_sms_free_sendsms_data();

sendSMS = OslMalloc(sizeof(mmi_frm_sms_send_struct));

memcpy((S8*) sendSMS, (S8*) sendData, sizeof(mmi_frm_sms_send_struct));

OslMfree(sendData);

mmi_frm_sms_send_sms_req();

}

2.3.6、短信发送请求

void mmi_frm_sms_send_sms_req(void)

{

[...]

/* check SC: get SC address, inMsg keeps the flag */

if ((sendSMS->sendcheck & MMI_FRM_SMS_SC) != MMI_FRM_SMS_SC)

{

[... 首次进入 ...]

return;

}

/* check DA: show input screen, inMsg keeps the number */

if ((sendSMS->sendcheck & MMI_FRM_SMS_DA) != MMI_FRM_SMS_DA)

{

[...二次进入, 弹出号码输入框...]

else if ((strlen((S8*) sendSMS->number) == 0) && ((sendSMS->sendrequire & MMI_FRM_SMS_REPLY) == 0))

{

if (GetCurrScrnId() != SCR_ID_MSG_NUMBER)

{

mmi_frm_sms_entry_number();

}

return;

}

sendSMS->sendcheck = MMI_FRM_SMS_DA;

}

/* check validity of DA */

[...]

/* check FDL: when FDN on */

{

[...号码输入完毕, 按[确认]到此...]

[...短信内容编码...]

result = mmi_frm_sms_pack_sms();

[...绘制发送短信发送界面...]

mmi_frm_sms_entry_send();

[...设置短信发送回调...]

SetProtocolEventHandler(mmi_frm_sms_send_sms_rsp, PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);

SetProtocolEventHandler(mmi_frm_sms_abort_sms_ind, PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);

[...(如果是长短信,循环)发送...]

for (i = 0; i < j; i++)

{

mmi_frm_sms_send_sms_seg();

}

[...]

}

}

void mmi_frm_sms_send_sms_seg(void)

{

MMI_FRM_SMS_SEND_MSG_REQ_STRUCT *sendSms;

[...]

mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_SEND_MSG_REQ, (oslParaType*) sendSms, NULL);

[...]

}

2.3.7、短信发送回调

无论发送是否成功(或者[取消]), 最后返回并高亮[写短信]菜单项:HighlightWMessageHandler()。

[SMSMsg.c]

void mmi_frm_sms_send_sms_rsp(void *inMsg)

{

[...]

mmi_frm_sms_callback_action((void*)number, sendResult);

[...]

}

[SmsPsHandler.c]

void mmi_msg_send_msg_rsp(void *number, module_type mod, U16 result)

{

switch (result)

{

case MMI_FRM_SMS_OK:

[... 设置跳转节点 ...]

else if (IsScreenPresent(SCR_ID_MSG_WRITE))

{

SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);

}

[... 删除历史屏幕, 返回[写短信]...]

if (g_msg_cntx.msg_send_info.CurrSendSmsNumbers == g_msg_cntx.msg_send_info.TotalSendSmsNumbers)

{

DeleteMessagesHistoryNodes();

mmi_frm_sms_delete_screen_history();

}

[...]

}

}

3、收短信

3.1、短信接收过程

l4a_callback

SMSMsg

SmsPsHandler

MessagesMiscell

1

l4c_sms_new_msg_text_lind

[...]

mmi_frm_sms_new_sms_ind

2

mmi_frm_sms_new_sms

mmi_frm_sms_indicate_sms

mmi_frm_sms_new_msg_ind

3

mmi_msg_handle_new_msg_ind

4

mmi_msg_new_msg_ind

mmi_msg_entry_new_msg_ind

3.2、接收过程详解:

3.2.1、收到新短信

L4层收到短信,向MMI_Task递交消息。

[l4a_callback.c]

void l4c_sms_new_msg_text_lind(...)

{

[…]

ilm_ptr->msg_id = (kal_uint16) MSG_ID_MMI_SMS_DELIVER_MSG_IND;/* Set the message id */

// MSG_ID_MMI_SMS_DELIVER_MSG_IND被注册到mmi_frm_sms_new_sms_ind函数:↘

[SMSMsg.c]

void mmi_frm_sms_set_protocol_event_handler(void)

{

SetProtocolEventHandler(mmi_frm_sms_new_sms_ind, PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND);

[…]

}

[ProtocolEvents.h]

#define PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND MSG_ID_MMI_SMS_DELIVER_MSG_IND

[…]

SEND_ILM(MOD_L4C,MOD_MMI,MMI_L4C_SAP,ilm_ptr);

}

MMI层收到新短信,更新短信计数器,转换短信数据,并压入未读短信队列。短信过滤等操作放在CHISTIncRecvdSMS()之前。

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_new_sms_ind(void *inMsg)

{

if( ( 1 == IsBlockAndEmergencyOnly() )

{

[…]

delete_pending_sms();

[…]

}

CHISTIncRecvdSMS();

/* convert L4 data to MMI data */

mmi_frm_sms_convert_new_sms(msgInd, data);

/* put to awaited list last entry, from now on only process new data as awaited list last entry */

mmi_frm_sms_add_new_sms(data, msgInd->no_msg_data, msgInd->msg_data);

/* process new sms data */

mmi_frm_sms_new_sms();

[…]

}

3.2.2、短信分类

新短信的信箱类型为 MMI_FRM_SMS_AWAITS,消息类型为 mmi_frm_sms_deliver_msg_struct,必须转换为 mmi_frm_sms_msgbox_struct类型,保存到全局的msgbox,并设置其信箱类型为 MMI_FRM_SMS_UNREAD,添加其索引到inbox。

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_new_sms(void)

{

[...]

case MMI_FRM_SMS_AWAITS:

{

mmi_frm_sms_indicate_sms(index);

}

[...]

}

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_indicate_sms(U16 index)

{

[…]

mmi_frm_sms_convert_mt_to_entry(data, entry);↘

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

void mmi_frm_sms_convert_mt_to_entry(mmi_frm_sms_deliver_msg_struct *data, mmi_frm_sms_msgbox_struct *entry)

type = MMI_FRM_SMS_UNREAD;// 设置短信类型

msgbox_index = mmi_frm_sms_add_sms_to_msgbox(entry, data->index, segment);// 添加短信到inbox,关键!↘

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

U16 mmi_frm_sms_add_sms_to_msgbox(mmi_frm_sms_msgbox_struct *entry, U16 index, U8 thisseg)

entryindex = mmi_frm_sms_add_sms_entry(entry, index, thisseg);↘

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

U16 mmi_frm_sms_add_sms_entry(mmi_frm_sms_msgbox_struct *data, U16 L4index, U8 thissegment)

#endif /* __UNIFIED_MESSAGE_SIMBOX_SUPPORT__ */

if ((data->msgtype & MMI_FRM_SMS_INBOX) == MSMS_INBOX)

{

type = MMI_FRM_SMS_INBOX;//短信分类

}

mmi_frm_sms_add_sms_to_list(entry, entryindex);↘

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

void mmi_frm_sms_add_sms_to_list(mmi_frm_sm_msgbox_struct *data, U16 index)

case MMI_FRM_SMS_UNREAD:

[... 添加索引到收件箱 ...]

if (i == mmi_frm_sms_msg_check_num)

{

mmi_frm_sms_new_msg_ind(msgbox_index);

}

[…]

}

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_new_msg_ind(U16 index)

{

[…]

if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND)

{

mmi_frm_sms_interrupt_handler[i].callback((void*)data, MOD_MMI, MMI_FRM_SMS_OK);//callback注册的函数为mmi_msg_handle_new_msg_ind↘

[\plutommi\mmi\messages\messagessrc\SmsPsHandler.c]

void mmi_msg_set_protocol_event_handler(void)

{

mmi_frm_sms_reg_interrupt_check(MOD_MMI, PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND, mmi_msg_handle_new_msg_ind);

[…]

}

//对比mmi_msg_set_protocol_event_handler与mmi_frm_sms_set_protocol_event_handler,这两个函数都使用了 PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND

break;

[…]

}

3.2.3、新短信提示

收到新短信之后,弹出“新短信”提示,如果当前处在待机界面,则显示新短信来自,并更改左软键为 [读取]。

[\plutommi\mmi\Messages\MessagesSrc\MessagesMiscell.c]

void mmi_msg_new_msg_ind(U16 index)

{

[...]

#ifdef __UNIFIED_MESSAGE_SIMBOX_SUPPORT__

mmi_msg_entry_new_sim_msg_ind();

#else /* __UNIFIED_MESSAGE_SIMBOX_SUPPORT__ */

mmi_msg_entry_new_msg_ind();//新短信查看入口

[...]

mmi_frm_sms_get_list_index(&type, &list_index, g_msg_cntx.msg_ind_index);↘

[\plutommi\mmi\miscframework\miscframeworksrc\SMSCore.c]

void mmi_frm_sms_get_list_index(U16 *type, U16 *index, U16 msgbox_index)

mmi_frm_sms_get_sms_list_index(type, index, msgbox_index);↘

void mmi_frm_sms_get_sms_list_index(U16 *type, U16 *index, U16 msgbox_index)

while (i < mmi_frm_sms_inbox_size)[...]

while (i < mmi_frm_sms_outbox_size)[...]

while (i < mmi_frm_sms_bizbox_size)[...]//扩展功能

[...]

mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_NORMAL);// 1. 弹出新短信提示框

#endif /* __UNIFIED_MESSAGE_SIMBOX_SUPPORT__ */

[...]

}

[plutommi\mmi\Messages\MessagesSrc\MessagesMiscell.c]

void mmi_msg_entry_new_msg_ind(void)

{

[...]

g_msg_cntx.msg_ind_after_call = FALSE;

if (IsKeyPadLockState() == 0)

{

ShowCategory154Screen(

0,

0,

STR_SCR6035_LSK,

IMG_SMS_COMMON_NOIMAGE,

STR_GLOBAL_BACK,

IMG_SMS_COMMON_NOIMAGE,

(PU8) GetString(STR_NEW_MESSAGE_FROM_ID),//在待机界面显示“消息来自:”

(PU8) mmi_msg_get_new_msg_ind_string(),

IMG_NEW_MESSAGE_NOTIFICATION_MSG_IN_IDLE,

NULL);

SetRightSoftkeyFunction(mmi_msg_go_back_from_new_msg_ind, KEY_EVENT_UP);

SetLeftSoftkeyFunction(mmi_msg_get_msg_new, KEY_EVENT_UP);// 左软键[读取]

SetKeyHandler(mmi_msg_end_key_from_new_msg_ind, KEY_END, KEY_EVENT_DOWN);

}

[…]

}

3.3 、【读取】短信

在待机屏按下[读取]键,向底层请求短信内容。阅读短信内容之后,按[返回]键,则退到收件箱。

[\plutommi\mmi\messages\messagessrc\SmsPsHandler.c]

void mmi_msg_get_msg_new(void)

{

[...]

mmi_msg_get_msg_req(MMI_FRM_SMS_APP_NOBOX, g_msg_cntx.msg_ind_index);// 发送读取短信内容的请求, 注意, 这里用的是NOBOX

mmi_frm_sms_get_list_index(&type, &list_index, g_msg_cntx.msg_ind_index);

[...]

mmi_msg_exit_bizbox_list_dummy();↘

[\plutommi\mmi\Messages\MessagesSrc\MessagesMiscell.c]

void mmi_msg_exit_inbox_list_dummy(void)

currHistory.entryFuncPtr = mmi_msg_entry_inbox_list;//设置阅读新短信之后按“返回”键跳转到哪里。

g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_INBOX;//设置显示页面

3.4、更新短信状态

读取请求发出之后,L4层已经把新短信状态改成已读, mmi_frm_sms_msg_box中的状态也应同步。

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U16 type, U16 index, MMI_BOOL change_status)

mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_INBOX);

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

U8 mmi_frm_sms_set_sms_status(U16 type, U16 index, U16 newtype)

{

[...]

switch (type)

{

[...]

case MMI_FRM_SMS_INBOX:

case MMI_FRM_SMS_UNREAD:

msgindex = mmi_frm_sms_inbox_list[index];

mti = (mmi_frm_sms_msg_box[msgindex].msgtype & 0xf000);

mmi_frm_sms_msg_box[msgindex].msgtype = mti | newtype;// 更改状态

break;

[…]

}

3、短信箱

3.1、信箱初始化

开机时,系统逐条读取所有短信,保存到mmi_frm_sms_msg_box, 然后根据短信类型(未读/已读/已发送...)将索引添加到对应的 mmi_frm_sms_xxbox_list。

开机之后,收到新短信或者发送短信时选择了“发送并保存”,则短信会即时添加到mmi_frm_sms_msg_box和各自对应的 mmi_frm_sms_xxbox_list。

clip_image002

(1) void mmi_frm_sms_convert_mt_to_entry()

(2) void mmi_frm_sms_convert_startup_read_to_entry()

3.2、信箱入口

以收件箱为例。入口函数并不直接生成列表,而是传递回调函数 mmi_msg_inbox_list_get_item给Categrory。

mmi_msg_pre_entry_inbox_list

[\plutommi\mmi\Messages\MessagesSrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_inbox_list(void)

{

[...]

ShowCategory184Screen(

STR_SCR6010_CAPTION,

IMG_SMS_ENTRY_SCRN_CAPTION,

STR_GLOBAL_OK,

IMG_GLOBAL_OK,

STR_GLOBAL_BACK,

IMG_GLOBAL_BACK,

numitem,

mmi_msg_inbox_list_get_item,

mmi_msg_inbox_list_get_hint,

hiliteitem,

guiBuffer);

[...]

}

[\plutommi\mmi\GUI\GUI_SRC\wgui_dynamic_menuitems.c]

void load_dynamic_item_buffer(S32 n_items)

{

for (i = 0; i < n_items; i++)

{

if (dynamic_item_buffer.load_func(i, (UI_string_type) subMenuData[i], &image, 3))

// 调用mmi_msg_inbox_list_get_item

[...]

}

在mmi_msg_inbox_list_get_item函数,取方号码(或姓名)做信箱列表item标题,并判断短信的状态(已读/未读)。

[\plutommi\mmi\Messages\MessagesSrc\SmsMoMtGuiInterface.c]

pBOOL mmi_msg_inbox_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask) mmi_msg_inbox_list_get_item

{

[…]

AnsiiToUnicodeString(temp, (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_APP_INBOX

, (U16) item_index)); //1 取发件方号码

name = lookUpNumber(temp);//2 取发件方姓名(如果电话本有记录)

[…]

*img_buff_p = get_image(IMG_MESSAGE_UNREAD); //3 未读短信图标

[…]

*img_buff_p = get_image(IMG_MESSAGE_READ); //4 已读短信图标

[…]

}

3.3、阅读短信

以收件箱为例。阅读短信时,并不是直接从全局数组 mmi_frm_sms_msg_box 读取,而是通过发送PRT_MSG_ID_MMI_SMS_GET_MSG_REQ获得短信,读取之后,短信的未读状态变为已读。

[\plutommi\mmi\Messages\MessagesSrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_inbox_list(void)

SetLeftSoftkeyFunction(mmi_msg_get_msg_inbox, KEY_EVENT_UP);// 设置左软件

[\plutommi\mmi\Messages\MessagesSrc\SmsPsHandler.c]

void mmi_msg_get_msg_inbox(void)

g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_INBOX;

mmi_msg_get_msg_req(MMI_FRM_SMS_APP_INBOX, (U16) g_msg_cntx.currBoxIndex);// 请求的是 MMI_FRM_SMS_APP_INBOX 短信

[\plutommi\mmi\Messages\MessagesSrc\SmsPsHandler.c]

void mmi_msg_get_msg_req(U16 type, U16 index)

mmi_frm_sms_read_sms(mmi_msg_get_msg_rsp, MOD_MMI, type, index, MMI_TRUE);

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U16 type, U16 index, MMI_BOOL change_status)

{

mmi_frm_sms_get_sms_index((mmi_frm_sms_msgbox_enum) type, index, data); // 根据信箱类型,取得L4index。

[...]

mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_INBOX);// 同步更改mmi_frm_sms_msg_box 短信状态, 底层短信状态在发送读取请求时更改。

[...]

mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_read_sms_req);// 提交读取短信请求

}

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_read_sms_req(void *inMsg)

mmi_frm_sms_read_sms_seg();

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

U8 mmi_frm_sms_read_sms_seg(void)

SetProtocolEventHandler(mmi_frm_sms_read_sms_rsp, PRT_MSG_ID_MMI_SMS_GET_MSG_RSP);

mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_GET_MSG_REQ, (oslParaType*) msgReq, NULL);

读取请求发送之后,在 mmi_frm_sms_read_sms_rsp 接收请求处理结果,显示短信。

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_read_sms_rsp(void *inMsg) // 短信请求应答

mmi_frm_sms_callback_action(&type, result);

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_callback_action(void *data, U16 result)

callback(data, (module_type) mod_src, result);// 调用 mmi_msg_entry_inbox_msg

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_inbox_msg(void)

// 显示短信内容

3.4、短信【选项】菜单

1、选项菜单资源:

SMS_INBOX_OPTIONS_MENUID //菜单ID

STR_GLOBAL_OPTIONS //字串资源

2、选项菜单入口:

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_option_inbox(void)

3、菜单子选项的初始化:

[\plutommi\customer\custresource\pluto_mmi\res_mmi\Res_Messages.c]

void PopulateMessagesResData (void)

{

[...]

ADD_APPLICATION_MENUITEM((SMS_INBOX_OPTIONS_MENUID,/* 1. 收件箱短信的[选项]菜单 */

0, NUM_MESSAGES_INBOXOP_MENU, /* 2. [选项]菜单项个数 */

SMS_INBOX_OPT_REPLY_MENUID, /* 3. [回复]选项 */

SMS_INBOX_OPT_DELETE_MENUID, /* 4. [删除]选项 */

[...]

STR_GLOBAL_OPTIONS, IMG_SMS_COMMON_NOIMAGE));

[...]

}

短信相关的高亮注册集中在mmi_msg_set_highlight_handler,可以从这里快速查找到[选项]各子项:

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_set_highlight_handler(void)

{

[...]

SetHiliteHandler(SMS_INBOX_OPT_REPLY_MENUID, mmi_msg_highlight_reply);

SetHiliteHandler(SMS_INBOX_OPT_EDIT_MENUID, mmi_msg_highlight_edit);

SetHiliteHandler(SMS_INBOX_OPT_FORWARD_MENUID, mmi_msg_highlight_forward);

[...]

}

4、业务信箱

业务信箱沿用原有的收/发件箱模式,但由于无法保存自定义的短信状态值, 所以必须自行建一个状态映射表,用以保存是否业务短信。

4.1、定义相关资源

[\custom\common\mmi_msg_context.c]

unsigned short mmi_frm_sms_inbox_list[CM_SMS_MAX_MSG_NUM];

unsigned short mmi_frm_sms_outbox_list[CM_SMS_MAX_MSG_NUM];

unsigned short mmi_frm_sms_bizbox_list[CM_SMS_MAX_MSG_NUM];// add

mmi_frm_sms_msgbox_struct mmi_frm_sms_msg_box[CM_SMS_MAX_MSG_NUM];

[\custom\common\mmi_msg_context.h]

extern unsigned short mmi_frm_sms_inbox_list[CM_SMS_MAX_MSG_NUM];

extern unsigned short mmi_frm_sms_outbox_list[CM_SMS_MAX_MSG_NUM];

extern unsigned short mmi_frm_sms_drafts_list[CM_SMS_MAX_MSG_NUM];

extern unsigned short mmi_frm_sms_bizbox_list[CM_SMS_MAX_MSG_NUM];// add

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

static U16 mmi_frm_sms_msgbox_size = 0;

static U16 mmi_frm_sms_inbox_size = 0;

static U16 mmi_frm_sms_outbox_size = 0;

static U16 mmi_frm_sms_bizbox_size = 0;// add

[\plutommi\mmi\miscframework\miscframeworkinc\SMSStruct.h]

mmi_frm_sms_msgbox_enum

MMI_FRM_SMS_INBOX = 0x02, //read

MMI_FRM_SMS_OUTBOX = 0x04,

MMI_FRM_SMS_BIZUNREAD = 0x200,// add

MMI_FRM_SMS_BIZINBOX = 0x400,// add

[\plutommi\mmi\miscframework\miscframeworkinc\SMSApi.h]

typedef enum

{

[...]

MMI_FRM_SMS_APP_INBOX = 0x02,

MMI_FRM_SMS_APP_OUTBOX = 0x04,

MMI_FRM_SMS_APP_BIZUNREAD = 0x200,// add

MMI_FRM_SMS_APP_BIZINBOX = 0x400,// add

[...]

} mmi_frm_sms_app_msgbox_enum;

[\plutommi\mmi\messages\messagesinc\MessagesResourceData.h]

typedef enum

{

[...]

SCR_ID_MSG_BIZBOX_MSG,// add

SCR_ID_MSG_BIZBOX_LIST,// add

MESSAGES_SCR_ID_DEFINES_MAX

} MESSAGES_SCREEN_ENUM;

[\plutommi\mmi\messages\messagesinc\MessagesResourceData.h]

typedef enum

{

MESSAGES_MENU_WMESSAGE,

MESSAGES_MENU_INBOX,

MESSAGES_MENU_OUTBOX,

MESSAGES_MEUN_BIZBOX, //add

[...]

NUM_MESSAGES_MAIN_MENU

} MESSAGES_MAIN_MENU_ENUMS;

[\plutommi\mmi\messages\messagesinc\SmsGuiInterfaceType.h]

TO_DISPLAY_MESSAGE_LIST_NONE,

TO_DISPLAY_MESSAGE_LIST_INBOX,

TO_DISPLAY_MESSAGE_LIST_OUTBOX,

TO_DISPLAY_MESSAGE_LIST_BIZBOX,// add

4.2、接收业务短信

4.2.1、新短信类型

[\plutommi\mmi\miscframework\miscframeworksrc\SMSCore.c]

void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U16 type, U16 index, MMI_BOOL change_status)

{

[...]

if (TRUE == IsBusinessPlatformNumber(mmi_frm_sms_msg_box[index].number))

{

mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_BIZINBOX);

}

else

{

mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_INBOX);

}

[...]

}

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

void mmi_frm_sms_convert_mt_to_entry(mmi_frm_sms_deliver_msg_struct *data, mmi_frm_sms_msgbox_struct *entry)

{

[...]

if (TRUE == IsBusinessPlatformNumber((S8*)data->addr_number.number))/* 是否业务短信 */

type = MMI_FRM_SMS_BIZUNREAD;

else

type = MMI_FRM_SMS_UNREAD;

[...]

}

4.2.2、添加到信箱

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

U16 mmi_frm_sms_add_sms_to_msgbox(mmi_frm_sms_msgbox_struct *entry, U16 index, U8 thisseg)

{

U16 entryindex;

/* 1. add to msg entry */

entryindex = mmi_frm_sms_add_sms_entry(entry, index, thisseg);

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSUtil.c]

U16 mmi_frm_sms_add_sms_entry(mmi_frm_sms_msgbox_struct *data, U16 L4index, U8 thissegment)

{

[...]

#endif /* __UNIFIED_MESSAGE_SIMBOX_SUPPORT__ */

if ((data->msgtype & MMI_FRM_SMS_BIZBOX) == MMI_FRM_SMS_BIZBOX)

{

type = MMI_FRM_SMS_BIZBOX;

}

else if ((data->msgtype & MMI_FRM_SMS_INBOX) == MMI_FRM_SMS_INBOX)

{

type = MMI_FRM_SMS_INBOX;

}

[...]

}

/* 2. update msg list */

if (mmi_frm_sms_list_done)

{

mmi_frm_sms_add_sms_to_list(entry, entryindex);

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

void mmi_frm_sms_add_sms_to_list(mmi_frm_sms_msgbox_struct *data, U16 index)

{

[...]

if ((data->msgtype & MMI_FRM_SMS_UNREAD) == MMI_FRM_SMS_UNREAD)

{

type = MMI_FRM_SMS_UNREAD;

}

else if ((data->msgtype & MMI_FRM_SMS_INBOX) == MMI_FRM_SMS_INBOX)

{

type = MMI_FRM_SMS_INBOX;

}

else if ((data->msgtype & MMI_FRM_SMS_BIZUNREAD) == MMI_FRM_SMS_BIZUNREAD)

{

type = MMI_FRM_SMS_BIZUNREAD;

}

if ((data->msgtype & MMI_FRM_SMS_BIZINBOX) == MMI_FRM_SMS_BIZINBOX)

{

type = MMI_FRM_SMS_BIZINBOX;

}

[...]

switch (type)

{

case MMI_FRM_SMS_BIZUNREAD:

case MMI_FRM_SMS_BIZINBOX:

[...]

mmi_frm_sms_bizbox_list[i] = index;// 把索引添加到业务信箱的索引表

mmi_frm_sms_bizbox_size++;

break;

case MMI_FRM_SMS_UNREAD:

case MMI_FRM_SMS_INBOX:

[...]

}

}

return entryindex; /* 3. 返回入口索引 */

}

// 执行mmi_msg_get_msg_req(MMI_FRM_SMS_APP_NOBOX, g_msg_cntx.msg_ind_index);发送读取短// 信请求之后,在 void mmi_frm_sms_read_sms_rsp(void *inMsg) [\plutommi\mmi\MiscFramew// ork\MiscFrameworkSrc\SMSMsg.c]收到应答:

case SMSAL_REC_READ:

type = (msgRsp->mti << 12) | mmi_frm_sms_msg_box[g_msg_cntx.msg_ind_index].msgtype;/* 直接使用短信本身的类型, 以区分业务信箱和普通信箱 */

[\plutommi\mmi\messages\messagessrc\SmsPsHandler.c]

void mmi_msg_get_msg_rsp(void *data, module_type mod, U16 result)

case MMI_FRM_SMS_BIZBOX:

mmi_msg_entry_bizbox_msg();//读取业务信箱的短信内容

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_bizbox_msg(void)

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

U8 *mmi_msg_get_bizbox_header(void)

void mmi_msg_go_back_from_bizbox_msg(void)// 跳转到业务信箱-》

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

U8 *mmi_frm_sms_get_sms_address(U16 type, U16 index)

case MMI_FRM_SMS_BIZBOX:

entryindex = mmi_frm_sms_bizbox_list[index];

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

U16 mmi_frm_sms_get_sms_list_size(U16 type)

case MMI_FRM_SMS_BIZBOX:

return mmi_frm_sms_bizbox_size

4.2.3、新业务短信提示

[\plutommi\mmi\messages\messagessrc\MessagesMiscell.c]

void mmi_msg_new_msg_ind(U16 index)

{

[…]

// 弹出新短信提示框

if (MMI_FRM_SMS_APP_BIZUNREAD == mmi_frm_sms_msg_box[index].msgtype)

{

mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_BUSINESS);// 弹出新业务短信提示框

}

else

{

mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_NORMAL);

}

[…]

mmi_msg_entry_new_msg_ind();

[…]

}

[\plutommi\mmi\Messages\MessagesSrc\MessagesMiscell.c]

void mmi_msg_entry_new_msg_ind(void)

{

[…]

if(MMI_FRM_SMS_APP_BIZUNREAD == mmi_frm_sms_msg_box[g_msg_cntx.msg_ind_index].msgtype)

{

titleID = STR_NEW_BUSINESS_MESSAGE_FROM;

}

else

{

titleID = STR_NEW_MESSAGE_FROM_ID;

}

[…]

// 在待机界面显示“新短信来自:”

ShowCategory154Screen(

0,

0,

STR_SCR6035_LSK,

IMG_SMS_COMMON_NOIMAGE,

STR_GLOBAL_BACK,

IMG_SMS_COMMON_NOIMAGE,

(PU8) GetString(titleID),

(PU8) mmi_msg_get_new_msg_ind_string(),

IMG_NEW_MESSAGE_NOTIFICATION_MSG_IN_IDLE,

NULL);

[…]

}

4.3、阅读新短信

4.3.1、响应【读取】键、发送“读取”请求

void mmi_msg_get_msg_new(void)

{

[...]

g_msg_cntx.msg_ind_in_idle = FALSE;

mmi_msg_get_msg_req(MMI_FRM_SMS_APP_NOBOX, g_msg_cntx.msg_ind_index);

mmi_frm_sms_get_list_index(&type, &list_index, g_msg_cntx.msg_ind_index);

[...]

if (!pending)

{

if (type == MMI_FRM_SMS_BIZUNREAD || type == MMI_FRM_SMS_BIZINBOX)

{

mmi_msg_exit_bizbox_list_dummy();

g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_BIZBOX;

}

else

{

mmi_msg_exit_inbox_list_dummy();

g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_INBOX;

}

}

[...]

}

4.3.2、设置【返回】键路径

[\plutommi\mmi\Messages\MessagesSrc\MessagesMiscell.c]

void mmi_msg_exit_bizbox_list_dummy(void)

{

history currHistory;

memset(&currHistory, 0, sizeof(currHistory));

currHistory.scrnID = SCR_ID_MSG_BIZBOX_LIST;

SetMessagesCurrScrnID(0);

g_msg_cntx.MessagesScrnIdToDelHistoryNodes = SCR_ID_MSG_BIZBOX_LIST;

g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_BIZBOX_LIST;

currHistory.entryFuncPtr = mmi_msg_entry_bizbox_list;//详见3.4 查看业务信箱

memset((S8*) currHistory.inputBuffer, 0, ENCODING_LENGTH);

AddHistory(currHistory);

}

4.3.3、接收“读取”请求的回复

[\plutommi\mmi\miscframework\miscframeworksrc\SMSMsg.c]

void mmi_frm_sms_read_sms_rsp(void *inMsg)

{

[...]

case SMSAL_REC_READ: mmi_frm_sms_msg_box[g_msg_cntx.msg_ind_index].msgtype;

type = (msgRsp->mti << 12) | mmi_frm_sms_index_list[g_msg_cntx.msg_ind_index].prevtype;

[...]

mmi_frm_sms_callback_action(&type, result);

}

[\plutommi\mmi\messages\messagessrc\SmsPsHandler.c]

void mmi_msg_get_msg_rsp(void *data, module_type mod, U16 result)

{

[...]

case MMI_FRM_SMS_BIZBOX:

mmi_msg_entry_bizbox_msg();

[...]

}

4.3.4、显示短信内容

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_bizbox_msg(void)

{

U8 *guiBuffer = NULL;

U8 *pHeader;

EMSData *pEms;

U16 strtitle;

if (IsScreenPresent(SCR_ID_MSG_PROCESSING))

{

HistoryReplace(SCR_ID_MSG_PROCESSING, SCR_ID_MSG_BIZBOX_MSG, mmi_msg_entry_bizbox_msg);

return;

}

EntryNewScreen(SCR_ID_MSG_BIZBOX_MSG, mmi_msg_exit_generic, mmi_msg_entry_bizbox_msg, NULL);

PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[SmsMoMtGuiInterface.c] mmi_msg_entry_bizbox_msg *\n"));

#ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__

if (IsScreenPresent(SCR_ID_MSG_BIZBOX_LIST_OPTION))

{

SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_BIZBOX_LIST_OPTION);

}

else

#endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */

{

SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_BIZBOX_MSG);

}

SetMessagesCurrScrnID(SCR_ID_MSG_BIZBOX_MSG);

GetCurrEndKeyDownHandler();

guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_BIZBOX_MSG);

GetEMSDataForView(&pEms, 0);

pHeader = mmi_msg_get_bizbox_header();

g_msg_cntx.number_from_phb = 0;

#if defined(__MMI_MESSAGES_EMS__)

EnableDisableAudioPlayback();

#endif

#ifdef __MMI_MESSAGES_CHAT__

if (pEms->listHead == NULL)

{

if (gChatInvitation)

{

SetChatInboxIndex(PendingSaveSendData.msgboxindex);

strtitle = STR_CHAT_INVITATION;

}

else if (CheckForInvitationMsg(pEms->textBuffer, (S32) pEms->textLength, TRUE) == TRUE)

{

SetChatInboxIndex(PendingSaveSendData.msgboxindex);

strtitle = STR_CHAT_INVITATION;

if (guiBuffer == NULL)

{

RemoveInvitationChar();

}

}

else

{

strtitle = STR_SCR6024_CAPTION;

gChatInvitation = 0;

}

}

else

{

strtitle = STR_SCR6024_CAPTION;

gChatInvitation = 0;

}

#else /* __MMI_MESSAGES_CHAT__ */

strtitle = 0; //strtitle = STR_SCR6024_CAPTION;

#endif /* __MMI_MESSAGES_CHAT__ */

ShowCategory39Screen(

(U16) strtitle,

IMG_SMS_ENTRY_SCRN_CAPTION,

STR_GLOBAL_OPTIONS,

IMG_SMS_COMMON_NOIMAGE,

STR_GLOBAL_BACK,

IMG_SMS_COMMON_NOIMAGE,

pEms,

pHeader,

guiBuffer);

#ifdef __MMI_MESSAGES_CHAT__

if (strtitle == STR_CHAT_INVITATION)

{

SetLeftSoftkeyFunction(mmi_msg_entry_option_chat, KEY_EVENT_UP);

}

else

{

SetLeftSoftkeyFunction(mmi_msg_entry_option_bizbox, KEY_EVENT_UP);

}

#else /* __MMI_MESSAGES_CHAT__ */

SetLeftSoftkeyFunction(mmi_msg_entry_option_bizbox, KEY_EVENT_UP);//设置【选项】

#endif /* __MMI_MESSAGES_CHAT__ */

SetLeftSoftkeyFunction(mmi_msg_entry_option_bizbox, KEY_EVENT_UP); // TODO: smsnote: overwrite LSK func?? (Tony said: old bug. keep it)

SetRightSoftkeyFunction(mmi_msg_go_back_from_bizbox_msg, KEY_EVENT_UP);

}

4.3.5、更新短信状态

读取之后,短信状态发生变化。

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

U8 mmi_frm_sms_set_sms_status(U16 type, U16 index, U8 newtype)

{

[...]

case MMI_FRM_SMS_BIZBOX:

[...]

}

4.4、查看业务短信箱

[plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void HighlightBizboxHandler(void)

{

ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);

ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);

SetLeftSoftkeyFunction(mmi_msg_pre_entry_bizbox_list, KEY_EVENT_UP);

SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

SetKeyHandler(mmi_msg_pre_entry_bizbox_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}

[\plutommi\mmi\messages\messagesinc\SmsGuiInterfaceProt.h]

extern void HighlightBizboxHandler(void);

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_set_highlight_handler(void)

{

#ifndef __MMI_UNIFIED_MESSAGE__

SetHiliteHandler(MESSAGES_MENU_WMESSAGE_MENU_ID, HighlightWMessageHandler);

SetHiliteHandler(MESSAGES_MENU_INBOX_MENUID, HighlightInboxHandler);

SetHiliteHandler(MESSAGES_MENU_BUSINESS_INBOX_MENUID, HighlightBizboxHandler);

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_set_msg_menu_highlight_handler(void)

{

#ifndef __MMI_UNIFIED_MESSAGE__

SetHiliteHandler(MESSAGES_MENU_WMESSAGE_MENU_ID, HighlightWMessageHandler);

SetHiliteHandler(MESSAGES_MENU_INBOX_MENUID, HighlightInboxHandler);

SetHiliteHandler(MESSAGES_MENU_BUSINESS_INBOX_MENUID, HighlightBizboxHandler);

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_pre_entry_inbox_list(void)

{

if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_BIZBOX) == 0)

{

DisplayPopup(

(U8*) GetString(STR_GLOBAL_EMPTY),

IMG_GLOBAL_EMPTY,

1,

MESSAGES_POPUP_TIME_OUT,

(U8) EMPTY_LIST_TONE);

}

else if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_BIZBOX) == MMI_FRM_SMS_INVALID_INDEX)

{

mmi_msg_set_processing_screen(

STR_MESSAGE_MAIN_MENU_CAPTION,

STR_LOADING_SMS,

IMG_GLOBAL_PROGRESS,

STR_LOADING_INBOX_BACK);//沿用INBOX字符

mmi_msg_entry_processing_generic();

/* SetInterruptEventHandler(mmi_msg_handle_ready_ind_inbox, NULL, PRT_MSG_ID_MMI_SMS_READY_IND); */

}

/* disallow re-entering SMS application when there is a pending SMS job running in the background */

else if (mmi_frm_sms_check_action_pending())

{

DisplayPopup(

(PU8) GetString(STR_SMS_MSG_NOT_READY_YET),

IMG_GLOBAL_UNFINISHED,

1,

MESSAGES_POPUP_TIME_OUT,

(U8) ERROR_TONE);

}

else

{

mmi_msg_entry_bizbox_list();

}

}

[\plutommi\mmi\messages\messagesinc\SmsGuiInterfaceProt.h]

extern void mmi_msg_pre_entry_inbox_list(void);

extern void mmi_msg_pre_entry_bizbox_list(void);

[\plutommi\mmi\messages\messagesinc\SmsGuiInterfaceProt.h ]

extern void mmi_msg_entry_inbox_list(void);

extern void mmi_msg_entry_bizbox_list(void);//bizboxtest

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_bizbox_list(void)

{

U8 *guiBuffer = NULL;

S32 hiliteitem = 0;

S32 numitem = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_BIZBOX);

if (IsScreenPresent(SCR_ID_MSG_PROCESSING))

{

HistoryReplace(SCR_ID_MSG_PROCESSING, SCR_ID_MSG_BIZBOX_LIST, mmi_msg_entry_bizbox_list);

g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_BIZBOX_LIST;

return;

}

if (numitem == 0)

{

DisplayPopup(

(U8*) GetString(STR_GLOBAL_EMPTY),

IMG_GLOBAL_EMPTY,

1,

MESSAGES_POPUP_TIME_OUT,

(U8) EMPTY_LIST_TONE);

return;

}

/* Most cases of entering inbox list while SMS not ready are checked in mmi_msg_pre_entry_inbox_list.

However, If new MT SMS comes during SMS not ready, after deleting/saving/copying/moving SMS,

inbox list cannot be entered and user should go back to idle screen. */

else if (numitem == MMI_FRM_SMS_INVALID_INDEX)

{

DeleteScreenIfPresent(SCR_ID_MSG_BIZBOX_LIST);

GoBackHistory();

return;

}

/* Update the totalinbox value in order to get the current inbox list size */

msgbox_info.totalinbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_BIZBOX);

EntryNewScreen(SCR_ID_MSG_BIZBOX_LIST, mmi_msg_exit_generic, mmi_msg_entry_bizbox_list, NULL);

PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[SmsMoMtGuiInterface.c] mmi_msg_entry_bizbox_list *\n"));

g_msg_cntx.msg_ind_in_idle = FALSE;

g_msg_cntx.msg_ind_after_call = FALSE;

SetMessagesCurrScrnID(SCR_ID_MSG_BIZBOX_LIST);

SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_BIZBOX_LIST);

guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_BIZBOX_LIST);

RegisterHighlightHandler(GetMsgIndex);

if (guiBuffer != NULL)

{

hiliteitem = (g_msg_cntx.currBoxIndex < numitem) ? g_msg_cntx.currBoxIndex : 0;

/* change gui buffer content */

change_cat184_list_menu_history_highlighted_item(hiliteitem, guiBuffer);

}

ShowCategory184Screen(

STR_BUSINESS_INBOX,

IMG_SMS_ENTRY_SCRN_CAPTION,

STR_GLOBAL_OK,

IMG_GLOBAL_OK,

STR_GLOBAL_BACK,

IMG_GLOBAL_BACK,

numitem,

mmi_msg_bizbox_list_get_item,

mmi_msg_bizbox_list_get_hint,

hiliteitem,

guiBuffer);

SetLeftSoftkeyFunction(mmi_msg_get_msg_bizbox, KEY_EVENT_UP);

SetKeyHandler(mmi_msg_get_msg_bizbox, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

#if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__)

SetRightSoftkeyFunction(mmi_msg_go_to_msg_menu, KEY_EVENT_UP);

SetKeyHandler(mmi_msg_go_to_msg_menu, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

#else /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) */

SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

#endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) */

}

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

pBOOL mmi_msg_bizbox_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)

{

/*----------------------------------------------------------------*/

/* Local Variables */

/*----------------------------------------------------------------*/

S8 temp[(MAX_DIGITS_SMS + 1) * ENCODING_LENGTH];

S8 *name;

/*----------------------------------------------------------------*/

/* Code Body */

/*----------------------------------------------------------------*/

if (((mmi_frm_sms_get_status(MMI_FRM_SMS_APP_BIZBOX, (U16) item_index) & 0xf000) >> 12) == SMSAL_MTI_STATUS_REPORT)

{

UCS2Strcpy((S8*) str_buff, (S8*) GetString(STR_BIZBOX_REPORT_ID));

}

else

{

memset(temp, 0, (MAX_DIGITS_SMS + 1) * ENCODING_LENGTH);

AnsiiToUnicodeString(temp, (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_APP_BIZBOX, (U16) item_index));

name = lookUpNumber(temp);

if (UCS2Strlen(name))

{

UCS2Strcpy((S8*) str_buff, name);

}

else

{

UCS2Strcpy((S8*) str_buff, temp);

}

}

if ((mmi_frm_sms_get_status(MMI_FRM_SMS_APP_BIZBOX, (U16) item_index) & 0x0f) == MMI_FRM_SMS_APP_UNREAD)

{

*img_buff_p = get_image(IMG_MESSAGE_UNREAD);

}

else

{

if (mmi_frm_sms_check_complete(MMI_FRM_SMS_APP_BIZBOX, (U16) item_index) == TRUE)

{

*img_buff_p = get_image(IMG_MESSAGE_READ);

}

else

{

*img_buff_p = get_image(IMG_MESSAGE_SS_NCOMP);

}

}

return TRUE;

}

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

S32 mmi_msg_bizbox_list_get_hint(S32 item_index, UI_string_type *hint_array)

{

mmi_msg_get_msg_date_time(

(S8*) hint_array[0],

NULL,

mmi_frm_sms_get_timestamp(MMI_FRM_SMS_APP_BIZBOX, (U16) item_index));

return TRUE;

}

[\plutommi\mmi\messages\messagesinc\SmsPsHandler.h]

extern void mmi_msg_get_msg_inbox(void);

extern void mmi_msg_get_msg_bizbox(void);

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_get_msg_bizbox(void)

{

g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_BIZBOX;

mmi_msg_get_msg_req(MMI_FRM_SMS_APP_BIZBOX, (U16) g_msg_cntx.currBoxIndex);

}

4.5、查看业务短信内容

1. 从mmi_frm_sms_bizbox_list[]读取短信的L4index:

[\plutommi\mmi\Messages\MessagesSrc\SmsPsHandler.c]

void mmi_msg_get_msg_bizbox(void)

mmi_msg_get_msg_req(MMI_FRM_SMS_BIZBOX, (U16) g_msg_cntx.currBoxIndex);

[\plutommi\mmi\Messages\MessagesSrc\SmsPsHandler.c]

void mmi_msg_get_msg_req(U16 type, U16 index)// 提交读取短信请求

mmi_frm_sms_read_sms(mmi_msg_get_msg_rsp, MOD_MMI, type, index, MMI_TRUE);

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U16 type, U16 index, MMI_BOOL change_status)

mmi_frm_sms_get_sms_index((mmi_frm_sms_msgbox_enum) type, index, data);

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

void mmi_frm_sms_get_sms_index(mmi_frm_sms_msgbox_enum type, U16 index, U16 *l4_index)

case MMI_FRM_SMS_BIZBOX:

L4index = mmi_frm_sms_msg_box[mmi_frm_sms_bizbox_list[index]].startindex;

2. 发送读短信请求注册回调:

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSCore.c]

void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U16 type, U16 index, MMI_BOOL change_status)

mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_read_sms_req);

// callback => mmi_msg_get_msg_rsp

3. 在应答回调中显示短信内容:

[\plutommi\mmi\MiscFramework\MiscFrameworkSrc\SMSMsg.c]

void mmi_frm_sms_read_sms_rsp(void *inMsg) // 短信请求应答

[\plutommi\mmi\messages\messagessrc\SmsMoMtGuiInterface.c]

void mmi_msg_entry_bizbox_msg(void) // 显示短信内容

4.6、开机加载短信

[\plutommi\mmi\miscframework\miscframeworksrc\SMSMsg.c]

void mmi_frm_sms_startup_read_ind(void *inMsg)

{

[...]

mmi_frm_sms_convert_startup_read_to_entry((MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT*) msgInd, entry);// 1. 短信数据类型转换

mmi_frm_sms_add_sms_to_msgbox(entry, msgInd->index, thisseg);// 2. 添加到短信箱和索引表

[...]

}

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

void mmi_frm_sms_convert_startup_read_to_entry(

MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT *data,

mmi_frm_sms_msgbox_struct *entry)

{

[...]

switch (data->status)

{

case SMSAL_REC_UNREAD:

[...]

type = MMI_FRM_SMS_BIZINBOX;// 如果是业务短信

[...]

type = MMI_FRM_SMS_INBOX;// 如果是普通短信

case SMSAL_REC_READ:

[...]// 处理过程与SMSAL_REC_UNREAD 相同

[...]

}

[\plutommi\mmi\miscframework\miscframeworksrc\SMSUtil.c]

U16 mmi_frm_sms_add_sms_to_msgbox(mmi_frm_sms_msgbox_struct *entry, U16 index, U8 thisseg)

{

[..]

/* add to msg entry */

entryindex = mmi_frm_sms_add_sms_entry(entry, index, thisseg);// 添加到短信箱

/* update msg list */

if (mmi_frm_sms_list_done)

{

mmi_frm_sms_add_sms_to_list(entry, entryindex);// 添加到索引表

}

return entryindex;

}

转载于:https://www.cnblogs.com/harisucici/archive/2011/12/01/2270380.html

python023基于Python旅游景点推荐系统带vue前后端分离毕业源码案例设计 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值