非idle界面received SMS提示

来源:互联网 发布:政务大数据基因系统 编辑:程序博客网 时间:2024/06/04 19:36
在10A的设计上就是只在idle界面才会show SMS的indication,非idle界面不会show提示界面,这种做法相对比较合理,参考多数对比机都是这种做法。而在09B及之前的版本上,在非idle界面会pop up提示界面,但不可以操作; 
1. 如果需要在非idle界面也要show提示界面,请将mmi_msg_entry_new_msg_ind,control_idle_screen 中的#ifdef __OP01__的判断注释掉,并打开MMI_NMGR_CMCC_MSG_EVENT,不过这只能实现在非idle界面popup received
sms的提示,不能进行操作去读短信。 
2. 如果需要在非idle界面,既可以show received SMS的提示,并可以操作去读SMS,可以参考如下方式修改。 
1) 在MessagesMiscell.c中定义如下函数和变量 
/***************************************************************************** 
 * FUNCTION 
 * mmi_nmgr_exit_sms_notification, mtk70536 
 * DESCRIPTION  
* PARAMETERS 
 * RETURNS 
 * void 
 *****************************************************************************/ 
MMI_BOOL mmi_nmgr_exit_sms_notification(void) 


MMI_ID grp_id; 
void mmi_nmgr_sms_notify_close_hdlr(void) 

 /*----------------------------------------------------------------*/ 
 /* Local Variables */ 
 /*----------------------------------------------------------------*/ 
  
 /*----------------------------------------------------------------*/ 
 /* Code Body */ 
 /*----------------------------------------------------------------*/ 
 mmi_frm_scrn_close(grp_id, SCR_ID_NMGR_NOTIFY); 

extern void mmi_nmgr_sms_notify_view_hdlr(void); 
/***************************************************************************** 
 * FUNCTION 
 * mmi_nmgr_entry_sms_notification 
 * DESCRIPTION 
 * display sms notification on other app screen, mtk70536 
 * PARAMETERS 
 * type [IN] Application ID 
 * flag [IN] Option flag 
 * RETURNS 
 * void 
 *****************************************************************************/ 
MMI_BOOL mmi_nmgr_entry_sms_notification(void) 

 /*----------------------------------------------------------------*/ 
 /* Local Variables */ 
 /*----------------------------------------------------------------*/ 
 U16 csk_img = IMG_GLOBAL_COMMON_CSK; 
 MMI_BOOL ret; 
 srv_um_sim_enum sim_type; 
 mmi_nmgr_info_struct sms_info; 
 #ifdef __MMI_MMS_IN_UM__ 
 mmi_nmgr_info_struct mms_info; 
 #endif /* __MMI_MMS_IN_UM__ */ 
 #ifdef __MMI_PUSH_IN_UM__ 
 mmi_nmgr_info_struct push_info; 
 #endif /* __MMI_PUSH_IN_UM__ */ 
 #ifdef __MMI_PROV_IN_UM__ 
 mmi_nmgr_info_struct prov_info; 
 #endif /* __MMI_PROV_IN_UM__ */ 
 S8 str_msg_notify[(MMI_NMGR_MAX_STR_LEN + 1) * ENCODING_LENGTH]; 
 S8 str_msg_num[MMI_UM_UI_MAX_MSG_NUM_DIGIT + 1]; 
 S8 str_msg_num_ucs2[(MMI_UM_UI_MAX_MSG_NUM_DIGIT + 1) * ENCODING_LENGTH]; 
 S8 str_unread_msg[(MMI_UM_UI_MAX_IDLE_UNREAD_STRING_LEN + 1) * ENCODING_LENGTH]; 
 U8 *list_string_1; 
 U8 *list_string_2; 
 U16 image; 
 S32 total_num; 
 /*----------------------------------------------------------------*/ 
 /* Code Body */ 
 /*----------------------------------------------------------------*/ 
 if(srv_sms_is_sms_ready() == MMI_FALSE) 
 { 
 return MMI_FALSE; 
 } 
 else 
 { 
 mmi_nmgr_get_app_info(MMI_NMGR_APP_SMS, &sms_info); 
 #ifdef __MMI_MMS_IN_UM__ 
 mmi_nmgr_get_app_info(MMI_NMGR_APP_MMS, &mms_info); 
 #endif /* __MMI_MMS_IN_UM__ */ 
 #ifdef __MMI_PUSH_IN_UM__ 
 mmi_nmgr_get_app_info(MMI_NMGR_APP_WAP_PUSH, &push_info); 
 #endif /* __MMI_PUSH_IN_UM__ */ 
 #ifdef __MMI_PROV_IN_UM__ 
 mmi_nmgr_get_app_info(MMI_NMGR_APP_PROVISIOING, &prov_info); 
 #endif /* __MMI_PROV_IN_UM__ */ 
  
 total_num = sms_info.total_num  
#ifdef __MMI_MMS_IN_UM__ 
 + mms_info.total_num  
#endif /* __MMI_MMS_IN_UM__ */ 
 #ifdef __MMI_PUSH_IN_UM__ 
 + push_info.total_num 
 #endif /* __MMI_PUSH_IN_UM__ */ 
 #ifdef __MMI_PROV_IN_UM__ 
 + prov_info.total_num 
 #endif /* __MMI_PROV_IN_UM__ */ 
 ; 
  
 if(total_num <= 0) 
 { 
 return MMI_FALSE; 
 } 
 else 
 { 
 /*initialize string memory*/ 
 memset(str_msg_notify, 0, sizeof(str_msg_notify)); 
 memset(str_msg_num, 0, sizeof(str_msg_num)); 
 memset(str_msg_num_ucs2, 0, sizeof(str_msg_num_ucs2)); 
 memset(str_unread_msg, 0, sizeof(str_unread_msg)); 
 #ifdef __MMI_DUAL_SIM_MASTER__ 
 if (srv_sms_get_msg_sim_id(g_msg_cntx.msg_ind_index) == SRV_SMS_SIM_1) 
 { 
 sim_type = SRV_UM_SIM_GSM_SIM1; 
 } 
 else 
 { 
 sim_type = SRV_UM_SIM_GSM_SIM2; 
 } 
 mmi_ucs2ncpy( 
 (S8*)str_msg_notify, 
 GetString(mmi_um_ui_ut_get_new_msg_str_id_by_sim(sim_type)),  
MMI_NMGR_MAX_STR_LEN); 
 #else /* __MMI_DUAL_SIM_MASTER__ */ 
 mmi_ucs2ncpy( 
 (S8*)str_msg_notify, 
 GetString(STR_UM_NEW_MSG_ID), 
 MMI_NMGR_MAX_STR_LEN); 
 #endif /* __MMI_DUAL_SIM_MASTER__ */ 
  
 /* String => N unread message(s) */ 
 MMI_ASSERT(SRV_UM_MAX_MSG_NUM >= total_num); 
 sprintf((S8*) str_msg_num, "%d ", total_num); 
 mmi_asc_to_ucs2((S8*) str_msg_num_ucs2, (S8*) str_msg_num); 
 mmi_ucs2cat((PS8)str_unread_msg, (PS8)str_msg_num_ucs2); 
 mmi_ucs2cat((PS8)str_unread_msg, (PS8)GetString(STR_UM_UNREAD_MSG_NUMBER_ID)); 
 list_string_1 = (U8*)str_msg_notify; 
 list_string_2 = (U8*)str_unread_msg; 
 } 
  
 image = IMG_NEW_MESSAGE_NOTIFICATION_MSG; 
  
 grp_id = mmi_frm_group_create(GRP_ID_ROOT,  
GRP_ID_AUTO_GEN,  
NULL,  
NULL); 
 mmi_frm_group_enter(grp_id, MMI_FRM_NODE_SMART_CLOSE_FLAG); 
 ret = mmi_frm_scrn_enter( 
 grp_id,  
SCR_ID_NMGR_NOTIFY,  
mmi_nmgr_exit_sms_notification, 
 NULL, 
 MMI_FRM_FULL_SCRN); 
 MMI_ASSERT(ret); 
 ShowCategory154Screen( 
 0,  
0,  
STR_GLOBAL_VIEW,  
0,  
STR_GLOBAL_CANCEL,  
0,  
list_string_1,  
list_string_2,  
image,  
NULL); 
 SetLeftSoftkeyFunction(mmi_nmgr_sms_notify_view_hdlr, KEY_EVENT_UP); 
  
 ChangeCenterSoftkey(0, csk_img); 
 SetCenterSoftkeyFunction(mmi_nmgr_sms_notify_view_hdlr, KEY_EVENT_UP); 
 SetRightSoftkeyFunction(mmi_nmgr_sms_notify_close_hdlr, KEY_EVENT_UP); 
 SetKeyHandler(mmi_nmgr_sms_notify_close_hdlr, KEY_END, KEY_EVENT_DOWN); 
 return MMI_TRUE; 
 } 

并根据实际需求修改函数mmi_msg_entry_new_msg_ind,下面实例的修改是在call的界面去show received sms的提示, 
void mmi_msg_entry_new_msg_ind(void) 

 /*----------------------------------------------------------------*/ 
 /* Local Variables */ 
 /*----------------------------------------------------------------*/ 
 if (srv_ucm_query_call_count(SRV_UCM_CALL_STATE_ALL, SRV_UCM_CALL_TYPE_NO_CSD, NULL) > 0) 
 { 
 mmi_frm_nmgr_query_app_info(MMI_NMGR_APP_SMS); 
 mmi_nmgr_entry_sms_notification(); 
 } 
 else 
 { 
 mmi_event_notify_enum event_id = MMI_EVENT_SMS; 
#ifdef __OP01__  
U16 indstr = 0; 
#endif 
 /*----------------------------------------------------------------*/ 
 /* Code Body */ 
 /*----------------------------------------------------------------*/ 
#ifdef __MMI_DUAL_SIM_MASTER__ 
 if (g_msg_cntx.isSlave == TRUE) 
 { 
 event_id = MMI_EVENT_SLAVE_SMS; 
 } 
#endif /* __MMI_DUAL_SIM_MASTER__ */ 
#ifdef __OP01__  
#ifndef __MMI_DUAL_SIM_MASTER__ 
 indstr = STR_RECEIVED_SMS; 
#else /* __MMI_DUAL_SIM_MASTER__ */ 
 if (g_msg_cntx.isSlave == FALSE) 
 {  
 indstr = STR_ID_SMS_MASTER_RECEIVED_SMS; 
 } 
 else 
 { 
 indstr = STR_ID_SMS_SLAVE_RECEIVED_SMS; 
 } 
#endif /* __MMI_DUAL_SIM_MASTER__ */ 
 mmi_frm_nmgr_notify_by_idle(MMI_SCENARIO_ID_NEW_SMS, event_id, (WCHAR*)GetString(indstr)); 
#else 
 mmi_frm_nmgr_notify_by_idle(MMI_SCENARIO_ID_NEW_SMS, event_id, NULL); 
#endif 
 } 

2) 在UMInterface.c中定义函数 
/* 
*DESCRIPTION 
*Entry Inbox to view SMS. Mtk70536 
*/ 
void mmi_nmgr_sms_notify_view_hdlr(void) 

 mmi_um_ui_cc_grp_cntx_struct *grp_cntx; 
 grp_cntx = mmi_um_ui_cc_get_curr_grp_cntx(); 
 if(!grp_cntx) 
 { 
 mmi_um_entry_inbox(); 
 } 
 else 
 { 
 mmi_frm_group_close(grp_cntx->grp_id); 
 mmi_um_entry_inbox(); 
 } 

3) 在IdleNotificationManager.c中定义函数 
/***************************************************************************** 
 * FUNCTION 
 * mmi_frm_nmgr_query_app_info 
 * DESCRIPTION 
 * This function query app information for nmgr notify screen. 
 * This function is to sync the nmgr context values of sms for the special  
* requirement of sms indication which does not use official normal notification  
* mechanism. 
 * PARAMETERS 
 * type [IN] Application ID 
 * RETURNS 
 * void 
 *****************************************************************************/ 
void mmi_frm_nmgr_query_app_info(U8 noti_type) 

 mmi_nmgr_query_app_info(noti_type); 

在NotificationGprot.h中进行函数声明 
extern void mmi_frm_nmgr_query_app_info(U8 noti_type); 
4) 在UMCentralCtrl.c中定义函数 
/***************************************************************************** 
 * FUNCTION 
 * mmi_um_ui_cc_get_curr_grp_cntx 
 * DESCRIPTION 
 * Get the current UM group context from table, mtk70536 
 * PARAMETERS 
 * 
 * RETURNS 
 *****************************************************************************/ 
mmi_um_ui_cc_grp_cntx_struct *mmi_um_ui_cc_get_curr_grp_cntx(void) 

 /*----------------------------------------------------------------*/ 
 /* Local Variables */ 
 /*----------------------------------------------------------------*/ 
 U16 i; 
 mmi_um_ui_cc_grp_cntx_struct *grp_cntx; 
 /*----------------------------------------------------------------*/ 
 /* Code Body */ 
 /*----------------------------------------------------------------*/ 
 grp_cntx = NULL; 
 for (i = 0; i < MMI_UM_UI_MAX_GRP_CNTX_NUM; i++) 
 { 
 if (g_um_ui_p->cc_cntx.grp_table[i].grp_id != 0) 
 { 
 grp_cntx = &g_um_ui_p->cc_cntx.grp_table[i]; 
 break; 
 } 
 } 
 return grp_cntx; 

在UMProt.h中声明, 
extern mmi_um_ui_cc_grp_cntx_struct *mmi_um_ui_cc_get_curr_grp_cntx(void);



原创粉丝点击