[Feature][task-view-998]merge P56U10 version, ZXW code

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: No
Doc Update: No

Change-Id: I466f2ab935c5ede0be1803c75518b2cc4f939c15
diff --git a/ap/app/zte_comm/sms/src/sms_proc.c b/ap/app/zte_comm/sms/src/sms_proc.c
index fe2cb6f..10e326d 100755
--- a/ap/app/zte_comm/sms/src/sms_proc.c
+++ b/ap/app/zte_comm/sms/src/sms_proc.c
@@ -1,662 +1,1748 @@
-
+/**************************************************************************

+*

+*                  Copyright (c) 2012 ZTE Corporation.

+*

+***************************************************************************

+* Ä£ ¿é Ãû : AT_SERVER

+* ÎÄ ¼þ Ãû : sms_proc.c

+* Ïà¹ØÎļþ : 

+* ʵÏÖ¹¦ÄÜ : AtServerÄ£¿ésmsÁ÷³Ì¿ØÖÆÎļþ

+* ×÷    Õß : G.F

+* °æ    ±¾ : V1.0

+* Íê³ÉÈÕÆÚ : 2013-09-29 

+* ÆäËü˵Ã÷ : 

+**************************************************************************/

+

+/**************************************************************************

+* Ð޸ļǼ1:

+***************************************************************************/

+/**************************************************************************

+* Ð޸ıàºÅ : EC:617002775301, EC617002775301

+* ÐÞ ¸Ä ÈË :    chenjie10092374

+* ÐÞ¸ÄÈÕÆÚ : 2014.5.30

+* ÐÞ¸ÄÄÚÈÝ : (´úÂë×ß²é)ÐÞ¸ÄÏà¹ØSMS½ÓÊÕ¶ÌÐÅÁ÷³Ì´¦Àí

+**************************************************************************/

+/**************************************************************************

+* Ð޸ıàºÅ : й¦ÄÜ

+* ÐÞ ¸Ä ÈË : chenjie10092374

+* ÐÞ¸ÄÈÕÆÚ : 2014.6.24

+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÖ§³Öufi monitor¹¦ÄÜ´¦Àí´úÂë

+**************************************************************************/

+/**************************************************************************

+* Ð޸ıàºÅ : й¦ÄÜ

+* ÐÞ ¸Ä ÈË : chenjie10092374

+* ÐÞ¸ÄÈÕÆÚ : 2014.08.07

+* ÐÞ¸ÄÄÚÈÝ : Ìí¼ÓÏòMMI·¢ËͶÌÐÅ״̬µÄ´úÂë

+**************************************************************************/

+/**************************************************************************

+* #includeÇø

+**************************************************************************/

 #include <limits.h>

 #include "sms_code.h"

 #include <sys/msg.h>

-T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;T_zUfiSms_GroupInfo g_zUfiSms_GroupSms;
-T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];UINT8 
-g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_MAX]={FALSE,FALSE};T_zUfiSms_DelSms 
-g_zUfiSms_DelMsg;T_zUfiSms_DelIndexInfo g_deleteIndex={(0x11ab+5072-0x257b)};
-T_zUfiSms_ModifySms g_zUfiSms_modifyMsg={(0x13a1+2914-0x1f03)};
-T_zUfiSms_ModifyIndexInfo g_modifyIndex={(0xb83+6302-0x2421)};int 
-g_zUfiSms_UnitLen=(0x1755+2050-0x1f57);int g_zUfiSms_ConcatTotalNum=
-(0x114+3667-0xf67);int g_zUfiSms_CurConcatSegNo=(0x1494+4280-0x254c);UINT8 
-g_zUfiSms_IsConcatSendSuc=TRUE;int g_zUfiSms_SendFailedCount=(0xdb0+4655-0x1fdf)
-;int g_zUfiSms_MsgRefer=(0xbe1+1037-0xfee);int g_zUfiSms_SendFailedRetry=
-(0x2dc+5290-0x1786);char g_Zmena_value[(0xf5a+1876-0x16ac)]={(0xc87+4385-0x1da8)
-};int g_displaymode=(0xf63+981-0x1338);extern SMS_LOCATION g_zUfiSms_CurLocation
-;extern T_zUfiSms_CmdStatus zUfiSms_HandleReport(unsigned char*ptPduData);extern
- void zUfiSms_GetReportStatus(char*pdu_tmp,int*stat);extern VOID 
-zUfiSms_ResendAtCmdZmena(int cid);extern int zUfiSms_DecodeSmsData(
-T_zUfiSms_DbStoreData*pDb_Data,int msg_index,zUfiSms_StoreType iStorePos,
-T_SmsStatus bSms_Status,wms_message_format_enum_v01 format,long iPdu_Len,
-unsigned char*pPdu_Received);typedef struct{long mtype;char mtext[
-(0xc44+918-0xfce)];}FOTA_MSG_BUF;
-#define WEBUI_NOTIFY_PUSH_MSG_  (0x3e4+5049-0x179a)

-typedef struct{unsigned int isread_record;unsigned int inbox_full;}
-T_zUfiMmi_SmsRecord;void zUfiMmi_SendSmsStatus(void){int iSmsNum=
-(0x43d+5275-0x18d8);T_zUfiMmi_SmsRecord tRecord={(0x1e7+8202-0x21f1)};CHAR 
-smsNum[(0xe6+3806-0xf92)]={(0x1de5+2272-0x26c5)};sc_cfg_get(NV_SMS_IN_NUM,smsNum
-,sizeof(smsNum));iSmsNum=atoi(smsNum);tRecord.isread_record=zUfiSms_IsUnreadSms(
-ZTE_WMS_MEMORY_MAX);if(iSmsNum>=ZSMS_NUM_MAX_CPE){tRecord.inbox_full=
-(0x101b+2079-0x1839);}else{tRecord.inbox_full=(0xb43+1124-0xfa7);}}VOID 
-zUfiSms_Init(VOID){zUfiSms_CfgInit();zUfiSms_ChangeMainState(SMS_STATE_INITING);
-}VOID zSvr_Zpbic_Sms_Init(VOID){int atRes=(0x1425+3977-0x23ae);
-T_zUfiSms_StatusInfo tStatus={(0xb58+2689-0x15d9)};CHAR outDate[
-(0xe37+6067-0x25b8)]={(0x638+2049-0xe39)};zUfiSms_Init();zUfiSms_InitCmdStatus(&
-tStatus,WMS_SMS_CMD_INIT);zSms_SendSmsInitReq();at_print(LOG_DEBUG,
-"corem zSvr_Zpbic_Sms_Init has send init req\n");zSms_SendZmenaReq(
-(0x8fc+7037-0x2479));at_print(LOG_DEBUG,
-"\x63\x6f\x72\x65\x6d\x20\x7a\x53\x76\x72\x5f\x5a\x70\x62\x69\x63\x5f\x53\x6d\x73\x5f\x49\x6e\x69\x74\x20\x68\x61\x73\x20\x73\x65\x6e\x64\x20\x7a\x6d\x65\x6e\x61\x20\x72\x65\x71" "\n"
-);sc_cfg_get(NV_OUTDATE_DELETE,outDate,sizeof(outDate));at_print(LOG_DEBUG,
-"\x63\x6f\x72\x65\x6d\x20\x7a\x53\x76\x72\x5f\x5a\x70\x62\x69\x63\x5f\x53\x6d\x73\x5f\x49\x6e\x69\x74\x20\x6f\x75\x74\x64\x61\x74\x65\x20\x63\x68\x65\x63\x6b\x20\x25\x73" "\n"
-,outDate);if((0x488+714-0x752)==strcmp(outDate,"\x31")){atWeb_OutdateSmsCheck(
-ZUFI_NULL);}}VOID zUfiSms_DeleteAllSimSms(VOID){zUfiSms_DeleteAllSimSmsInDb();}
-#if (0xd69+3281-0x1a3a)

-VOID zUfiSms_ResendAtCmdZmena(int cid){CHAR netType[(0x14b4+2675-0x1ef5)]={
-(0x7b2+2096-0xfe2)};sc_cfg_get(NV_NETWORK_TYPE,netType,sizeof(netType));if(!
-g_Zmena_rsp&&((0x1515+3-0x1518)!=strcmp(
-"\x4e\x6f\x20\x53\x65\x72\x76\x69\x63\x65",netType)&&(0x1019+5417-0x2542)!=
-strcmp("\x4c\x69\x6d\x69\x74\x65\x64\x20\x53\x65\x72\x76\x69\x63\x65",netType)))
-{atUnsoli_Report_Zmena(NULL,cid);}}
+

+/**************************************************************************

+* ³£Á¿¶¨ÒåÇø

+**************************************************************************/

+

+/* **********È«¾Ö³£Á¿ **************/

+

+// ³¤¶ÌÐŵļ¶ÁªÐÅÏ¢

+T_zUfiSms_ConcatInfo g_zUfiSms_ConcatSms;

+

+// Ⱥ·¢ÐÅÏ¢

+T_zUfiSms_GroupInfo g_zUfiSms_GroupSms; 

+

+//Êý¾Ý¿âÖд洢µÄÐÅÏ¢£¬ÓÃÓÚ´æ´¢ÒÑ·¢ÐÅÏ¢

+T_zUfiSms_DbStoreData g_zUfiSms_DbStoreData[ZTE_WMS_CONCAT_SMS_COUNT_MAX];

+

+/* ¿¨ÖÐÊÇ·ñ´æ´¢ÒÑÂú, 0--¿¨, 1--nv */

+UINT8 g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_MAX] = {FALSE,FALSE};

+

+// ¶ÌÐÅɾ³ýÐÅÏ¢

+T_zUfiSms_DelSms g_zUfiSms_DelMsg;

+T_zUfiSms_DelIndexInfo g_deleteIndex={0};

+

+//¶ÌÐÅδ¶Á±êÖ¾ÐÞ¸Ä

+T_zUfiSms_ModifySms g_zUfiSms_modifyMsg={0};

+T_zUfiSms_ModifyIndexInfo g_modifyIndex={0};

+

+// ³¤¶ÌÐŵĵ¥Î»·¢Ëͳ¤¶È

+int g_zUfiSms_UnitLen = 0;

+

+// ³¤¶ÌÐŵÄ×Ü·Ö¶ÎÊý,ÓÃÓÚÅж϶ÌÐÅ·Ö¶ÎÊÇ·ñ·¢ËÍÍê±Ï

+int g_zUfiSms_ConcatTotalNum = 0;

+

+//µ±Ç°·¢Ë͵ij¤¶ÌÐÅÆ¬¶ÎºÅ£¬ÓÃÓڼǼÿ¶ÎµÄ·¢Ëͽá¹ûºÍÅжÏÊÇ·ñ·¢ËͽáÊø

+int g_zUfiSms_CurConcatSegNo = 0;

+

+//³¤¶ÌÐÅÊÇ·ñ·¢Ëͳɹ¦£¬Ä¬ÈÏ·¢Ëͳɹ¦

+UINT8 g_zUfiSms_IsConcatSendSuc = TRUE;

+

+// ¶ÌÐÅ·¢ËÍʧ°ÜµÄÌõÊý£¬ÓÃÓÚ³¤¶ÌÐŵķ¢ËͼÆÊý

+int g_zUfiSms_SendFailedCount = 0;

+

+//¶ÌÐŲÎÕÕÊý¾Ý£¬¸ø×é×°¼¶Áª¶ÌÐŵĶÌÐÅͷʱÓÃ

+int g_zUfiSms_MsgRefer = 0;

+

+// ¶ÌÐÅ·¢ËÍʧ°ÜºóÖØÊÔ´ÎÊý

+int g_zUfiSms_SendFailedRetry = 0;

+

+//¼Ç¼µ±Ç°×´Ì¬£¬ÓÃÓÚWebserverÏÔʾ 

+//T_zUfiSms_StatusInfo g_zUfiSms_StatusInfo;

+

+char g_Zmena_value[2] = {0};

+//Êý¾Ý¿âÖÐָʾһÌõ¶ÌÐżÇ¼ÊÇ·ñ±»WEBUIÏÔʾ

+//0:ÏÔʾ£»1:²»ÏÔʾ

+int g_displaymode = 0;

+

+

+extern SMS_LOCATION g_zUfiSms_CurLocation;

+extern T_zUfiSms_CmdStatus zUfiSms_HandleReport( unsigned char* ptPduData);

+extern void zUfiSms_GetReportStatus(char  *pdu_tmp,int *stat);

+extern VOID  zUfiSms_ResendAtCmdZmena(int cid);

+extern int zUfiSms_DecodeSmsData

+(

+    T_zUfiSms_DbStoreData *pDb_Data,

+    int msg_index,

+    zUfiSms_StoreType iStorePos,

+    T_SmsStatus bSms_Status,

+    wms_message_format_enum_v01 format,

+    long iPdu_Len,

+    unsigned char *pPdu_Received

+);

+

+typedef struct{

+    long mtype;

+    char mtext[12];

+}FOTA_MSG_BUF;

+

+#define WEBUI_NOTIFY_PUSH_MSG_  3

+

+/* ºê´¦Àí */

+

+/**************************************************************************

+* Êý¾Ý½á¹¹¶¨ÒåÇø

+**************************************************************************/

+typedef struct

+{

+    unsigned int  isread_record;

+	unsigned int inbox_full;

+}T_zUfiMmi_SmsRecord;

+/**************************************************************************

+* staticº¯ÊýÉùÃ÷Çø

+**************************************************************************/

+

+/**************************************************************************

+* È«¾Ö±äÁ¿¶¨ÒåÇø

+**************************************************************************/

+

+

+/**************************************************************************

+* º¯ÊýʵÏÖÇø

+**************************************************************************/

+//ËùÓÐsmsÏà¹ØµÄ¹¦Äܳõʼ»¯

+void zUfiMmi_SendSmsStatus(void)

+{

+    int                 iSmsNum = 0;

+    T_zUfiMmi_SmsRecord tRecord = { 0 };

+    CHAR smsNum[50]={0};

+    sc_cfg_get(NV_SMS_IN_NUM,smsNum,sizeof(smsNum));

+    

+    iSmsNum = atoi(smsNum);

+    // *G.F*

+    tRecord.isread_record = zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_MAX);

+    if(iSmsNum >= ZSMS_NUM_MAX_CPE)

+    {

+        tRecord.inbox_full = 1;

+    }

+    else

+    {

+        tRecord.inbox_full = 0;

+    }

+    //zUfi_SendMsgToAp(MODULE_ID_MMI,MSG_MMICHANNEL_MESSAGE, sizeof(tRecord), (CHAR*)&tRecord);

+}

+

+VOID zUfiSms_Init(VOID)

+{

+    zUfiSms_CfgInit();

+    zUfiSms_ChangeMainState(SMS_STATE_INITING); /* ÉèÖÃ״̬Ϊiniting, ÒÔ¹©Ò³ÃæÆÁ±Î²Ù×÷*/

+    //zUfiSms_InitDb();

+

+    //zUfiMmi_SendSmsStatus();

+}

+

+VOID zSvr_Zpbic_Sms_Init(VOID)

+{

+	int atRes = 0;

+    T_zUfiSms_StatusInfo tStatus = {0};

+    CHAR outDate[50]={0};

+    

+    zUfiSms_Init();

+    zUfiSms_InitCmdStatus(&tStatus,WMS_SMS_CMD_INIT);

+	

+    //zSvr_Sms_At_Init(cid);

+    zSms_SendSmsInitReq();

+    at_print(LOG_DEBUG,"corem zSvr_Zpbic_Sms_Init has send init req\n");

+    //atUnsoli_Report_Zmena("0", cid);

+	zSms_SendZmenaReq(0);

+	at_print(LOG_DEBUG,"corem zSvr_Zpbic_Sms_Init has send zmena req\n");

+    sc_cfg_get(NV_OUTDATE_DELETE,outDate,sizeof(outDate));

+	at_print(LOG_DEBUG,"corem zSvr_Zpbic_Sms_Init outdate check %s\n", outDate);

+    if(0 == strcmp(outDate, "1"))

+    {

+        atWeb_OutdateSmsCheck(ZUFI_NULL);

+    }

+}

+

+

+VOID zUfiSms_DeleteAllSimSms(VOID)

+{

+	zUfiSms_DeleteAllSimSmsInDb();

+}

+

+#if 0

+VOID  zUfiSms_ResendAtCmdZmena(int cid)

+{

+    CHAR netType[50]={0};

+    sc_cfg_get(NV_NETWORK_TYPE,netType,sizeof(netType));

+    

+    if(!g_Zmena_rsp && 

+        (0!=strcmp("No Service",netType)&&0!=strcmp("Limited Service",netType)))

+    {

+        atUnsoli_Report_Zmena(NULL,cid);

+    }

+}

 #endif

-void zUfiSms_Ack_new_msg(BOOL needAck){
-#if (0x13f7+3455-0x2176)

-CHAR ackPduStr[(0x15e0+691-0x1703)]={(0x1c4+8832-0x2444)};SMS_PARAM reportParam=
-{(0x1aac+1494-0x2082)};int total_length=(0x6dc+147-0x76f);UINT8 TP_FCS=
-(0x2f5+8132-0x22b9);CHAR strValue[(0x10af+3716-0x1f31)]={(0x12a5+782-0x15b3)};if
-(needAck){TP_FCS=(0x1021+3013-0x1be6);sprintf(strValue,"\x25\x64",
-(0xdda+1677-0x1466));}else{TP_FCS=(0x1a8+8976-0x23e5);sprintf(strValue,
-"\x25\x64",(0x1c31+584-0x1e77));}sprintf(reportParam.SCA,"\x25\x73",cfg_get(
-"\x73\x6d\x73\x5f\x63\x65\x6e\x74\x65\x72\x5f\x6e\x75\x6d"));total_length=
-zUfiSms_EncodePdu_DeliverReport(&reportParam,ackPduStr,TP_FCS);memset(&
-g_zUfiSms_ackPdu,(0xdaf+5972-0x2503),sizeof(g_zUfiSms_ackPdu));g_zUfiSms_ackPdu.
-length=String2Bytes(ackPduStr,g_zUfiSms_ackPdu.pdu,strlen(ackPduStr));memset(
-g_zUfiSms_ackPdu.pdu,(0x90d+2911-0x146c),sizeof(g_zUfiSms_ackPdu.pdu));memcpy(&
-g_zUfiSms_ackPdu.pdu,&ackPduStr,sizeof(ackPduStr));atBase_SendMsgToSelf(
-ZAT_CNMA_CMD,strValue,sizeof(strValue));
+

+void zUfiSms_Ack_new_msg(BOOL needAck)

+{

+#if 0

+    CHAR ackPduStr[400] = {0};

+    SMS_PARAM reportParam = {0};

+    int total_length = 0;

+    UINT8 TP_FCS = 0;

+    CHAR strValue[2] = {0};

+    

+    if(needAck)

+    {

+        TP_FCS = 0x00;

+        sprintf(strValue, "%d", 1);	 

+    }

+    else

+    {

+        TP_FCS = 0xD3;

+        sprintf(strValue, "%d", 2);	 

+    }

+    

+    sprintf(reportParam.SCA, "%s", cfg_get("sms_center_num"));	 

+    total_length = zUfiSms_EncodePdu_DeliverReport(&reportParam, ackPduStr, TP_FCS);

+    

+    memset(&g_zUfiSms_ackPdu, 0, sizeof(g_zUfiSms_ackPdu));

+    g_zUfiSms_ackPdu.length = String2Bytes(ackPduStr, g_zUfiSms_ackPdu.pdu, strlen(ackPduStr));

+    

+    memset(g_zUfiSms_ackPdu.pdu, 0, sizeof(g_zUfiSms_ackPdu.pdu));

+    memcpy(&g_zUfiSms_ackPdu.pdu, &ackPduStr, sizeof(ackPduStr));

+    

+    atBase_SendMsgToSelf(ZAT_CNMA_CMD, strValue, sizeof(strValue)); 

 #endif

-#if (0x72a+5465-0x1c83)
-CHAR strValue[(0xe55+4258-0x1ef5)]={(0x1132+167-0x11d9)};if(needAck){snprintf(
-strValue,sizeof(strValue),"\x25\x64",(0x1276+2761-0x1d3e));}else{snprintf(
-strValue,sizeof(strValue),"\x25\x64",(0x15c8+1400-0x1b3e));}zSvr_InnerSendMsg(
-ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_CNMA,strlen(strValue
-),strValue);
+#if 0//zhangfen for platform

+    CHAR strValue[2] = {0};

+    

+    if(needAck)

+    {

+        snprintf(strValue, sizeof(strValue),"%d", 1);	 

+    }

+    else

+    {

+        snprintf(strValue, sizeof(strValue),"%d", 2);	 

+    }

+    zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_CNMA,strlen(strValue),strValue);

 #endif

-if(needAck){zSms_SendCnmaReq((0x1136+5367-0x262c));}else{zSms_SendCnmaReq(
-(0xd58+317-0xe93));}}T_zUfiSms_CmdStatus zUfiSms_SendRawSms(T_zUfiSms_SendReq*
-ptSendMsg){if(NULL==ptSendMsg||(0x57a+6022-0x1d00)==ptSendMsg->receiver_count){
-return WMS_CMD_FAILED;}at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x52\x61\x77\x53\x6d\x73\x20\x72\x65\x63\x65\x69\x76\x65\x72\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x64\x65\x73\x74\x5f\x6e\x75\x6d\x3a\x25\x73\x2f\x6d\x73\x67\x5f\x6c\x65\x6e\x3a\x25\x64\x2f\x69\x64\x3a\x25\x64\x2e" "\n"
-,ptSendMsg->receiver_count,ptSendMsg->dest_num[(0xe43+5767-0x24ca)],ptSendMsg->
-msg_len,ptSendMsg->id);
-#if (0xe94+287-0xfb2)
-at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x52\x61\x77\x53\x6d\x73\x20\x64\x63\x73\x3a\x25\x64" "\n"
-,ptSendMsg->dcs);
-#endif

-sc_cfg_set(NV_SMS_SEND_RESULT,"");g_zUfiSms_SendFailedCount=(0x6ad+3566-0x149b);
-if(ptSendMsg->isDelete==TRUE||-(0x1379+2062-0x1b86)!=ptSendMsg->id){(void)
-zUfiSms_DeleteDraftSms(ptSendMsg->id);}zUfiSms_SetGlobalDcsLang(ptSendMsg->dcs);
-memset(&g_zUfiSms_GroupSms,(0xa63+4849-0x1d54),sizeof(g_zUfiSms_GroupSms));if(
-ZUFI_FAIL==zUfiSms_FillGroupSms(ptSendMsg,&g_zUfiSms_GroupSms)){return 
-WMS_CMD_FAILED;}memset(&g_zUfiSms_ConcatSms,(0x50+3418-0xdaa),sizeof(
-g_zUfiSms_ConcatSms));g_zUfiSms_UnitLen=zUfiSms_FillConcatSms(ptSendMsg,&
-g_zUfiSms_ConcatSms);g_zUfiSms_IsConcatSendSuc=TRUE;g_zUfiSms_CurConcatSegNo=
-(0x11ec+683-0x1497);memset(g_zUfiSms_DbStoreData,(0xff+6232-0x1957),sizeof(
-g_zUfiSms_DbStoreData));if(ptSendMsg->mem_store==(0x4fb+2182-0xd77)){
-g_displaymode=(0x852+6110-0x202f);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x3a\x20\x6d\x73\x67\x5f\x64\x69\x73\x70\x6c\x61\x79\x6d\x6f\x64\x65\x20\x3d\x20\x31" "\n"
-);}else{g_displaymode=(0x40d+1942-0xba3);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x6e\x64\x53\x6d\x73\x3a\x20\x6d\x73\x67\x5f\x64\x69\x73\x70\x6c\x61\x79\x6d\x6f\x64\x65\x20\x3d\x20\x30" "\n"
-);}return zUfiSms_SendSms();}T_zUfiSms_CmdStatus zUfiSms_WriteRawSms(
-T_zUfiSms_SaveReq*pSaveBuff){T_zUfiSms_ConcatInfo tConcatSms;T_zUfiSms_GroupInfo
- tGroupSms;int iSmsLen=(0x742+2786-0x1224);T_zUfiSms_CmdStatus result=
-WMS_CMD_SUCCESS;if(NULL==pSaveBuff){return WMS_CMD_FAILED;}if(
-g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV]){at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x6e\x76\x20\x6d\x65\x6d\x6f\x72\x79\x20\x69\x73\x20\x66\x75\x6c\x6c\x2c\x72\x65\x74\x75\x72\x6e" "\n"
-);return WMS_CMD_FAILED;}if(pSaveBuff->isDelete==TRUE){(void)
-zUfiSms_DeleteDraftSms(pSaveBuff->id);}zUfiSms_SetGlobalDcsLang(pSaveBuff->dcs);
-memset(&tConcatSms,(0x1c6+351-0x325),sizeof(T_zUfiSms_ConcatInfo));memset(&
-tGroupSms,(0x764+922-0xafe),sizeof(T_zUfiSms_GroupInfo));(void)
-zUfiSms_FillGroupSms(pSaveBuff,&tGroupSms);iSmsLen=zUfiSms_FillConcatSms(
-pSaveBuff,&tConcatSms);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x74\x6f\x74\x61\x6c\x5f\x72\x65\x63\x65\x69\x76\x65\x72\x3d\x25\x64\x2c\x69\x53\x6d\x73\x4c\x65\x6e\x3d\x25\x64" "\n"
-,tGroupSms.total_receiver,iSmsLen);for(tGroupSms.current_receiver=
-(0x1960+1255-0x1e47);tGroupSms.current_receiver<tGroupSms.total_receiver;
-tGroupSms.current_receiver++){tConcatSms.current_sending=(0xd41+1574-0x1367);
-result=zUfiSms_SaveSmsToDb(pSaveBuff,&tConcatSms,&tGroupSms,iSmsLen);at_print(
-LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x63\x75\x72\x72\x65\x6e\x74\x5f\x72\x65\x63\x65\x69\x76\x65\x72\x3d\x25\x64\x2c\x72\x65\x73\x75\x6c\x74\x3d\x25\x64" "\n"
-,tGroupSms.current_receiver,result);}sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");
-zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);if(g_zUfiSms_MemFullFlag[
-WMS_STORAGE_TYPE_NV_V01]){zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);}at_print(
-LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x57\x72\x69\x74\x65\x52\x61\x77\x53\x6d\x73\x20\x65\x6e\x64\x20\x61\x6e\x64\x20\x72\x65\x73\x75\x6c\x74\x3d\x25\x64" "\n"
-,result);return result;}T_zUfiSms_CmdStatus zUfiSms_DeleteSms(T_zUfiSms_DelReq*
-ptDelBuff){T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;BOOL 
-memoryFullbeforeDelete=FALSE;BOOL unreadBeforeDelete=FALSE;if(NULL==ptDelBuff){
-return WMS_CMD_FAILED;}at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x21\x21\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x69\x64\x5b\x25\x64\x5d\x2e" "\n"
-,ptDelBuff->all_or_count,ptDelBuff->id[(0x114b+3604-0x1f5f)]);(void)
-zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(
-SMS_STATE_DELING);memset(&g_zUfiSms_DelMsg,(0x1c66+202-0x1d30),sizeof(
-T_zUfiSms_DelSms));if(ZUFI_FAIL==zUfiSms_SetDeleteInfo(ptDelBuff)){at_print(
-LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x74\x44\x65\x6c\x65\x74\x65\x49\x6e\x66\x6f\x20\x66\x61\x69\x6c\x2e" "\n"
-);zUfiSms_ChangeMainState(SMS_STATE_DELED);return WMS_CMD_FAILED;}at_print(
-LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x21\x21\x21\x7a\x55\x66\x69\x53\x6d\x73\x5f\x53\x65\x74\x44\x65\x6c\x65\x74\x65\x49\x6e\x66\x6f\x20\x52\x65\x61\x64\x20\x74\x6f\x20\x44\x65\x6c\x65\x74\x65\x3a\x6e\x76\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2f\x73\x69\x6d\x5f\x63\x6f\x75\x6e\x74\x3a\x25\x64\x2e" "\n"
-,g_zUfiSms_DelMsg.nv_count,g_zUfiSms_DelMsg.sim_count);if((0x980+2743-0x1437)<
-g_zUfiSms_DelMsg.nv_count){if(g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]){
-memoryFullbeforeDelete=TRUE;}unreadBeforeDelete=zUfiSms_IsUnreadSms(
-ZTE_WMS_MEMORY_NV);result=(T_zUfiSms_CmdStatus)zUfiSms_DeleteNvSms();(void)
-zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(
-SMS_STATE_DELED);sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x20\x6d\x65\x6d\x6f\x72\x79\x46\x75\x6c\x6c\x62\x65\x66\x6f\x72\x65\x44\x65\x6c\x65\x74\x65\x3d\x25\x64\x2c\x4d\x65\x6d\x46\x75\x6c\x6c\x46\x6c\x61\x67\x28\x4e\x56\x29\x3d\x25\x64" "\n"
-,memoryFullbeforeDelete,g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]);if(
-memoryFullbeforeDelete&&!g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]){
-at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x4e\x76\x53\x6d\x73\x3a\x20\x73\x65\x6e\x64\x20\x41\x54\x2b\x5a\x4d\x45\x4e\x41\x3d\x30" "\n"
-);zSms_SendZmenaReq((0xd95+2081-0x15b6));}if(memoryFullbeforeDelete&&!
-g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]||unreadBeforeDelete&&!
-zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){zUfiSms_SendSmsStatusInfo(
-MSG_SMS_DEFAULT);}}if((0x391+5270-0x1827)<g_zUfiSms_DelMsg.sim_count){result=
-zUfiSms_DeleteSimSms();(void)zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_SIM);}
-at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x44\x65\x6c\x65\x74\x65\x53\x6d\x73\x20\x72\x65\x73\x75\x6c\x74\x3d\x25\x64" "\n"
-,result);return result;}T_zUfiSms_CmdStatus zUfiSms_ModifySmsTag(
-T_zUfiSms_ModifyFlag*ptModifyBuff){unsigned long i=(0x67d+78-0x6cb);
-T_zUfiSms_CmdStatus result=WMS_CMD_SUCCESS;char acStorePos[(0xa4b+2857-0x1542)]=
-{(0x6ca+3788-0x1596)};if(NULL==ptModifyBuff){at_print(LOG_ERR,
-"\x69\x6e\x70\x75\x74\x73\x20\x69\x73\x20\x6e\x75\x6c\x6c\x2e");return 
-WMS_CMD_FAILED;}for(i=(0x2db+3157-0xf30);i<ptModifyBuff->total_id;i++){if(
-ptModifyBuff->id[i]<(0xcfa+5204-0x214d)||ZUFI_FAIL==zUfiSms_UpdateSmsTagInDb(
-ptModifyBuff->id[i],ptModifyBuff->tags)){result=WMS_CMD_FAILED;}else{result=
-WMS_CMD_SUCCESS;}}if(ZUFI_FAIL==zUfiSms_GetStorePosById(
-"\x4d\x65\x6d\x5f\x53\x74\x6f\x72\x65",acStorePos,sizeof(acStorePos),
-ptModifyBuff->id[(0x1b6+2999-0xd6d)])){return ZUFI_FAIL;}if((0x18ec+1375-0x1e4b)
-==strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)){zUfiSms_SendSmsStatusInfo(
-MSG_SMS_READING);}if((0xae9+3027-0x16bc)==strcmp(acStorePos,ZTE_WMS_DB_SIM_TABLE
-)&&ptModifyBuff->total_id>(0x594+4811-0x185f)){zUfiSms_ModifyModemSms(
-ptModifyBuff);}return result;}T_zUfiSms_CmdStatus zUfiSms_SetSmsPara(
-T_zUfiSms_ParaInfo*ptParaBuff){int atRes=(0xe21+2138-0x167b);CHAR sca[
-ZTE_WMS_ADDRESS_DIGIT_MAX_V01+(0x1283+3113-0x1eab)]={(0x93d+4710-0x1ba3)};CHAR 
-store[(0x9f2+2095-0x120d)]={(0x14a+1509-0x72f)};CHAR defaultStore[
-(0x217+4442-0x133f)]={(0xbb+7806-0x1f39)};if(ptParaBuff==ZUFI_NULL){return 
-WMS_CMD_FAILED;}if(strlen(ptParaBuff->sca)!=(0x1260+2650-0x1cba)){strncpy(sca,
-ptParaBuff->sca,sizeof(sca)-(0x6bc+1352-0xc03));at_print(LOG_DEBUG,
-"\x73\x65\x6e\x64\x20\x5a\x41\x54\x5f\x43\x53\x43\x41\x5f\x53\x45\x54\x5f\x43\x4d\x44\x20\x6d\x65\x73\x73\x61\x67\x65\x20\x63\x73\x63\x61\x20\x69\x73\x20\x25\x73\x2e" "\n"
-,sca);atRes=zSms_SetCscaReq(ptParaBuff->sca);if(atRes!=ZSMS_RESULT_OK){return 
-WMS_CMD_FAILED;}}sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));
-if((*(ptParaBuff->default_store)!='\0')&&((0x3c+2694-0xac2)!=strcmp(defaultStore
-,ptParaBuff->default_store))){{strncpy(store,ptParaBuff->default_store,sizeof(
-store)-(0x884+5123-0x1c86));}atRes=zSms_SendCnmiReq(store);if(atRes!=
-ZSMS_RESULT_OK){return WMS_CMD_FAILED;}}if(-(0x846+6859-0x2310)==
-zUfiSms_SetDbParameters(ptParaBuff)){at_print(LOG_ERR,
-"\x73\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73\x20\x74\x6f\x20\x74\x61\x62\x6c\x65\x20\x66\x61\x69\x6c\x65\x64\x2e"
-);return WMS_CMD_FAILED;}return WMS_CMD_SUCCESS;}void zUfiSms_CmgrNvSet(void){
-char sms_rec_flag[(0x16d+1853-0x8a5)]={(0x897+3326-0x1595)};char remind_flag[
-(0xbe3+1705-0x1287)];int sms_count=(0x88b+3327-0x158a);int remind_count=
-(0xa91+674-0xd33);memset(sms_rec_flag,(0x1171+425-0x131a),sizeof(sms_rec_flag));
-sc_cfg_get(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag,sizeof(sms_rec_flag));
-sms_count=atoi(sms_rec_flag);if(sms_count<(0x3d7+5576-0x199f)||sms_count>INT_MAX
--(0xe8a+1188-0x132d)){at_print(LOG_ERR,
-"\x5b\x53\x4d\x53\x5d\x73\x6d\x73\x5f\x63\x6f\x75\x6e\x74\x20\x65\x72\x72\x3a\x25\x64" "\n"
-,sms_count);return;}memset(sms_rec_flag,(0x987+2733-0x1434),sizeof(sms_rec_flag)
-);snprintf(sms_rec_flag,sizeof(sms_rec_flag),"\x25\x64",sms_count+
-(0x93d+5305-0x1df5));sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag);
-sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED_LED,sms_rec_flag);memset(remind_flag,
-(0x1003+3708-0x1e7f),sizeof(remind_flag));snprintf(remind_flag,sizeof(
-remind_flag),"\x25\x64",remind_count+(0x38+9457-0x2528));sc_cfg_set(
-ZTE_WMS_NVCONFIG_RECEVIED_REMIND,remind_flag);sc_cfg_set(NV_SMS_RECV_RESULT,
-"\x6f\x6b");sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");}void zUfiSms_CdsRespProc(
-T_zSms_SmsInd*ptRespData){unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x9ea+4102-0x19f0)};T_zUfiSms_DbStoreData tDbStoreData={(0xe76+2412-0x17e2)};
-int isPushSms=(0x381+247-0x478);if(strcmp(ptRespData->pdu,"")==
-(0x1052+195-0x1115)){CHAR srState[(0xac9+1469-0x1054)]={(0x1c56+180-0x1d0a)};
-sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if((0x82f+5473-0x1d90)!=strcmp(
-srState,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
-;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
-return;}zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)
-String2Bytes(ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if(
-(0xce3+2467-0x1681)==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);
-sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");
-zUfiSms_Ack_new_msg(TRUE);return;}return;}int zUfiSms_CheckIfWholeSms(
-T_zUfiSms_DbStoreData*data,SMS_MSG_INFO*pmsg){if(data->concat_sms!=
-(0x617+4819-0x18e9)){return(0x3ac+8367-0x245b);}zUfiSms_GetCurrentRecvTotalSeq(
-data,pmsg);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x68\x65\x63\x6b\x49\x66\x57\x68\x6f\x6c\x65\x53\x6d\x73\x20\x69\x64\x20\x3d\x20\x25\x73\x2c\x20\x74\x6f\x74\x61\x6c\x53\x65\x71\x20\x3d\x20\x25\x64\x2c\x72\x65\x66\x20\x3d\x25\x64\x2c\x74\x6f\x74\x61\x6c\x20\x3d\x25\x64\x2c\x20\x73\x65\x71\x3d\x25\x64" "\n"
-,pmsg->id,atoi(pmsg->total_seq),data->concat_info[(0x147+7478-0x1e7d)],data->
-concat_info[(0xad8+5057-0x1e98)],data->concat_info[(0x7c6+2218-0x106e)]);if(data
-->concat_info[(0x5d5+1524-0xbc8)]==atoi(pmsg->total_seq)){return
-(0x685+4804-0x1949);}return-(0x5b3+8404-0x2686);}void 
-zUfiSms_TrafficChangeSmsTag(T_zUfiSms_DbStoreData*data){CHAR smsNumber[
-(0x672+7618-0x2402)]={(0x15f0+3582-0x23ee)};sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,
-smsNumber,sizeof(smsNumber));if((0xaa4+35-0xac7)==strcmp(smsNumber,data->number)
-){data->tag=WMS_TAG_TYPE_MT_READ_V01;data->msg_displaymode=(0x114f+5388-0x265a);
-}}void zUfiSms_HandleTrafficSms(T_zUfiSms_DbStoreData*data){int iSmsId=
-(0x1257+4896-0x2577);SMS_MSG_INFO msg={(0xa77+520-0xc7f)};CHAR smsNumber[
-(0x55f+4296-0x15f5)]={(0xb36+726-0xe0c)};sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,
-smsNumber,sizeof(smsNumber));at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x74\x44\x62\x53\x74\x6f\x72\x65\x44\x61\x74\x61\x2e\x6e\x75\x6d\x62\x65\x72\x20\x3d\x20\x25\x73\x2c\x20\x74\x72\x61\x66\x66\x69\x63\x5f\x73\x6d\x73\x5f\x6e\x75\x6d\x62\x65\x72\x20\x3d\x20\x25\x73" "\n"
-,data->number,smsNumber);if((0x4e3+3708-0x135f)==strcmp(smsNumber,data->number))
-{if((0xa9a+6219-0x22e5)!=zUfiSms_CheckIfWholeSms(data,&msg)){at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x2c\x20\x72\x65\x63\x76\x20\x73\x6d\x73\x2c\x20\x62\x75\x74\x20\x6e\x6f\x74\x20\x77\x68\x6f\x6c\x65\x20\x73\x6d\x73\x2c\x20\x77\x61\x69\x74\x20\x74\x6f\x20\x72\x65\x63\x76\x20\x6e\x65\x78\x74\x20\x73\x65\x67" "\n"
-);return;}sc_cfg_set(NV_TRAFFIC_RECV_SMS_ID,msg.id);sc_cfg_set(
-NV_TRAFFIC_SMS_NUMBER,"\x30");at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x5b\x74\x72\x61\x66\x66\x69\x63\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x48\x61\x6e\x64\x6c\x65\x54\x72\x61\x66\x66\x69\x63\x53\x6d\x73\x20\x20\x20\x74\x72\x61\x66\x66\x69\x63\x5f\x72\x65\x63\x76\x5f\x73\x6d\x73\x5f\x69\x64\x20\x3d\x20\x25\x73" "\n"
-,msg.id);}}void zUfiSms_CmtRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType 
-iStorePos=WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0xeef+2228-0x17a3)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0x1781+1027-0x1b84);SMS_PARAM one_sms={(0x176b+2186-0x1ff5)};int 
-unread_sms_before_recv_new_sms=(0x8ab+123-0x926);memset(&tDbStoreData,
-(0x1497+3887-0x23c6),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
-,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);if(
-strcmp(ptRespData->pdu,"")==(0x48a+576-0x6ca)){CHAR srState[(0x358+391-0x4ad)]={
-(0xa85+1245-0xf62)};sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if(
-(0x1667+1461-0x1c1c)!=strcmp(srState,
-"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
-;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
-return;}isPushSms=DecodePushPdu(ptRespData->pdu,&one_sms);at_print(LOG_DEBUG,
-"\x5b\x73\x6d\x73\x5d\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x20\x25\x64" "\n"
-,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x2413+502-0x2609));}if(
-SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
-,one_sms.index);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_ReferNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x41\x6c\x6c\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_AllPieceNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x43\x75\x72\x72\x65\x6e\x74\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);
-zUfiSms_Ack_new_msg(TRUE);return;}zUfiSms_GetReportStatus(ptRespData->pdu,&
-ptRespData->stat);(void)String2Bytes(ptRespData->pdu,acFormatPdu,(int)strlen(
-ptRespData->pdu));if((0xfd9+1406-0x1552)==ptRespData->stat){(void)
-zUfiSms_HandleReport(acFormatPdu);sc_cfg_set(NV_SR_STATE,
-"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");zUfiSms_Ack_new_msg(TRUE);return
-;}(void)zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->index,iStorePos,(
-T_SmsStatus)ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length,
-acFormatPdu);if(tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){iStorePos=
-WMS_STORAGE_TYPE_UIM_V01;}if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){
-unread_sms_before_recv_new_sms=(0x131d+1448-0x18c4);}else{
-unread_sms_before_recv_new_sms=(0x39c+2825-0xea5);}zUfiSms_TrafficChangeSmsTag(&
-tDbStoreData);if(ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,
-iStorePos,-(0x1a58+1345-0x1f98))){zUfiSms_Ack_new_msg(FALSE);zSms_SendZmenaReq(
-(0x16f4+787-0x1a06));return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){
-zUfiSms_Ack_new_msg(TRUE);}zUfiSms_CmgrNvSet();zUfiSms_CheckMemoryFull(
-ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(SMS_STATE_RECVED);
-zUfiSms_SendSmsStatusInfo(MSG_SMS_NEW);zUfiSms_HandleTrafficSms(&tDbStoreData);
-return;}void zUfiSms_ZmgrRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType 
-iStorePos=WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x19b6+1348-0x1efa)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0x2f9+4293-0x13be);SMS_PARAM one_sms={(0xb03+5728-0x2163)};CHAR defaultStore[
-(0x1154+5303-0x25d9)]={(0x1c2+572-0x3fe)};memset(&tDbStoreData,
-(0x3bd+4483-0x1540),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
-,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);if(
-strcmp(ptRespData->pdu,"")==(0xa8b+6603-0x2456)){CHAR srState[
-(0x16ac+918-0x1a10)]={(0x607+2098-0xe39)};sc_cfg_get(NV_SR_STATE,srState,sizeof(
-srState));if((0xdb4+4069-0x1d99)!=strcmp(srState,
-"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
-;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
-return;}isPushSms=DecodePushPdu(ptRespData->pdu,&one_sms);at_print(LOG_DEBUG,
-"\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x20\x25\x64" "\n"
-,isPushSms);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x25\x64\x20" "\n"
-,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0xb0a+6584-0x24c2));}if(
-SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
-,one_sms.index);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_ReferNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x41\x6c\x6c\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_AllPieceNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x43\x75\x72\x72\x65\x6e\x74\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);return;}
-zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)String2Bytes(
-ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if(
-(0x1208+4515-0x23a6)==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);
-sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");return;}
-sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));if(
-(0x62+2104-0x89a)==strcmp(defaultStore,"\x73\x69\x6d")){iStorePos=
-WMS_STORAGE_TYPE_UIM_V01;}(void)zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->
-index,iStorePos,(T_SmsStatus)ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,
-ptRespData->length,acFormatPdu);if(tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){
-iStorePos=WMS_STORAGE_TYPE_UIM_V01;}zUfiSms_TrafficChangeSmsTag(&tDbStoreData);
-if(ZTE_WMS_NV_MEMORY_FULL==zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-
-(0x297+4578-0x1478))){return;}if(tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){}
-zUfiSms_CmgrNvSet();zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);
-zUfiSms_ChangeMainState(SMS_STATE_RECVED);zUfiSms_HandleTrafficSms(&tDbStoreData
-);return;}void zUfiSms_CmgrRespProc(T_zSms_SmsInd*ptRespData){zUfiSms_StoreType 
-iStorePos=WMS_STORAGE_TYPE_NV_V01;unsigned char acFormatPdu[ZSMS_PDU_SIZE]={
-(0x8b7+7273-0x2520)};T_zUfiSms_DbStoreData tDbStoreData;int isPushSms=
-(0x54a+8076-0x24d6);SMS_PARAM one_sms={(0x125b+1354-0x17a5)};int 
-unread_sms_before_recv_new_sms=(0x4aa+5375-0x19a9);memset(&tDbStoreData,
-(0xda9+3736-0x1c41),sizeof(T_zUfiSms_DbStoreData));at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x45\x6e\x74\x65\x72\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2f\x70\x64\x75\x3a\x25\x73\x21" "\n"
-,ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);
-zUfiSms_SendSmsStatusInfo(MSG_SMS_READING);if(strcmp(ptRespData->pdu,"")==
-(0x1001+3027-0x1bd4)){CHAR srState[(0x21cf+916-0x2531)]={(0x1840+2664-0x22a8)};
-sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));if((0x696+1415-0xc1d)!=strcmp(
-srState,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x69\x6e\x67")){sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x66\x61\x69\x6c");zUfiSms_ChangeMainState(SMS_STATE_RECVED)
-;}else{sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");}
-return;}isPushSms=DecodePushPdu(ptRespData->pdu,&one_sms);at_print(LOG_DEBUG,
-"\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x20\x25\x64" "\n"
-,isPushSms);at_print(LOG_DEBUG,
-"\x5b\x53\x4d\x53\x5d\x20\x7a\x55\x66\x69\x53\x6d\x73\x5f\x43\x6d\x67\x72\x52\x65\x73\x70\x50\x72\x6f\x63\x20\x69\x73\x50\x75\x73\x68\x53\x6d\x73\x20\x3d\x25\x64\x20" "\n"
-,isPushSms);if(SMS_NOTIFICATION==isPushSms){BakNotificationSms(one_sms.TP_UD,
-strlen(one_sms.TP_UD));zte_fota_notifyPushMsg((0x301+6959-0x1e30));}if(
-SMS_NO_PUSH!=isPushSms){at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x69\x6e\x64\x65\x78\x20\x3d\x20\x25\x64" "\n"
-,one_sms.index);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x52\x65\x66\x65\x72\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_ReferNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x41\x6c\x6c\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_AllPieceNum);at_print(LOG_DEBUG,
-"\x20\x6f\x6e\x65\x5f\x73\x6d\x73\x2e\x54\x50\x5f\x43\x75\x72\x72\x65\x6e\x74\x50\x69\x65\x63\x65\x4e\x75\x6d\x20\x3d\x20\x25\x64" "\n"
-,one_sms.TP_CurrentPieceNum);zUfiSms_ChangeMainState(SMS_STATE_RECVED);return;}
-zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);(void)String2Bytes(
-ptRespData->pdu,acFormatPdu,(int)strlen(ptRespData->pdu));if(
-(0x135f+3869-0x2277)==ptRespData->stat){(void)zUfiSms_HandleReport(acFormatPdu);
-sc_cfg_set(NV_SR_STATE,"\x73\x72\x5f\x72\x65\x63\x65\x69\x76\x65\x64");return;}(
-void)zUfiSms_DecodeSmsData(&tDbStoreData,ptRespData->index,iStorePos,(
-T_SmsStatus)ptRespData->stat,WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length,
-acFormatPdu);if(tDbStoreData.sms_class==WMS_MESSAGE_CLASS_2){iStorePos=
-WMS_STORAGE_TYPE_UIM_V01;}if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV)){
-unread_sms_before_recv_new_sms=(0xf71+5803-0x261b);}else{
-unread_sms_before_recv_new_sms=(0xd67+1763-0x144a);}if(ZTE_WMS_NV_MEMORY_FULL==
-zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-(0xc16+328-0xd5d))){return;}if(
-tDbStoreData.sms_class!=WMS_MESSAGE_CLASS_2){}zUfiSms_CmgrNvSet();
-zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);zUfiSms_ChangeMainState(
-SMS_STATE_RECVED);return;}void zUfiSms_CmgsRespProc(VOID){T_zUfiSms_StatusInfo 
-tStatusInfo={(0x700+2008-0xed8)};g_zUfiSms_DbStoreData->msg_displaymode=
-g_displaymode;if(g_zUfiSms_DbStoreData->msg_displaymode!=(0x1bbc+2507-0x2586)){
-if((0x1bd4+1105-0x2025)==zUfiSms_WriteSmsToDb(&g_zUfiSms_DbStoreData[
-g_zUfiSms_CurConcatSegNo-(0x35f+2529-0xd3f)],WMS_STORAGE_TYPE_NV_V01,-
-(0x183+1522-0x774))){g_zUfiSms_MsgRefer++;(void)zUfiSms_SetMaxReference(
-g_zUfiSms_MsgRefer);}}printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x67\x73\x52\x73\x70\x20\x73\x65\x67\x4e\x6f\x3a\x25\x64\x2f\x54\x6f\x74\x61\x6c\x4e\x75\x6d\x3a\x25\x64\x2f\x46\x61\x69\x6c\x4e\x75\x6d\x3a\x25\x64\x2e" "\n"
-,g_zUfiSms_CurConcatSegNo,g_zUfiSms_ConcatTotalNum,g_zUfiSms_SendFailedCount);if
-(g_zUfiSms_CurConcatSegNo==g_zUfiSms_ConcatTotalNum){g_zUfiSms_CurConcatSegNo=
-(0x362+8307-0x23d5);memset((void*)&tStatusInfo,(0x183+5112-0x157b),sizeof(
-T_zUfiSms_StatusInfo));tStatusInfo.err_code=ZTE_SMS_CMS_NONE;tStatusInfo.
-send_failed_count=g_zUfiSms_SendFailedCount;tStatusInfo.delete_failed_count=
-(0x866+7294-0x24e4);if(g_zUfiSms_SendFailedCount==(0xa62+1848-0x119a)){
-tStatusInfo.cmd_status=WMS_CMD_SUCCESS;sc_cfg_set(NV_SMS_SEND_RESULT,"\x6f\x6b")
-;}else{tStatusInfo.cmd_status=WMS_CMD_FAILED;sc_cfg_set(NV_SMS_SEND_RESULT,
-"\x66\x61\x69\x6c");}tStatusInfo.cmd=WMS_SMS_CMD_MSG_SEND;(void)
-zUfiSms_SetCmdStatus(&tStatusInfo);sc_cfg_set(NV_SMS_DB_CHANGE,"\x31");
-zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);if(g_zUfiSms_MemFullFlag[
-WMS_STORAGE_TYPE_NV_V01]){zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);}}else{}}
-int zte_fota_notifyPushMsg(int cmd){FOTA_MSG_BUF msg={(0x8f+7512-0x1de7)};int 
-errs=(0x5a0+6377-0x1e89);key_t req_id=ftok(
-"\x2f\x6d\x65\x64\x69\x61\x2f\x7a\x74\x65\x2f\x7a\x74\x65\x5f\x73\x6f\x63\x6b\x65\x74\x2f\x66\x6f\x74\x61\x5f\x64\x6d\x61\x70\x70\x5f\x6d\x73\x67"
-,(0x138f+1262-0x187c));int msgid=msgget(req_id,(0x205+558-0x433));if(msgid!=-
-(0x334+1294-0x841)){msg.mtype=(0x6c3+245-0x7b7);msg.mtext[(0x1a46+1438-0x1fe4)]=
-WEBUI_NOTIFY_PUSH_MSG_;errs=msgsnd(msgid,&msg,sizeof(msg)-sizeof(long),
-(0x42a+6169-0x1c43));}return(errs<(0x505+8564-0x2679)?(0x13c8+4378-0x24e2):
-(0x556+5523-0x1ae8));}
-#if (0x979+7072-0x2519)  
-int atSms_SendCmglReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){return 
-zSvr_SendAtSyn(ZAT_CMGL_CMD,"\x41\x54\x2b\x43\x4d\x47\x4c\x3d\x30" "\r\n",cid,
-pAtRst,atRstSize);}VOID atSms_RecvCmglRsp(T_zAt_AtRes*pResLine){return;}
+ 	if(needAck)

+    {

+		zSms_SendCnmaReq(1);

+    }

+    else

+    {

+		zSms_SendCnmaReq(2);

+    }

+}

+

+

+/*  ·¢ËͶÌÐÅ */

+T_zUfiSms_CmdStatus zUfiSms_SendRawSms(T_zUfiSms_SendReq *ptSendMsg)

+{

+    if(NULL == ptSendMsg || 0 == ptSendMsg->receiver_count)

+    {

+        return WMS_CMD_FAILED;

+    }

+	at_print(LOG_DEBUG, "[SMS] zUfiSms_SendRawSms receiver_count:%d/dest_num:%s/msg_len:%d/id:%d.\n",ptSendMsg->receiver_count,ptSendMsg->dest_num[0],ptSendMsg->msg_len,ptSendMsg->id);

+	#if 1//corem for debug

+	at_print(LOG_DEBUG, "[SMS] zUfiSms_SendRawSms dcs:%d\n",ptSendMsg->dcs);

+	#endif

+

+    sc_cfg_set(NV_SMS_SEND_RESULT, "");

+    g_zUfiSms_SendFailedCount = 0;

+    

+    // Ö¸¶¨ÒªÉ¾³ý£¬»òÕßÊǴӲݸåÏäÖлñÈ¡(idÓÐЧ)£¬ÏÈɾ³ýÔ­¶ÌÐÅ¡£*/

+    if (ptSendMsg->isDelete == TRUE || -1 != ptSendMsg->id) 

+    {

+        (void)zUfiSms_DeleteDraftSms(ptSendMsg->id);

+    }

+

+    //¼Ç¼±àÂë¸ñʽºÍÓïÑÔ£¬ºóÐøÄÚÈÝת»»Ê±Ê¹ÓÃ

+    zUfiSms_SetGlobalDcsLang(ptSendMsg->dcs);

+

+    // Ìî³äȺ·¢¼Ç¼

+    memset(&g_zUfiSms_GroupSms,0,sizeof(g_zUfiSms_GroupSms));

+    if(ZUFI_FAIL == zUfiSms_FillGroupSms(ptSendMsg, &g_zUfiSms_GroupSms))//kw 3

+    {

+        return WMS_CMD_FAILED;

+    }

+

+    // ²ð·Ö¼¶Áª¶ÌÐÅ£¬ÄÚÈÝÌîµ½g_zUfiSms_ConcatSmsÖУ¬·µ»Ø¶ÌÐŵĵ¥Î»³¤¶È

+    memset(&g_zUfiSms_ConcatSms,0,sizeof(g_zUfiSms_ConcatSms));

+    g_zUfiSms_UnitLen = zUfiSms_FillConcatSms(ptSendMsg,&g_zUfiSms_ConcatSms);

+

+    g_zUfiSms_IsConcatSendSuc = TRUE;

+    g_zUfiSms_CurConcatSegNo = 0;

+    memset(g_zUfiSms_DbStoreData,0,sizeof(g_zUfiSms_DbStoreData));

+    

+    //for traffic 

+    //Á÷Á¿Ð£×¼¹¦ÄÜ·¢Ë͵ĶÌÐŲ»ÐèÒªÏÔʾ¸øWEBUI

+    if(ptSendMsg->mem_store == 10)

+    {

+        g_displaymode = 1;

+        at_print(LOG_DEBUG,"[SMS][traffic]zUfiSms_SendSms: msg_displaymode = 1\n");

+    }

+    else

+    {

+        g_displaymode = 0;

+        at_print(LOG_DEBUG,"[SMS][traffic]zUfiSms_SendSms: msg_displaymode = 0\n");

+    }

+    return zUfiSms_SendSms();

+}

+

+T_zUfiSms_CmdStatus zUfiSms_WriteRawSms(T_zUfiSms_SaveReq *pSaveBuff)

+{

+    T_zUfiSms_ConcatInfo tConcatSms;

+    T_zUfiSms_GroupInfo tGroupSms;

+    int iSmsLen = 0;

+    T_zUfiSms_CmdStatus result = WMS_CMD_SUCCESS;

+    

+    if(NULL == pSaveBuff)

+    {

+        return WMS_CMD_FAILED;

+    }

+

+    if (g_zUfiSms_MemFullFlag[ZTE_WMS_MEMORY_NV])

+    {

+        // NVÒÑÂú

+        at_print(LOG_DEBUG,"[SMS] zUfiSms_WriteRawSms nv memory is full,return\n");

+        //g_zUfiSms_StatusInfo.err_code = ZTE_SMS_CMS_MEM_FULL;

+        return WMS_CMD_FAILED;

+    }

+    

+    if (pSaveBuff->isDelete == TRUE)

+    {

+        (void)zUfiSms_DeleteDraftSms(pSaveBuff->id);

+    }

+    zUfiSms_SetGlobalDcsLang(pSaveBuff->dcs);

+

+    memset(&tConcatSms,0,sizeof(T_zUfiSms_ConcatInfo));

+    memset(&tGroupSms,0,sizeof(T_zUfiSms_GroupInfo));

+    (void)zUfiSms_FillGroupSms(pSaveBuff,&tGroupSms);

+    iSmsLen = zUfiSms_FillConcatSms(pSaveBuff,&tConcatSms);

+    

+    at_print(LOG_DEBUG, "[SMS] zUfiSms_WriteRawSms total_receiver=%d,iSmsLen=%d\n",tGroupSms.total_receiver,iSmsLen);

+    //°´ÕÕ·¢¼þÈË£¬Öð¸ö½øÐжÌÐű£´æ

+    for(tGroupSms.current_receiver = 0; tGroupSms.current_receiver < tGroupSms.total_receiver; tGroupSms.current_receiver++)

+    {

+        tConcatSms.current_sending = 0;

+        result = zUfiSms_SaveSmsToDb(pSaveBuff,&tConcatSms,&tGroupSms,iSmsLen);

+        at_print(LOG_DEBUG, "[SMS] zUfiSms_WriteRawSms current_receiver=%d,result=%d\n",tGroupSms.current_receiver,result);

+    }

+    sc_cfg_set(NV_SMS_DB_CHANGE,"1");

+    

+    zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+    if( g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01])

+   {

+	zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);

+   }

+

+    at_print(LOG_DEBUG,"[SMS] zUfiSms_WriteRawSms end and result=%d\n",result);

+    return result;

+

+}

+

+T_zUfiSms_CmdStatus zUfiSms_DeleteSms(T_zUfiSms_DelReq *ptDelBuff)

+{

+    T_zUfiSms_CmdStatus result = WMS_CMD_SUCCESS;

+    BOOL memoryFullbeforeDelete = FALSE;

+	BOOL unreadBeforeDelete = FALSE;

+    

+    if(NULL == ptDelBuff)

+    {

+        return WMS_CMD_FAILED;

+    }

+	at_print(LOG_DEBUG, "[SMS] !!!!!zUfiSms_DeleteSms!!count:%d/id[%d].\n",ptDelBuff->all_or_count,ptDelBuff->id[0]);

+    (void)zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+    zUfiSms_ChangeMainState(SMS_STATE_DELING);

+    

+    // ¹¹Ôì¶ÌÐŵÄÏêϸɾ³ýÐÅÏ¢

+    memset(&g_zUfiSms_DelMsg,0,sizeof(T_zUfiSms_DelSms));

+    if(ZUFI_FAIL == zUfiSms_SetDeleteInfo(ptDelBuff))

+    {

+        at_print(LOG_DEBUG,"[SMS] !!!zUfiSms_SetDeleteInfo fail.\n");

+        zUfiSms_ChangeMainState(SMS_STATE_DELED);

+        return WMS_CMD_FAILED;

+    }

+    at_print(LOG_DEBUG, "[SMS] !!!zUfiSms_SetDeleteInfo Read to Delete:nv_count:%d/sim_count:%d.\n",g_zUfiSms_DelMsg.nv_count,g_zUfiSms_DelMsg.sim_count);

+    

+    if(0 < g_zUfiSms_DelMsg.nv_count) /* delete nv sms*/

+    {

+        if(g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01])

+        {

+            memoryFullbeforeDelete = TRUE;

+        }

+

+		unreadBeforeDelete = zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV);

+			

+        result = (T_zUfiSms_CmdStatus)zUfiSms_DeleteNvSms();

+        (void)zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+        zUfiSms_ChangeMainState(SMS_STATE_DELED);

+        sc_cfg_set(NV_SMS_DB_CHANGE,"1");

+        at_print(LOG_DEBUG, "[SMS] zUfiSms_DeleteNvSms memoryFullbeforeDelete=%d,MemFullFlag(NV)=%d\n",memoryFullbeforeDelete,g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]);

+        if(memoryFullbeforeDelete && !g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01])

+        {

+            //memset(g_Zmena_value,0,sizeof(g_Zmena_value));

+            //sat_print(LOG_DEBUGg_Zmena_value, "%d", 0);

+            //atBase_SendMsgToSelf(ZAT_ZMENA_CMD, g_Zmena_value,sizeof(g_Zmena_value));

+            at_print(LOG_DEBUG,"[SMS] zUfiSms_DeleteNvSms: send AT+ZMENA=0\n");

+            //atUnsoli_Report_Zmena("0", cid);

+            zSms_SendZmenaReq(0);

+        }

+

+        if(memoryFullbeforeDelete && !g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01]

+			|| unreadBeforeDelete && !zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV))

+        {

+        	zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);

+        }

+    }

+    if(0 < g_zUfiSms_DelMsg.sim_count) /*delete sim sms*/

+    {

+        result = zUfiSms_DeleteSimSms();

+        (void)zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_SIM);

+    }

+    at_print(LOG_DEBUG,"[SMS] zUfiSms_DeleteSms result=%d\n",result);

+    return result;

+}

+

+

+// δ¶Á±äÒѶÁ

+T_zUfiSms_CmdStatus zUfiSms_ModifySmsTag(T_zUfiSms_ModifyFlag *ptModifyBuff)

+{

+    unsigned long i = 0;

+    T_zUfiSms_CmdStatus result = WMS_CMD_SUCCESS;

+    char acStorePos[50] = {0};

+	

+    if(NULL == ptModifyBuff)

+    {

+        at_print(LOG_ERR,"inputs is null.");

+        return WMS_CMD_FAILED;

+    }

+

+    for(i = 0; i < ptModifyBuff->total_id; i++)

+    {

+        if(ptModifyBuff->id[i] < 1 || ZUFI_FAIL == zUfiSms_UpdateSmsTagInDb(ptModifyBuff->id[i],ptModifyBuff->tags))

+        {

+            result = WMS_CMD_FAILED;

+        }

+        else

+        {

+            result = WMS_CMD_SUCCESS;

+        }

+    }

+

+	if(ZUFI_FAIL == zUfiSms_GetStorePosById("Mem_Store",acStorePos,sizeof(acStorePos),ptModifyBuff->id[0]))

+    {

+        return ZUFI_FAIL;

+    }

+        

+	if(0 == strcmp(acStorePos,ZTE_WMS_DB_NV_TABLE)) //!zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV) && 

+    {

+       zUfiSms_SendSmsStatusInfo(MSG_SMS_READING);

+    }

+	

+    if(0 == strcmp(acStorePos,ZTE_WMS_DB_SIM_TABLE) && ptModifyBuff->total_id > 0)/*sim sms*/

+    {

+	   zUfiSms_ModifyModemSms(ptModifyBuff);

+    }

+    return result;

+}

+

+//ÉèÖöÌÐŲÎÊý

+T_zUfiSms_CmdStatus zUfiSms_SetSmsPara(T_zUfiSms_ParaInfo *ptParaBuff)

+{

+	int atRes = 0;

+	CHAR sca[ZTE_WMS_ADDRESS_DIGIT_MAX_V01 + 1] = {0};

+    CHAR store[20] = {0};

+    CHAR defaultStore[50]={0};

+	

+	if (ptParaBuff == ZUFI_NULL)

+	{

+		return WMS_CMD_FAILED;

+	}

+	

+	if (strlen(ptParaBuff->sca) != 0)

+    {

+    	strncpy(sca, ptParaBuff->sca,sizeof(sca)-1);

+		at_print(LOG_DEBUG, "send ZAT_CSCA_SET_CMD message csca is %s.\n", sca);

+    	//atBase_SendMsgToSelf(ZAT_CSCA_SET_CMD, (CHAR *)&tCscaPara, sizeof(tCscaPara));

+		//zhangfen for platform

+		atRes = zSms_SetCscaReq(ptParaBuff->sca);

+        if(atRes != ZSMS_RESULT_OK)

+        {

+            return WMS_CMD_FAILED;

+        }

+    }

+

+    sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));

+    if((*(ptParaBuff->default_store) != '\0') && 

+		(0 != strcmp(defaultStore, ptParaBuff->default_store)))

+    {

+        

+        //atBase_SendMsgToSelf(ZAT_CNMI_CMD, NULL, 0);

+        //zhangfen for platform

+        //kw 3

+        //if(ptParaBuff->default_store == NULL)

+        //{        	

+        //	sc_cfg_get(NV_DEFAULT_STORE,store,sizeof(store));

+        //}

+		//else

+		{

+			strncpy(store, ptParaBuff->default_store,sizeof(store)-1);  

+		}

+        atRes = zSms_SendCnmiReq(store);

+        if(atRes != ZSMS_RESULT_OK)

+        {

+            return WMS_CMD_FAILED;

+        }

+    }

+		

+	if(-1 == zUfiSms_SetDbParameters(ptParaBuff))

+    {

+        at_print(LOG_ERR,"set parameters to table failed.");

+        return WMS_CMD_FAILED;

+    }

+

+	//memcpy((VOID *)&g_zUfiSms_CurSmsPara, (VOID *)ptParaBuff, sizeof(T_zUfiSms_ParaInfo));

+

+	return WMS_CMD_SUCCESS;

+}

+

+void zUfiSms_CmgrNvSet(void)

+{

+    char sms_rec_flag[5] = {0};

+    char remind_flag[5];

+    int sms_count = 0;

+    int remind_count =0;

+

+    //NVÖжÌÐÅÊýÁ¿¼ÓÒ»

+    memset(sms_rec_flag,0,sizeof(sms_rec_flag));

+    sc_cfg_get(ZTE_WMS_NVCONFIG_RECEVIED,sms_rec_flag,sizeof(sms_rec_flag));

+    sms_count = atoi(sms_rec_flag);    

+	if(sms_count < 0 || sms_count > INT_MAX-1) { //kw 3

+		at_print(LOG_ERR,"[SMS]sms_count err:%d\n", sms_count);

+		return;

+	}

+

+    memset(sms_rec_flag,0,sizeof(sms_rec_flag));

+    snprintf(sms_rec_flag,sizeof(sms_rec_flag),"%d",sms_count + 1);

+

+    sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED, sms_rec_flag);

+    sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED_LED, sms_rec_flag);

+    

+    memset(remind_flag,0,sizeof(remind_flag));

+    snprintf(remind_flag,sizeof(remind_flag),"%d",remind_count+1);

+    sc_cfg_set(ZTE_WMS_NVCONFIG_RECEVIED_REMIND, remind_flag);

+    sc_cfg_set(NV_SMS_RECV_RESULT, "ok");

+    sc_cfg_set(NV_SMS_DB_CHANGE,"1");

+}

+

+void zUfiSms_CdsRespProc(T_zSms_SmsInd *ptRespData)

+{   

+    unsigned char         acFormatPdu[ZSMS_PDU_SIZE] = { 0 };

+    T_zUfiSms_DbStoreData tDbStoreData     = { 0 };

+    int                   isPushSms = 0;

+

+    // ¶ÌÐÅÄÚÈÝΪ¿Õ

+    if (strcmp(ptRespData->pdu,"") == 0)

+    {

+        CHAR srState[50]={0};

+        sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));

+        if(0 != strcmp(srState, "sr_receiving"))

+        {

+            //²»´¦ÓÚÕýÔÚ½ÓÊÕ"¶ÌÐÅ״̬±¨¸æ"µÄ״̬,ÊÕµ½¿Õ¶ÌÐÅ£¬³ö´í

+            sc_cfg_set(NV_SMS_RECV_RESULT, "fail");

+            zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        }

+        else

+        {

+            // ±¨¸æÊÕµ½

+            sc_cfg_set(NV_SR_STATE, "sr_received");

+        }

+        return;

+    }

+	

+    zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);

+    (void)String2Bytes(ptRespData->pdu, acFormatPdu, (int)strlen(ptRespData->pdu));

+    

+    /*  ÊÕµ½DU_AE ¶ÌÐÅ״̬±¨¸æ,´¦Àí±¨¸æ */

+    if(5 == ptRespData->stat)

+    {   

+        (void)zUfiSms_HandleReport(acFormatPdu);

+        sc_cfg_set(NV_SR_STATE, "sr_received");

+        zUfiSms_Ack_new_msg(TRUE);

+        return ;

+    }

+    

+    return; 

+}

+

+int  zUfiSms_CheckIfWholeSms(T_zUfiSms_DbStoreData *data, SMS_MSG_INFO *pmsg)

+{	

+    if(data->concat_sms != 1)	

+    {

+    	return 0;

+    }

+

+    zUfiSms_GetCurrentRecvTotalSeq(data, pmsg);

+

+    at_print(LOG_DEBUG, "[SMS][traffic] zUfiSms_CheckIfWholeSms id = %s, totalSeq = %d,ref =%d,total =%d, seq=%d\n", pmsg->id, atoi(pmsg->total_seq),data->concat_info[0],data->concat_info[1],data->concat_info[2]);

+    if(data->concat_info[1] == atoi(pmsg->total_seq))

+    {

+    	return 0;

+    }

+

+    return -1;

+}

+

+void zUfiSms_TrafficChangeSmsTag(T_zUfiSms_DbStoreData *data)

+{

+    CHAR smsNumber[50]={0};

+    sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,smsNumber,sizeof(smsNumber));

+    if(0 == strcmp(smsNumber, data->number))

+    {

+        data->tag = WMS_TAG_TYPE_MT_READ_V01;

+        data->msg_displaymode = 1;

+    }

+}

+

+void zUfiSms_HandleTrafficSms(T_zUfiSms_DbStoreData *data)

+{

+    int iSmsId = 0;

+    SMS_MSG_INFO msg = {0};

+    CHAR smsNumber[50]={0};

+    sc_cfg_get(NV_TRAFFIC_SMS_NUMBER,smsNumber,sizeof(smsNumber));

+    

+    at_print(LOG_DEBUG, "[SMS][traffic] tDbStoreData.number = %s, traffic_sms_number = %s\n", data->number,smsNumber);

+    if(0 == strcmp(smsNumber, data->number))

+    {	  	

+        if(0 != zUfiSms_CheckIfWholeSms(data, &msg))

+        {

+            at_print(LOG_DEBUG,"[SMS][traffic] cmt ind, recv sms, but not whole sms, wait to recv next seg\n");

+            return;

+        }

+        

+        sc_cfg_set(NV_TRAFFIC_RECV_SMS_ID, msg.id);

+        sc_cfg_set(NV_TRAFFIC_SMS_NUMBER, "0");

+        at_print(LOG_DEBUG, "[SMS][traffic] zUfiSms_HandleTrafficSms   traffic_recv_sms_id = %s\n", msg.id);

+    }

+    

+}

+

+void zUfiSms_CmtRespProc(T_zSms_SmsInd *ptRespData)

+{   

+    zUfiSms_StoreType     iStorePos        = WMS_STORAGE_TYPE_NV_V01;

+    unsigned char         acFormatPdu[ZSMS_PDU_SIZE] = { 0 };

+    T_zUfiSms_DbStoreData tDbStoreData;

+    int       isPushSms = 0;

+    SMS_PARAM one_sms   = { 0 };

+    int unread_sms_before_recv_new_sms = 0;

+	

+    memset(&tDbStoreData,0,sizeof(T_zUfiSms_DbStoreData));

+    at_print(LOG_DEBUG, "[SMS] Enter zUfiSms_CmgrRespProc! index:%d/stat:%d/length:%d/pdu:%s!\n", ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);

+    

+    // ¶ÌÐÅÄÚÈÝΪ¿Õ

+    if (strcmp(ptRespData->pdu,"") == 0  )

+    {

+        CHAR srState[50]={0};

+        sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));

+        if(0 != strcmp(srState, "sr_receiving"))

+        {

+            //²»´¦ÓÚÕýÔÚ½ÓÊÕ"¶ÌÐÅ״̬±¨¸æ"µÄ״̬,ÊÕµ½¿Õ¶ÌÐÅ£¬³ö´í

+            sc_cfg_set(NV_SMS_RECV_RESULT, "fail");

+            zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        }

+        else

+        {

+            // ±¨¸æÊÕµ½

+            sc_cfg_set(NV_SR_STATE, "sr_received");

+        }

+        return;

+    }

+    

+    //sleep(1);

+    isPushSms=DecodePushPdu(ptRespData->pdu, &one_sms);

+    at_print(LOG_DEBUG, "[sms]zUfiSms_CmgrRespProc isPushSms = %d\n",isPushSms);

+    if(SMS_NOTIFICATION == isPushSms) //notification

+    {	   

+        BakNotificationSms(one_sms.TP_UD,strlen(one_sms.TP_UD));

+        zte_fota_notifyPushMsg(0);	   

+    }

+    

+    if(SMS_NO_PUSH != isPushSms)

+    {

+        /*ɾ³ýSIM¿¨ÀïµÄ¶ÌÐÅ*/

+        at_print(LOG_DEBUG, " one_sms.index = %d\n",one_sms.index);

+        at_print(LOG_DEBUG, " one_sms.TP_ReferNum = %d\n",one_sms.TP_ReferNum);

+        at_print(LOG_DEBUG, " one_sms.TP_AllPieceNum = %d\n",one_sms.TP_AllPieceNum);

+        at_print(LOG_DEBUG, " one_sms.TP_CurrentPieceNum = %d\n",one_sms.TP_CurrentPieceNum);

+        

+        //zUfiSms_DelModemSms(one_sms.index);

+        zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        zUfiSms_Ack_new_msg(TRUE);

+        return;

+    } 

+    

+    //»ñȡ״̬

+    zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);

+    (void)String2Bytes(ptRespData->pdu, acFormatPdu, (int)strlen(ptRespData->pdu));

+    

+    /*  ÊÕµ½DU_AE ¶ÌÐÅ״̬±¨¸æ,´¦Àí±¨¸æ£¬É¾³ý¶ÔÓ¦¶ÌÐż´¿É */

+    if(5 == ptRespData->stat)

+    {   

+        (void)zUfiSms_HandleReport(acFormatPdu);

+        sc_cfg_set(NV_SR_STATE, "sr_received");

+        zUfiSms_Ack_new_msg(TRUE); 

+        return ;

+    }

+    

+    // ½«¶ÌÐÅacPdu_Format½âÂë´æÓÚtDb_StoreDataÖÐ

+    (void)zUfiSms_DecodeSmsData(&tDbStoreData, ptRespData->index, iStorePos, (T_SmsStatus)ptRespData->stat, 

+                                WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length, acFormatPdu);

+    

+    if(tDbStoreData.sms_class == WMS_MESSAGE_CLASS_2)

+    {

+        iStorePos = WMS_STORAGE_TYPE_UIM_V01;

+    }

+

+	if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV))

+    {

+        unread_sms_before_recv_new_sms = 1;

+    }

+	else

+	{

+	    unread_sms_before_recv_new_sms = 0;

+	}

+    

+    zUfiSms_TrafficChangeSmsTag(&tDbStoreData);

+    

+    //дÈëÒ»ÌõжÌÐÅ£¬°üÀ¨Ð´ÈëÒ»¸ö³¤¶ÌÐŵÄseg

+    if(ZTE_WMS_NV_MEMORY_FULL == zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-1))

+    {

+        zUfiSms_Ack_new_msg(FALSE);

+        //memset(g_Zmena_value,0,sizeof(g_Zmena_value));

+        //sat_print(LOG_DEBUGg_Zmena_value, "%d", 1);

+        //atBase_SendMsgToSelf(ZAT_ZMENA_CMD, g_Zmena_value,sizeof(g_Zmena_value));

+		//zhangfen for platform

+		//zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_ZMENA,1,"1");

+		 zSms_SendZmenaReq(1);

+        return;

+    }

+    

+    if(tDbStoreData.sms_class != WMS_MESSAGE_CLASS_2)

+    {

+        zUfiSms_Ack_new_msg(TRUE);  

+    }

+    

+    zUfiSms_CmgrNvSet();

+                     

+    zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+    zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+

+    zUfiSms_SendSmsStatusInfo(MSG_SMS_NEW);

+    

+    //for traffic sms

+    zUfiSms_HandleTrafficSms(&tDbStoreData);

+    return; 

+}

+

+void zUfiSms_ZmgrRespProc(T_zSms_SmsInd *ptRespData)

+{   

+    zUfiSms_StoreType     iStorePos        = WMS_STORAGE_TYPE_NV_V01;

+    unsigned char         acFormatPdu[ZSMS_PDU_SIZE] = { 0 };

+    T_zUfiSms_DbStoreData tDbStoreData;

+    int       isPushSms = 0;

+    SMS_PARAM one_sms   = { 0 };

+    CHAR defaultStore[50]={0};

+    

+    memset(&tDbStoreData,0,sizeof(T_zUfiSms_DbStoreData));

+    at_print(LOG_DEBUG, "[SMS] Enter zUfiSms_CmgrRespProc! index:%d/stat:%d/length:%d/pdu:%s!\n", ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);

+    

+    // ¶ÌÐÅÄÚÈÝΪ¿Õ

+    if (strcmp(ptRespData->pdu,"") == 0  )

+    {

+        CHAR srState[50]={0};

+        sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));

+        if(0 != strcmp(srState, "sr_receiving"))

+        {

+            //²»´¦ÓÚÕýÔÚ½ÓÊÕ"¶ÌÐÅ״̬±¨¸æ"µÄ״̬,ÊÕµ½¿Õ¶ÌÐÅ£¬³ö´í

+            sc_cfg_set(NV_SMS_RECV_RESULT, "fail");

+            zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        }

+        else

+        {

+            // ±¨¸æÊÕµ½

+            sc_cfg_set(NV_SR_STATE, "sr_received");

+        }

+        return;

+    }

+    

+    //sleep(1);

+    isPushSms=DecodePushPdu(ptRespData->pdu, &one_sms);

+    at_print(LOG_DEBUG, " zUfiSms_CmgrRespProc isPushSms = %d\n",isPushSms);

+    at_print(LOG_DEBUG, "[SMS] zUfiSms_CmgrRespProc isPushSms =%d \n", isPushSms);

+    if(SMS_NOTIFICATION == isPushSms) //notification

+    {	   

+        BakNotificationSms(one_sms.TP_UD,strlen(one_sms.TP_UD));

+        zte_fota_notifyPushMsg(0);	   

+    }

+    

+    if(SMS_NO_PUSH != isPushSms)

+    {

+        /*ɾ³ýSIM¿¨ÀïµÄ¶ÌÐÅ*/

+        at_print(LOG_DEBUG, " one_sms.index = %d\n",one_sms.index);

+        at_print(LOG_DEBUG, " one_sms.TP_ReferNum = %d\n",one_sms.TP_ReferNum);

+        at_print(LOG_DEBUG, " one_sms.TP_AllPieceNum = %d\n",one_sms.TP_AllPieceNum);

+        at_print(LOG_DEBUG, " one_sms.TP_CurrentPieceNum = %d\n",one_sms.TP_CurrentPieceNum);

+        

+        //zUfiSms_DelModemSms(one_sms.index);

+        zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        //zUfiSms_Ack_new_msg(TRUE);

+        return;

+    } 

+    

+    //»ñȡ״̬

+    zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);

+    (void)String2Bytes(ptRespData->pdu, acFormatPdu, (int)strlen(ptRespData->pdu));

+    

+    /*  ÊÕµ½DU_AE ¶ÌÐÅ״̬±¨¸æ,´¦Àí±¨¸æ£¬É¾³ý¶ÔÓ¦¶ÌÐż´¿É */

+    if(5 == ptRespData->stat)

+    {   

+        (void)zUfiSms_HandleReport(acFormatPdu);

+        sc_cfg_set(NV_SR_STATE, "sr_received");

+        //zUfiSms_Ack_new_msg(TRUE); 

+        return ;

+    }

+

+    sc_cfg_get(NV_DEFAULT_STORE,defaultStore,sizeof(defaultStore));

+    if(0 == strcmp(defaultStore, "sim"))

+    {

+        iStorePos = WMS_STORAGE_TYPE_UIM_V01;

+    }

+	

+    // ½«¶ÌÐÅacPdu_Format½âÂë´æÓÚtDb_StoreDataÖÐ

+    (void)zUfiSms_DecodeSmsData(&tDbStoreData, ptRespData->index, iStorePos, (T_SmsStatus)ptRespData->stat, 

+                                WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length, acFormatPdu);

+    

+    if(tDbStoreData.sms_class == WMS_MESSAGE_CLASS_2)

+    {

+        iStorePos = WMS_STORAGE_TYPE_UIM_V01;

+    }

+

+    zUfiSms_TrafficChangeSmsTag(&tDbStoreData);

+

+    //дÈëÒ»ÌõжÌÐÅ£¬°üÀ¨Ð´ÈëÒ»¸ö³¤¶ÌÐŵÄseg

+    if(ZTE_WMS_NV_MEMORY_FULL == zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-1))

+    {

+        //zUfiSms_Ack_new_msg(FALSE);

+        //memset(g_Zmena_value,0,sizeof(g_Zmena_value));

+        //sat_print(LOG_DEBUGg_Zmena_value, "%d", 1);

+        //atBase_SendMsgToSelf(ZAT_ZMENA_CMD, g_Zmena_value,sizeof(g_Zmena_value));

+        //zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_AT_ZMENA,1,"1");

+        return;

+    }

+    

+    if(tDbStoreData.sms_class != WMS_MESSAGE_CLASS_2)

+    {

+        //zUfiSms_Ack_new_msg(TRUE);  

+    }

+    

+    zUfiSms_CmgrNvSet();

+                     

+    zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+    zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+

+    //for traffic sms

+    zUfiSms_HandleTrafficSms(&tDbStoreData);

+	

+    return; 

+}

+

+//unused

+void zUfiSms_CmgrRespProc(T_zSms_SmsInd *ptRespData)

+{   

+    zUfiSms_StoreType     iStorePos        = WMS_STORAGE_TYPE_NV_V01;

+    unsigned char         acFormatPdu[ZSMS_PDU_SIZE] = { 0 };

+    T_zUfiSms_DbStoreData tDbStoreData;

+    int       isPushSms = 0;

+    SMS_PARAM one_sms   = { 0 };

+    int unread_sms_before_recv_new_sms = 0;

+	

+    memset(&tDbStoreData,0,sizeof(T_zUfiSms_DbStoreData));

+    at_print(LOG_DEBUG, "[SMS] Enter zUfiSms_CmgrRespProc! index:%d/stat:%d/length:%d/pdu:%s!\n", ptRespData->index,ptRespData->stat,ptRespData->length,ptRespData->pdu);

+    zUfiSms_SendSmsStatusInfo(MSG_SMS_READING);

+    // ¶ÌÐÅÄÚÈÝΪ¿Õ

+    if (strcmp(ptRespData->pdu,"") == 0  )

+    {

+        CHAR srState[50]={0};

+        sc_cfg_get(NV_SR_STATE,srState,sizeof(srState));

+        if(0 != strcmp(srState, "sr_receiving"))

+        {

+            //²»´¦ÓÚÕýÔÚ½ÓÊÕ"¶ÌÐÅ״̬±¨¸æ"µÄ״̬,ÊÕµ½¿Õ¶ÌÐÅ£¬³ö´í

+            sc_cfg_set(NV_SMS_RECV_RESULT, "fail");

+            zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        }

+        else

+        {

+            // ±¨¸æÊÕµ½

+            sc_cfg_set(NV_SR_STATE, "sr_received");

+        }

+        return;

+    }

+    

+    //sleep(1);

+    isPushSms=DecodePushPdu(ptRespData->pdu, &one_sms);

+    at_print(LOG_DEBUG, " zUfiSms_CmgrRespProc isPushSms = %d\n",isPushSms);

+    at_print(LOG_DEBUG, "[SMS] zUfiSms_CmgrRespProc isPushSms =%d \n", isPushSms);

+    if(SMS_NOTIFICATION == isPushSms) //notification

+    {	   

+        BakNotificationSms(one_sms.TP_UD,strlen(one_sms.TP_UD));

+        zte_fota_notifyPushMsg(0);	   

+    }

+    

+    if(SMS_NO_PUSH != isPushSms)

+    {

+        /*ɾ³ýSIM¿¨ÀïµÄ¶ÌÐÅ*/

+        at_print(LOG_DEBUG, " one_sms.index = %d\n",one_sms.index);

+        at_print(LOG_DEBUG, " one_sms.TP_ReferNum = %d\n",one_sms.TP_ReferNum);

+        at_print(LOG_DEBUG, " one_sms.TP_AllPieceNum = %d\n",one_sms.TP_AllPieceNum);

+        at_print(LOG_DEBUG, " one_sms.TP_CurrentPieceNum = %d\n",one_sms.TP_CurrentPieceNum);

+        

+        //zUfiSms_DelModemSms(one_sms.index);

+        zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+        //zUfiSms_Ack_new_msg(TRUE);

+        return;

+    } 

+    

+    //»ñȡ״̬

+    zUfiSms_GetReportStatus(ptRespData->pdu,&ptRespData->stat);

+    (void)String2Bytes(ptRespData->pdu, acFormatPdu, (int)strlen(ptRespData->pdu));

+    

+    /*  ÊÕµ½DU_AE ¶ÌÐÅ״̬±¨¸æ,´¦Àí±¨¸æ£¬É¾³ý¶ÔÓ¦¶ÌÐż´¿É */

+    if(5 == ptRespData->stat)

+    {   

+        (void)zUfiSms_HandleReport(acFormatPdu);

+        sc_cfg_set(NV_SR_STATE, "sr_received");

+        //zUfiSms_Ack_new_msg(TRUE); 

+        return ;

+    }

+    

+    // ½«¶ÌÐÅacPdu_Format½âÂë´æÓÚtDb_StoreDataÖÐ

+    (void)zUfiSms_DecodeSmsData(&tDbStoreData, ptRespData->index, iStorePos, (T_SmsStatus)ptRespData->stat, 

+                                WMS_MESSAGE_FORMAT_GW_PP_V01,ptRespData->length, acFormatPdu);

+    

+    if(tDbStoreData.sms_class == WMS_MESSAGE_CLASS_2)

+    {

+        iStorePos = WMS_STORAGE_TYPE_UIM_V01;

+    }

+

+	if(zUfiSms_IsUnreadSms(ZTE_WMS_MEMORY_NV))

+    {

+        unread_sms_before_recv_new_sms = 1;

+    }

+	else

+	{

+	    unread_sms_before_recv_new_sms = 0;

+	}

+	

+    //дÈëÒ»ÌõжÌÐÅ£¬°üÀ¨Ð´ÈëÒ»¸ö³¤¶ÌÐŵÄseg

+    if(ZTE_WMS_NV_MEMORY_FULL == zUfiSms_WriteSmsToDb(&tDbStoreData,iStorePos,-1))

+    {

+        //zUfiSms_Ack_new_msg(FALSE);

+        //memset(g_Zmena_value,0,sizeof(g_Zmena_value));

+        //sprintf(g_Zmena_value, "%d", 1);

+        //atBase_SendMsgToSelf(ZAT_ZMENA_CMD, g_Zmena_value,sizeof(g_Zmena_value));

+        //zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_LOCAL,MSG_CMD_AT_ZMENA,1,"1");

+        return;

+    }

+    

+    if(tDbStoreData.sms_class != WMS_MESSAGE_CLASS_2)

+    {

+        //zUfiSms_Ack_new_msg(TRUE);  

+    }

+    

+    zUfiSms_CmgrNvSet();

+                     

+    zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+    zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+

+    return; 

+}

+

+

+void zUfiSms_CmgsRespProc(VOID)

+{

+	T_zUfiSms_StatusInfo tStatusInfo = {0};

+	

+    g_zUfiSms_DbStoreData->msg_displaymode = g_displaymode;

+    

+    if(g_zUfiSms_DbStoreData->msg_displaymode != 1)

+    {

+        //²»¹Üʧ°ÜÓë·ñ£¬´æÈë·¢¼þÏ䣬²¢ÉèÖñê¼Ç

+        if(0 == zUfiSms_WriteSmsToDb(&g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-1],WMS_STORAGE_TYPE_NV_V01,-1))

+        {

+            g_zUfiSms_MsgRefer++;

+            (void)zUfiSms_SetMaxReference(g_zUfiSms_MsgRefer);

+        }

+    }

+    

+	printf("[SMS] atSms_RecvCmgsRsp segNo:%d/TotalNum:%d/FailNum:%d.\n",g_zUfiSms_CurConcatSegNo,g_zUfiSms_ConcatTotalNum,g_zUfiSms_SendFailedCount);

+	

+    // ¶ÌÐÅ·¢ËͽáÊø

+    if(g_zUfiSms_CurConcatSegNo == g_zUfiSms_ConcatTotalNum )

+    {

+        g_zUfiSms_CurConcatSegNo = 0;

+

+        memset((void*)&tStatusInfo,0,sizeof(T_zUfiSms_StatusInfo));

+        tStatusInfo.err_code = ZTE_SMS_CMS_NONE;

+        tStatusInfo.send_failed_count = g_zUfiSms_SendFailedCount;

+        tStatusInfo.delete_failed_count = 0;

+        if(g_zUfiSms_SendFailedCount == 0)

+        {

+            tStatusInfo.cmd_status = WMS_CMD_SUCCESS;

+            sc_cfg_set(NV_SMS_SEND_RESULT, "ok");

+        }

+        else

+        {

+            tStatusInfo.cmd_status = WMS_CMD_FAILED;

+            sc_cfg_set(NV_SMS_SEND_RESULT, "fail");

+        }

+        tStatusInfo.cmd = WMS_SMS_CMD_MSG_SEND;

+        (void)zUfiSms_SetCmdStatus(&tStatusInfo);

+        sc_cfg_set(NV_SMS_DB_CHANGE,"1");

+        zUfiSms_CheckMemoryFull(ZTE_WMS_MEMORY_NV);

+        if( g_zUfiSms_MemFullFlag[WMS_STORAGE_TYPE_NV_V01])

+        {

+            zUfiSms_SendSmsStatusInfo(MSG_SMS_DEFAULT);

+        }

+    }

+    else

+    {

+        //¼ÌÐø·¢ËÍÏÂÒ»¸öseg

+        //zUfiSms_SendConcatSms(cid);

+    }

+}

+

+int zte_fota_notifyPushMsg(int cmd)

+{

+	FOTA_MSG_BUF msg = {0};

+	int errs = 0;

+	key_t req_id = ftok("/media/zte/zte_socket/fota_dmapp_msg",1);

+	int msgid=msgget(req_id,0);

+	if (msgid != -1) { //kw 3

+		msg.mtype = 1;

+		msg.mtext[0] = WEBUI_NOTIFY_PUSH_MSG_;

+		errs = msgsnd(msgid, &msg, sizeof(msg)-sizeof(long),0);

+	}

+	return (errs<0?0:1);

+}

+

+#if 0  //ÎÞÓôúÂë

+int atSms_SendCmglReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    return zSvr_SendAtSyn(ZAT_CMGL_CMD,"AT+CMGL=0\r\n",cid,pAtRst,atRstSize);

+}

+

+VOID atSms_RecvCmglRsp(T_zAt_AtRes *pResLine)

+{

+	return;

+}

 #endif 

-#if (0x1aa5+1940-0x2239) 
-int atSms_SendZmglReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){int res
-=(0x9cf+952-0xd87);pthread_mutex_lock(&smsdb_mutex);res=zSvr_SendAtSyn(
-ZAT_ZMGL_CMD,"\x41\x54\x2b\x5a\x4d\x47\x4c\x3d\x34" "\r\n",cid,pAtRst,atRstSize)
-;pthread_mutex_unlock(&smsdb_mutex);return res;}VOID atSms_initAtOk(VOID){
-T_zUfiSms_StatusInfo tStatus={(0x374+3933-0x12d1)};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);}
-int atSms_initAtErr(UINT8*pErrCode){T_zUfiSms_StatusInfo tStatus={
-(0xec4+2318-0x17d2)};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);return FALSE;}
-VOID atSms_RecvZmglRsp(T_zAt_AtRes*pResLine){static T_zUfiSms_SmsItem tSmsPara={
-(0x157f+1247-0x1a5e)};printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x6c\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
-,pResLine->pduFlag,pResLine->result);if(pResLine->pduFlag==ZAT_ATRES_PDU_FLAG){
-zUfiSms_CmglRespProc(pResLine,&tSmsPara);}else{memset(&tSmsPara,
-(0x10e5+5423-0x2614),sizeof(T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine
-->resParas,sizeof(pResLine->resParas),&tSmsPara,(0x9a5+4514-0x1b46));printf(
-"\x5b\x53\x4d\x53\x5d\x20\x5a\x6d\x67\x6c\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
-,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}}int atSms_SendCmgrReq(PSTR 
-pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x443+8871-0x26d6)
-]={(0xd5d+4902-0x2083)};iSmsIndex=atoi(pAtCmdPara);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6d\x67\x72\x52\x65\x71\x20\x47\x65\x74\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2e" "\n"
-,iSmsIndex);snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x43\x4d\x47\x52\x3d\x25\x73" "\r\n",pAtCmdPara);return 
-zSvr_SendAtSyn(ZAT_CMGR_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvCmgrRsp(T_zAt_AtRes*pResLine){
-#if (0x917+2861-0x1444)

-static T_zUfiSms_SmsItem tSmsPara={(0x172b+1529-0x1d24)};T_zUfiSms_CmgrSetRsp 
-tCmgrRsp={(0x150c+400-0x169c)};printf(
-"\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x67\x72\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
-,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
-ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->result){printf(
-"\x21\x21\x21\x21\x21\x21\x21\x21\x21\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x67\x72\x52\x73\x70\x20\x67\x65\x74\x20\x72\x65\x73\x75\x6c\x74\x20\x45\x72\x72\x6f\x72\x2e" "\n"
-);return;}tCmgrRsp.index=tSmsPara.index;tCmgrRsp.length=tSmsPara.length;tCmgrRsp
-.stat=tSmsPara.stat;sscanf(pResLine->resParas,"\x25\x35\x30\x30\x73",tCmgrRsp.
-pdu);zUfiSms_CmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();sc_cfg_set(
-"\x73\x6d\x73\x5f\x72\x65\x63\x76\x5f\x72\x65\x73\x75\x6c\x74","\x6f\x6b");}else
-{memset(&tSmsPara,(0x1307+4716-0x2573),sizeof(T_zUfiSms_SmsItem));(void)
-zUfiSms_FormatSms(pResLine->resParas,&tSmsPara,(0x733+6534-0x20b7));tSmsPara.
-index=iSmsIndex;printf(
-"\x3d\x3d\x3d\x3d\x3d\x3d\x43\x6d\x67\x72\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
-,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}
+

+#if 0 //zhangfen for platform

+int atSms_SendZmglReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    int res = 0;

+    pthread_mutex_lock(&smsdb_mutex);

+    res = zSvr_SendAtSyn(ZAT_ZMGL_CMD,"AT+ZMGL=4\r\n",cid,pAtRst,atRstSize);  

+    pthread_mutex_unlock(&smsdb_mutex);

+    return res;

+}

+

+

+

+VOID atSms_initAtOk(VOID)

+{

+    T_zUfiSms_StatusInfo tStatus = {0};

+    //´Ë´¦»áµ¼ÖÂcmglÔÙ·¢Ò»´Î¼ÓÔØµ½ME´¦

+    //zUfiSms_ChangeMainState(SMS_STATE_LOADED);

+    sc_cfg_set(NV_SMS_LOAD_RESULT, "ok");

+    tStatus.cmd_status = WMS_CMD_SUCCESS;

+    tStatus.cmd = WMS_SMS_CMD_INIT;

+    (void)zUfiSms_SetCmdStatus(&tStatus);

+    zUfiSms_ChangeMainState(SMS_STATE_LOADED);

+}

+

+int atSms_initAtErr(UINT8 *pErrCode)

+{

+    T_zUfiSms_StatusInfo tStatus = {0};

+    

+    sc_cfg_set(NV_SMS_LOAD_RESULT, "fail");

+    zUfiSms_ChangeMainState(SMS_STATE_LOADED);

+    

+    tStatus.cmd_status = WMS_CMD_FAILED;

+    tStatus.cmd = WMS_SMS_CMD_INIT;

+    (void)zUfiSms_SetCmdStatus(&tStatus);

+    return FALSE;

+}

+

+VOID atSms_RecvZmglRsp(T_zAt_AtRes *pResLine)

+{

+	static T_zUfiSms_SmsItem tSmsPara = {0};

+	

+    printf("[SMS] atSms_RecvZmglRsp Enter pduFlag:%d/result:%d.\n",pResLine->pduFlag,pResLine->result);

+    if(pResLine->pduFlag == ZAT_ATRES_PDU_FLAG)

+    {

+        zUfiSms_CmglRespProc(pResLine, &tSmsPara);

+    }

+    else

+    {

+		//ÊÕµ½Ò»ÌõÐÂcmglºó£¬½«+cmgl:1,2,"",152¸ñʽ»¯²¢´æ´¢IndexºÍstatus¡¢length

+		memset(&tSmsPara,0,sizeof(T_zUfiSms_SmsItem)); 

+		(void)zUfiSms_FormatSms(pResLine->resParas, sizeof(pResLine->resParas), &tSmsPara,1);

+		printf("[SMS] Zmgl Resp! index:%d/stat:%d/length:%d.\n", tSmsPara.index,tSmsPara.stat,tSmsPara.length);

+    }

+}

+

+int atSms_SendCmgrReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    CHAR pAtcmdStr[20]  = {0};

+

+	iSmsIndex = atoi(pAtCmdPara);

+	printf("[SMS] atSms_SendCmgrReq Get index:%d.\n",iSmsIndex);	

+	

+    snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+CMGR=%s\r\n", pAtCmdPara);

+    return zSvr_SendAtSyn(ZAT_CMGR_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+}

+

+VOID atSms_RecvCmgrRsp(T_zAt_AtRes *pResLine)

+{

+#if 0

+	static T_zUfiSms_SmsItem tSmsPara = {0};

+	T_zUfiSms_CmgrSetRsp tCmgrRsp = {0};

+	

+	printf("atSms_RecvCmgrRsp Enter pduFlag:%d/Paras:%s/result:%d.\n",pResLine->pduFlag,pResLine->resParas,pResLine->result);

+		

+    if(pResLine->pduFlag == ZAT_ATRES_PDU_FLAG)

+    {       

+

+        if(ZAT_RESULT_AUTOREPORT != pResLine->result)

+        {

+        	printf("!!!!!!!!!atSms_RecvCmgrRsp get result Error.\n");

+            return;

+        }

+

+		tCmgrRsp.index = tSmsPara.index;

+		tCmgrRsp.length = tSmsPara.length;

+		tCmgrRsp.stat = tSmsPara.stat;

+		sscanf(pResLine->resParas,"%500s", tCmgrRsp.pdu);

+		//strcpy(tCmgrRsp.pdu, pResLine->resParas);

+			

+        zUfiSms_CmgrRespProc(&tCmgrRsp);

+		zUfiMmi_SendSmsStatus();

+        sc_cfg_set("sms_recv_result", "ok");

+    }

+    else

+    {

+    	//ÊÕµ½Ò»ÌõÐÂcmgrºó£¬½«+cmgr:1,"",68¸ñʽ»¯²¢´æ´¢status¡¢length, ²»Ð¯´øË÷ÒýÖµ

+		memset(&tSmsPara,0,sizeof(T_zUfiSms_SmsItem)); 

+		

+		(void)zUfiSms_FormatSms(pResLine->resParas, &tSmsPara,2);

+		tSmsPara.index = iSmsIndex;

+		printf("======Cmgr Resp! index:%d/stat:%d/length:%d.\n", tSmsPara.index,tSmsPara.stat,tSmsPara.length);

+    }

+	#endif

+}

+

+int atSms_SendZmgrReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    CHAR pAtcmdStr[20]  = {0};

+

+	iSmsIndex = atoi(pAtCmdPara);

+	printf("[SMS] atSms_SendZmgrReq Get index:%d.\n",iSmsIndex);	

+	

+    snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+ZMGR=%s\r\n", pAtCmdPara);

+    return zSvr_SendAtSyn(ZAT_ZMGR_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+}

+

+VOID atSms_RecvZmgrOk(T_zAt_AtRes *pResLine, UINT8 *nextAt)

+{

+    return;

+}

+

+VOID atSms_RecvZmgrErr(T_zAt_AtRes *pResLine, UINT8 *nextAt)

+{

+    at_print(LOG_DEBUG,"SMS zmgr is fail\n");

+    at_print(LOG_DEBUG"[SMS] atSms_RecvZmgrErr  SMS zmgr is fail\n");

+    //if(0 != strcmp(cfg_safe_get("sr_state"), "sr_receiving"))

+    {

+        //¶ÌÐŽÓÊÕʧ°Ü£¬ÓÖ·Ç״̬±¨¸æ×´Ì¬

+        sc_cfg_set(NV_SMS_RECV_RESULT, "fail");

+        zUfiSms_ChangeMainState(SMS_STATE_RECVED);

+    }

+}

+

+VOID atSms_RecvZmgrRsp(T_zAt_AtRes *pResLine)

+{

+	static T_zUfiSms_SmsItem tSmsPara = {0};

+	T_zUfiSms_CmgrSetRsp tCmgrRsp = {0};

+	

+	printf("[SMS] atSms_RecvZmgrRsp Enter pduFlag:%d/Paras:%s/result:%d.\n",pResLine->pduFlag,pResLine->resParas,pResLine->result);

+		

+    if(pResLine->pduFlag == ZAT_ATRES_PDU_FLAG)

+    {       

+

+        if(ZAT_RESULT_AUTOREPORT != pResLine->result)

+        {

+        	printf("[SMS] atSms_RecvZmgrRsp get result Error.\n");

+            return;

+        }

+		

+		tCmgrRsp.index = tSmsPara.index;

+		tCmgrRsp.length = tSmsPara.length;

+		tCmgrRsp.stat = tSmsPara.stat;

+		sscanf(pResLine->resParas,"%500s", tCmgrRsp.pdu);

+		//strcpy(tCmgrRsp.pdu, pResLine->resParas);

+			

+        zUfiSms_ZmgrRespProc(&tCmgrRsp);

+		zUfiMmi_SendSmsStatus();

+        sc_cfg_set(NV_SMS_RECV_RESULT, "ok");

+    }

+    else

+    {

+    	//ÊÕµ½Ò»ÌõÐÂzmgrºó£¬½«+zmgr:1,"",68¸ñʽ»¯²¢´æ´¢status¡¢length, ²»Ð¯´øË÷ÒýÖµ

+		memset(&tSmsPara,0,sizeof(T_zUfiSms_SmsItem)); 

+		

+		(void)zUfiSms_FormatSms(pResLine->resParas, sizeof(pResLine->resParas), &tSmsPara,2);

+		tSmsPara.index = iSmsIndex;

+		printf("[SMS] Zmgr Resp! index:%d/stat:%d/length:%d.\n", tSmsPara.index,tSmsPara.stat,tSmsPara.length);

+    }

+}

+

+

+int atSms_SendCmgdReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    CHAR pAtcmdStr[20]  = {0};

+    

+    snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+CMGD=%s\r\n", pAtCmdPara);

+    return zSvr_SendAtSyn(ZAT_CMGD_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+}

+

+VOID atSms_RecvCmgdOk(VOID)

+{

+    CHAR  strUsed[10]    = {0};

+    int used = 0;

+    

+    sc_cfg_set(NV_SMS_DEL_RESULT, "ok");

+    printf("[SMS] set sim_del_result to OK. \n");

+    

+    sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));

+    used = atoi(strUsed)-1;

+    if(used < 0)

+    {

+        used = 0;

+    }

+    memset(&strUsed, 0, 10);

+    snprintf(strUsed,sizeof(strUsed),"%d", used);

+    sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_USED, strUsed);

+}

+

+VOID atSms_RecvCmgdErr(VOID)

+{

+    

+    sc_cfg_set(NV_SMS_DEL_RESULT, "fail");

+    printf("[SMS] set sim_del_result to fail. \n");

+}

+

+VOID atSms_RecvCmgdFinish(VOID)

+{

+    char StrValue[10] = {0};

+    CHAR  strTotal[10]    = {0};

+    CHAR  strUsed[10]    = {0};

+    int total = 0;

+    int used = 0;

+    int remain = 0;

+    

+    sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));

+    used = atoi(strUsed);

+    sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strTotal,sizeof(strTotal));

+    total = atoi(strTotal);

+    remain = total - used;

+    if(remain < 0)

+    {

+        remain = 0;

+    }

+    

+    memset(&StrValue, 0, 10);

+    snprintf(StrValue,sizeof(StrValue),"%d", remain);

+    sc_cfg_set(ZTE_WMS_NVCONFIG_SIM_CARD_REMAIN,StrValue);

+    printf("[SMS] zUfiSms_DeleteSimSms used=%d,remain=%d,total=%d\n",used,remain,total);

+    zUfiSms_ChangeMainState(SMS_STATE_DELED);

+    sc_cfg_set(NV_SMS_DB_CHANGE,"1");

+}

+

+

+int atSms_SendCmgsReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+	int atRes = 0;

+    CHAR            pAtcmdStr[ZSMS_PDU_SIZE]    = {0};

+

+    snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+CMGS=%d\r\n", g_zUfiSms_FinalCmgsBuf.length);

+	atRes = zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+	if(atRes != ZAT_RESULT_SMS)

+	{

+		return atRes;

+	}

+

+	memset(pAtcmdStr, 0, ZSMS_PDU_SIZE);

+    //assert(strlen(g_zUfiSms_FinalCmgsBuf.pdu)< ZSMS_PDU_SIZE);

+    //Áôһλ¸ø½áβ·û

+    if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)< ZSMS_PDU_SIZE-1)

+    {

+        memcpy(pAtcmdStr, g_zUfiSms_FinalCmgsBuf.pdu, strlen(g_zUfiSms_FinalCmgsBuf.pdu));

+    }

+    else

+    {

+        printf("[SMS] atSms_SendCmgsReq pdu too long:%s\n",g_zUfiSms_FinalCmgsBuf.pdu);

+        memcpy(pAtcmdStr, g_zUfiSms_FinalCmgsBuf.pdu, ZSMS_PDU_SIZE-2);

+    }

+    // Ìí¼Ó½áβ·û

+    *(pAtcmdStr + strlen(g_zUfiSms_FinalCmgsBuf.pdu)) = ZSMS_CTRL_Z_CHAR;

+    memset(pAtRst, 0, atRstSize);

+	return zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+}

+

+

+VOID atSms_RecvCmgsOk(UINT8 *pResLine, int cid)

+{

+    at_print(LOG_DEBUG,"sms sended success. \n");	

+    g_zUfiSms_CurConcatSegNo++;

+    

+    if(g_zUfiSms_CurConcatSegNo > ZTE_WMS_CONCAT_SMS_COUNT_MAX)

+    {

+        return;

+    }

+    

+    //·¢Ëͳɹ¦Ò»½Ú

+    g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-1].tag = WMS_TAG_TYPE_MO_SENT_V01;

+    

+	zUfiSms_CmgsRespProc(cid);

+}

+

+VOID atSms_RecvCmgsErr(UINT8 *pResLine, int cid)

+{   

+    at_print(LOG_DEBUG,"sms sended fail. \n");

+    g_zUfiSms_CurConcatSegNo++;

+    if(g_zUfiSms_CurConcatSegNo > ZTE_WMS_CONCAT_SMS_COUNT_MAX)

+    {

+        return;

+    }

+    

+    //ʧ°ÜÊýÁ¿£¬×îÖÕдÈëÊý¾Ý¿â

+    g_zUfiSms_SendFailedCount++;

+    

+    at_print(LOG_DEBUG,"send sms failed,so write sms to draftbox.\n");

+    g_zUfiSms_DbStoreData[g_zUfiSms_CurConcatSegNo-1].tag = WMS_TAG_TYPE_MO_NOT_SENT_V01;

+    if(g_zUfiSms_ConcatTotalNum > 1)

+    {

+        // ³¤¶ÌÐÅ·¢ËÍʧ°Ü£¬ÖÃΪfalse

+        g_zUfiSms_IsConcatSendSuc = FALSE;

+    }

+    

+	zUfiSms_CmgsRespProc(cid);

+}

+

+

+VOID atSms_RecvCmgsRsp(T_zAt_AtRes *pResLine)

+{  

+	return;

+}

+

+

+VOID atSms_RecvCmtRsp(T_zAt_AtRes *pResLine)

+{

+    //ÅжÏÊÇ·ñÖ§³ÖSMS

+    //added by wenqin 2016-5-18

+    CHAR needSMS[50] = {0};

+    sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));

+    if(0 == strcmp(needSMS, "no"))

+    {

+        printf("[SMS]atSms_RecvCmtRsp needSMS=no!");

+        return;

+    }

+    

+    

+    static T_zUfiSms_SmsItem tSmsPara = {0};

+    T_zUfiSms_CmtSetRsp tCmtRsp = {0};

+    

+    if(NULL == pResLine) 

+    {

+        return;

+    }

+    

+    printf("[SMS] atSms_RecvCmtRsp Enter pduFlag:%d/Paras:%s/result:%d.\n",pResLine->pduFlag,pResLine->resParas,pResLine->result);

+    

+    if(pResLine->pduFlag == ZAT_ATRES_PDU_FLAG)

+    {       

+        

+        if(ZAT_RESULT_AUTOREPORT != pResLine->result)

+        {

+            printf("[SMS] atSms_RecvCmtRsp get result Error.\n");

+            return;

+        }

+        

+        tCmtRsp.length = tSmsPara.length;

+        sscanf(pResLine->resParas,"%500s", tCmtRsp.pdu);

+        

+        pthread_mutex_lock(&smsdb_mutex);

+        zUfiSms_CmtRespProc(&tCmtRsp);

+        zUfiMmi_SendSmsStatus();

+        pthread_mutex_unlock(&smsdb_mutex);

+        sc_cfg_set(NV_SMS_RECV_RESULT, "ok");

+    }

+    else

+    {

+        memset(&tSmsPara,0,sizeof(T_zUfiSms_SmsItem)); 

+        atBase_PreProcRes(pResLine->resParas, sizeof(pResLine->resParas));

+        printf("[SMS] cmt ind! pResLine->resParas:%s.\n", pResLine->resParas);

+        sscanf(pResLine->resParas,"%s %d", tSmsPara.alpha, &tSmsPara.length);	

+        printf("[SMS] cmt ind! length:%d.\n", tSmsPara.length);

+    }

+}

+

+VOID atSms_RecvCmtiRsp(T_zAt_AtRes *pResLine)

+{

+    //ÅжÏÊÇ·ñÖ§³ÖSMS

+    //added by wenqin 2016-5-18

+    CHAR needSMS[50] = {0};

+    sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));

+    if(0 == strcmp(needSMS, "no"))

+    {

+        printf("[SMS]atSms_RecvCmtRsp needSMS=no!");

+        return;

+    }

+    

+    char sms_Main_state[30]={0};

+    char * memory = NULL;

+

+	printf("[SMS] atSms_RecvCmtiRsp enter %s.\n",pResLine->resParas);

+

+    if(NULL == pResLine) 

+    {

+        return;

+    }

+    

+    if(ZAT_CMTI_CMD != pResLine->atCmdId)

+    {

+        return;

+    }

+

+    //ɾ³ý¹ý³ÌÖв»½ÓÊÜжÌÐÅ

+    sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));

+    if(strcmp(sms_Main_state,"sms_deling")==0)

+    {

+    	printf("[SMS] atSms_RecvCmtiRsp: sms_deling\n");

+        return;

+    }

+

+    // ÉèÖöÌÐÅ´æ´¢ÇøÓò£¬ZMGRÈ¥¶ÁÈ¡

+    memory = strstr(pResLine->resParas,"\"");

+    if(NULL != memory)

+    {

+    	memory++;

+    }

+	

+	if(0 == strncmp("SM", memory, 2))

+    {

+        zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);       

+        zUfiSms_ChangeMainState(SMS_STATE_RECVING);

+        memory += 4;

+        printf("[SMS] send cmgr: %s\n",memory);

+        zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_ZMGR,strlen(memory),memory);

+    }

+    else //Ä£¿éÔÚÖØÆôºó¾­³£³öÏÖ¶ÌÐŴ洢λÖÃΪSRµÄÇé¿ö

+    {

+        printf("[SMS] atSms_RecvCmtiRsp :store location not SM.\n");

+    }

+    sc_cfg_set(NV_SMS_RECV_RESULT, "");

+}

+

+VOID atSms_RecvCdsRsp(T_zAt_AtRes *pResLine)

+{

+    //ÅжÏÊÇ·ñÖ§³ÖSMS

+    //added by wenqin 2016-5-18

+    CHAR needSMS[50] = {0};

+    sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));

+    if(0 == strcmp(needSMS, "no"))

+    {

+        printf("[SMS]atSms_RecvCmtRsp needSMS=no!");

+        return;

+    }

+    

+    static T_zUfiSms_SmsItem tSmsPara = {0};

+    T_zUfiSms_CmgrSetRsp tCmgrRsp = {0};

+    

+    if(NULL == pResLine) 

+    {

+        return;

+    }

+    

+    if(pResLine->pduFlag == ZAT_ATRES_PDU_FLAG)

+    {       

+        

+        if(ZAT_RESULT_AUTOREPORT != pResLine->result)

+        {

+            printf("[SMS] atSms_RecvCdsRsp get result Error.\n");

+            return;

+        }

+        

+        tCmgrRsp.length = tSmsPara.length;

+        sscanf(pResLine->resParas,"%500s", tCmgrRsp.pdu);

+        

+        pthread_mutex_lock(&smsdb_mutex);

+        zUfiSms_CdsRespProc(&tCmgrRsp);

+        zUfiMmi_SendSmsStatus();

+        pthread_mutex_unlock(&smsdb_mutex);

+        sc_cfg_set(NV_SMS_RECV_RESULT, "ok");

+    }

+    else

+    {

+        memset(&tSmsPara,0,sizeof(T_zUfiSms_SmsItem)); 

+        atBase_PreProcRes(pResLine->resParas, sizeof(pResLine->resParas));

+        printf("[SMS] cds ind! pResLine->resParas:%s.\n", pResLine->resParas);

+        sscanf(pResLine->resParas,"%s %d", tSmsPara.alpha, &tSmsPara.length);	

+        printf("[SMS] atSms_RecvCdsRsp cds ind! length:%d.\n", tSmsPara.length);

+    }

+}

+

+VOID atSms_RecvCdsiRsp(T_zAt_AtRes *pResLine)

+{

+    //ÅжÏÊÇ·ñÖ§³ÖSMS

+    //added by wenqin 2016-5-18

+    CHAR needSMS[50] = {0};

+    sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));

+    if(0 == strcmp(needSMS, "no"))

+    {

+        printf("[SMS]atSms_RecvCmtRsp needSMS=no!");

+        return;

+    }

+    

+    char sms_Main_state[30]={0};

+    char * memory = NULL;

+    

+    printf("[SMS] atSms_RecvCdsiRsp enter %s.\n",pResLine->resParas);

+    

+    if(NULL == pResLine) 

+    {

+        return;

+    }

+    

+    if(ZAT_CDSI_CMD != pResLine->atCmdId)

+    {

+        return;

+    }

+    

+    //ɾ³ý¹ý³ÌÖв»½ÓÊÜжÌÐÅ

+    sc_cfg_get(NV_SMS_STATE,sms_Main_state,sizeof(sms_Main_state));

+    if(strcmp(sms_Main_state,"sms_deling")==0)

+    {

+        printf("[SMS] atSms_RecvCdsiRsp: sms_deling\n");

+        return;

+    }

+    

+    memory = strstr(pResLine->resParas,"\"");

+    if(NULL != memory)

+    {

+        memory++;

+    }

+    printf("[SMS] atSms_RecvCdsiRsp: memory = %s\n", memory);

+    if(0 == strncmp("SM", memory, 2))

+    {

+        zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);       

+        zUfiSms_ChangeMainState(SMS_STATE_RECVING);

+        memory += 4;

+        printf("[SMS] send cmgr: %s\n",memory);

+        zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,MSG_CMD_AT_ZMGR,strlen(memory),memory);

+    }

+    else //Ä£¿éÔÚÖØÆôºó¾­³£³öÏÖ¶ÌÐŴ洢λÖÃΪSRµÄÇé¿ö

+    {

+        printf("[SMS] atSms_RecvCdsiRsp :store location not SM.\n");

+    }

+    sc_cfg_set(NV_SMS_RECV_RESULT, "");

+}

+

+int atSms_SendZmenaReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    CHAR pAtcmdStr[20]  = {0};

+    

+    snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+ZMENA=%s\r\n", pAtCmdPara);

+    return zSvr_SendAtSyn(ZAT_ZMENA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+}

+

+VOID atSms_RecvZmenaOk(VOID)

+{

+    g_Zmena_rsp = TRUE;

+    return;

+}

+

+VOID atSms_RecvZmenaErr(VOID)

+{

+    g_Zmena_rsp = FALSE;

+    return;

+}

+

+

+int atSms_SendCnmaReq(PSTR pAtCmdPara, int cid, PSTR pAtRst, int atRstSize)

+{

+    int atRes = 0;

+    CHAR pAtcmdStr[ZSMS_PDU_SIZE]  = {0};

+    CHAR ackPduStr[50] = {0};

+        

+    if(atoi(pAtCmdPara) == 1)

+    {

+        snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+CNMA=%s\r\n", pAtCmdPara);

+        atRes = zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+        printf("[SMS] atSms_SendCnmaReq 111111 ack ok = %s.\n", pAtcmdStr);

+	 return 0;

+    }

+    else

+    {

+        zUfiSms_EncodePdu_DeliverReport(ackPduStr, 0xD3);       

+                

+        snprintf(pAtcmdStr, sizeof(pAtcmdStr),"AT+CNMA=%s,%d\r\n", pAtCmdPara, strlen(ackPduStr)/2);

+        atRes = zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);

+        if(atRes != ZAT_RESULT_SMS)

+        {

+            return atRes;

+        }

+        printf("[SMS] atSms_SendCnmaReq = %s.\n", pAtcmdStr);

+        

+        memset(pAtcmdStr, 0, ZSMS_PDU_SIZE);

+        

+        if(strlen(ackPduStr)< ZSMS_PDU_SIZE-1)

+        {

+            memcpy(pAtcmdStr, ackPduStr, strlen(ackPduStr));

+        }

+        else

+        {

+            printf("[SMS] atSms_SendCmgsReq pdu too long:%s\n",ackPduStr);

+            memcpy(pAtcmdStr, ackPduStr, ZSMS_PDU_SIZE-2);

+        }

+     

+        // Ìí¼Ó½áβ·û

+        *(pAtcmdStr + strlen(ackPduStr)) = ZSMS_CTRL_Z_CHAR;

+        printf("[SMS] atSms_SendCnmaReq. pdu= %s\n", pAtcmdStr);

+        memset(pAtRst, 0, atRstSize);

+        return zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);       

+    }

+    

+}

+

+VOID atSms_RecvCnmaRsp(T_zAt_AtRes *pResLine)

+{

+    return;

+}

+

+

+VOID atUnsoli_Delete_Sim_Sms(UINT8 *pDatabuf, int cid)

+{

+	CHAR errCode[ZSVR_AT_RES_CODE_LEN] = {0};	

+	int atRes = 0;

+

+    if(pDatabuf == NULL)

+    {

+        return;

+    }

+   	atRes = atSms_SendCmgdReq(pDatabuf, cid, errCode, ZSVR_AT_RES_CODE_LEN);

+    if(atRes == ZSMS_RESULT_OK)

+    {

+        atSms_RecvCmgdOk();

+    }

+    else

+    {

+        atSms_RecvCmgdErr();

+    }

+    atSms_RecvCmgdFinish();

+}

+

+

+VOID atUnsoli_Report_Cnma(UINT8 *pDatabuf, int cid)

+{

+    CHAR errCode[ZSVR_AT_RES_CODE_LEN] = {0};	

+    if(pDatabuf == NULL)

+    {

+        printf("[SMS] atUnsoli_Report_Cnma null");

+        return;

+    }

+    atSms_SendCnmaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);

+}

+

+

+VOID atUnsoli_Report_Zmena(UINT8 *pDatabuf, int cid)

+{

+    CHAR errCode[ZSVR_AT_RES_CODE_LEN] = {0};

+    int atRes = 0;

+

+    if(pDatabuf == NULL)

+    {

+        printf("[SMS] atUnsoli_Report_Zmena null");

+        return;

+    }

+

+	atRes = atSms_SendZmenaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);

+    if(atRes == ZSMS_RESULT_OK)

+    {

+        atSms_RecvZmenaOk();

+    }

+    else

+    {

+        atSms_RecvZmenaErr();

+    }

+}

+

+VOID atUnsoli_Report_Zmgr(UINT8 *pDatabuf, int cid)

+{

+    CHAR errCode[ZSVR_AT_RES_CODE_LEN] = {0};	

+    if(pDatabuf == NULL)

+    {

+        printf("[SMS] atUnsoli_Report_Zmgr null");

+        return;

+    }

+    atSms_SendZmgrReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);

+}

 #endif

-}int atSms_SendZmgrReq(PSTR pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR 
-pAtcmdStr[(0x12ec+4760-0x2570)]={(0x1e5a+1155-0x22dd)};iSmsIndex=atoi(pAtCmdPara
-);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);snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x5a\x4d\x47\x52\x3d\x25\x73" "\r\n",pAtCmdPara);return 
-zSvr_SendAtSyn(ZAT_ZMGR_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvZmgrOk(T_zAt_AtRes*pResLine,UINT8*nextAt){return;}VOID 
-atSms_RecvZmgrErr(T_zAt_AtRes*pResLine,UINT8*nextAt){at_print(LOG_DEBUG,
-"\x53\x4d\x53\x20\x7a\x6d\x67\x72\x20\x69\x73\x20\x66\x61\x69\x6c" "\n");
-at_print(LOG_DEBUG
-"\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 atSms_RecvZmgrRsp(T_zAt_AtRes*pResLine){static 
-T_zUfiSms_SmsItem tSmsPara={(0x753+3546-0x152d)};T_zUfiSms_CmgrSetRsp tCmgrRsp={
-(0x1ef3+1207-0x23aa)};printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
-,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
-ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->result){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x5a\x6d\x67\x72\x52\x73\x70\x20\x67\x65\x74\x20\x72\x65\x73\x75\x6c\x74\x20\x45\x72\x72\x6f\x72\x2e" "\n"
-);return;}tCmgrRsp.index=tSmsPara.index;tCmgrRsp.length=tSmsPara.length;tCmgrRsp
-.stat=tSmsPara.stat;sscanf(pResLine->resParas,"\x25\x35\x30\x30\x73",tCmgrRsp.
-pdu);zUfiSms_ZmgrRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();sc_cfg_set(
-NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,(0x164+6948-0x1c88),sizeof
-(T_zUfiSms_SmsItem));(void)zUfiSms_FormatSms(pResLine->resParas,sizeof(pResLine
-->resParas),&tSmsPara,(0x1d1b+2531-0x26fc));tSmsPara.index=iSmsIndex;printf(
-"\x5b\x53\x4d\x53\x5d\x20\x5a\x6d\x67\x72\x20\x52\x65\x73\x70\x21\x20\x69\x6e\x64\x65\x78\x3a\x25\x64\x2f\x73\x74\x61\x74\x3a\x25\x64\x2f\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
-,tSmsPara.index,tSmsPara.stat,tSmsPara.length);}}int atSms_SendCmgdReq(PSTR 
-pAtCmdPara,int cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x27d+4796-0x1525)
-]={(0x97d+1670-0x1003)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x43\x4d\x47\x44\x3d\x25\x73" "\r\n",pAtCmdPara);return 
-zSvr_SendAtSyn(ZAT_CMGD_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvCmgdOk(VOID){CHAR strUsed[(0x1690+1574-0x1cac)]={(0x913+4519-0x1aba)};
-int used=(0x1bd3+2499-0x2596);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));used=atoi(
-strUsed)-(0x9c0+3095-0x15d6);if(used<(0x1763+1318-0x1c89)){used=
-(0x114c+1414-0x16d2);}memset(&strUsed,(0x7c+677-0x321),(0x152f+1998-0x1cf3));
-snprintf(strUsed,sizeof(strUsed),"\x25\x64",used);sc_cfg_set(
-ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed);}VOID atSms_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 atSms_RecvCmgdFinish(VOID){char StrValue[(0x206f+386-0x21e7)]={
-(0xacb+3889-0x19fc)};CHAR strTotal[(0x156b+799-0x1880)]={(0x192c+1325-0x1e59)};
-CHAR strUsed[(0xa58+4353-0x1b4f)]={(0x34c+8283-0x23a7)};int total=
-(0x1064+5727-0x26c3);int used=(0xe0d+3097-0x1a26);int remain=(0x430+258-0x532);
-sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_USED,strUsed,sizeof(strUsed));used=atoi(
-strUsed);sc_cfg_get(ZTE_WMS_NVCONFIG_SIM_CARD_TOTAL,strTotal,sizeof(strTotal));
-total=atoi(strTotal);remain=total-used;if(remain<(0xa0+7377-0x1d71)){remain=
-(0xf35+1527-0x152c);}memset(&StrValue,(0x1482+3767-0x2339),(0x4c+8372-0x20f6));
-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 atSms_SendCmgsReq(PSTR pAtCmdPara,int cid,PSTR 
-pAtRst,int atRstSize){int atRes=(0xe4b+3483-0x1be6);CHAR pAtcmdStr[ZSMS_PDU_SIZE
-]={(0xba+3074-0xcbc)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x43\x4d\x47\x53\x3d\x25\x64" "\r\n",g_zUfiSms_FinalCmgsBuf.length)
-;atRes=zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);if(atRes!=
-ZAT_RESULT_SMS){return atRes;}memset(pAtcmdStr,(0x190c+644-0x1b90),ZSMS_PDU_SIZE
-);if(strlen(g_zUfiSms_FinalCmgsBuf.pdu)<ZSMS_PDU_SIZE-(0x12dc+1160-0x1763)){
-memcpy(pAtcmdStr,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(pAtcmdStr,g_zUfiSms_FinalCmgsBuf.pdu,
-ZSMS_PDU_SIZE-(0x610+601-0x867));}*(pAtcmdStr+strlen(g_zUfiSms_FinalCmgsBuf.pdu)
-)=ZSMS_CTRL_Z_CHAR;memset(pAtRst,(0xb7+1731-0x77a),atRstSize);return 
-zSvr_SendAtSyn(ZAT_CMGS_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvCmgsOk(UINT8*pResLine,int cid){at_print(LOG_DEBUG,
-"\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-(0x17d+9261-0x25a9)].tag=WMS_TAG_TYPE_MO_SENT_V01;
-zUfiSms_CmgsRespProc(cid);}VOID atSms_RecvCmgsErr(UINT8*pResLine,int cid){
-at_print(LOG_DEBUG,
-"\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++;at_print(
-LOG_DEBUG,
-"\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-(0x5bc+3822-0x14a9)].tag=
-WMS_TAG_TYPE_MO_NOT_SENT_V01;if(g_zUfiSms_ConcatTotalNum>(0x1198+3115-0x1dc2)){
-g_zUfiSms_IsConcatSendSuc=FALSE;}zUfiSms_CmgsRespProc(cid);}VOID 
-atSms_RecvCmgsRsp(T_zAt_AtRes*pResLine){return;}VOID atSms_RecvCmtRsp(
-T_zAt_AtRes*pResLine){CHAR needSMS[(0x10b5+773-0x1388)]={(0x209+3612-0x1025)};
-sc_cfg_get(NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0xe41+3041-0x1a22)==
-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;}static T_zUfiSms_SmsItem tSmsPara={(0x19d9+2833-0x24ea)};
-T_zUfiSms_CmtSetRsp tCmtRsp={(0xab0+4246-0x1b46)};if(NULL==pResLine){return;}
-printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x45\x6e\x74\x65\x72\x20\x70\x64\x75\x46\x6c\x61\x67\x3a\x25\x64\x2f\x50\x61\x72\x61\x73\x3a\x25\x73\x2f\x72\x65\x73\x75\x6c\x74\x3a\x25\x64\x2e" "\n"
-,pResLine->pduFlag,pResLine->resParas,pResLine->result);if(pResLine->pduFlag==
-ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->result){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x6d\x74\x52\x73\x70\x20\x67\x65\x74\x20\x72\x65\x73\x75\x6c\x74\x20\x45\x72\x72\x6f\x72\x2e" "\n"
-);return;}tCmtRsp.length=tSmsPara.length;sscanf(pResLine->resParas,
-"\x25\x35\x30\x30\x73",tCmtRsp.pdu);pthread_mutex_lock(&smsdb_mutex);
-zUfiSms_CmtRespProc(&tCmtRsp);zUfiMmi_SendSmsStatus();pthread_mutex_unlock(&
-smsdb_mutex);sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,
-(0xb79+3209-0x1802),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
-resParas,sizeof(pResLine->resParas));printf(
-"\x5b\x53\x4d\x53\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x21\x20\x70\x52\x65\x73\x4c\x69\x6e\x65\x2d\x3e\x72\x65\x73\x50\x61\x72\x61\x73\x3a\x25\x73\x2e" "\n"
-,pResLine->resParas);sscanf(pResLine->resParas,"\x25\x73\x20\x25\x64",tSmsPara.
-alpha,&tSmsPara.length);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x63\x6d\x74\x20\x69\x6e\x64\x21\x20\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
-,tSmsPara.length);}}VOID atSms_RecvCmtiRsp(T_zAt_AtRes*pResLine){CHAR needSMS[
-(0x3a+4255-0x10a7)]={(0x1997+2178-0x2219)};sc_cfg_get(NV_NEED_SUPPORT_SMS,
-needSMS,sizeof(needSMS));if((0x1f9+9003-0x2524)==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;}char sms_Main_state[(0xe6f+3877-0x1d76)]={(0x12b9+2632-0x1d01)};char*
-memory=NULL;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\x65\x6e\x74\x65\x72\x20\x25\x73\x2e" "\n"
-,pResLine->resParas);if(NULL==pResLine){return;}if(ZAT_CMTI_CMD!=pResLine->
-atCmdId){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")==
-(0x1246+1277-0x1743)){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;}memory=strstr(pResLine->resParas,"\"");if(NULL!=memory){memory++;}if(
-(0x7+3385-0xd40)==strncmp("\x53\x4d",memory,(0x14e2+4183-0x2537))){
-zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);zUfiSms_ChangeMainState(
-SMS_STATE_RECVING);memory+=(0x682+7316-0x2312);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x73\x65\x6e\x64\x20\x63\x6d\x67\x72\x3a\x20\x25\x73" "\n"
-,memory);zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,
-MSG_CMD_AT_ZMGR,strlen(memory),memory);}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 atSms_RecvCdsRsp(T_zAt_AtRes*pResLine
-){CHAR needSMS[(0x1429+2746-0x1eb1)]={(0x519+4865-0x181a)};sc_cfg_get(
-NV_NEED_SUPPORT_SMS,needSMS,sizeof(needSMS));if((0x1537+3158-0x218d)==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;}static T_zUfiSms_SmsItem tSmsPara={(0x1867+1625-0x1ec0)};
-T_zUfiSms_CmgrSetRsp tCmgrRsp={(0x276+5695-0x18b5)};if(NULL==pResLine){return;}
-if(pResLine->pduFlag==ZAT_ATRES_PDU_FLAG){if(ZAT_RESULT_AUTOREPORT!=pResLine->
-result){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x52\x73\x70\x20\x67\x65\x74\x20\x72\x65\x73\x75\x6c\x74\x20\x45\x72\x72\x6f\x72\x2e" "\n"
-);return;}tCmgrRsp.length=tSmsPara.length;sscanf(pResLine->resParas,
-"\x25\x35\x30\x30\x73",tCmgrRsp.pdu);pthread_mutex_lock(&smsdb_mutex);
-zUfiSms_CdsRespProc(&tCmgrRsp);zUfiMmi_SendSmsStatus();pthread_mutex_unlock(&
-smsdb_mutex);sc_cfg_set(NV_SMS_RECV_RESULT,"\x6f\x6b");}else{memset(&tSmsPara,
-(0x1472+4760-0x270a),sizeof(T_zUfiSms_SmsItem));atBase_PreProcRes(pResLine->
-resParas,sizeof(pResLine->resParas));printf(
-"\x5b\x53\x4d\x53\x5d\x20\x63\x64\x73\x20\x69\x6e\x64\x21\x20\x70\x52\x65\x73\x4c\x69\x6e\x65\x2d\x3e\x72\x65\x73\x50\x61\x72\x61\x73\x3a\x25\x73\x2e" "\n"
-,pResLine->resParas);sscanf(pResLine->resParas,"\x25\x73\x20\x25\x64",tSmsPara.
-alpha,&tSmsPara.length);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x52\x65\x63\x76\x43\x64\x73\x52\x73\x70\x20\x63\x64\x73\x20\x69\x6e\x64\x21\x20\x6c\x65\x6e\x67\x74\x68\x3a\x25\x64\x2e" "\n"
-,tSmsPara.length);}}VOID atSms_RecvCdsiRsp(T_zAt_AtRes*pResLine){CHAR needSMS[
-(0x1fdf+312-0x20e5)]={(0x14b8+3005-0x2075)};sc_cfg_get(NV_NEED_SUPPORT_SMS,
-needSMS,sizeof(needSMS));if((0x506+2099-0xd39)==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;}char sms_Main_state[(0x1419+153-0x1494)]={(0x182b+2074-0x2045)};char*
-memory=NULL;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\x65\x6e\x74\x65\x72\x20\x25\x73\x2e" "\n"
-,pResLine->resParas);if(NULL==pResLine){return;}if(ZAT_CDSI_CMD!=pResLine->
-atCmdId){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")==
-(0xb88+3843-0x1a8b)){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;}memory=strstr(pResLine->resParas,"\"");if(NULL!=memory){memory++;}
-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\x6d\x65\x6d\x6f\x72\x79\x20\x3d\x20\x25\x73" "\n"
-,memory);if((0x672+5749-0x1ce7)==strncmp("\x53\x4d",memory,(0x2400+403-0x2591)))
-{zUfiSms_SetSmsLocation(SMS_LOCATION_SIM);zUfiSms_ChangeMainState(
-SMS_STATE_RECVING);memory+=(0x18d4+1384-0x1e38);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x73\x65\x6e\x64\x20\x63\x6d\x67\x72\x3a\x20\x25\x73" "\n"
-,memory);zSvr_InnerSendMsg(ZUFI_MODULE_ID_AT_LOCAL,ZUFI_MODULE_ID_AT_UNSOLI,
-MSG_CMD_AT_ZMGR,strlen(memory),memory);}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 atSms_SendZmenaReq(PSTR pAtCmdPara,int
- cid,PSTR pAtRst,int atRstSize){CHAR pAtcmdStr[(0x10fc+656-0x1378)]={
-(0xe0f+5854-0x24ed)};snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x5a\x4d\x45\x4e\x41\x3d\x25\x73" "\r\n",pAtCmdPara);return 
-zSvr_SendAtSyn(ZAT_ZMENA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}VOID 
-atSms_RecvZmenaOk(VOID){g_Zmena_rsp=TRUE;return;}VOID atSms_RecvZmenaErr(VOID){
-g_Zmena_rsp=FALSE;return;}int atSms_SendCnmaReq(PSTR pAtCmdPara,int cid,PSTR 
-pAtRst,int atRstSize){int atRes=(0x68a+4025-0x1643);CHAR pAtcmdStr[ZSMS_PDU_SIZE
-]={(0x7f2+1008-0xbe2)};CHAR ackPduStr[(0x172c+1885-0x1e57)]={(0x3c3+4472-0x153b)
-};if(atoi(pAtCmdPara)==(0x6e9+7538-0x245a)){snprintf(pAtcmdStr,sizeof(pAtcmdStr)
-,"\x41\x54\x2b\x43\x4e\x4d\x41\x3d\x25\x73" "\r\n",pAtCmdPara);atRes=
-zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x31\x31\x31\x31\x31\x31\x20\x61\x63\x6b\x20\x6f\x6b\x20\x3d\x20\x25\x73\x2e" "\n"
-,pAtcmdStr);return(0xd2a+4658-0x1f5c);}else{zUfiSms_EncodePdu_DeliverReport(
-ackPduStr,(0xcef+5558-0x21d2));snprintf(pAtcmdStr,sizeof(pAtcmdStr),
-"\x41\x54\x2b\x43\x4e\x4d\x41\x3d\x25\x73\x2c\x25\x64" "\r\n",pAtCmdPara,strlen(
-ackPduStr)/(0xe50+3389-0x1b8b));atRes=zSvr_SendAtSyn(ZAT_CNMA_CMD,pAtcmdStr,cid,
-pAtRst,atRstSize);if(atRes!=ZAT_RESULT_SMS){return atRes;}printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x53\x6d\x73\x5f\x53\x65\x6e\x64\x43\x6e\x6d\x61\x52\x65\x71\x20\x3d\x20\x25\x73\x2e" "\n"
-,pAtcmdStr);memset(pAtcmdStr,(0x412+1275-0x90d),ZSMS_PDU_SIZE);if(strlen(
-ackPduStr)<ZSMS_PDU_SIZE-(0x353+5295-0x1801)){memcpy(pAtcmdStr,ackPduStr,strlen(
-ackPduStr));}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"
-,ackPduStr);memcpy(pAtcmdStr,ackPduStr,ZSMS_PDU_SIZE-(0xe0b+1562-0x1423));}*(
-pAtcmdStr+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"
-,pAtcmdStr);memset(pAtRst,(0x6aa+8231-0x26d1),atRstSize);return zSvr_SendAtSyn(
-ZAT_CNMA_CMD,pAtcmdStr,cid,pAtRst,atRstSize);}}VOID atSms_RecvCnmaRsp(
-T_zAt_AtRes*pResLine){return;}VOID atUnsoli_Delete_Sim_Sms(UINT8*pDatabuf,int 
-cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x19a7+2215-0x224e)};int atRes=
-(0x196c+196-0x1a30);if(pDatabuf==NULL){return;}atRes=atSms_SendCmgdReq(pDatabuf,
-cid,errCode,ZSVR_AT_RES_CODE_LEN);if(atRes==ZSMS_RESULT_OK){atSms_RecvCmgdOk();}
-else{atSms_RecvCmgdErr();}atSms_RecvCmgdFinish();}VOID atUnsoli_Report_Cnma(
-UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]={(0x131c+1462-0x18d2)
-};if(pDatabuf==NULL){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x43\x6e\x6d\x61\x20\x6e\x75\x6c\x6c"
-);return;}atSms_SendCnmaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);}VOID 
-atUnsoli_Report_Zmena(UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]
-={(0x11f7+2543-0x1be6)};int atRes=(0xb9a+4471-0x1d11);if(pDatabuf==NULL){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x5a\x6d\x65\x6e\x61\x20\x6e\x75\x6c\x6c"
-);return;}atRes=atSms_SendZmenaReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);if
-(atRes==ZSMS_RESULT_OK){atSms_RecvZmenaOk();}else{atSms_RecvZmenaErr();}}VOID 
-atUnsoli_Report_Zmgr(UINT8*pDatabuf,int cid){CHAR errCode[ZSVR_AT_RES_CODE_LEN]=
-{(0x1b04+672-0x1da4)};if(pDatabuf==NULL){printf(
-"\x5b\x53\x4d\x53\x5d\x20\x61\x74\x55\x6e\x73\x6f\x6c\x69\x5f\x52\x65\x70\x6f\x72\x74\x5f\x5a\x6d\x67\x72\x20\x6e\x75\x6c\x6c"
-);return;}atSms_SendZmgrReq(pDatabuf,cid,errCode,ZSVR_AT_RES_CODE_LEN);}
-#endif

-
+