poc(1018).c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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绉掓煡璇�竴娆?
  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娴兼垹婀㈡禍?
  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;//鍘绘帀鍥炶溅鎹㈣�
  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://鎶㈤害澶辫触锛屽彲浠�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(鎴愬憳鍒楄〃绱㈠紩),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,3);
  226. if(index==0)return;//长度不够的直接丢了
  227. index=FindIndexBydouhao(msg,1);
  228. type=atoi(buf+index);
  229. switch(type){
  230. case 0:
  231. sutApp.reloginStatus=0;
  232. sutPocStatus.logined=0;
  233. if(0==memcmp(msg+10, "CEDECDF8C2E7C1ACBDD3",20)) sutPocStatus.PocLineOffReason=1;
  234. else if(0==memcmp(msg+10, "CEDEB7A8C1ACBDD3",16)) sutPocStatus.PocLineOffReason=2;
  235. else if(0==memcmp(msg+10, "C3BBD3D0B7FECEF1",16)) sutPocStatus.PocLineOffReason=3;
  236. else if(0==memcmp(msg+10, "B5C7C2BDCAA7B0DC",16)) sutPocStatus.PocLineOffReason=4;
  237. break;
  238. case 2:
  239. sutApp.reloginStatus=1;
  240. sutPocStatus.PocLineOffReason=0;
  241. index=FindIndexBydouhao(msg,3);
  242. len=strlen(msg+index);
  243. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  244. memcpy(Username, msg+index,len);
  245. Username[len]=0;
  246. StrAsciiToHex(Username, sutPocStatus.LocalUser.name);
  247. //msg[10]=0;
  248. index=FindIndexBydouhao(msg,2);
  249. sutPocStatus.LocalUser.ID=atoi(msg+index);//strtol(&msg+index, &pName, 16);
  250. MSG_INFO(1, "Login ok");
  251. sutPocStatus.loginResult=3;
  252. break;
  253. }
  254. }
  255. /*鏈変汉璇磋瘽
  256. msg:00,dddddddd(鎴愬憳id),nnnnnnnn(鎴愬憳鍚嶇О)*/
  257. static void pro83Msg(char *msg){
  258. int len;
  259. char callerName[POC_GROUP_USER_NAME_LEN*2];
  260. backLightReset();//閺€璺哄煂閺堝�姹夌拠纾嬬樈
  261. len=strlen(msg+10);
  262. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  263. memcpy(callerName, msg+10,len);
  264. callerName[len]=0;
  265. if(0!=memcmp(callerName, sutPocStatus.CallName,len)) StrAsciiToHex(callerName, sutPocStatus.CallName);
  266. }
  267. /*鍗曞懠鍝嶅簲淇℃伅
  268. msg:00,mmmmmmmmmm(鍗曞懠缁撴灉淇℃伅)
  269. BAF4BDD0B3C9B9A6 琛ㄧず 鍛煎彨鎴愬姛
  270. BAF4BDD0CAA7B0DC 琛ㄧず 鍛煎彨澶辫触
  271. CDCBB3F6C1D9CAB1BAF4BDD0 琛ㄧず 閫€鍑轰复鏃跺懠鍙?
  272. C1D9CAB1BAF4BDD031BAC5BBFA 琛ㄧず 涓存椂鍛煎彨 1 鍙锋満*/
  273. static void pro84Msg(char *msg){
  274. //unsigned char danhureport[POC_GROUP_USER_NAME_LEN+1];
  275. //StrAsciiToHex(msg+2, danhureport);
  276. if(0==memcmp(msg+2, "C1D9CAB1BAF4BDD0",16)){//涓存椂鍛煎彨 XXXX 鍙�暀涓存椂鍛煎彨
  277. msg[2+16]=0;
  278. }
  279. ttsPlay(ENCODE_USER_GBK, msg+2);
  280. if(0==memcmp(msg+2, "C1D9CAB1", 8)) sutPocStatus.danHuStatus=1;
  281. else if(0==memcmp(msg+2, "CDCBB3F6", 8)) sutPocStatus.danHuStatus=0;
  282. else if(0==memcmp(msg+2, "BAF4BDD0B3C9B9A6", 16)) sutPocStatus.danHuStatus=1;
  283. }
  284. /*
  285. +POC:JOINGRP,0,201536,80622f67e8904700500053004b6dd58b0000
  286. */
  287. static void pro86Msg(char *msg){
  288. char buf[POC_GROUP_USER_NAME_LEN*4+40],*pName;
  289. int len,i;
  290. char GroupName[POC_GROUP_USER_NAME_LEN*2];
  291. char tmp[POC_GROUP_USER_NAME_LEN*2+20];
  292. char needTTs=0,index;
  293. sutPocStatus.logined=1;
  294. index=FindIndexBydouhao(msg, 3);
  295. len=strlen(msg+index);
  296. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  297. memcpy(GroupName, msg+index,len);
  298. GroupName[len]=0;
  299. //msg[10]=0;
  300. index=FindIndexBydouhao(msg, 2);
  301. sutPocStatus.LocalGroup.ID=atoi(msg+index);
  302. StrAsciiToHex(GroupName, sutPocStatus.LocalGroup.name);
  303. if(sutPocStatus.firstLogin==0|| sutApp.reloginTts){
  304. snprintf(tmp, sizeof(tmp), "%s,已登录,%s", sutPocStatus.LocalUser.name,sutPocStatus.LocalGroup.name);
  305. backLightReset();//绗�竴娆$櫥褰曟椂锛屼繚鎸佸睆浜�捣鏉?
  306. needTTs=1;
  307. sutApp.reloginTts=0;
  308. }else{
  309. snprintf(tmp, sizeof(tmp), "进入,%s",sutPocStatus.LocalGroup.name);
  310. if(sutApp.groupTTSEnable!=0){
  311. needTTs=1;
  312. sutApp.groupTTSEnable=0;
  313. }
  314. }
  315. if(needTTs!=0){
  316. memset(buf, 0, sizeof(buf));
  317. for(i=0;i<strlen(tmp);i++){
  318. snprintf(GroupName, sizeof(GroupName), "%02x", tmp[i]);
  319. strcat(buf, GroupName);
  320. }
  321. //ttsPlay(ENCODE_USER_GBK, buf);
  322. }
  323. sutPocStatus.danHuStatus=0;
  324. sutPocStatus.firstLogin=1;
  325. }
  326. /*鏌ヨ�鎵€灞炵兢缁勬€绘暟鐨勫搷搴?
  327. 鍙慉T+POC=3D0000鑾峰緱
  328. msg:000000,nnnn(鎵€灞炲�灏戜釜缇ょ粍)*/
  329. static void pro3dMsg(char *msg){
  330. char *pName;
  331. sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
  332. sutPocStatus.ListUpdate=1;
  333. MSG_INFO(1, "groupNum:%d", sutPocStatus.ListCurOnlineNum);
  334. }
  335. /*鏌ヨ�鎵€灞炲湪绾挎垚鍛樻€绘暟鐨勫搷搴?
  336. 鍙慉T+POC=3E0000鑾峰緱
  337. msg:000000,nnnn(鎵€灞炲�灏戜釜鍦ㄧ嚎鎴愬憳)*/
  338. static void pro3eMsg(char *msg){
  339. char *pName;
  340. sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
  341. sutPocStatus.ListUpdate=1;
  342. MSG_INFO(1, "userNum:%d", sutPocStatus.ListCurOnlineNum);
  343. }
  344. /*鏌ヨ�鎵€鍦ㄧ粍鎴愬憳淇℃伅鏃惰繑鍥烇紝寰楀埌鍦ㄧ嚎鎴愬憳鎬绘暟
  345. msg:000000,nnnn(鍦ㄧ嚎鎴愬憳鎬绘暟)*/
  346. static void pro0eMsg(char *msg){
  347. }
  348. /*瀹氶噺鏌ヨ�鎵€鍦ㄧ兢缁勪腑鐨勫湪绾挎垚鍛樹俊鎭�搷搴?
  349. 鍙慉T+POC=1E0000xxxxx鑾峰緱
  350. msg:010000,iiii(鎴愬憳鍒楄〃绱㈠紩),dddddddd(鎴愬憳ID),mmmmmmmm(鎴愬憳鍚嶇О)*/
  351. static void pro1eMsg(char *msg){
  352. char name[POC_GROUP_USER_NAME_LEN*2+1];
  353. int len;
  354. unsigned long id;
  355. char *pTemp;
  356. if(!uiAssist.status)return 1;
  357. len = strlen(&msg[18]);
  358. if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
  359. memcpy(name, &msg[18], len);
  360. name[len]=0;
  361. msg[18]=0;
  362. id=strtol(&msg[10],&pTemp,16);
  363. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=id;
  364. if(name[0]==0){
  365. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[0]=' ';
  366. sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[1]=0;
  367. }else StrAsciiToHex(name, sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name);
  368. sutPocStatus.ListFillIndex++;
  369. if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
  370. sutPocStatus.ListGetOneFlag=1;
  371. sutPocStatus.ListDetailValid=1;
  372. }
  373. }
  374. /*瀹氭椂鏌ヨ�鎵€灞炵粍淇℃伅
  375. 鍙慉T+POC=1D0000xxxxx鑾峰緱
  376. msg:000000,iiii(缁勫垪琛ㄧ储寮?,dddddddd(缁処D),nnnn(鎴愬憳涓�暟),mmmmmmmmm(鍚嶇О)*/
  377. static void pro1dMsg(char *msg){
  378. unsigned short num;
  379. char name[POC_GROUP_USER_NAME_LEN*2+1];
  380. unsigned long id;
  381. unsigned short index;
  382. char *pTemp;
  383. int len;
  384. if(!uiAssist.status)return ;
  385. len = strlen(&msg[22]);//宸插幓鎺夊洖杞︽崲琛?
  386. if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
  387. memcpy(name, &msg[22], len);
  388. name[len]=0;
  389. msg[22]=0;
  390. num=strtol(&msg[18],&pTemp,16);
  391. msg[18]=0;
  392. id=strtol(&msg[10],&pTemp,16);
  393. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID=id;
  394. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].usernum=num;
  395. if(name[0]==0){
  396. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[0]=' ';
  397. sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[1]=0;
  398. }else
  399. StrAsciiToHex(name, sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name);
  400. sutPocStatus.ListFillIndex++;
  401. if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
  402. sutPocStatus.ListGetOneFlag=1;
  403. sutPocStatus.ListDetailValid=1;
  404. }
  405. }
  406. /*
  407. +POC_VER:01027
  408. msg=01027
  409. */
  410. static void pocGetVer(char *msg){
  411. snprintf(sutApp.pocVersion, sizeof(sutApp.pocVersion), "%s",msg);
  412. }
  413. static void pocGetPpp(char *msg){
  414. if(msg[0]=='1') sutApp.pocPpp=1;
  415. else sutApp.pocPpp=0;
  416. }
  417. /*
  418. +GAUTH:AD86EBCCECC4
  419. msg=AD86EBCCECC4+鍥炶溅
  420. */
  421. static void proGauthMsg(char *msg){
  422. }
  423. /*
  424. +NOTE:0,1
  425. msg=0,1+鍥炶溅
  426. */
  427. static void proNoteMsg(char *msg){
  428. MSG_INFO(1,"authAck:%s",msg);
  429. }
  430. /*
  431. +CTEC: 0,0
  432. msg=0,0
  433. */
  434. static void proNetMode(char *msg){
  435. unsigned char netModeValue;
  436. char cmd[30];
  437. if(msg[0]<'0' || msg[0]>'9') return;
  438. netModeValue=atoi(msg);
  439. ctecCurrentSet=netModeValue;
  440. if(ctecCurrentSet != newPara.netMode){
  441. snprintf(cmd, sizeof(cmd),"AT+CTEC=%d,%d\r\n", ctecCurrentSet, newPara.netMode);
  442. msgAtSend(cmd);
  443. }
  444. }
  445. /*
  446. +COPS: 0,2,"46000",7
  447. msg=+COPS: 0,2,"46000",7
  448. */
  449. static void proCopsMsg(char *msg){
  450. int i,j=0,codeType;
  451. for(i=0;i<strlen(msg);i++){
  452. if(msg[i]==','){
  453. if(++j==3){
  454. codeType=msg[i+1]-0x30;
  455. if(codeType==7) codeType=4;
  456. if(netshowvalue!=codeType) netshowvalue=codeType;
  457. return;
  458. }
  459. }
  460. }
  461. }
  462. /*
  463. +SIMCROSS:0
  464. msg=0/1
  465. */
  466. static void proSimMode(char *msg){
  467. unsigned char tmpSim;
  468. tmpSim=msg[0]-0x30;
  469. if(tmpSim!=0 && tmpSim!=1) return;
  470. sutApp.simSel=tmpSim;
  471. }
  472. /*
  473. +UDP:0,5,30
  474. msg=0,5,30
  475. */
  476. static void proPwrMode(char *msg){
  477. int seg1,seg2;
  478. short i;
  479. char buf[15];
  480. for(i=2;i<strlen(msg);i++){
  481. if(msg[i]==','){
  482. seg1=atoi(msg+2);
  483. seg2=atoi(msg+i+1);
  484. pwrModeAckHandler(seg1,seg2);
  485. }
  486. }
  487. }
  488. /*
  489. +FOTA:1,0
  490. +FOTA:1,XXX
  491. +FOTA:0
  492. +FOTA:1
  493. +FOTA:2
  494. msg=1,xxxx
  495. */
  496. static void proFotaMsg(char *msg){
  497. if(msg[1]==','){
  498. if(msg[2]=='0' && msg[3]==0) sutApp.fotaStatus=1;
  499. else{
  500. strcpy(sutApp.fotaVersion, msg+2);
  501. sutApp.fotaStatus=2;
  502. }
  503. }else if(msg[1]==0){
  504. if(msg[0]=='0') sutApp.fotaStatus=3;
  505. else if(msg[0]=='1') sutApp.fotaStatus=4;
  506. else if(msg[0]=='2') sutApp.fotaStatus=5;
  507. }
  508. }
  509. /*
  510. SV63302_T02
  511. msg=SV63302_T02
  512. */
  513. static void proGmrMsg(char *msg){
  514. snprintf(sutApp.modemVer, sizeof(sutApp.modemVer), "%s", msg);
  515. }
  516. /*
  517. +SMS:1,B2E2CAD4313233
  518. msg=1,B2E2CAD4313233
  519. */
  520. static void proSmsMsg(char *msg){
  521. }
  522. /*鏈嶅姟鍣ㄦ姤涓嬪彂鎶ヨ�TTS锛孭OC宸叉挱鎶ワ紝鏈�俊鎭�彧鎻愮ず*/
  523. static void proAlarmMsg(void){
  524. }
  525. static void proPendMsg(void){
  526. MSG_INFO(1, "active auth now");
  527. msgAtSend("AT+GAUTH\r\n");//鐢ㄤ簬鎺堟潈妫€娴?
  528. }
  529. static void proToneMsg(char *msg){
  530. #ifndef ENABLE_PWM_BEEP
  531. if(msg[0]=='1'){
  532. sutPocStatus.TONE=1;
  533. paControl(true);
  534. }else if(msg[0]=='0'){
  535. sutPocStatus.TONE=0;
  536. }
  537. #endif
  538. }
  539. /*
  540. +GPIP:183.131.13.10
  541. msg=183.131.13.10
  542. */
  543. static void proGPIPMsg(char *msg){
  544. if(strlen(msg)<7) return;
  545. if(strcmp(showPIP, msg)==0) return;
  546. snprintf(showPIP, sizeof(showPIP), "%s",msg);
  547. MSG_INFO(1, "updatePIP:%s", showPIP);
  548. }
  549. /*
  550. +GGIP:183.131.13.6
  551. msg=183.131.13.6
  552. */
  553. static void proGGIPMsg(char *msg){
  554. if(strlen(msg)<7) return;
  555. if(strcmp(showGIP, msg)==0) return;
  556. snprintf(showGIP, sizeof(showGIP), "%s",msg);
  557. MSG_INFO(1, "updateGIP:%s", showGIP);
  558. }
  559. /*
  560. +CSQ: 14,99
  561. msg=14,99
  562. */
  563. static void proCsqMsg(char *msg){
  564. int csq=atoi(msg);
  565. if(csq != sutApp.g_iCSQ) sutApp.g_iCSQ=csq;
  566. }
  567. /*
  568. +HEADSET:1
  569. msg=1
  570. */
  571. void proHeadSet(char *msg){
  572. switch(msg[0]){
  573. case '0'://HEADSET CONNECT
  574. sutApp.earLev=1;
  575. //msgAtSend("AT+AUDCH=1,3\r\n");
  576. sutApp.pcant=2;
  577. VolMicUpdate();
  578. VolSpkUpdate();
  579. break;//HEADSET DISCONNECTED
  580. case '1':
  581. sutApp.earLev=0;
  582. //msgAtSend("AT+AUDCH=0,0\r\n");
  583. sutApp.pcant=4;
  584. VolMicUpdate();
  585. VolSpkUpdate();
  586. break;//HEADSET BTN PRESS
  587. case '2':
  588. micPttHandler(1);
  589. break;//HEADSET BTN RELEASED
  590. case '3':
  591. micPttHandler(0);
  592. break;
  593. }
  594. }
  595. /*
  596. +CCID: 898604851920C0133569
  597. msg=898604851920C0133569
  598. */
  599. void proCCIDMsg(char *msg){
  600. sutApp.cardStatus=1;
  601. msg[6]=0;
  602. sutApp.copstype=atoi(msg+4);
  603. }
  604. void LogoutOutTimeCheck(unsigned int interval){
  605. //鎺夌嚎鍚庤秴杩?鍒嗛挓鍐嶇櫥褰曪紝闇€瑕佹挱鏀剧櫥褰曚俊鎭?
  606. static unsigned char lastLoginStatus=0;
  607. static unsigned int cnt=0;
  608. if(sutApp.reloginStatus == lastLoginStatus) return;
  609. if(sutApp.reloginStatus==0){//鐢卞湪绾垮彉鎴愭帀绾?
  610. if(++cnt>=(180000/interval)){
  611. cnt=0;
  612. sutApp.reloginTts=1;
  613. }
  614. }else{//鐢辨帀绾垮啀涓婄嚎
  615. cnt=0;
  616. }
  617. lastLoginStatus=sutApp.reloginStatus;
  618. }
  619. char *ohpocGetIMEI(void){
  620. static char imei[16]={0};
  621. if(imei[0]==0){
  622. if(LSAPI_SIM_GetIMEI(imei)==0){
  623. return imei;
  624. }
  625. }
  626. return NULL;
  627. }