|
发表于 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?
|
|
|
|
|
|
|
|
本帖最后由 七个柚子多少钱 于 2021-2-24 15:25 编辑
是要在newmobiapp_main()任务里面去处理来电嘛?如果是接听的话可以修改源码变为自动接听或者上报KEY_SEND键进行接听来电; 以下是修改为自动接听方法: - void mmi_ucm_entry_incoming_call(mmi_scrn_essential_struct* scr_info)
- {
- .....
- if (!mmi_is_redrawing_bk_screens())
- {
- ......
- }
- OslMfree(call_info);
- //add code
- mmi_ucm_incoming_call_sendkey();
- //end
- .....
- }
复制代码
|
|
|
|
|
|
|
|
读取短信内容可以试试下面的接口:
- CHAR pOutBuffer[2048];
- void mmi_read_sms(U16 msg_id,SrvSmsCallbackFunc callback_func)
- {
- srv_sms_msg_data_struct * msg_data = NULL;
- EMSData* content_ems = NULL;
- // 申请结构体空间
- msg_data = (srv_sms_msg_data_struct*)OslMalloc(sizeof(srv_sms_msg_data_struct));
-
- /* If want to content as EMS format, we need to fill para_flag to SRV_SMS_PARA_CONTENT_EMS */
- msg_data->para_flag = SRV_SMS_PARA_CONTENT_EMS;
- /* For content, its buffer also provided by caller. */
- //申请短信内容存放空间
- msg_data->content_ems = (EMSData*)GetEMSDataForView((EMSData*)&content_ems, 1);
- /* If want to get protocol identifier(PID), we need to fill para_flag to SRV_SMS_PARA_PID */
- msg_data->para_flag |= SRV_SMS_PARA_PID;
- msg_data->para_flag |= SRV_SMS_PARA_SCA;
- msg_data->para_flag |= SRV_SMS_PARA_STATUS;
- msg_data->para_flag |= SRV_SMS_PARA_NUM;
- msg_data->para_flag |= SRV_SMS_PARA_CONTENT;
- msg_data->content_buff = content_ems->textBuffer;
- msg_data->content_buff_size = content_ems->textBufferSize + 2;
- //读取短信内容 在回调函数显示
- srv_sms_read_msg(
- msg_id,
- MMI_FALSE,
- msg_data,
- callback_func,
- NULL);
- }
- void mmi_sample_read_func(srv_sms_callback_struct* callback_data)
- {
- srv_sms_read_msg_cb_struct *read_msg_cb_data;
- srv_sms_msg_data_struct *msg_data;
- //得到短信信息结构体
- read_msg_cb_data =(srv_sms_read_msg_cb_struct*)callback_data->action_data;
- msg_data = read_msg_cb_data->msg_data;
- if (callback_data->result == MMI_TRUE) //读取成功
- {
-
- newmobi_trace("SMS"," read sms succeed !!!");
- //短信号码
- memset(pOutBuffer,0,sizeof(pOutBuffer));
- mmi_chset_ucs2_to_text_str(pOutBuffer,mmi_ucs2strlen(msg_data->number) * 2,msg_data->number,GB2312_ENCODING_TYPE);
- newmobi_trace("pOutBuffer "," == %s",pOutBuffer);
- //短信内容
- memset(pOutBuffer,0,sizeof(pOutBuffer));
- mmi_chset_ucs2_to_text_str(pOutBuffer,mmi_ucs2strlen(msg_data->content_buff) * 2,msg_data->content_buff,GB2312_ENCODING_TYPE);
- newmobi_trace("pOutBuffer "," == %s",pOutBuffer);
- }
- else
- {
- newmobi_trace("SMS"," read sms fail !!!");
- }
- }
复制代码 使用方法:
在需要读取短信地方调用下面函数,第1个传参是短信索引,收件箱第一条短信就是索引0,第2个传参是一个函数指针,读取结果将会在mmi_sample_read_func函数中得到- mmi_read_sms(0,mmi_sample_read_func);
复制代码
|
|
|
|
|
|
|
|
楼主|
发表于 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 |
|
|
|
|
|
|
|
楼主|
发表于 2021-2-24 16:10:06
I need to be prompted immediately when a new SMS is received. How should it be done? |
|
|
|
|
|
|
|
你可以定时去查询收件箱的短信数量;如果要是要主动通知你的话这方面不太了解,需要跟一下代码流程才行; |
|
|
|
|
|
|
|
楼主|
发表于 2021-2-24 16:21:42
本帖最后由 jawadi 于 2021-2-24 16:47 编辑
OK. I'm processing the received SMS in the SmsReceiverSrv.c currently |
|
|
|
|
|
|
登录或注册
|