[Feature][T106]ZXW P56U09 code
Only Configure: Yes
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: No
Doc Update: No
Change-Id: I3cbd8b420271eb20c2b40ebe5c78f83059cd42f3
diff --git a/ap/app/zte_comm/sms/src/sms_main.c b/ap/app/zte_comm/sms/src/sms_main.c
new file mode 100755
index 0000000..cc3588e
--- /dev/null
+++ b/ap/app/zte_comm/sms/src/sms_main.c
@@ -0,0 +1,394 @@
+
+#include <errno.h>
+#include <sys/msg.h>
+#include <semaphore.h>
+#include <limits.h>
+#include <pthread.h>
+#include "sms_code.h"
+typedef VOID(*pAtWeb_SmsMsgProc)(UINT8*pDatabuf);typedef struct{UINT32 msg_id;
+VOID(*func_ptr)(UINT8*pDatabuf);BOOL need_block;}T_zSmsHandleTable;VOID
+atWeb_SendSms(UINT8*pDatabuf);VOID atWeb_DelSmsByIndex(UINT8*pDatabuf);VOID
+atWeb_DelSmsByType(UINT8*pDatabuf);VOID atWeb_ReadSms(UINT8*pDatabuf);VOID
+atWeb_SaveSms(UINT8*pDatabuf);VOID atWeb_SetSms(UINT8*pDatabuf);VOID
+atWeb_OutdateSmsCheck(UINT8*pDatabuf);int zSms_SendZmgrReq(int index);extern
+UINT8 g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_MAX];extern T_zSms_SendSmsReq
+g_zUfiSms_FinalCmgsBuf;extern int g_zUfiSms_CurConcatSegNo;extern
+T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];extern
+ int g_zUfiSms_SendFailedCount;extern int g_zUfiSms_ConcatTotalNum;extern UINT8
+g_zUfiSms_IsConcatSendSuc;int iSmsIndex=(0x491+3896-0x13c9);int g_zSms_MsqId=-
+(0x24+7436-0x1d2f);int g_zSms_LocalMsqId=-(0x222+3114-0xe4b);sem_t g_sms_sem_id;
+T_zSms_optRsp g_smsOptRsp={(0xaf9+2542-0x14e7)};static const T_zSmsHandleTable
+SmsHandleWebTab[]={{MSG_CMD_SEND_SMS,atWeb_SendSms,TRUE},{
+MSG_CMD_DEL_SMS_BY_INDEX,atWeb_DelSmsByIndex,TRUE},{MSG_CMD_SMS_MODIFY_TAG,
+atWeb_ReadSms,TRUE},{MSG_CMD_DRAFTS_SAVE,atWeb_SaveSms,FALSE},{
+MSG_CMD_SMS_LOCATION_SET,atWeb_SetSms,TRUE},{MSG_CMD_SMS_OUTDATE_CHECK,
+atWeb_OutdateSmsCheck,TRUE},{(0xc1c+3312-0x190c),NULL,FALSE}};VOID atWeb_SendSms
+(UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;T_zUfiSms_StatusInfo tStatus={
+(0x38c+4353-0x148d)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
+pDatabuf;zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_SEND);(void)
+zUfiSms_SendRawSms((T_zUfiSms_SendReq*)ptMessage->msg_data);}VOID
+atWeb_DelSmsByIndex(UINT8*pDatabuf){T_zUfiSms_DelReq tDelReq={
+(0x1467+3798-0x233d)};T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;
+T_zUfiSms_StatusInfo tStatus={(0x5d2+3619-0x13f5)};assert(pDatabuf!=NULL);printf
+("[SMS] atWeb_DelSmsByIndex recv msg\n");memcpy(&tDelReq,pDatabuf,sizeof(
+T_zUfiSms_DelReq));zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_DELETE);result
+=zUfiSms_DeleteSms(&tDelReq);tStatus.cmd_status=result;(void)
+zUfiSms_SetCmdStatus(&tStatus);zUfiMmi_SendSmsStatus();}VOID atWeb_DelSmsByType(
+UINT8*pDatabuf){
+#if (0x344+368-0x4b4)
+WEB_DEL_SMS_BY_TYPE*req=NULL;req=(WEB_DEL_SMS_BY_TYPE*)pDatabuf;assert(req!=NULL
+);if(req->eLocation!=ZSMS_LOCATION_SIM){ZTE_LOG(LOG_ERR,
+"\x7a\x53\x6d\x73\x5f\x50\x72\x65\x70\x44\x65\x6c\x42\x79\x54\x79\x70\x65\x20\x70\x61\x72\x61\x20\x4e\x55\x4c\x4c\x2e" "\n"
+);return;}zSms_ChangeMainState(ZSMS_STATE_DELING);ZTE_LOG(LOG_DEBUG,
+"\x7a\x53\x6d\x73\x5f\x50\x72\x65\x70\x44\x65\x6c\x42\x79\x54\x79\x70\x65\x20\x70\x73\x74\x52\x65\x71\x2d\x3e\x65\x42\x6f\x78\x4e\x61\x6d\x65\x3d\x25\x64" "\n"
+,req->eBoxName);SMS_DeleteRecordFromXML(SMS_LOCATION_SIM,(0x1a7+5576-0x176f),req
+->eBoxName);if(req->eBoxName==SMS_INBOX){sms_LoadSmsFromSim();}
+#endif
+}VOID atWeb_ReadSms(UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;
+T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={
+(0x20b+4601-0x1404)};assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)
+pDatabuf;zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_MSG_MODIFY_TAG);result=
+zUfiSms_ModifySmsTag((T_zUfiSms_ModifyFlag*)ptMessage->msg_data);tStatus.
+cmd_status=result;(void)zUfiSms_SetCmdStatus(&tStatus);}VOID atWeb_SaveSms(UINT8
+*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;T_zUfiSms_CmdStatus result=
+WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={(0x98f+1762-0x1071)};assert(
+pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)pDatabuf;zUfiSms_InitCmdStatus(&
+tStatus,WMS_SMS_CMD_MSG_WRITE);result=zUfiSms_WriteRawSms((T_zUfiSms_SaveReq*)
+ptMessage->msg_data);if(g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){tStatus.
+err_code=ZTE_SMS_CMS_MEM_FULL;printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x57\x65\x62\x5f\x53\x61\x76\x65\x53\x6d\x73\x20\x6d\x65\x6d\x20\x66\x75\x6c\x6c" "\n"
+);}tStatus.cmd_status=result;(void)zUfiSms_SetCmdStatus(&tStatus);
+zUfiSms_ChangeMainState(SMS_STATE_SAVING);sc_cfg_set(NV_SMS_SAVE_RESULT,
+"\x6f\x6b");}VOID atWeb_SetSms(UINT8*pDatabuf){T_zGoaheadMsgBuf*ptMessage=NULL;
+T_zUfiSms_CmdStatus result=WMS_CMD_PROCESSING;T_zUfiSms_StatusInfo tStatus={
+(0x16eb+1028-0x1aef)};printf(
+"\x49\x4e\x54\x4f\x20\x61\x74\x57\x65\x62\x5f\x53\x65\x74\x53\x6d\x73\x2e" "\n")
+;assert(pDatabuf!=NULL);ptMessage=(T_zGoaheadMsgBuf*)pDatabuf;
+zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_CFG_SET_PARAMETERS);result=
+zUfiSms_SetSmsPara((T_zUfiSms_ParaInfo*)ptMessage->msg_data);tStatus.cmd_status=
+result;(void)zUfiSms_SetCmdStatus(&tStatus);}VOID atWeb_OutdateSmsCheck(UINT8*
+pDatabuf){T_zUfiSms_DelReq tSmsDel={(0x7f0+7623-0x25b7)};
+zUfiSms_CheckDbOutdateSms(ZTE_WMS_DB_NV_TABLE,&tSmsDel);printf(
+"\x2d\x2d\x2d\x2d\x6f\x75\x74\x20\x63\x6f\x75\x6e\x20\x6e\x76\x74\x3a\x20\x25\x64\x2d\x2d\x2d\x2d" "\n"
+,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0x12b+6943-0x1c4a)){
+atWeb_DelSmsByIndex(&tSmsDel);}memset(&tSmsDel,(0x709+941-0xab6),sizeof(
+T_zUfiSms_DelReq));zUfiSms_CheckDbOutdateSms(ZTE_WMS_DB_SIM_TABLE,&tSmsDel);
+printf(
+"\x2d\x2d\x2d\x2d\x6f\x75\x74\x20\x63\x6f\x75\x6e\x74\x20\x73\x69\x6d\x3a\x20\x25\x64\x2d\x2d\x2d\x2d" "\n"
+,tSmsDel.all_or_count);if(tSmsDel.all_or_count>(0x4c+4306-0x111e)){
+atWeb_DelSmsByIndex(&tSmsDel);}}VOID zSms_HandleWebMsg(MSG_BUF*ptMsgBuf){UINT32
+i=(0x162d+3387-0x2368);assert(ptMsgBuf!=NULL);printf(
+"\x73\x6d\x73\x20\x72\x65\x63\x76\x20\x6d\x73\x67\x20\x66\x72\x6f\x6d\x20\x77\x65\x62\x73\x65\x72\x76\x65\x72\x3a\x25\x64" "\n"
+,ptMsgBuf->usMsgCmd);while((0x1f32+747-0x221d)!=SmsHandleWebTab[i].msg_id){if(
+ptMsgBuf->usMsgCmd==SmsHandleWebTab[i].msg_id){if(SmsHandleWebTab[i].need_block
+&&ptMsgBuf->src_id!=MODULE_ID_SMS){ipc_send_message(MODULE_ID_SMS,
+MODULE_ID_SMS_LOCAL,ptMsgBuf->usMsgCmd,ptMsgBuf->usDataLen,(unsigned char*)
+ptMsgBuf->aucDataBuf,(0x1a87+1294-0x1f95));}else if(NULL!=SmsHandleWebTab[i].
+func_ptr){SmsHandleWebTab[i].func_ptr(ptMsgBuf->aucDataBuf);}break;}i++;}}SINT32
+ zSms_SendMsg(USHORT Msg_cmd,USHORT us_DataLen,UCHAR*pData){printf(
+"\x73\x6d\x73\x20\x73\x65\x6e\x64\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
+,Msg_cmd);ipc_send_message(MODULE_ID_SMS,MODULE_ID_AT_CTL,Msg_cmd,us_DataLen,(
+unsigned char*)pData,(0x1303+5102-0x26f1));return(0x1d49+1315-0x226c);}SINT32
+zSms_SendCmgsReq(VOID){T_zSms_SendSmsReq sendSmsInfo={(0xd73+3579-0x1b6e)};
+memset(&sendSmsInfo,(0x4e6+7181-0x20f3),sizeof(T_zSms_SendSmsReq));sendSmsInfo.
+length=g_zUfiSms_FinalCmgsBuf.length;if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)<
+ZSMS_PDU_SIZE-(0x12cb+5109-0x26bf)){memcpy(sendSmsInfo.pdu,
+g_zUfiSms_FinalCmgsBuf.pdu,strlen(g_zUfiSms_FinalCmgsBuf.pdu));}else{printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
+,g_zUfiSms_FinalCmgsBuf.pdu);memcpy(sendSmsInfo.pdu,g_zUfiSms_FinalCmgsBuf.pdu,
+ZSMS_PDU_SIZE-(0x263+6187-0x1a8c));}*(sendSmsInfo.pdu+strlen(
+g_zUfiSms_FinalCmgsBuf.pdu))=ZSMS_CTRL_Z_CHAR;
+#if (0x13a4+3823-0x2292)
+printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x73\x52\x65\x71\x20\x73\x65\x6e\x64\x20\x64\x61\x74\x61" "\n"
+);printf("\n" "\x5b\x53\x4d\x53\x5d\x25\x73" "\n",sendSmsInfo.pdu);
+#endif
+zSms_SendMsg(MSG_CMD_SENDSMS_REQ,sizeof(T_zSms_SendSmsReq),&sendSmsInfo);
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x58f+8057-0x2507)){return
+ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmgsOk(VOID){
+printf(
+"\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x73\x75\x63\x63\x65\x73\x73\x2e\x20" "\n"
+);g_zUfiSms_CurConcatSegNo++;if(g_zUfiSms_CurConcatSegNo>
+ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_DbStoreData[
+g_zUfiSms_CurConcatSegNo-(0x199d+794-0x1cb6)].tag=WMS_TAG_TYPE_MO_SENT_V01;
+zUfiSms_CmgsRespProc();}VOID zSms_RecvCmgsErr(VOID){printf(
+"\x73\x6d\x73\x20\x73\x65\x6e\x64\x65\x64\x20\x66\x61\x69\x6c\x2e\x20" "\n");
+g_zUfiSms_CurConcatSegNo++;if(g_zUfiSms_CurConcatSegNo>
+ZTE_WMS_CONCAT_SMS_COUNT_MAX){return;}g_zUfiSms_SendFailedCount++;printf(
+"\x73\x65\x6e\x64\x20\x73\x6d\x73\x20\x66\x61\x69\x6c\x65\x64\x2c\x73\x6f\x20\x77\x72\x69\x74\x65\x20\x73\x6d\x73\x20\x74\x6f\x20\x64\x72\x61\x66\x74\x62\x6f\x78\x2e" "\n"
+);g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-(0xb23+6995-0x2675)].tag=
+WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0xda1+4409-0x1ed9)){
+g_zUfiSms_IsConcatSendSuc=FALSE;}zUfiSms_CmgsRespProc();}SINT32 zSms_SendCmgdReq
+(UINT8 index){T_zSms_DelSmsReq delSmsReq={(0x150d+548-0x1731)};delSmsReq.index=
+index;zSms_SendMsg(MSG_CMD_DELSMS_REQ,sizeof(T_zSms_DelSmsReq),&delSmsReq);
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0xb8d+6650-0x2586)){return
+ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmgdOk(VOID){CHAR
+strUsed[(0x1f6+4782-0x149a)]={(0x7c7+1653-0xe3c)};int used=(0x1d52+1382-0x22b8);
+int tmp_i=(0x41c+8940-0x2708);sc_cfg_set(NV_SMS_DEL_RESULT,"\x6f\x6b");printf(
+"\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x4f\x4b\x2e\x20" "\n"
+);sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));tmp_i=atoi(
+strUsed);if(tmp_i<(0xd2+2286-0x9c0)||tmp_i>INT_MAX-(0x58f+4477-0x170b)){at_print
+(LOG_ERR,
+"\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x55\x53\x45\x44\x20\x74\x6d\x70\x5f\x69\x20\x65\x72\x72\x3a\x25\x64" "\n"
+,tmp_i);tmp_i=(0x1e87+2085-0x26ac);}used=tmp_i-(0x1509+833-0x1849);if(used<
+(0x815+3685-0x167a)){used=(0x76a+2959-0x12f9);}memset(&strUsed,
+(0x28c+9143-0x2643),(0x131c+4422-0x2458));snprintf(strUsed,sizeof(strUsed),
+"\x25\x64",used);sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed);}VOID
+zSms_RecvCmgdErr(VOID){sc_cfg_set(NV_SMS_DEL_RESULT,"\x66\x61\x69\x6c");printf(
+"\x5b\x53\x4d\x53\x5d\x20\x73\x65\x74\x20\x73\x69\x6d\x5f\x64\x65\x6c\x5f\x72\x65\x73\x75\x6c\x74\x20\x74\x6f\x20\x66\x61\x69\x6c\x2e\x20" "\n"
+);}VOID zSms_RecvCmgdFinish(VOID){char StrValue[(0x1645+741-0x1920)]={
+(0x120+8615-0x22c7)};CHAR strTotal[(0x362+1659-0x9d3)]={(0x6c6+2727-0x116d)};
+CHAR strUsed[(0x147a+1195-0x191b)]={(0xc7+4977-0x1438)};int total=
+(0x11c8+5139-0x25db);int used=(0x310+4312-0x13e8);int remain=(0x332+1387-0x89d);
+sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(
+strUsed);if(used<(0xb24+881-0xe95)||used>INT_MAX-(0x7a8+958-0xb65)){at_print(
+LOG_ERR,
+"\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x55\x53\x45\x44\x20\x65\x72\x72\x3a\x25\x64" "\n"
+,used);used=(0x18d4+2299-0x21cf);}sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,
+strTotal,sizeof(strTotal));total=atoi(strTotal);if(total<(0xd04+5453-0x2251)||
+total>INT_MAX-(0x41d+6249-0x1c85)){at_print(LOG_ERR,
+"\x5b\x53\x4d\x53\x5d\x57\x4d\x53\x5f\x4e\x56\x43\x4f\x4e\x46\x49\x47\x5f\x53\x49\x4d\x5f\x43\x41\x52\x44\x5f\x54\x4f\x54\x41\x4c\x20\x65\x72\x72\x3a\x25\x64" "\n"
+,total);total=(0x848+4425-0x1991);}remain=total-used;if(remain<
+(0x11cf+4952-0x2527)){remain=(0x765+669-0xa02);}memset(&StrValue,
+(0x2307+585-0x2550),(0x1bf7+666-0x1e87));snprintf(StrValue,sizeof(StrValue),
+"\x25\x64",remain);sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,StrValue);printf(
+"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x69\x6d\x53\x6d\x73\x20\x75\x73\x65\x64\x3d\x25\x64\x2c\x72\x65\x6d\x61\x69\x6e\x3d\x25\x64\x2c\x74\x6f\x74\x61\x6c\x3d\x25\x64" "\n"
+,used,remain,total);zUfiSms_ChangeMainState(SMS_STATE_DELED);sc_cfg_set(
+NV_SMS_DB_CHANGE,"\x31");}int zSms_SendZmenaReq(SINT32 avail){T_zSms_StroageReq
+storageReq={(0xddb+1645-0x1448)};storageReq.type=avail;zSms_SendMsg(
+MSG_CMD_STORAGE_CAP_REQ,sizeof(T_zSms_StroageReq),&storageReq);sem_wait(&
+g_sms_sem_id);if(g_smsOptRsp.result==(0xe8c+3887-0x1dba)){return ZSMS_RESULT_OK;
+}else{return ZSMS_RESULT_ERROR;}}int zSms_SendCmgrReq(UINT8 index){
+T_zSms_ModifyTagReq modTagReq={(0x1290+3141-0x1ed5)};modTagReq.index=index;
+zSms_SendMsg(MSG_CMD_MODIFY_TAG_REQ,sizeof(T_zSms_ModifyTagReq),&modTagReq);
+sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0x6c5+6712-0x20fc)){return
+ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}int zSms_SetCscaReq(PSTR sca){
+T_zSms_SetScaReq setscareq;strncpy(setscareq.sca,sca,sizeof(setscareq.sca)-
+(0x323+2292-0xc16));zSms_SendMsg(MSG_CMD_SCA_SET_REQ,sizeof(T_zSms_SetScaReq),&
+setscareq);sem_wait(&g_sms_sem_id);if(g_smsOptRsp.result==(0xd3d+5876-0x2430)){
+return ZSMS_RESULT_OK;}else{return ZSMS_RESULT_ERROR;}}int zSms_SendCnmiReq(PSTR
+ pAtCmdPara){T_zSms_NotifySetReq notifySetReq={(0x2145+404-0x22d9)};if(
+(0x13fd+1059-0x1820)==strcmp(pAtCmdPara,"\x73\x69\x6d")){notifySetReq.mt=
+(0x23a2+328-0x24e9);}else{notifySetReq.mt=(0x17d6+3494-0x257a);}zSms_SendMsg(
+MSG_CMD_NOTIFY_SET_REQ,sizeof(T_zSms_NotifySetReq),¬ifySetReq);sem_wait(&
+g_sms_sem_id);if(g_smsOptRsp.result==(0x1b5+8977-0x24c5)){return ZSMS_RESULT_OK;
+}else{return ZSMS_RESULT_ERROR;}}VOID zSms_RecvCmtInd(UINT8*pDatabuf){CHAR
+needSMS[(0x908+1777-0xfc7)]={(0x10f0+4378-0x220a)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x8fb+3132-0x1537)==strcmp(
+needSMS,"\x6e\x6f")){printf(
+"\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
+);return;}T_zSms_SmsInd tCmtRsp={(0x358+8885-0x260d)};memcpy(&tCmtRsp,(
+T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));zUfiSms_CmtRespProc(&tCmtRsp);
+zUfiMmi_SendSmsStatus();sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}VOID
+zSms_RecvCmtiInd(UINT8*pDatabuf){char sms_Main_state[(0x2dc+7721-0x20e7)]={
+(0xe84+5410-0x23a6)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf;
+CHAR needSMS[(0xd7a+4550-0x1f0e)]={(0xa76+7146-0x2660)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x867+2088-0x108f)==strcmp(
+needSMS,"\x6e\x6f")){printf(
+"\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
+);return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));if(
+strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
+(0x18b7+1300-0x1dcb)){printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
+);return;}if((0xe4c+637-0x10c9)==strncmp("\x53\x4d",smsIdxInd->storetype,
+(0xe8b+2252-0x1755))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
+zUfiSms_ChangeMainState(SMS_STATE_RECVING);zSms_SendZmgrReq(smsIdxInd->index);}
+else{printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
+);}sc_cfg_set(NV_SMS_RECV_RESULT,"");}VOID zSms_RecvCdsInd(UINT8*pDatabuf){CHAR
+needSMS[(0x9bf+2246-0x1253)]={(0x2285+389-0x240a)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x19f0+2873-0x2529)==strcmp(
+needSMS,"\x6e\x6f")){printf(
+"\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
+);return;}T_zSms_SmsInd tCmtRsp={(0x80b+2814-0x1309)};memcpy(&tCmtRsp,(
+T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));zUfiSms_CdsRespProc(&tCmtRsp);
+zUfiMmi_SendSmsStatus();sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}VOID
+zSms_RecvCdsiInd(UINT8*pDatabuf){char sms_Main_state[(0x1c9d+521-0x1e88)]={
+(0xbba+2772-0x168e)};T_zSms_SmsIndexInd*smsIdxInd=(T_zSms_SmsIndexInd*)pDatabuf;
+CHAR needSMS[(0xab+3971-0xffc)]={(0x5ca+286-0x6e8)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0xdf4+4121-0x1e0d)==strcmp(
+needSMS,"\x6e\x6f")){printf(
+"\x5b\x53\x4d\x53\x5d\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x6e\x65\x65\x64\x53\x4d\x53\x3d\x6e\x6f\x21"
+);return;}sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));if(
+strcmp(sms_Main_state,"\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67")==
+(0x983+3381-0x16b8)){printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x3a\x20\x73\x6d\x73\x5f\x64\x65\x6c\x69\x6e\x67" "\n"
+);return;}if((0x1d39+1720-0x23f1)==strncmp("\x53\x4d",smsIdxInd->storetype,
+(0x1cf+301-0x2fa))){zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);
+zUfiSms_ChangeMainState(SMS_STATE_RECVING);zSms_SendZmgrReq(smsIdxInd->index);}
+else{printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x69\x52\x73\x70\x20\x3a\x73\x74\x6f\x72\x65\x20\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x20\x6e\x6f\x74\x20\x53\x4d\x2e" "\n"
+);}sc_cfg_set(NV_SMS_RECV_RESULT,"");}int zSms_SendCnmaReq(int ack_mode){
+T_zSms_SmsAckReq ackReq={(0x1094+1044-0x14a8)};CHAR ackPduStr[
+(0x1a11+1201-0x1e90)]={(0x162b+3850-0x2535)};ackReq.ackmode=ack_mode;if(ack_mode
+==(0x9fa+5551-0x1fa7)){zUfiSms_EncodePdu_DeliverReport(ackPduStr,
+(0x143f+3491-0x210f));memcpy(ackReq.pdu,ackPduStr,strlen(ackPduStr));
+#if (0x63f+934-0x9e5)
+if(strlen(ackPduStr)<ZSMS_PDU_SIZE-(0x8d4+2780-0x13af)){memcpy(ackReq.pdu,
+ackPduStr,strlen(ackPduStr));}else{at_print(LOG_DEBUG
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x70\x64\x75\x20\x74\x6f\x6f\x20\x6c\x6f\x6e\x67\x3a\x25\x73" "\n"
+,ackPduStr);memcpy(ackReq.pdu,ackPduStr,ZSMS_PDU_SIZE-(0x1102+4875-0x240b));}
+#endif
+*(ackReq.pdu+strlen(ackPduStr))=ZSMS_CTRL_Z_CHAR;printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x2e\x20\x70\x64\x75\x3d\x20\x25\x73" "\n"
+,ackReq.pdu);ackReq.length=strlen(ackPduStr)/(0xae5+3505-0x1894);}zSms_SendMsg(
+MSG_CMD_SMSACK_REQ,sizeof(T_zSms_SmsAckReq),&ackReq);sem_wait(&g_sms_sem_id);if(
+g_smsOptRsp.result==(0x525+2491-0xedf)){return ZSMS_RESULT_OK;}else{return
+ZSMS_RESULT_ERROR;}}int zSms_SendZmgrReq(int index){T_zSms_ReadSmsReq readSmsReq
+={(0x142d+4208-0x249d)};iSmsIndex=index;printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x5a\x6d\x67\x72\x52\x65\x71\x20\x47\x65\x74\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2e" "\n"
+,iSmsIndex);readSmsReq.index=index;zSms_SendMsg(MSG_CMD_READSMS_REQ,sizeof(
+T_zSms_ReadSmsReq),&readSmsReq);return(0x13c+5559-0x16f3);}VOID zSms_RecvZmgrRsp
+(UINT8*pDatabuf){T_zSms_SmsInd tCmgrRsp={(0x13af+2920-0x1f17)};memcpy(&tCmgrRsp,
+(T_zSms_SmsInd*)pDatabuf,sizeof(T_zSms_SmsInd));tCmgrRsp.index=iSmsIndex;
+zUfiSms_ZmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();}VOID zSms_RecvZmgrOk(
+UINT8*pDatabuf){T_zSms_optRsp smsOptRsp={(0x1d65+454-0x1f2b)};memcpy(&smsOptRsp,
+(T_zSms_optRsp*)pDatabuf,sizeof(T_zSms_optRsp));if(smsOptRsp.result==
+(0xb9c+875-0xf06)){sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{printf(
+"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x45\x72\x72\x20\x20\x53\x4d\x53\x20\x7a\x6d\x67\x72\x20\x69\x73\x20\x66\x61\x69\x6c" "\n"
+);sc_cfg_set(NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(
+SMS_STATE_RECVED);}}VOID zSms_RecvZpbicInd(UINT8*pDatabuf){T_zAt_ZpbicRes*ptPara
+=ZUFI_NULL;if(pDatabuf==NULL){return;}ptPara=(T_zAt_ZpbicRes*)(pDatabuf);if((
+(0x7c3+7342-0x2470)==ptPara->result)&&((0x96a+5767-0x1ff1)==ptPara->opertype)){
+CHAR needSms[(0x11a4+4522-0x231c)]={(0x1dd+7039-0x1d5c)};sc_cfg_get(
+NV_NEED_SUPPORT_SMS,needSms,sizeof(needSms));if((0x553+860-0x8af)!=strcmp(
+needSms,"\x6e\x6f")){zSvr_Zpbic_Sms_Init();}}}VOID zSms_RecvCpmsInd(UINT8*
+pDatabuf){T_zSms_CpmsInd*cpmsInd=(T_zSms_CpmsInd*)pDatabuf;CHAR strBuf[
+(0x34f+7123-0x1f18)]={(0xdba+6094-0x2588)};int remainSpace=(0x70f+6278-0x1f95);
+snprintf(strBuf,sizeof(strBuf),"\x25\x64",cpmsInd->total);sc_cfg_set(
+ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strBuf);sc_cfg_set(
+ZTE_WMS_NVCONFIG_SIM_CAPABILITY,strBuf);memset(&strBuf,(0x1a1+1197-0x64e),
+(0x5cc+6259-0x1e35));snprintf(strBuf,sizeof(strBuf),"\x25\x64",cpmsInd->used);
+sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strBuf);remainSpace=cpmsInd->total-
+cpmsInd->used;memset(&strBuf,(0xaef+5647-0x20fe),(0x659+776-0x957));snprintf(
+strBuf,sizeof(strBuf),"\x25\x64",remainSpace);sc_cfg_set(
+ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,strBuf);sc_cfg_set(NV_SMS_STORE,"\x6f\x6b");}
+#define AT_CMD_MAX (0xfab+1648-0x15db)
+#define ZAT_TAB_REPLACE ((unsigned char )(\
+(0x1c9c+2460-0x253c)))
+#define ZAT_NULL_FILL ((unsigned char )((0x122+2248-0x8ed)\
+))
+#define ZAT_SPACE_REPLACE ((unsigned char )(\
+(0x1731+2168-0x1eab)))
+#define ZAT_LF_REPLACE ((unsigned char )(\
+(0x62a+4773-0x17d4)))
+#define ZAT_CR_REPLACE ((unsigned char )(\
+(0x553+8614-0x25ff)))
+static void atBase_PreProcRes(char*pParaLine,int paraSize){signed long flg=
+(0xe43+5379-0x2346);unsigned long i=(0x622+4342-0x1718);unsigned long length=
+(0x1157+3151-0x1da6);char*pSource=pParaLine;char*pDest=NULL;char*pStrDestMalloc=
+(char*)malloc(AT_CMD_MAX);if(NULL==pStrDestMalloc){return;}memset(pStrDestMalloc
+,(0x892+6111-0x2071),AT_CMD_MAX);assert(pParaLine!=NULL);pDest=pStrDestMalloc;
+length=strlen(pParaLine);if((length==(0xb37+871-0xe9e))||(length>=AT_CMD_MAX)){
+free(pStrDestMalloc);return;}for(i=(0x9d5+7250-0x2627);(i<length)&&(pDest-
+pStrDestMalloc<AT_CMD_MAX);i++){if(((char)(0x110b+2214-0x198f))==*pSource){flg=(
+(0x16dd+1489-0x1cae)==flg)?(0x287+3229-0xf23):(0x1392+528-0x15a2);if(
+((char)(0xdd3+3510-0x1b67))==*(pSource+(0x1225+942-0x15d2))){*pDest++=(char)
+ZAT_NULL_FILL;}}else if((((char)(0x851+1619-0xe78))==*pSource)&&(
+(0x1758+1232-0x1c28)==flg)){*pDest++=((char)(0xe7b+379-0xfd6));if(
+((char)(0x12ad+5113-0x267a))==*(pSource+(0xdd1+2970-0x196a))){*pDest++=
+((char)(0x3e2+3098-0xfc3));}else if('\0'==*(pSource+(0x1a69+519-0x1c6f))){*pDest
+++=(char)ZAT_NULL_FILL;}}else{if((((char)(0x1b94+2916-0x26d8))==*pSource)&&(
+(0x5c6+1446-0xb6b)==flg)){*pDest++=(char)ZAT_SPACE_REPLACE;}else if(('\t'==*
+pSource)&&((0x55a+8478-0x2677)==flg)){*pDest++=(char)ZAT_TAB_REPLACE;}else if((
+'\n'==*pSource)&&((0x245+4523-0x13ef)==flg)){*pDest++=(char)ZAT_LF_REPLACE;}else
+ if(('\r'==*pSource)&&((0x75b+3123-0x138d)==flg)){*pDest++=(char)ZAT_CR_REPLACE;
+}else{*pDest++=*pSource;}}pSource++;}memset(pParaLine,(0x383+404-0x517),paraSize
+);strncpy(pParaLine,pStrDestMalloc,paraSize-(0x4f1+6200-0x1d28));free(
+pStrDestMalloc);}VOID zSms_RecvCscaInd(UINT8*pDatabuf){T_zSms_CscaInd cscaInd={
+(0x385+1585-0x9b6)};
+#if (0xb62+5910-0x2277)
+printf(
+"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x7a\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x73\x63\x61\x49\x6e\x64\x20\x64\x61\x74\x61\x62\x75\x66\x3a\x25\x73" "\n"
+,pDatabuf);
+#endif
+atBase_PreProcRes(pDatabuf,strlen(pDatabuf));sscanf(pDatabuf,
+"\x25\x32\x31\x73\x20\x25\x32\x31\x73",cscaInd.sca,cscaInd.tosca);
+#if (0x121+6723-0x1b63)
+printf(
+"\x5b\x53\x4d\x53\x63\x6f\x72\x65\x6d\x5d\x7a\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x73\x63\x61\x49\x6e\x64\x20\x73\x63\x61\x3a\x25\x73\x2c\x20\x74\x6f\x73\x63\x61\x25\x73" "\n"
+,cscaInd.sca,cscaInd.tosca);
+#endif
+sc_cfg_set(NV_SMS_CENTER_NUM,cscaInd.sca);zUfiSms_SetScaPara(cscaInd.sca);}VOID
+zSms_RecvZmglInd(UINT8*pDatabuf){zUfiSms_CmglRespProc((T_zSms_SmsInd*)pDatabuf);
+}int zSms_SendSmsInitReq(VOID){zSms_SendMsg(MSG_CMD_SMSINIT_REQ,
+(0x1748+156-0x17e4),NULL);return(0x626+1706-0xcd0);}VOID zSms_initAtOk(VOID){
+T_zUfiSms_StatusInfo tStatus={(0x10b+411-0x2a6)};sc_cfg_set(NV_SMS_STORE,
+"\x6f\x6b");sc_cfg_set(NV_SMS_LOAD_RESULT,"\x6f\x6b");tStatus.cmd_status=
+WMS_CMD_SUCCESS;tStatus.cmd=WMS_SMS_CMD_INIT;(void)zUfiSms_SetCmdStatus(&tStatus
+);zUfiSms_ChangeMainState(SMS_STATE_LOADED);}VOID zSms_initAtErr(VOID){
+T_zUfiSms_StatusInfo tStatus={(0x584+6585-0x1f3d)};sc_cfg_set(NV_SMS_LOAD_RESULT
+,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_LOADED);tStatus.
+cmd_status=WMS_CMD_FAILED;tStatus.cmd=WMS_SMS_CMD_INIT;(void)
+zUfiSms_SetCmdStatus(&tStatus);}VOID zSms_RecvSmsInitRst(UINT8*pDatabuf){memcpy(
+&g_smsOptRsp,pDatabuf,sizeof(T_zSms_optRsp));if(g_smsOptRsp.result==
+(0x1bc5+748-0x1eb0)){zSms_initAtOk();}else{zSms_initAtErr();}}UINT8
+zSms_SmsMsgCreat(VOID){g_zSms_MsqId=msgget(MODULE_ID_SMS,IPC_CREAT|
+(0xc74+1274-0xfee));if(g_zSms_MsqId==-(0xc6b+3916-0x1bb6)){return ZUFI_FAIL;}
+g_zSms_LocalMsqId=msgget(MODULE_ID_SMS_LOCAL,IPC_CREAT|(0x7fc+5701-0x1cc1));if(
+g_zSms_LocalMsqId==-(0x1c9b+65-0x1cdb)){return ZUFI_FAIL;}sem_init(&g_sms_sem_id
+,(0x1922+1102-0x1d70),(0x1af6+2504-0x24be));return ZUFI_SUCC;}void
+zSms_HandleAtctlLocalMsg(MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
+"\x73\x6d\x73\x20\x6c\x6f\x63\x61\x6c\x20\x72\x65\x63\x76\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
+,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_ZPBIC_IND:
+zSms_RecvZpbicInd(ptMsgBuf->aucDataBuf);break;case MSG_CMD_ZMGL_IND:
+zSms_RecvZmglInd(ptMsgBuf->aucDataBuf);break;case MSG_CMD_NEWSMS_STATUS_IND:
+zSms_RecvCdsInd(ptMsgBuf->aucDataBuf);break;case MSG_CMD_NEWSMS_IND:
+zSms_RecvCmtInd(ptMsgBuf->aucDataBuf);default:break;}}VOID zSms_HandleAtctlMsg(
+MSG_BUF*ptMsgBuf){assert(ptMsgBuf!=NULL);printf(
+"\x73\x6d\x73\x20\x72\x65\x63\x76\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
+,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_SENDSMS_RSP:case
+MSG_CMD_DELSMS_RSP:case MSG_CMD_STORAGE_CAP_RSP:case MSG_CMD_MODIFY_TAG_RSP:case
+ MSG_CMD_NOTIFY_SET_RSP:case MSG_CMD_SCA_SET_RSP:case MSG_CMD_SMSACK_RSP:{memcpy
+(&g_smsOptRsp,ptMsgBuf->aucDataBuf,sizeof(T_zSms_optRsp));sem_post(&g_sms_sem_id
+);}break;case MSG_CMD_CPMS_IND:zSms_RecvCpmsInd(ptMsgBuf->aucDataBuf);break;case
+ MSG_CMD_CSCA_IND:zSms_RecvCscaInd(ptMsgBuf->aucDataBuf);break;case
+MSG_CMD_ZMGR_IND:zSms_RecvZmgrRsp(ptMsgBuf->aucDataBuf);break;case
+MSG_CMD_READSMS_RSP:zSms_RecvZmgrOk(ptMsgBuf->aucDataBuf);break;case
+MSG_CMD_SMSINIT_RSP:zSms_RecvSmsInitRst(ptMsgBuf->aucDataBuf);break;case
+MSG_CMD_NEWSMS_INDEX_IND:zSms_RecvCmtiInd(ptMsgBuf->aucDataBuf);break;case
+MSG_CMD_NEWSMS_STATUS_INDEX_IND:zSms_RecvCdsiInd(ptMsgBuf->aucDataBuf);break;
+case MSG_CMD_NEWSMS_IND:case MSG_CMD_ZPBIC_IND:case MSG_CMD_ZMGL_IND:case
+MSG_CMD_NEWSMS_STATUS_IND:ipc_send_message(MODULE_ID_SMS,MODULE_ID_SMS_LOCAL,
+ptMsgBuf->usMsgCmd,ptMsgBuf->usDataLen,(unsigned char*)ptMsgBuf->aucDataBuf,
+(0x25a+7929-0x2153));break;default:break;}}VOID zSms_HandleResetToFactory(){CHAR
+ clearSms[(0x1871+2544-0x222f)]={(0x759+1666-0xddb)};sc_cfg_get(
+NV_CLEAR_SMS_WHEN_RESTORE,clearSms,sizeof(clearSms));printf(
+"\x61\x74\x57\x65\x62\x5f\x52\x65\x73\x74\x6f\x72\x65\x46\x61\x63\x74\x6f\x72\x79\x53\x65\x74\x74\x69\x6e\x67\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
+);printf(
+"\x63\x6c\x65\x61\x72\x5f\x73\x6d\x73\x5f\x77\x68\x65\x6e\x5f\x72\x65\x73\x74\x6f\x72\x65\x3d\x25\x73\x20" "\n"
+,clearSms);if(strcmp(clearSms,"\x79\x65\x73")==(0x327+5545-0x18d0)){printf(
+"\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x72\x6f\x70\x41\x6c\x6c\x54\x61\x62\x6c\x65\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
+);zUfiSms_DropAllTable();}else{printf(
+"\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x72\x6f\x70\x41\x6c\x6c\x54\x61\x62\x6c\x65\x45\x78\x63\x65\x70\x74\x53\x6d\x73\x20\x65\x6e\x74\x65\x72\x65\x64\x21\x20" "\n"
+);zUfiSms_DropAllTableExceptSms();}ipc_send_message(MODULE_ID_SMS,
+MODULE_ID_MAIN_CTRL,MSG_CMD_RESET_RSP,(0x1461+3029-0x2036),NULL,
+(0x163+6829-0x1c10));}void zSms_HandleMainCtrlMsg(MSG_BUF*ptMsgBuf){assert(
+ptMsgBuf!=NULL);printf(
+"\x73\x6d\x73\x20\x72\x65\x63\x76\x20\x6d\x61\x69\x6e\x20\x63\x74\x72\x6c\x20\x6d\x73\x67\x20\x63\x6d\x64\x3a\x25\x64" "\n"
+,ptMsgBuf->usMsgCmd);switch(ptMsgBuf->usMsgCmd){case MSG_CMD_RESET_NOTIFY:
+zSms_HandleResetToFactory(ptMsgBuf->aucDataBuf);break;default:break;}}void
+sms_msg_thread_proc(void*arg){int iRet=(0xb60+1700-0x1204);MSG_BUF stMsg={
+(0x3d4+8753-0x2605)};int msgSize=sizeof(MSG_BUF)-sizeof(long);int queueId=*((int
+*)arg);prctl(PR_SET_NAME,"\x73\x6d\x73\x5f\x6c\x6f\x63\x61\x6c",
+(0x12c9+582-0x150f),(0x91b+1988-0x10df),(0xf74+4524-0x2120));while(
+(0xb22+3411-0x1874)){iRet=(0x59b+2292-0xe8f);memset(&stMsg,(0x529+2870-0x105f),
+sizeof(MSG_BUF));iRet=msgrcv(queueId,&stMsg,msgSize,(0xe87+2449-0x1818),
+(0x19f0+3295-0x26cf));if(iRet>=(0x22a1+326-0x23e7)){switch(stMsg.src_id){case
+MODULE_ID_WEB_CGI:{zSms_HandleWebMsg(&stMsg);break;}case MODULE_ID_AT_CTL:{
+zSms_HandleAtctlMsg(&stMsg);break;}case MODULE_ID_SMS:{zSms_HandleWebMsg(&stMsg)
+;zSms_HandleAtctlLocalMsg(&stMsg);break;}case MODULE_ID_MAIN_CTRL:{
+zSms_HandleMainCtrlMsg(&stMsg);break;}default:{break;}}}else{at_print(AT_DEBUG,
+"\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x2c\x20\x65\x72\x72\x6d\x73\x67\x20\x3d\x20\x25\x73" "\n"
+,errno,strerror(errno));}}}int sms_main(int argc,char*argv[]){pthread_t
+recv_thread_tid=(0x546+178-0x5f8);MSG_BUF msgBuf={(0x85a+5342-0x1d38)};CHAR
+needSMS[(0x16ea+2122-0x1f02)]={(0xea3+1178-0x133d)};prctl(PR_SET_NAME,
+"\x73\x6d\x73\x5f\x6d\x61\x69\x6e",(0x14fd+359-0x1664),(0xcb6+5473-0x2217),
+(0x322+7676-0x211e));loglevel_init();sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,
+sizeof(needSMS));if((0x453+7708-0x226f)!=strcmp(needSMS,"\x6e\x6f")){
+zUfiSms_InitDb();zUfiSms_CfgSmsNvInit();zUfiMmi_SendSmsStatus();zSms_SmsMsgCreat
+();}else{return-(0x189f+1040-0x1cae);}printf(
+"\x73\x6d\x73\x20\x61\x70\x70\x20\x69\x6e\x69\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64\x2c\x20\x77\x69\x6c\x6c\x20\x74\x6f\x20\x72\x65\x63\x65\x69\x76\x65\x20\x6d\x73\x67\x2c\x20\x6d\x73\x67\x69\x64\x3a\x25\x64" "\n"
+,g_zSms_MsqId);if(pthread_create(&recv_thread_tid,NULL,sms_msg_thread_proc,(void
+*)(&g_zSms_LocalMsqId))==-(0x4f5+7384-0x21cc)){assert((0x270+7721-0x2099));}
+sms_msg_thread_proc(&g_zSms_MsqId);return(0x8bc+7114-0x2486);}