搜索

6

主题

21

帖子

198

积分

注册会员

Rank: 2

积分
198
发表于 2021-2-24 14:11:10 31455 浏览 6 回复

How to indicate incoming call and received sms of MT2503D in the main task?

Hi,

I am working on incoming calls and SMS and I can handle them in the service files, but I need to manage them in the main task i.e. newmobiapp_main. Should I send the message using an ILM to the main task or there's a better way to define an indicator function for those?
回复

使用道具 举报

212

主题

303

帖子

3394

积分

版主

Rank: 7Rank: 7Rank: 7

积分
3394
QQ
发表于 2021-2-24 15:19:37
本帖最后由 七个柚子多少钱 于 2021-2-24 15:25 编辑

是要在newmobiapp_main()任务里面去处理来电嘛?如果是接听的话可以修改源码变为自动接听或者上报KEY_SEND键进行接听来电;

以下是修改为自动接听方法:

  1. void mmi_ucm_entry_incoming_call(mmi_scrn_essential_struct* scr_info)
  2. {
  3.         .....
  4.     if (!mmi_is_redrawing_bk_screens())
  5.     {
  6.                 ......
  7.         }
  8.     OslMfree(call_info);
  9.         //add code
  10.         mmi_ucm_incoming_call_sendkey();
  11.         //end
  12.         .....
  13. }       
复制代码

回复

使用道具 举报

212

主题

303

帖子

3394

积分

版主

Rank: 7Rank: 7Rank: 7

积分
3394
QQ
发表于 2021-2-24 15:33:42
读取短信内容可以试试下面的接口:
  1. CHAR pOutBuffer[2048];
  2. void mmi_read_sms(U16 msg_id,SrvSmsCallbackFunc callback_func)
  3. {
  4.         srv_sms_msg_data_struct * msg_data  = NULL;
  5.          EMSData* content_ems = NULL;
  6.       // 申请结构体空间
  7.         msg_data = (srv_sms_msg_data_struct*)OslMalloc(sizeof(srv_sms_msg_data_struct));
  8.         
  9.         /* If want to content as EMS format, we need to fill para_flag to SRV_SMS_PARA_CONTENT_EMS */
  10.         msg_data->para_flag = SRV_SMS_PARA_CONTENT_EMS;
  11.         /* For content, its buffer also provided by caller. */
  12.      //申请短信内容存放空间
  13.         msg_data->content_ems = (EMSData*)GetEMSDataForView((EMSData*)&content_ems, 1);
  14.         /* If want to get protocol identifier(PID), we need to fill para_flag to SRV_SMS_PARA_PID */
  15.         msg_data->para_flag |= SRV_SMS_PARA_PID;
  16.         msg_data->para_flag |= SRV_SMS_PARA_SCA;
  17.         msg_data->para_flag |= SRV_SMS_PARA_STATUS;
  18.         msg_data->para_flag |= SRV_SMS_PARA_NUM;
  19.         msg_data->para_flag |= SRV_SMS_PARA_CONTENT;
  20.         msg_data->content_buff = content_ems->textBuffer;
  21.         msg_data->content_buff_size = content_ems->textBufferSize + 2;
  22.      //读取短信内容 在回调函数显示
  23.         srv_sms_read_msg(
  24.         msg_id,
  25.         MMI_FALSE,
  26.         msg_data,
  27.         callback_func,
  28.         NULL);
  29. }

  30. void mmi_sample_read_func(srv_sms_callback_struct* callback_data)
  31. {
  32.         srv_sms_read_msg_cb_struct *read_msg_cb_data;
  33.         srv_sms_msg_data_struct *msg_data;
  34.      //得到短信信息结构体
  35.         read_msg_cb_data =(srv_sms_read_msg_cb_struct*)callback_data->action_data;
  36.         msg_data = read_msg_cb_data->msg_data;
  37.         if (callback_data->result == MMI_TRUE)  //读取成功
  38.         {
  39.                
  40.                 newmobi_trace("SMS"," read sms succeed !!!");
  41.           //短信号码
  42.                 memset(pOutBuffer,0,sizeof(pOutBuffer));
  43.                 mmi_chset_ucs2_to_text_str(pOutBuffer,mmi_ucs2strlen(msg_data->number) * 2,msg_data->number,GB2312_ENCODING_TYPE);
  44.                 newmobi_trace("pOutBuffer                "," == %s",pOutBuffer);
  45.           //短信内容
  46.                  memset(pOutBuffer,0,sizeof(pOutBuffer));
  47.                 mmi_chset_ucs2_to_text_str(pOutBuffer,mmi_ucs2strlen(msg_data->content_buff) * 2,msg_data->content_buff,GB2312_ENCODING_TYPE);
  48.                 newmobi_trace("pOutBuffer                "," == %s",pOutBuffer);
  49.         }
  50.         else
  51.         {
  52.                 newmobi_trace("SMS"," read sms fail !!!");
  53.         }
  54. }
复制代码
使用方法:
在需要读取短信地方调用下面函数,第1个传参是短信索引,收件箱第一条短信就是索引0,第2个传参是一个函数指针,读取结果将会在mmi_sample_read_func函数中得到
  1. mmi_read_sms(0,mmi_sample_read_func);
复制代码




回复

使用道具 举报

6

主题

21

帖子

198

积分

注册会员

Rank: 2

积分
198
 楼主| 发表于 2021-2-24 15:39:45
本帖最后由 jawadi 于 2021-2-24 15:47 编辑

I am already handling incoming calls in UCM, but I think it's not the best way. Thanks for the response
回复

使用道具 举报

6

主题

21

帖子

198

积分

注册会员

Rank: 2

积分
198
 楼主| 发表于 2021-2-24 16:10:06
I need to be prompted immediately when a new SMS is received. How should it be done?
回复

使用道具 举报

212

主题

303

帖子

3394

积分

版主

Rank: 7Rank: 7Rank: 7

积分
3394
QQ
发表于 2021-2-24 16:18:08
jawadi 发表于 2021-2-24 16:10
I need to be prompted immediately when a new SMS is received. How should it be done?

你可以定时去查询收件箱的短信数量;如果要是要主动通知你的话这方面不太了解,需要跟一下代码流程才行;
回复

使用道具 举报

6

主题

21

帖子

198

积分

注册会员

Rank: 2

积分
198
 楼主| 发表于 2021-2-24 16:21:42
本帖最后由 jawadi 于 2021-2-24 16:47 编辑

OK. I'm processing the received SMS in the SmsReceiverSrv.c currently
回复

使用道具 举报

返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


登录或注册
快速回复 返回顶部 返回列表