poc(3797).c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. #include "includes.h"
  2. POC_DEF sutPocStatus;
  3. void pocDataInit(void){
  4. memset((unsigned char *)&sutPocStatus, 0, sizeof(POC_DEF));
  5. }
  6. /*�批��亥砭POC霈曄蔭�嗆�?
  7. dly:�亙藁鋡怨��函�憸𤑳�嚗��雿㤈s*/
  8. void pocProCtl(int dly){
  9. //3蝘埝䰻霂V�甈?
  10. static unsigned short cnt=0xfff;
  11. if(sutApp.gtMode!=0) return;//GT璅∪��𦒘��齿䰻霂?
  12. if(++cnt<(5*1000/dly)) return;
  13. cnt=0;
  14. if(getAppObjStatus(ASLEEP_LCD)==0) return;//POC隡𤑳��塚�銝滚���誘
  15. if(sutApp.pocParaDone<=1) msgAtSend("AT+POC=020000\r\n");//�其�璉�瘚见僎霈曄蔭POC��㺭
  16. msgAtSend("AT+COPS?\r\n");
  17. msgAtSend("AT+CTEC?\r\n");//�亥砭敶枏�蝵𤑳��嗅�
  18. msgAtSend("AT+UDP?\r\n");//�亥砭�蠘�㛖𠶖�?
  19. msgAtSend("AT+CSQ\r\n");//�亥砭靽∪噡撘箏漲
  20. msgAtSend("AT+GPIP?\r\nAT+GGIP?\r\n");//�亥砭PIP,GIP
  21. }
  22. char FindIndexBydouhao(char*data,char numb)
  23. {
  24. char i=0,j=0;
  25. while(*data){
  26. if(*data==','){
  27. i++;
  28. if(i==numb)return j+1;//龰飯瘍綴珨弇
  29. }
  30. data++;
  31. j++;
  32. }
  33. return 0;
  34. }
  35. static void micPro(int mic);
  36. static void spkPro(int spk);
  37. static void pocStartMsg(void);
  38. static void pro80Msg(char *msg);
  39. static void pro81Msg(char *msg);
  40. static void pro82Msg(char *msg);
  41. static void pro83Msg(char *msg);
  42. static void pro84Msg(char *msg);
  43. static void pro86Msg(char *msg);
  44. static void pro3dMsg(char *msg);
  45. static void pro3eMsg(char *msg);
  46. static void pro0eMsg(char *msg);
  47. static void pro1eMsg(char *msg);
  48. static void pro1dMsg(char *msg);
  49. static void pocGetVer(char *msg);
  50. static void pocGetPpp(char *msg);
  51. static void proGauthMsg(char *msg);
  52. static void proNoteMsg(char *msg);
  53. static void proNetMode(char *msg);
  54. static void proSimMode(char *msg);
  55. static void proPwrMode(char *msg);
  56. static void proFotaMsg(char *msg);
  57. static void proGmrMsg(char *msg);
  58. static void proSmsMsg(char *msg);
  59. static void proAlarmMsg(void);
  60. static void proPendMsg(void);
  61. static void proToneMsg(char *msg);
  62. static void proGPIPMsg(char *msg);
  63. static void proGGIPMsg(char *msg);
  64. static void proCsqMsg(char *msg);
  65. static void proMicSpk(int mic, int spk);
  66. static void proCopsMsg(char *msg);
  67. void cmdsProcess(char *msg, int len){//撌脣縧�匧�頧行揢銵?
  68. int i,j;
  69. char buf[10];
  70. //if(sutApp.pocInitStatus==0) sutApp.pocInitStatus=1;
  71. if(sutApp.gtMode==0){
  72. appSleepCtl(ASLEEP_POC, 1);
  73. tryWakeupApp();
  74. MSG_INFO(1,"POC:%s",msg);
  75. if(msgCmp(msg, "PocSleep")){//POC瘚潭�皝X�?
  76. appSleepCtl(ASLEEP_POC, 0);
  77. }
  78. // else if(msgCmp(msg, "+POC:WAKEUP")){//POC�𠺶��𧢲�?
  79. // }else if(msgCmp(msg, "+POC:8B")){
  80. // buf[0]=msg[9];buf[1]=msg[10];buf[2]=0;
  81. // proSpk(atoi(buf));
  82. // }else if(msgCmp(msg, "+POC:0B")){//+POC:0B000000
  83. // buf[0]=msg[7];buf[1]=msg[8];buf[2]=0;
  84. // proMic(atoi(buf));
  85. // }else if(msgCmp(msg, "+POC:0C00")){
  86. // proMic(3);//敶閖𨺗蝏𤘪�
  87. // }else if(msgCmp(msg, "+LSHTTS: END")){
  88. // sutPocStatus.TTS=0;
  89. // }else if(msgCmp(msg, "+HTTS: START")){
  90. // paControl(true);
  91. // sutPocStatus.TTS=1;
  92. // }
  93. else if(msgCmp(msg, "PTT_") || msgCmp(msg, "GW_")) pocGetVer(msg);
  94. else if(msgCmp(msg, "+POC:02000000")){
  95. //setPocPara(msg+13,len-13);
  96. //sutApp.startPoc=1;
  97. }else if(msgCmp(msg, "+POC:81")) pro81Msg(msg+7);
  98. else if(msgCmp(msg, "+POC:LOGIN")) pro82Msg(msg);
  99. else if(msgCmp(msg, "+POC:3D")) pro3dMsg(msg+7);
  100. else if(msgCmp(msg, "+POC:3E")) pro3eMsg(msg+7);
  101. else if(msgCmp(msg, "+POC:80")) pro80Msg(msg+7);
  102. else if(msgCmp(msg, "+POC:1E")) pro1eMsg(msg+7);
  103. else if(msgCmp(msg, "+POC:JOINGRP")) pro86Msg(msg);
  104. else if(msgCmp(msg, "+POC:83")) pro83Msg(msg+7);
  105. else if(msgCmp(msg, "+POC:84")) pro84Msg(msg+7);
  106. else if(msgCmp(msg, "+POC:0E")) pro0eMsg(msg+7);
  107. else if(msgCmp(msg, "+POC:1D")) pro1dMsg(msg+7);
  108. // else if(msgCmp(msg, "+POC:0D")) pro0dMsg(msg+7);
  109. // else if(msgCmp(msg, "+POC:28")) pro28Msg(msg);
  110. // else if(msgCmp(msg, "+POC:7F000000")) proVoiceMode(msg+13);
  111. else if(msgCmp(msg, "+CCID: ")) proCCIDMsg(msg+7);
  112. // else if(msgCmp(msg, "$GNRMC"))process_gps_data(msg+7,len-7);
  113. else if(msgCmp(msg, "+CTEC:")) proNetMode(msg+7);
  114. else if(msgCmp(msg, "+CSQ: ")) proCsqMsg(msg+6);
  115. else if(msgCmp(msg, "+COPS:")) proCopsMsg(msg);
  116. else if(msgCmp(msg, "+CPIN: READY")) sutApp.cardStatus=1;
  117. else if(msgCmp(msg, "+SIMCROSS"))proSimMode(msg+10);
  118. else if(msgCmp(msg, "SV")) strcpy(sutApp.modemVer, msg);
  119. // else if(msgCmp(msg,"+CACCP:"))ProGetMicLV(msg);
  120. else MSG_INFO(1, "skip:%d,%s", len,msg);
  121. }
  122. }
  123. //憭��POC璅∪�靽⊥�
  124. void pocCmdHandler(unsigned char *msg, int len){
  125. //�㗇��航��伐�憒��銝齿糓+POC:SLEEP嚗釶OC�賢𤧅�雴�
  126. static char tmp[300],ch;
  127. static int k=0;
  128. unsigned int j;
  129. if(sutApp.authReady==0) return;
  130. if(sutApp.gtMode !=0 && sutApp.gtTMode != 0){
  131. usbOutPut(msg, len);//TM璅∪�銝讠凒�仿�譍�
  132. return;
  133. }
  134. for(j=0;j<len;j++){//餈�誘
  135. if(k>=sizeof(tmp)) k=0;
  136. tmp[k++]=msg[j];
  137. if(ch=='\r' && msg[j]=='\n'){
  138. if(k!=2){
  139. //憭��
  140. k -=2;tmp[k]=0;//�餅��噼膠�Z�
  141. cmdsProcess(tmp,k);
  142. }
  143. k=0;
  144. }
  145. ch=msg[j];
  146. }
  147. }
  148. static void proMicSpk(int mic, int spk){
  149. if(mic==0 && spk==0){//0000
  150. if(newPara.KeySound!=0) pttBeepStart(false);
  151. sutPocStatus.spk=0;
  152. sutPocStatus.mic=0;
  153. sutPocStatus.TONE=0;
  154. }else if(mic==1 && spk==0){//0100
  155. if(newPara.KeySound!=0) pttBeepStart(false);
  156. sutPocStatus.mic=1;
  157. }else if(mic==0 && spk==1){//0001
  158. if(newPara.KeySound!=0) paControl(true);//pttBeepStart(false);
  159. else paControl(true);//�喲𡡒�鞟內�單𧒄嚗䔶�閬��撘���号
  160. sutPocStatus.spk=1;
  161. sutPocStatus.mic=0;
  162. }else if(mic==0 && spk==13){//0013
  163. if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
  164. }else if(mic==0 && spk==2){
  165. paControl(true);
  166. sutPocStatus.TONE=1;
  167. }
  168. }
  169. static void micPro(int mic){
  170. switch(mic){
  171. case 0://�喲𡡒mic
  172. sutPocStatus.mic=0;
  173. break;
  174. case 1://�枏�mic
  175. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  176. sutPocStatus.mic=1;
  177. //sutPocStatus.spk=0;
  178. break;
  179. }
  180. }
  181. static void spkPro(int spk){
  182. switch(spk){
  183. case 0://tone�喳��喲𡡒spk
  184. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  185. sutPocStatus.spk=0;
  186. break;
  187. case 1://tone�喳�靽脲�spk�枏�
  188. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  189. paControl(true);
  190. sutPocStatus.spk=1;
  191. sutPocStatus.mic=0;
  192. break;
  193. case 2://�剜𦆮TTS
  194. paControl(true);
  195. sutPocStatus.TTS=1;
  196. break;
  197. case 13://�a漲憭梯揖嚗�虾隞另one�寞��?
  198. if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
  199. break;
  200. }
  201. }
  202. /*POC撌脣鍳�冽��?*/
  203. static void pocStartMsg(void){
  204. sutApp.pocInitStatus=1;
  205. }
  206. /*敶枏�韐血噡��撅䂿黎蝏��銵其縑�?銝�甈⊥�扯繮�𡝗��?
  207. 銝滚�摨𠉛鍂��鍂銝滚���瘙��隞?
  208. 隞𦒘��函瑪�啁蒈敶蓥�銝餃𢆡銝𦠜𥁒銝�甈∪�銵?
  209. �飊T+POC=0D0000銋煺�銝𦠜𥁒銝�甈∪�銵?
  210. msg:000000,iiii(蝏��銵函揣撘?,dddddddd(蝏�D),nnnn(蝏���䀹㺭),mmmmmm(蝏��蝘?*/
  211. static void pro80Msg(char *msg){
  212. }
  213. /*���函��𣂼�靽⊥��𡑒”
  214. �飊T+POC=0E0000xxxxxxxx�亥砭
  215. msg:010000,iiii(�𣂼��𡑒”蝝W�),dddddddd(�𣂼�ID),mmmmmmmm(�𣂼��滨妍)*/
  216. static void pro81Msg(char *msg){
  217. }
  218. /*
  219. +POC:LOGIN,2,6077024,3000300031000000
  220. */
  221. static void pro82Msg(char *msg){
  222. char buf[3],*pName,index;
  223. int type,len;
  224. char Username[POC_GROUP_USER_NAME_LEN*2];
  225. index=FindIndexBydouhao(msg,1);
  226. MSG_INFO(1,"douhao =========%d",index);
  227. type=atoi(buf+index);
  228. switch(type){
  229. case 0:
  230. sutApp.reloginStatus=0;
  231. sutPocStatus.logined=0;
  232. if(0==memcmp(msg+10, "CEDECDF8C2E7C1ACBDD3",20)) sutPocStatus.PocLineOffReason=1;
  233. else if(0==memcmp(msg+10, "CEDEB7A8C1ACBDD3",16)) sutPocStatus.PocLineOffReason=2;
  234. else if(0==memcmp(msg+10, "C3BBD3D0B7FECEF1",16)) sutPocStatus.PocLineOffReason=3;
  235. else if(0==memcmp(msg+10, "B5C7C2BDCAA7B0DC",16)) sutPocStatus.PocLineOffReason=4;
  236. break;
  237. case 2:
  238. sutApp.reloginStatus=1;
  239. sutPocStatus.PocLineOffReason=0;
  240. index=FindIndexBydouhao(msg,3);
  241. len=strlen(msg+index);
  242. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  243. memcpy(Username, msg+index,len);
  244. Username[len]=0;
  245. StrAsciiToHex(Username, sutPocStatus.LocalUser.name);
  246. //msg[10]=0;
  247. index=FindIndexBydouhao(msg,2);
  248. sutPocStatus.LocalUser.ID=atoi(msg+index);//strtol(&msg+index, &pName, 16);
  249. MSG_INFO(1, "Login ok");
  250. sutPocStatus.loginResult=3;
  251. break;
  252. }
  253. }
  254. /*�劐犖霂渲�
  255. msg:00,dddddddd(�𣂼�id),nnnnnnnn(�𣂼��滨妍)*/
  256. static void pro83Msg(char *msg){
  257. int len;
  258. char callerName[POC_GROUP_USER_NAME_LEN*2];
  259. backLightReset();//��頝箏����瘙厩�蝤讠𧬘
  260. len=strlen(msg+10);
  261. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  262. memcpy(callerName, msg+10,len);
  263. callerName[len]=0;
  264. if(0!=memcmp(callerName, sutPocStatus.CallName,len)) StrAsciiToHex(callerName, sutPocStatus.CallName);
  265. }
  266. /*�訫鐤�滚�靽⊥�
  267. msg:00,mmmmmmmmmm(�訫鐤蝏𤘪�靽⊥�)
  268. BAF4BDD0B3C9B9A6 銵函內 �澆㙈�𣂼�
  269. BAF4BDD0CAA7B0DC 銵函內 �澆㙈憭梯揖
  270. CDCBB3F6C1D9CAB1BAF4BDD0 銵函內 ���箔葩�嗅鐤�?
  271. C1D9CAB1BAF4BDD031BAC5BBFA 銵函內 銝湔𧒄�澆㙈 1 �瑟㦤*/
  272. static void pro84Msg(char *msg){
  273. //unsigned char danhureport[POC_GROUP_USER_NAME_LEN+1];
  274. //StrAsciiToHex(msg+2, danhureport);
  275. if(0==memcmp(msg+2, "C1D9CAB1BAF4BDD0",16)){//銝湔𧒄�澆㙈 XXXX �芰�銝湔𧒄�澆㙈
  276. msg[2+16]=0;
  277. }
  278. ttsPlay(ENCODE_USER_GBK, msg+2);
  279. if(0==memcmp(msg+2, "C1D9CAB1", 8)) sutPocStatus.danHuStatus=1;
  280. else if(0==memcmp(msg+2, "CDCBB3F6", 8)) sutPocStatus.danHuStatus=0;
  281. else if(0==memcmp(msg+2, "BAF4BDD0B3C9B9A6", 16)) sutPocStatus.danHuStatus=1;
  282. }
  283. /*
  284. +POC:JOINGRP,0,201536,80622f67e8904700500053004b6dd58b0000
  285. */
  286. static void pro86Msg(char *msg){
  287. char buf[POC_GROUP_USER_NAME_LEN*4+40],*pName;
  288. int len,i;
  289. char GroupName[POC_GROUP_USER_NAME_LEN*2];
  290. char tmp[POC_GROUP_USER_NAME_LEN*2+20];
  291. char needTTs=0,index;
  292. sutPocStatus.logined=1;
  293. index=FindIndexBydouhao(msg, 3);
  294. len=strlen(msg+index);
  295. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  296. memcpy(GroupName, msg+index,len);
  297. GroupName[len]=0;
  298. //msg[10]=0;
  299. index=FindIndexBydouhao(msg, 2);
  300. sutPocStatus.LocalGroup.ID=atoi(msg+index);
  301. StrAsciiToHex(GroupName, sutPocStatus.LocalGroup.name);
  302. if(sutPocStatus.firstLogin==0|| sutApp.reloginTts){
  303. snprintf(tmp, sizeof(tmp), "%s,眒腎翹,%s", sutPocStatus.LocalUser.name,sutPocStatus.LocalGroup.name);
  304. backLightReset();//蝚砌�甈∠蒈敶閙𧒄嚗䔶����鈭株絲�?
  305. needTTs=1;
  306. sutApp.reloginTts=0;
  307. }else{
  308. snprintf(tmp, sizeof(tmp), "輛⻌,%s",sutPocStatus.LocalGroup.name);
  309. if(sutApp.groupTTSEnable!=0){
  310. needTTs=1;
  311. sutApp.groupTTSEnable=0;
  312. }
  313. }
  314. if(needTTs!=0){
  315. memset(buf, 0, sizeof(buf));
  316. for(i=0;i<strlen(tmp);i++){
  317. snprintf(GroupName, sizeof(GroupName), "%02x", tmp[i]);
  318. strcat(buf, GroupName);
  319. }
  320. ttsPlay(ENCODE_USER_GBK, buf);
  321. }
  322. sutPocStatus.danHuStatus=0;
  323. sutPocStatus.firstLogin=1;
  324. }
  325. /*�亥砭��撅䂿黎蝏��餅㺭���摨?
  326. �飊T+POC=3D0000�瑕�
  327. msg:000000,nnnn(��撅𧼮�撠睲葵蝢斤�)*/
  328. static void pro3dMsg(char *msg){
  329. char *pName;
  330. sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
  331. sutPocStatus.ListUpdate=1;
  332. MSG_INFO(1, "groupNum:%d", sutPocStatus.ListCurOnlineNum);
  333. }
  334. /*�亥砭��撅𧼮銁蝥踵��䀹�餅㺭���摨?
  335. �飊T+POC=3E0000�瑕�
  336. msg:000000,nnnn(��撅𧼮�撠睲葵�函瑪�𣂼�)*/
  337. static void pro3eMsg(char *msg){
  338. char *pName;
  339. sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
  340. sutPocStatus.ListUpdate=1;
  341. MSG_INFO(1, "userNum:%d", sutPocStatus.ListCurOnlineNum);
  342. }
  343. /*�亥砭���函��𣂼�靽⊥��嗉��痹�敺堒��函瑪�𣂼��餅㺭
  344. msg:000000,nnnn(�函瑪�𣂼��餅㺭)*/
  345. static void pro0eMsg(char *msg){
  346. }
  347. /*摰𡁻��亥砭���函黎蝏�葉��銁蝥踵��䀝縑�臬�摨?
  348. �飊T+POC=1E0000xxxxx�瑕�
  349. msg:010000,iiii(�𣂼��𡑒”蝝W�),dddddddd(�𣂼�ID),mmmmmmmm(�𣂼��滨妍)*/
  350. static void pro1eMsg(char *msg){
  351. char name[POC_GROUP_USER_NAME_LEN*2+1];
  352. int len;
  353. unsigned long id;
  354. char *pTemp;
  355. if(!uiAssist.status)return 1;
  356. len = strlen(&msg[18]);
  357. if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
  358. memcpy(name, &msg[18], len);
  359. name[len]=0;
  360. msg[18]=0;
  361. id=strtol(&msg[10],&pTemp,16);
  362. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=id;
  363. if(name[0]==0){
  364. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[0]=' ';
  365. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[1]=0;
  366. }else StrAsciiToHex(name, sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name);
  367. sutPocStatus.ListFillIndex++;
  368. if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
  369. sutPocStatus.ListGetOneFlag=1;
  370. sutPocStatus.ListDetailValid=1;
  371. }
  372. }
  373. /*摰𡁏𧒄�亥砭��撅䂿�靽⊥�
  374. �飊T+POC=1D0000xxxxx�瑕�
  375. msg:000000,iiii(蝏��銵函揣撘?,dddddddd(蝏�D),nnnn(�𣂼�銝芣㺭),mmmmmmmmm(�滨妍)*/
  376. static void pro1dMsg(char *msg){
  377. unsigned short num;
  378. char name[POC_GROUP_USER_NAME_LEN*2+1];
  379. unsigned long id;
  380. unsigned short index;
  381. char *pTemp;
  382. int len;
  383. if(!uiAssist.status)return ;
  384. len = strlen(&msg[22]);//撌脣縧�匧�頧行揢銵?
  385. if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
  386. memcpy(name, &msg[22], len);
  387. name[len]=0;
  388. msg[22]=0;
  389. num=strtol(&msg[18],&pTemp,16);
  390. msg[18]=0;
  391. id=strtol(&msg[10],&pTemp,16);
  392. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID=id;
  393. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].usernum=num;
  394. if(name[0]==0){
  395. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[0]=' ';
  396. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[1]=0;
  397. }else
  398. StrAsciiToHex(name, sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name);
  399. sutPocStatus.ListFillIndex++;
  400. if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
  401. sutPocStatus.ListGetOneFlag=1;
  402. sutPocStatus.ListDetailValid=1;
  403. }
  404. }
  405. /*
  406. +POC_VER:01027
  407. msg=01027
  408. */
  409. static void pocGetVer(char *msg){
  410. snprintf(sutApp.pocVersion, sizeof(sutApp.pocVersion), "%s",msg);
  411. }
  412. static void pocGetPpp(char *msg){
  413. if(msg[0]=='1') sutApp.pocPpp=1;
  414. else sutApp.pocPpp=0;
  415. }
  416. /*
  417. +GAUTH:AD86EBCCECC4
  418. msg=AD86EBCCECC4+�噼膠
  419. */
  420. static void proGauthMsg(char *msg){
  421. }
  422. /*
  423. +NOTE:0,1
  424. msg=0,1+�噼膠
  425. */
  426. static void proNoteMsg(char *msg){
  427. MSG_INFO(1,"authAck:%s",msg);
  428. }
  429. /*
  430. +CTEC: 0,0
  431. msg=0,0
  432. */
  433. static void proNetMode(char *msg){
  434. unsigned char netModeValue;
  435. char cmd[30];
  436. if(msg[0]<'0' || msg[0]>'9') return;
  437. netModeValue=atoi(msg);
  438. ctecCurrentSet=netModeValue;
  439. if(ctecCurrentSet != newPara.netMode){
  440. snprintf(cmd, sizeof(cmd),"AT+CTEC=%d,%d\r\n", ctecCurrentSet, newPara.netMode);
  441. msgAtSend(cmd);
  442. }
  443. }
  444. /*
  445. +COPS: 0,2,"46000",7
  446. msg=+COPS: 0,2,"46000",7
  447. */
  448. static void proCopsMsg(char *msg){
  449. int i,j=0,codeType;
  450. for(i=0;i<strlen(msg);i++){
  451. if(msg[i]==','){
  452. if(++j==3){
  453. codeType=msg[i+1]-0x30;
  454. if(codeType==7) codeType=4;
  455. if(netshowvalue!=codeType) netshowvalue=codeType;
  456. return;
  457. }
  458. }
  459. }
  460. }
  461. /*
  462. +SIMCROSS:0
  463. msg=0/1
  464. */
  465. static void proSimMode(char *msg){
  466. unsigned char tmpSim;
  467. tmpSim=msg[0]-0x30;
  468. if(tmpSim!=0 && tmpSim!=1) return;
  469. sutApp.simSel=tmpSim;
  470. }
  471. /*
  472. +UDP:0,5,30
  473. msg=0,5,30
  474. */
  475. static void proPwrMode(char *msg){
  476. int seg1,seg2;
  477. short i;
  478. char buf[15];
  479. for(i=2;i<strlen(msg);i++){
  480. if(msg[i]==','){
  481. seg1=atoi(msg+2);
  482. seg2=atoi(msg+i+1);
  483. pwrModeAckHandler(seg1,seg2);
  484. }
  485. }
  486. }
  487. /*
  488. +FOTA:1,0
  489. +FOTA:1,XXX
  490. +FOTA:0
  491. +FOTA:1
  492. +FOTA:2
  493. msg=1,xxxx
  494. */
  495. static void proFotaMsg(char *msg){
  496. if(msg[1]==','){
  497. if(msg[2]=='0' && msg[3]==0) sutApp.fotaStatus=1;
  498. else{
  499. strcpy(sutApp.fotaVersion, msg+2);
  500. sutApp.fotaStatus=2;
  501. }
  502. }else if(msg[1]==0){
  503. if(msg[0]=='0') sutApp.fotaStatus=3;
  504. else if(msg[0]=='1') sutApp.fotaStatus=4;
  505. else if(msg[0]=='2') sutApp.fotaStatus=5;
  506. }
  507. }
  508. /*
  509. SV63302_T02
  510. msg=SV63302_T02
  511. */
  512. static void proGmrMsg(char *msg){
  513. snprintf(sutApp.modemVer, sizeof(sutApp.modemVer), "%s", msg);
  514. }
  515. /*
  516. +SMS:1,B2E2CAD4313233
  517. msg=1,B2E2CAD4313233
  518. */
  519. static void proSmsMsg(char *msg){
  520. }
  521. /*�滚𦛚�冽𥁒銝见��亥郎TTS嚗釶OC撌脫偘�伐��砌縑�臬蘨�鞟內*/
  522. static void proAlarmMsg(void){
  523. }
  524. static void proPendMsg(void){
  525. MSG_INFO(1, "active auth now");
  526. msgAtSend("AT+GAUTH\r\n");//�其����璉�瘚?
  527. }
  528. static void proToneMsg(char *msg){
  529. #ifndef ENABLE_PWM_BEEP
  530. if(msg[0]=='1'){
  531. sutPocStatus.TONE=1;
  532. paControl(true);
  533. }else if(msg[0]=='0'){
  534. sutPocStatus.TONE=0;
  535. }
  536. #endif
  537. }
  538. /*
  539. +GPIP:183.131.13.10
  540. msg=183.131.13.10
  541. */
  542. static void proGPIPMsg(char *msg){
  543. if(strlen(msg)<7) return;
  544. if(strcmp(showPIP, msg)==0) return;
  545. snprintf(showPIP, sizeof(showPIP), "%s",msg);
  546. MSG_INFO(1, "updatePIP:%s", showPIP);
  547. }
  548. /*
  549. +GGIP:183.131.13.6
  550. msg=183.131.13.6
  551. */
  552. static void proGGIPMsg(char *msg){
  553. if(strlen(msg)<7) return;
  554. if(strcmp(showGIP, msg)==0) return;
  555. snprintf(showGIP, sizeof(showGIP), "%s",msg);
  556. MSG_INFO(1, "updateGIP:%s", showGIP);
  557. }
  558. /*
  559. +CSQ: 14,99
  560. msg=14,99
  561. */
  562. static void proCsqMsg(char *msg){
  563. int csq=atoi(msg);
  564. if(csq != sutApp.g_iCSQ) sutApp.g_iCSQ=csq;
  565. }
  566. /*
  567. +HEADSET:1
  568. msg=1
  569. */
  570. void proHeadSet(char *msg){
  571. switch(msg[0]){
  572. case '0'://HEADSET CONNECT
  573. sutApp.earLev=1;
  574. //msgAtSend("AT+AUDCH=1,3\r\n");
  575. sutApp.pcant=2;
  576. VolMicUpdate();
  577. VolSpkUpdate();
  578. break;//HEADSET DISCONNECTED
  579. case '1':
  580. sutApp.earLev=0;
  581. //msgAtSend("AT+AUDCH=0,0\r\n");
  582. sutApp.pcant=4;
  583. VolMicUpdate();
  584. VolSpkUpdate();
  585. break;//HEADSET BTN PRESS
  586. case '2':
  587. micPttHandler(1);
  588. break;//HEADSET BTN RELEASED
  589. case '3':
  590. micPttHandler(0);
  591. break;
  592. }
  593. }
  594. /*
  595. +CCID: 898604851920C0133569
  596. msg=898604851920C0133569
  597. */
  598. void proCCIDMsg(char *msg){
  599. sutApp.cardStatus=1;
  600. msg[6]=0;
  601. sutApp.copstype=atoi(msg+4);
  602. }
  603. void LogoutOutTimeCheck(unsigned int interval){
  604. //�厩瑪�舘�餈?����滨蒈敶𤏪���閬�偘�曄蒈敶蓥縑�?
  605. static unsigned char lastLoginStatus=0;
  606. static unsigned int cnt=0;
  607. if(sutApp.reloginStatus == lastLoginStatus) return;
  608. if(sutApp.reloginStatus==0){//�勗銁蝥踹��鞉�蝥?
  609. if(++cnt>=(180000/interval)){
  610. cnt=0;
  611. sutApp.reloginTts=1;
  612. }
  613. }else{//�望�蝥踹�銝羓瑪
  614. cnt=0;
  615. }
  616. lastLoginStatus=sutApp.reloginStatus;
  617. }
  618. char *ohpocGetIMEI(void){
  619. static char imei[16]={0};
  620. if(imei[0]==0){
  621. if(LSAPI_SIM_GetIMEI(imei)==0){
  622. return imei;
  623. }
  624. }
  625. return NULL;
  626. }