poc.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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. static unsigned short cnt=0;
  10. static unsigned char cnt2=0;
  11. if(sutApp.gtMode!=0) return;//GT璅∪��𦒘��齿䰻霂?
  12. if(++cnt<(5*1000/dly)) return;
  13. cnt=0;
  14. if(cnt2<3)cnt2++;
  15. if(cnt2==3){
  16. //�帋��寞䰻LBS
  17. if(sutApp.weather[0]==0&&newPara.newold_plam)broad_request_weather_info((double)0, (double)0);
  18. }
  19. if(getAppObjStatus(ASLEEP_LCD)==0) return;//POC隡𤑳��塚�銝滚���誘
  20. //�其�璉�瘚见僎霈曄蔭POC��㺭
  21. msgAtSend("AT+COPS?\r\n");
  22. msgAtSend("AT+CTEC?\r\n");//�亥砭敶枏�蝵𤑳��嗅�
  23. msgAtSend("AT+CSQ\r\n");//�亥砭靽∪噡撘箏漲
  24. }
  25. static void micPro(int mic);
  26. static void spkPro(int spk);
  27. static void pocStartMsg(void);
  28. static void pro80Msg(char *msg);
  29. static void pro81Msg(char *msg);
  30. static void pro82Msg(char *msg);
  31. static void pro83Msg(char *msg);
  32. static void pro84Msg(char *msg);
  33. static void pro86Msg(char *msg);
  34. static void pro3dMsg(char *msg);
  35. static void pro3eMsg(char *msg);
  36. static void pro0eMsg(char *msg);
  37. static void pro1eMsg(char *msg);
  38. static void pro1dMsg(char *msg);
  39. static void pocGetVer(char *msg);
  40. static void pocGetPpp(char *msg);
  41. static void proGauthMsg(char *msg);
  42. static void proNoteMsg(char *msg);
  43. static void proNetMode(char *msg);
  44. static void proSimMode(char *msg);
  45. static void proPwrMode(char *msg);
  46. static void proFotaMsg(char *msg);
  47. static void proGmrMsg(char *msg);
  48. static void proSmsMsg(char *msg);
  49. static void proAlarmMsg(void);
  50. static void proPendMsg(void);
  51. static void proToneMsg(char *msg);
  52. static void proGPIPMsg(char *msg);
  53. static void proGGIPMsg(char *msg);
  54. static void proCsqMsg(char *msg);
  55. static void proMicSpk(int mic, int spk);
  56. static void proCopsMsg(char *msg);
  57. static void proHeadSet(char *msg);
  58. static void proApnCopy(char *msg);
  59. void proCCIDMsg(char *msg);
  60. void cmdsProcess(char *msg, int len){//撌脣縧�匧�頧行揢銵?
  61. int i,j;
  62. char buf[10];
  63. if(sutApp.pocInitStatus==0) sutApp.pocInitStatus=1;
  64. if(sutApp.gtMode==0){
  65. //appSleepCtl(ASLEEP_POC, 1);
  66. tryWakeupApp();
  67. MSG_INFO(1,"POC:%s",msg);
  68. if(msgCmp(msg, "PocSleep")){//POC隡𤑳�鈭?
  69. appSleepCtl(ASLEEP_POC, 0);
  70. }else if(msgCmp(msg, "+POC:WAKEUP")){//POC�日�鈭?
  71. }else if(msgCmp(msg, "+POC:8B")){
  72. buf[0]=msg[7];buf[1]=msg[8];buf[2]=0;
  73. i=atoi(buf);
  74. buf[0]=msg[9];buf[1]=msg[10];buf[2]=0;
  75. j=atoi(buf);
  76. proMicSpk(i, j);
  77. }else if(msgCmp(msg, "+LSHTTS: END")){
  78. sutPocStatus.TTS=0;
  79. }else if(msgCmp(msg, "+HTTS: START")){
  80. paControl(true);
  81. sutPocStatus.TTS=1;
  82. }
  83. else if(msgCmp(msg, "+CTEC:")) proNetMode(msg+7);
  84. else if(msgCmp(msg, "+CSQ: ")) proCsqMsg(msg+6);
  85. else if(msgCmp(msg, "+COPS:")) proCopsMsg(msg);
  86. else if(msgCmp(msg, "+CPIN: READY")) sutApp.cardStatus=1;
  87. else if(msgCmp(msg, "+CCID: ")) proCCIDMsg(msg+7);
  88. else if(msgCmp(msg, "+SIMCROSS"))proSimMode(msg+10);
  89. else if(msgCmp(msg, "SV")) strcpy(sutApp.modemVer, msg);
  90. else if(msgCmp(msg, "+CGDCONT"))proApnCopy(msg);
  91. else MSG_INFO(1, "skip:%d,%s", len,msg);
  92. }
  93. }
  94. //憭��POC璅∪�靽⊥�
  95. void pocCmdHandler(unsigned char *msg, int len){
  96. //�㗇��航��伐�憒��銝齿糓+POC:SLEEP嚗釶OC�賢𤧅�雴�
  97. static char tmp[300],ch;
  98. static int k=0;
  99. unsigned int j;
  100. if(sutApp.authReady==0) return;
  101. if(sutApp.gtMode !=0 && sutApp.gtTMode != 0){
  102. //MSG_INFO(1,"stop USBsend");
  103. usbOutPut(msg, len);//TM TRACE
  104. return;
  105. }
  106. for(j=0;j<len;j++){//餈�誘
  107. if(k>=sizeof(tmp)) k=0;
  108. tmp[k++]=msg[j];
  109. if(ch=='\r' && msg[j]=='\n'){
  110. if(k!=2){
  111. //憭��
  112. k -=2;tmp[k]=0;//�餅��噼膠�Z�
  113. cmdsProcess(tmp,k);
  114. }
  115. k=0;
  116. }
  117. ch=msg[j];
  118. }
  119. }
  120. static void proApnCopy(char *msg){
  121. static char str1[128]={0};
  122. static char cnt=0;
  123. char info[64];
  124. int ret=0;
  125. //+CGDCONT: 0,"IPV4V6","","IPV4:0.0.0.0 IPV6:::"
  126. //+CGDCONT: 1,"IPV4V6","","IPV4:0.0.0.0 IPV6:::"
  127. //�𣂼�蝚�1銝芷�堒噡銝𡒊洵3銝芷�堒噡��揣撘�
  128. int dou_first=findByteFromStr(msg, strlen(msg),',',1);
  129. //int dou_two=findByteFromStr(msg, strlen(msg),',',2);
  130. int dou_three=findByteFromStr(msg, strlen(msg),',',3);
  131. if(dou_first<0 || dou_three<0) return;
  132. if(msg[10]=='0'){
  133. if(str1[0]=='\0' && cnt==0){
  134. cnt++;
  135. return;
  136. }else{
  137. msg[dou_three-1]=0;
  138. snprintf(info, sizeof(info), "%s", msg+dou_first);
  139. if(strcmp(info, str1)==0){
  140. sutApp.apnCopyDone=1;
  141. return;
  142. }
  143. //if(cnt==1){
  144. msgAtSend("AT+CGACT=0\r\n");
  145. LSAPI_OSI_ThreadSleep(500);
  146. snprintf(str1, sizeof(str1), "AT+CGDCONT=1,%s\r\n", info);
  147. MSG_INFO(1,"%s",str1);
  148. msgAtSend(str1);
  149. //}
  150. }
  151. }else if(msg[10]=='1'){
  152. msg[dou_three-1]=0;
  153. snprintf(str1, sizeof(str1), "%s", msg+dou_first);
  154. }
  155. }
  156. static void proMicSpk(int mic, int spk){
  157. if(mic==0 && spk==0){//0000
  158. if(newPara.KeySound!=0) pttBeepStart(false);
  159. sutPocStatus.spk=0;
  160. sutPocStatus.mic=0;
  161. sutPocStatus.TONE=0;
  162. }else if(mic==1 && spk==0){//0100
  163. if(newPara.KeySound!=0) pttBeepStart(false);
  164. sutPocStatus.mic=1;
  165. }else if(mic==0 && spk==1){//0001
  166. if(newPara.KeySound!=0) paControl(true);//pttBeepStart(false);
  167. else paControl(true);//�喲𡡒�鞟內�單𧒄嚗䔶�閬��撘���号
  168. sutPocStatus.spk=1;
  169. sutPocStatus.mic=0;
  170. }else if(mic==0 && spk==13){//0013
  171. if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
  172. }else if(mic==0 && spk==2){
  173. paControl(true);
  174. sutPocStatus.TONE=1;
  175. }
  176. }
  177. static void micPro(int mic){
  178. switch(mic){
  179. case 0://�喲𡡒mic
  180. sutPocStatus.mic=0;
  181. break;
  182. case 1://�枏�mic
  183. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  184. sutPocStatus.mic=1;
  185. //sutPocStatus.spk=0;
  186. break;
  187. }
  188. }
  189. static void spkPro(int spk){
  190. switch(spk){
  191. case 0://tone�喳��喲𡡒spk
  192. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  193. sutPocStatus.spk=0;
  194. break;
  195. case 1://tone�喳�靽脲�spk�枏�
  196. if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
  197. paControl(true);
  198. sutPocStatus.spk=1;
  199. sutPocStatus.mic=0;
  200. break;
  201. case 2://�剜𦆮TTS
  202. paControl(true);
  203. sutPocStatus.TTS=1;
  204. break;
  205. case 13://�a漲憭梯揖嚗�虾隞另one�寞��?
  206. if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
  207. break;
  208. }
  209. }
  210. /*POC撌脣鍳�冽��?*/
  211. static void pocStartMsg(void){
  212. sutApp.pocInitStatus=1;
  213. }
  214. /*敶枏�韐血噡��撅䂿黎蝏��銵其縑�?銝�甈⊥�扯繮�𡝗��?
  215. 銝滚�摨𠉛鍂��鍂銝滚���瘙��隞?
  216. 隞𦒘��函瑪�啁蒈敶蓥�銝餃𢆡銝𦠜𥁒銝�甈∪�銵?
  217. �飊T+POC=0D0000銋煺�銝𦠜𥁒銝�甈∪�銵?
  218. msg:000000,iiii(蝏��銵函揣撘?,dddddddd(蝏�D),nnnn(蝏���䀹㺭),mmmmmm(蝏��蝘?*/
  219. static void pro80Msg(char *msg){
  220. }
  221. /*���函��𣂼�靽⊥��𡑒”
  222. �飊T+POC=0E0000xxxxxxxx�亥砭
  223. msg:010000,iiii(�𣂼��𡑒”蝝W�),dddddddd(�𣂼�ID),mmmmmmmm(�𣂼��滨妍)*/
  224. static void pro81Msg(char *msg){
  225. }
  226. /*�餃��嗆��縑�?
  227. msg:ss(00�芰蒈敶?02撌脩蒈敶?,dddddddd(�𣂼�id),mmmmmmmm(�嗆��縑�臬�摰?
  228. 00 CEDECDF8C2E7C1ACBDD3 銵函內銝滚銁蝥選�颲枏枂靽⊥�銝?�删�蝏𡏭��?�典噡瘝?�𣂼�)
  229. 00 CEDEB7A8C1ACBDD3 銵函內銝滚銁蝥選�颲枏枂靽⊥�銝?�䭾�餈墧𦻖(IP 銝滚笆�硋� �穃㨃)
  230. 00 C3BBD3D0B7FECEF1 銵函內銝滚銁蝥選�颲枏枂靽⊥�銝?瘝⊥��滚𦛚(瘝⊥釣�?
  231. 00 B5C7C2BDCAA7B0DC 銵函內銝滚銁蝥選�颲枏枂靽⊥�銝?�駁�憭梯揖(韐血噡�躰秤)
  232. 00 0D5CBBAC5D0C5CFA2B4EDCEF3 韐血噡靽⊥��躰秤
  233. 02 0001A750 B2E2CAD431BAC5(瘚贝� 1 �?,*/
  234. static void pro82Msg(char *msg){
  235. char buf[3],*pName;
  236. int type,len;
  237. char Username[POC_GROUP_USER_NAME_LEN*2];
  238. buf[0]=msg[0];buf[1]=msg[1];buf[2]=0;
  239. type=atoi(buf);
  240. switch(type){
  241. case 0:
  242. sutPocStatus.logined=0;
  243. if(0==memcmp(msg+10, "CEDECDF8C2E7C1ACBDD3",20)) sutPocStatus.PocLineOffReason=1;
  244. else if(0==memcmp(msg+10, "CEDEB7A8C1ACBDD3",16)) sutPocStatus.PocLineOffReason=2;
  245. else if(0==memcmp(msg+10, "C3BBD3D0B7FECEF1",16)) sutPocStatus.PocLineOffReason=3;
  246. else if(0==memcmp(msg+10, "B5C7C2BDCAA7B0DC",16)) sutPocStatus.PocLineOffReason=4;
  247. break;
  248. case 2:
  249. sutPocStatus.PocLineOffReason=0;
  250. len=strlen(msg+10);
  251. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  252. memcpy(Username, msg+10,len);
  253. Username[len]=0;
  254. StrAsciiToHex(Username, sutPocStatus.LocalUser.name);
  255. msg[10]=0;
  256. sutPocStatus.LocalUser.ID=strtol(&msg[2], &pName, 16);
  257. MSG_INFO(1, "Login ok");
  258. sutPocStatus.loginResult=3;
  259. break;
  260. }
  261. }
  262. /*�劐犖霂渲�
  263. msg:00,dddddddd(�𣂼�id),nnnnnnnn(�𣂼��滨妍)*/
  264. static void pro83Msg(char *msg){
  265. int len;
  266. char callerName[POC_GROUP_USER_NAME_LEN*2];
  267. backLightReset();//��頝箏����瘙厩�蝤讠𧬘
  268. len=strlen(msg+10);
  269. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  270. memcpy(callerName, msg+10,len);
  271. callerName[len]=0;
  272. if(0!=memcmp(callerName, sutPocStatus.CallName,len)) StrAsciiToHex(callerName, sutPocStatus.CallName);
  273. }
  274. /*�訫鐤�滚�靽⊥�
  275. msg:00,mmmmmmmmmm(�訫鐤蝏𤘪�靽⊥�)
  276. BAF4BDD0B3C9B9A6 銵函內 �澆㙈�𣂼�
  277. BAF4BDD0CAA7B0DC 銵函內 �澆㙈憭梯揖
  278. CDCBB3F6C1D9CAB1BAF4BDD0 銵函內 ���箔葩�嗅鐤�?
  279. C1D9CAB1BAF4BDD031BAC5BBFA 銵函內 銝湔𧒄�澆㙈 1 �瑟㦤*/
  280. static void pro84Msg(char *msg){
  281. //unsigned char danhureport[POC_GROUP_USER_NAME_LEN+1];
  282. //StrAsciiToHex(msg+2, danhureport);
  283. ttsPlay(ENCODE_USER_GBK, msg+2);
  284. if(0==memcmp(msg+2, "C1D9CAB1", 8)) sutPocStatus.danHuStatus=1;
  285. else if(0==memcmp(msg+2, "CDCBB3F6", 8)) sutPocStatus.danHuStatus=0;
  286. else if(0==memcmp(msg+2, "BAF4BDD0B3C9B9A6", 16)) sutPocStatus.danHuStatus=1;
  287. }
  288. /*��揢蝢斤�摰峕���誘(銵函內撌脩蒈敶?
  289. msg:00,dddddddd(蝏�d),nnnnnnnn(蝏��蝘?*/
  290. static void pro86Msg(char *msg){
  291. char buf[POC_GROUP_USER_NAME_LEN*4+40],*pName;
  292. int len,i;
  293. char GroupName[POC_GROUP_USER_NAME_LEN*2];
  294. char tmp[POC_GROUP_USER_NAME_LEN*2+20];
  295. char needTTs=0;
  296. sutPocStatus.logined=1;
  297. len=strlen(msg+10);
  298. if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
  299. memcpy(GroupName, msg+10,len);
  300. GroupName[len]=0;
  301. msg[10]=0;
  302. sutPocStatus.LocalGroup.ID=strtol(msg+2, &pName,16);
  303. StrAsciiToHex(GroupName, sutPocStatus.LocalGroup.name);
  304. if(sutPocStatus.firstLogin==0){
  305. snprintf(tmp, sizeof(tmp), "%s,眒腎翹,%s", sutPocStatus.LocalUser.name,sutPocStatus.LocalGroup.name);
  306. backLightReset();//蝚砌�甈∠蒈敶閙𧒄嚗䔶����鈭株絲�?
  307. needTTs=1;
  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(�𣂼��𡑒”蝝W�),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. #if 1
  423. unsigned char newAuthTable[10]={0x50,0x28,0xaf,0x6d,0x08,0x9c,0x1b,0xe4,0x23,0x77};
  424. unsigned char randBuf[100];
  425. char buf[3];
  426. int len,i,j;
  427. len=0;
  428. for(i=0;i<strlen(msg);i++){
  429. if(msg[i]=='\r' || msg[i]=='\n' || msg[i]=='\0') goto MSG_DONE;
  430. randBuf[len++]=msg[i];
  431. }
  432. MSG_DONE:
  433. //�瑕�銝脣僎頧祆揢�?6餈𥕦��惩�銝?
  434. if(len%2 || 0!=restoreDataFormatByHex(randBuf,len)){
  435. MSG_WARN(1, "auth get error");
  436. return;
  437. }
  438. len /= 2;//敺堒��惩�靽⊥�:�踹漲銝槌en��andBuf
  439. extCodeBuffer(randBuf, len,newAuthTable, sizeof(newAuthTable));
  440. snprintf(randBuf, sizeof(randBuf), "AT+SAUTH=");
  441. //撠�鵭摨虫蛹i��mp���隞亙��剛��嗡葡�枏��煾�?
  442. for(j=0;j<sizeof(newAuthTable);j++){
  443. snprintf(buf, sizeof(buf),"%02x",newAuthTable[j]);
  444. strcat(randBuf, buf);
  445. }
  446. strcat(randBuf, "\r\n");
  447. msgAtSend(randBuf);
  448. MSG_INFO(0, randBuf);
  449. #else
  450. #define FACTORY_MARK "PC-TOOL"
  451. #define MODULE_MARK "PC-TEST-TOOL"
  452. unsigned char randBuf[20];
  453. unsigned char tmp[16+16+20];
  454. unsigned char imei[20];
  455. char sendBuf[sizeof(tmp)*2+20]="AT+SAUTH=";
  456. char *fillPtr=sendBuf+9;
  457. char buf[3];
  458. char *imeiPtr;
  459. int len,i,j;
  460. len=0;
  461. for(i=0;i<strlen(msg);i++){
  462. if(msg[i]=='\r' || msg[i]=='\n' || msg[i]=='\0') goto MSG_DONE;
  463. randBuf[len++]=msg[i];
  464. }
  465. MSG_DONE:
  466. //�瑕�銝脣僎頧祆揢�?6餈𥕦��惩�銝?
  467. if(len%2 || 0!=restoreDataFormatByHex(randBuf,len)){
  468. MSG_WARN(1, "auth get error");
  469. return;
  470. }
  471. len /= 2;//敺堒��惩�靽⊥�:�踹漲銝槌en��andBuf
  472. //撖嫣葡餈𥡝��惩��?�惩�撖孵�銝箏��?�箏�+霈曉�ID[32+32+20]
  473. imeiPtr=ohpocGetIMEI();
  474. if(NULL==imeiPtr){
  475. MSG_WARN(1, "imei is not ready");
  476. return;
  477. }
  478. MSG_INFO(1, "IMEI:%s",imeiPtr);
  479. i=strlen(imeiPtr);
  480. if(i>sizeof(imei)){
  481. MSG_ERR(1, "imei buffer overflow:%d",i);
  482. return;
  483. }
  484. memcpy(imei, imeiPtr,i);//敺堒�IMEI�唳旿:�踹漲銝槐��mei
  485. //蝏���讛悅�唳旿
  486. memset(tmp, 0,sizeof(tmp));
  487. memcpy(tmp,FACTORY_MARK,strlen(FACTORY_MARK));
  488. memcpy(tmp+16, MODULE_MARK,strlen(MODULE_MARK));
  489. tmp[32]=i;
  490. memcpy(tmp+33,imei,i);
  491. i=32+1+i;
  492. //雿輻鍂�踹漲銝槌en��andBuf�惩�銝脣笆�踹漲銝槐��mp餈𥡝��惩�
  493. extCodeBuffer(randBuf, len, tmp, i);
  494. //撠�鵭摨虫蛹i��mp���隞亙��剛��嗡葡�枏��煾�?
  495. for(j=0;j<i;j++){
  496. snprintf(buf, sizeof(buf),"%02x",tmp[j]);
  497. *fillPtr++=buf[0];
  498. *fillPtr++=buf[1];
  499. }
  500. *fillPtr++='\r';
  501. *fillPtr++='\n';
  502. *fillPtr++='\0';
  503. msgAtSend(sendBuf);
  504. MSG_INFO(0, sendBuf);
  505. #endif
  506. }
  507. /*
  508. +NOTE:0,1
  509. msg=0,1+�噼膠
  510. */
  511. static void proNoteMsg(char *msg){
  512. MSG_INFO(1,"authAck:%s",msg);
  513. }
  514. /*
  515. +CTEC: 0,0
  516. msg=0,0
  517. */
  518. static void proNetMode(char *msg){
  519. unsigned char netModeValue;
  520. char cmd[30];
  521. if(msg[0]<'0' || msg[0]>'9') return;
  522. netModeValue=atoi(msg);
  523. ctecCurrentSet=netModeValue;
  524. if(ctecCurrentSet != newPara.netMode){
  525. snprintf(cmd, sizeof(cmd),"AT+CTEC=%d,%d\r\n", ctecCurrentSet, newPara.netMode);
  526. msgAtSend(cmd);
  527. }
  528. }
  529. /*
  530. +COPS: 0,2,"46000",7
  531. msg=+COPS: 0,2,"46000",7
  532. */
  533. static void proCopsMsg(char *msg){
  534. int i,j=0,codeType;
  535. char w=0;
  536. unsigned char netModeValue;
  537. MSG_INFO(1,"enter PORCOPS");
  538. for(i=0;i<strlen(msg);i++){
  539. if(msg[i]==','){
  540. if(++j==3){
  541. codeType=msg[i+1]-0x30;
  542. if(codeType==7) codeType=4;
  543. if(netshowvalue!=codeType) netshowvalue=codeType;
  544. return;
  545. }
  546. }else if(msg[i]=='"'){
  547. /*
  548. if(++w==1){
  549. codeType=atoi(msg+i+1);
  550. if(codeType>0 && codeType != sutApp.copstype) sutApp.copstype=codeType;
  551. }
  552. */
  553. }
  554. }
  555. }
  556. /*
  557. +SIMCROSS:0
  558. msg=0/1
  559. */
  560. static void proSimMode(char *msg){
  561. unsigned char tmpSim;
  562. tmpSim=msg[0]-0x30;
  563. if(tmpSim!=0 && tmpSim!=1) return;
  564. sutApp.simSel=tmpSim;
  565. }
  566. /*
  567. +UDP:0,5,30
  568. msg=0,5,30
  569. */
  570. static void proPwrMode(char *msg){
  571. int seg1,seg2;
  572. short i;
  573. char buf[15];
  574. for(i=2;i<strlen(msg);i++){
  575. if(msg[i]==','){
  576. seg1=atoi(msg+2);
  577. seg2=atoi(msg+i+1);
  578. pwrModeAckHandler(seg1,seg2);
  579. }
  580. }
  581. }
  582. /*
  583. +FOTA:1,0
  584. +FOTA:1,XXX
  585. +FOTA:0
  586. +FOTA:1
  587. +FOTA:2
  588. msg=1,xxxx
  589. */
  590. static void proFotaMsg(char *msg){
  591. if(msg[1]==','){
  592. if(msg[2]=='0' && msg[3]==0){
  593. fotaStepSet(6);
  594. }else{
  595. strcpy(sutApp.fotaVersion, msg+2);
  596. fotaStepSet(9);
  597. }
  598. }else if(msg[1]==0){
  599. if(msg[0]=='0'){
  600. fotaStepSet(7);
  601. }else if(msg[0]=='1') showLoading();
  602. else if(msg[0]=='2'){
  603. fotaStepSet(8);
  604. }
  605. }
  606. }
  607. /*
  608. SV63302_T02
  609. msg=SV63302_T02
  610. */
  611. static void proGmrMsg(char *msg){
  612. snprintf(sutApp.modemVer, sizeof(sutApp.modemVer), "%s", msg);
  613. }
  614. /*
  615. +SMS:1,B2E2CAD4313233
  616. msg=1,B2E2CAD4313233
  617. */
  618. static void proSmsMsg(char *msg){
  619. unsigned char smsType=msg[0]-0x30;
  620. unsigned len=strlen(msg+2);
  621. if(len%2 || 0!=restoreDataFormatByHex(msg+2,len)){
  622. MSG_WARN(1, "sms data error");
  623. return;
  624. }
  625. len /= 2;
  626. sutMess.codeType=smsType;
  627. sutSms.smsUpdate=1;
  628. memcpy(sutMess.GBKMess1+4, msg+2, len);
  629. }
  630. /*�滚𦛚�冽𥁒銝见��亥郎TTS嚗釶OC撌脫偘�伐��砌縑�臬蘨�鞟內*/
  631. static void proAlarmMsg(void){
  632. }
  633. static void proPendMsg(void){
  634. MSG_INFO(1, "active auth now");
  635. msgAtSend("AT+GAUTH\r\n");//�其����璉�瘚?
  636. }
  637. static void proToneMsg(char *msg){
  638. #ifndef ENABLE_PWM_BEEP
  639. if(msg[0]=='1'){
  640. sutPocStatus.TONE=1;
  641. paControl(true);
  642. }else if(msg[0]=='0'){
  643. sutPocStatus.TONE=0;
  644. }
  645. #endif
  646. }
  647. /*
  648. +GPIP:183.131.13.10
  649. msg=183.131.13.10
  650. */
  651. static void proGPIPMsg(char *msg){
  652. if(strlen(msg)<7) return;
  653. if(strcmp(showPIP, msg)==0) return;
  654. snprintf(showPIP, sizeof(showPIP), "%s",msg);
  655. MSG_INFO(1, "updatePIP:%s", showPIP);
  656. }
  657. /*
  658. +GGIP:183.131.13.6
  659. msg=183.131.13.6
  660. */
  661. static void proGGIPMsg(char *msg){
  662. if(strlen(msg)<7) return;
  663. if(strcmp(showGIP, msg)==0) return;
  664. snprintf(showGIP, sizeof(showGIP), "%s",msg);
  665. MSG_INFO(1, "updateGIP:%s", showGIP);
  666. }
  667. /*
  668. +CSQ: 14,99
  669. msg=14,99
  670. */
  671. static void proCsqMsg(char *msg){
  672. int csq=atoi(msg);
  673. if(csq != sutApp.g_iCSQ) sutApp.g_iCSQ=csq;
  674. }
  675. /*
  676. +HEADSET:1
  677. msg=1
  678. */
  679. static void proHeadSet(char *msg){
  680. switch(msg[0]){
  681. case '0'://HEADSET CONNECT
  682. sutApp.earLev=1;
  683. msgAtSend("AT+AUDCH=1,3\r\n");
  684. sutApp.pcant=2;
  685. break;//HEADSET DISCONNECTED
  686. case '1':
  687. sutApp.earLev=0;
  688. msgAtSend("AT+AUDCH=0,0\r\n");
  689. sutApp.pcant=4;
  690. break;//HEADSET BTN PRESS
  691. case '2':
  692. micPttHandler(1);
  693. break;//HEADSET BTN RELEASED
  694. case '3':
  695. micPttHandler(0);
  696. break;
  697. }
  698. }
  699. static void ProGetATIMsg(char *msg)
  700. {
  701. strcpy(sutApp.modemVer, msg);
  702. }
  703. void proCCIDMsg(char *msg){
  704. sutApp.cardStatus=1;
  705. msg[6]=0;
  706. sutApp.copstype=atoi(msg+4);
  707. }
  708. #ifdef USE_BND_POC
  709. char *ohpocGetICCID(void){
  710. static char iccid[21]={0};
  711. //if(iccid[0]==0){
  712. if(LSAPI_SIM_GetICCID(iccid)==0){
  713. return iccid;
  714. }
  715. //}
  716. return NULL;
  717. }
  718. char *ohpocGetIMEI(void){
  719. static char imei[16]={0};
  720. //if(imei[0]==0){
  721. if(LSAPI_SIM_GetIMEI(imei)==0){
  722. MSG_INFO(1,"get imei==%s",imei);
  723. return imei;
  724. }
  725. //}
  726. return NULL;
  727. }
  728. void ohpocGetClock(MY_CLOCK *myclock){
  729. //MSG_INFO(1,"get time----------");
  730. current_zone_time(myclock);
  731. }
  732. #endif