MTK623508B收件箱流程

【信箱】--à

mmi_msg_pre_entry_divided_inbox_menu(void)    //[信箱]

        case MMI_SMS_INBOX:

                 mmi_msg_entry_divided_inbox_menu();    //[收件箱]

        case MMI_SMS_OUTBOX:

                 mmi_msg_entry_divided_outbox_menu();   //[發件箱]

-àmmi_msg_entry_divided_inbox_menu()

   àmmi_mtpnp_entry_menu(SCR_MTPNP_DM_MSG_INBOX, NULL, mmi_msg_entry_divided_inbox_menu,

            MESSAGES_MENU_INBOX_MENUID,STR_INBOX_MENUENTRY,IMG_SMS_ENTRY_SCRN_CAPTION);

           EntryNewScreen(scr_id, exit_func, entry_func, NULL);

       ShowCategory52Screen

       mmi_msg_pre_entry_master_inbox_list                         //回調收件箱

             mmi_msg_entry_inbox_list();

       mmi_msg_pre_entry_master_outbox_list                       //回調發件箱

             mmi_msg_entry_outbox_list()

【設置】

          mmi_msg_entry_dm_msg_settings(void)  

mmi_mtpnp_entry_menu

mmi_msg_pre_entry_msg_settings                         //設置

mmi_msg_get_preferred_storage_req()                   

【讀短信】

      mmi_msg_get_msg_inbox()

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

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

                          mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_INBOX);//設置爲INBOX

                              mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_read_sms_req);

                                 mmi_frm_sms_read_action();

          mmi_frm_sms_read_sms_req(void *inMsg)

              MTPNP_PFAL_Read_SMS_Segment(void)

mmi_msg_get_msg_outbox(void)

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

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

      g_mmi_frm_sms_change_status = MMI_FALSE;

mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_read_sms_req);

                                mmi_frm_sms_read_action();

mmi_frm_sms_read_sms_req(void *inMsg)

                MTPNP_PFAL_Read_SMS_Segment(void)

 

 

mmi_msg_get_msg_rsp

         mmi_msg_entry_inbox_msg

         mmi_msg_entry_outbox_msg()

         mmi_msg_entry_simbox_msg()

         mmi_msg_entry_default_msg()

短信回覆入口:mmi_msg_reply_msg_to_entry(void)

mmi_msg_pre_entry_write_msg(SEND_MSG_CASE_REPLY);  //進入寫短信發短信流程

轉發短信入口:mmi_msg_edit_msg_from_view(void)

             mmi_msg_pre_entry_write_msg(5);            //進入寫短信發短信流程

編輯短信入口:mmi_msg_edit_msg_from_view(void)

             mmi_msg_pre_entry_write_msg(4);

複製到SIM卡上入口:mmi_msg_entry_confirm_generic(void)

移動到SIM卡上入口:

刪除短信入口:mmi_msg_entry_confirm_generic(void)

SetLeftSoftkeyFunction(msg_confirm_lskFuncPtr, KEY_EVENT_UP);

          SetRightSoftkeyFunction(msg_confirm_rskFuncPtr, KEY_EVENT_UP);

信箱初始化

     開機時系統逐條讀取所有短信保存到mmi_frm_sms_msg_box, 然後根據短信類型未讀/已讀/已發送...將索引添加到對應的 mmi_frm_sms_xxbox_list

     開機之後收到新短信或者發送短信時選擇了發送並保存”,則短信會即時添加到mmi_frm_sms_msg_box和各自對應的 mmi_frm_sms_xxbox_list

 

 

 

 

 

 

 

 

 


(1) void mmi_frm_sms_convert_mt_to_entry()

(2) void mmi_frm_sms_convert_startup_read_to_entry()

 

 

1.獲取短消息,

 

MTK沒有專門用於獲取短消息內容的函數,這給我們操作短消息帶來了不便.比如有時我們需要分析短消息的內容,再比如有時要把短消息寫入T卡了,再或者有時要把某條短消息顯示到某些應用場合了,這時就需要獲取短消息的內容.這裏提供一個我經常使用的接口:

 

#include "SMSApi.h"

#include "med_utility.h"

extern unsigned short mmi_frm_sms_show_list_index[];

S8 g_sms_buffer[160] = {0};

char *ConvertString(char * str)

{

 char temp;

 int i;

       int len = wstrlen(str);

   

 for (i = 0; i < len ; i += 2)

 {

            temp = str[i];

      str[i] = str[i+1];

      str[i+1] = temp;

 }

 

 return str;

}

int wstrlen(char * txt)

{

 int lenth=0;

 unsigned char * ss=(unsigned char*)txt;

 

 while(((*ss<<8)+*(ss+1))!=0)

 {

  lenth+=2;

  ss+=2;

 }

 return lenth;

}

 

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

{

 //U8 type=*(U8*)data;

 EMSData* pEms;

 int len = 0;

 

 GetEMSDataForView (&pEms, 0);

 

 len = wstrlen((char *)(pEms->textBuffer))+2;

 

//把獲取的信息複製到g_sms_buffer以備使用

 if (len < 20)

 {

  memcpy(g_sms_buffer, pEms->textBuffer, len);

 }

 else

 {

  memcpy(g_sms_buffer, pEms->textBuffer, 20);

 }

}

// type: MMI_FRM_SMS_APP_INBOX, MMI_FRM_SMS_APP_OUTBOX, MMI_FRM_SMS_APP_DRAFTS

// index: 0~0XFF

S32 my_msg_get_msg_req (U8 type, U16 req_index, E_MTPNP_AD_FILTER_RULE  cur_sim)

{

 int count =0;

 U16 index;

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

 if(mmi_frm_sms_check_action_pending())

 {

  return 1;

 }

 

#ifdef __MMI_DUAL_SIM_MASTER__

 if(cur_sim == MTPNP_AD_FILTER_MASTER)

 {

  MTPNP_AD_SMS_Set_Filter_Rule(MTPNP_AD_FILTER_MASTER);

  count =MTPNP_PFAL_SMS_Get_SMS_List_Size(type);

 }

 else

 {

  MTPNP_AD_SMS_Set_Filter_Rule(MTPNP_AD_FILTER_SLAVE);

  count = MTPNP_PFAL_SMS_Get_SMS_List_Size(type);

 }

 

 if((count <=0)||(req_index >= count))

 {

  return -1;

 }

 

 MTPNP_PFAL_SMS_Set_Current_Index(req_index);

 index = mmi_frm_sms_show_list_index[req_index];

#else

 index = req_index;

#endif

 

 

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

 

 return 0;

}

 

2.發短信,有時我們需要向網絡或者別的基站發送一條自填充內容的短信.比如訂閱某種服務,或者查詢話費,或者定時發送短信,或者拒接電話時給MT發一條提示短信等場合.函數有5個參數,mobileNo爲手機號碼,ASC類型字串,mobileNoLen號碼長度,smsMsg短消息內容,應爲UCS2編碼,smsMsgLen長度,simid雙卡情況下,0爲主卡,1爲副卡

 

#include "SMSApi.h"

#include "ProtocolEvents.h"

#ifndef __MMI_DUAL_SIM_MASTER__

void my_send_sms(S8 mobileNo[], U32 mobileNoLen, U8 smsMsg[], U32 smsMsgLen)

#else

void my_send_sms(S8 mobileNo[], U32 mobileNoLen, U8 smsMsg[], U32 smsMsgLen,

U8 simid)

 

#endif

{

 

 mmi_sms_send_msg_req_struct *sendSms;

 

 sendSms = (mmi_sms_send_msg_req_struct*)OslConstructDataPtr(sizeof(*sendSms));

 

 sendSms->dcs = SMSAL_UCS2_DCS;

 sendSms->udhi = 0;

 sendSms->length = smsMsgLen;

 memset(sendSms->msg,0,SMSAL_MAX_MSG_LEN);

 

 memcpy(sendSms->msg,smsMsg,sendSms->length);

 

 sendSms->profile = 0;

 sendSms->para = 0;

 sendSms->reply_index = MMI_FRM_SMS_INVALID_INDEX;

 sendSms->dest.type = CSMCC_DEFAULT_ADDR_TYPE;

 memset((S8*)sendSms->dest.number,0,MAX_CC_ADDR_LEN);

 

 sendSms->dest.length = mobileNoLen;

 memcpy(sendSms->dest.number,mobileNo,sendSms->dest.length);

 

 sendSms->seq_num = 0;

 sendSms->mms_mode = 0;

 

//  simsp_set_sms_ProtocolEventHandler();

#ifndef __MMI_DUAL_SIM_MASTER__

 mmi_frm_sms_send_message(MOD_MMI,MOD_L4C,0,PRT_MSG_ID_MMI_SMS_SEND_MSG_REQ,(

oslParaType*)sendSms,NULL);

 

#else//__MMI_DUAL_SIM_MASTER__

 

 if(simid == 0)

 {

  mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0,PRT_MSG_ID_MMI_SMS_SEND_MSG_REQ

, (oslParaType *)sendSms, NULL);

 

 }

 else

 {

  MTPNP_PFAL_Send_Message_Segment((void *)sendSms);

 }

#endif//__MMI_DUAL_SIM_MASTER__

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章