|
MTK短信开发详解(八)
[\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 = 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);
[…]
}
完整版本请见 http://www.51qianru.cn/bbs/
曙海教育
曙海嵌入式学院3G通信培训中心
(MTK培训,Android培训,iPhone培训)
电话:021-51875830
网址:http://www.51qianru.cn
讲师:李现路
版权所有-曙海教育 转发请注明出处
|
|