123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966 |
- #include "includes.h"
- POC_DEF sutPocStatus;
- void pocDataInit(void){
- memset((unsigned char *)&sutPocStatus, 0, sizeof(POC_DEF));
- }
- unsigned long long htoi(char s[])
- {
- int i = 0;
- unsigned long long n = 0;
- if (s[0] == '0' && (s[1]=='x' || s[1]=='X')) i = 2;
- else i = 0;
- for (; (s[i] >= '0' && s[i] <= '9') || (s[i] >= 'a' && s[i] <= 'z') || (s[i] >='A' && s[i] <= 'Z');++i){
- if (tolower(s[i]) > '9') n = 16 * n + (10 + tolower(s[i]) - 'a');
- else n = 16 * n + (tolower(s[i]) - '0');
- }
- return n;
- }
- /*
- MakeStringToUpperCap
- 閬嶅巻data锛屽皢闈炲ぇ鍐欏瓧姣嶈浆鎴愬ぇ鍐欏瓧姣�
- */
- void MakeStringToUpperCap(unsigned char *data, unsigned short len){
- unsigned short i;
- for(i=0;i<len;i++)
- {
- if(data[i] >= 'a' && data[i] <= 'z')
- data[i] -= 0x20;
- }
- }
- /*鎺у埗鏌ヨ�POC璁剧疆鐘舵€?
- dly:鎺ュ彛琚�皟鐢ㄧ殑棰戠巼锛屽崟浣峬s*/
- void pocProCtl(int dly){
- //3缁夋帗鐓$拠顫��濞�?
- static unsigned short cnt=0;
- static unsigned short timecnt=0;// 5鍒嗛挓鏍″噯涓€娆℃椂闂�
- if(sutApp.gtMode!=0) return;//GT濡�€崇础閸氬簼绗夐崘宥嗙叀鐠�?
- if(++cnt<(5*1000/dly)) return;
- cnt=0;
- if(getAppObjStatus(ASLEEP_LCD)==0) return;//POC娴兼垹婀㈤弮璁圭礉娑撳秴褰傞幐鍥︽姢
-
- msgAtSend("AT+COPS?\r\n");
- msgAtSend("AT+CTEC?\r\n");//閺屻儴顕楄ぐ鎾冲�缂冩垹绮堕崚璺虹础
- msgAtSend("AT+CSQ\r\n");//閺屻儴顕楁穱鈥冲娇瀵�搫瀹�
- msgAtSend("AT+POC=280000\r\n");//鑾峰彇鍖椾含鏃堕棿
-
- #ifdef CONFIG_AUDIO_AFTER_INIT
- msgAtSend("AT+CACCP=0,0,1,\"\"\r\n");//妫€娴媘ic鏄�惁琚玬ute鎺変簡
- #endif
- }
- static void micPro(int mic);
- static void spkPro(int spk);
- static void pocStartMsg(void);
- static void pro80Msg(char *msg);
- static void pro81Msg(char *msg);
- static void pro82Msg(char *msg);
- static void pro83Msg(char *msg);
- static void pro84Msg(char *msg);
- static void pro86Msg(char *msg);
- static void pro3dMsg(char *msg);
- static void pro3eMsg(char *msg);
- static void pro0eMsg(char *msg);
- static void pro1eMsg(char *msg);
- static void pro1dMsg(char *msg);
- static void pocGetVer(char *msg);
- static void proNoteMsg(char *msg);
- static void proNetMode(char *msg);
- static void proSimMode(char *msg);
- static void proGmrMsg(char *msg);
- static void proSmsMsg(char *msg);
- static void proCsqMsg(char *msg);
- static void proMicSpk(int mic, int spk);
- static void proCopsMsg(char *msg);
- static bool proMicGain(char *msg);
- static void pro96Msg(char *msg);
- static void pro28Msg(char *msg);
- static void pro0dMsg(char *msg);
- static void pro0eMsg(char *msg);
- static void pro3bMsg (char *msg);
- static void Pro7DMsg(char *msg);
- void pro8CMsg(char *msg);
- void cmdsProcess(char *msg, int len){//宸插幓鎺夊洖杞︽崲琛?
- int i,j;
- char buf[10];
- if(sutApp.pocInitStatus==0) sutApp.pocInitStatus=1;
- if(sutApp.gtMode==0){
- if(msgCmp(msg,"+POC")){
- //鏄疨OC 淇℃伅 鍞ら啋
- if(!msgCmp(msg,"+POC:28")&&!msgCmp(msg,"+POC:85")&&!msgCmp(msg,"+POC:97")){
- backLightReset();
- tryWakeupApp();
- MSG_INFO(1,"POCwakeup");
- }
-
- }
-
- MSG_INFO(1,"POC:%s",msg);
- if(msgCmp(msg, "PocSleep")){//POC浼戠湢浜?
- appSleepCtl(ASLEEP_POC, 0);
- }else if(msgCmp(msg, "+POC:WAKEUP")){//POC鍞ら啋浜?
- }else if(msgCmp(msg, "+POC:8B")){
- #if 1
- buf[0]=msg[7];buf[1]=msg[8];buf[2]=0;
- i=atoi(buf);
- buf[0]=msg[9];buf[1]=msg[10];buf[2]=0;
- j=atoi(buf);
- proMicSpk(i, j);
- #endif
- }else if(msgCmp(msg, "+LSHTTS: END")){
- sutPocStatus.TTS=0;
- }else if(msgCmp(msg, "+HTTS: START")){
- paControl(true);
- sutPocStatus.TTS=1;
- }else if(msgCmp(msg, "+POC:02000000")) setPocPara(msg+13,len-13);
- else if(msgCmp(msg,"+POC:9600")) pro96Msg(msg);
- else if(msgCmp(msg, "+POC:82")) pro82Msg(msg);
- else if(msgCmp(msg, "+POC:86")) pro86Msg(msg);
- else if(msgCmp(msg, "+POC:83")) pro83Msg(msg);
- else if(msgCmp(msg, "+POC:28")) pro28Msg(msg);
- else if(msgCmp(msg, "+POC:80")) pro80Msg(msg);
- else if(msgCmp(msg, "+POC:81")) pro81Msg(msg);
- else if(msgCmp(msg, "+POC:0D")) pro0dMsg(msg);
- //else if(msgCmp(msg, "+POC:0E")) pro0eMsg(msg);
- else if(msgCmp(msg, "+POC:3B")) pro3bMsg(msg);
- else if(msgCmp(msg, "+POC:7D")) Pro7DMsg(msg+13);
-
- else if(msgCmp(msg, "+POC:84")) pro84Msg(msg+7);
- else if(msgCmp(msg, "+CTEC:")) proNetMode(msg+7);
- else if(msgCmp(msg, "+CSQ: ")) proCsqMsg(msg+6);
- else if(msgCmp(msg, "+POC:8C00")) pro8CMsg(msg);
-
- else if(msgCmp(msg, "+POC:1D")) pro1dMsg(msg+7);
- // else if(msgCmp(msg, "+HEADSET:")) proHeadSet(msg+9);
- else if(msgCmp(msg, "+POC:START")) pocStartMsg();
- else if(msgCmp(msg, "+POC_VER:")) pocGetVer(msg+9);
- else if(msgCmp(msg, "+NOTE:")) proNoteMsg(msg+6);
- else if(msgCmp(msg, "+SIMCROSS:")) proSimMode(msg+10);
- else if(msgCmp(msg, "SV")) proGmrMsg(msg);
- else if(msgCmp(msg, "+SMS:")) proSmsMsg(msg+5);
-
- else if(msgCmp(msg, "+COPS:")) proCopsMsg(msg);
- else if(msgCmp(msg, "+CPIN: READY")) sutApp.cardStatus=1;
- //else if(msgCmp(msg, "+CCID: ")) proCCIDMsg(msg+7);
- else if(msgCmp(msg, "+CACCP: ")){
- if(false==proMicGain(msg+8)) proCaccpMsg(msg+8);
- }else MSG_INFO(1, "skip:%d,%s", len,msg);
- }
- }
- //澶勭悊POC妯″潡淇℃伅
- void pocCmdHandler(unsigned char *msg, int len){
- //鏈夋秷鎭�繘鏉ワ紝濡傛灉涓嶆槸+POC:SLEEP锛孭OC閮藉敜閱掍簡
- static char tmp[300],ch;
- static int k=0;
- unsigned int j;
- if(sutApp.authReady==0) return;
- if(sutApp.gtMode !=0 && sutApp.gtTMode != 0){
- usbOutPut(msg, len);//TM妯″紡涓嬬洿鎺ラ€忎紶
- return;
- }
- for(j=0;j<len;j++){//杩囨护
- if(k>=sizeof(tmp)) k=0;
- tmp[k++]=msg[j];
- if(ch=='\r' && msg[j]=='\n'){
- if(k!=2){
- //澶勭悊
- k -=2;tmp[k]=0;//鍘绘帀鍥炶溅鎹㈣�
- MakeStringToUpperCap(tmp, k);
- cmdsProcess(tmp,k);
- }
- k=0;
- }
- ch=msg[j];
- }
- }
- static void proMicSpk(int mic, int spk){
- if(mic==0 && spk==0){//0000
- if(newPara.KeySound!=0) pttBeepStart(false);
- sutPocStatus.spk=0;
- sutPocStatus.mic=0;
- sutPocStatus.TONE=0;
- }else if(mic==1 && spk==0){//0100
- if(newPara.KeySound!=0) pttBeepStart(false);
- sutPocStatus.mic=1;
- }else if(mic==0 && spk==1){//0001
- if(newPara.KeySound!=0) paControl(true);//pttBeepStart(false);
- else paControl(true);//鍏抽棴鎻愮ず闊虫椂锛屼篃瑕佹墦寮€鍠囧彮
- sutPocStatus.spk=1;
- sutPocStatus.mic=0;
- }else if(mic==0 && spk==13){//0013
- if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
- }else if(mic==0 && spk==2){
- paControl(true);
- sutPocStatus.TONE=1;
- }
- }
- static void micPro(int mic){
- switch(mic){
- case 0://鍏抽棴mic
- sutPocStatus.mic=0;
- break;
- case 1://鎵撳紑mic
- if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
- sutPocStatus.mic=1;
- //sutPocStatus.spk=0;
- break;
- }
- }
- static void spkPro(int spk){
- switch(spk){
- case 0://tone闊冲悗鍏抽棴spk
- if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
- sutPocStatus.spk=0;
- break;
- case 1://tone闊冲悗淇濇寔spk鎵撳紑
- if(newPara.KeySound!=0) beepStart(TONE_NORMAL);
- paControl(true);
- sutPocStatus.spk=1;
- sutPocStatus.mic=0;
- break;
- case 2://鎾�斁TTS
- paControl(true);
- sutPocStatus.TTS=1;
- break;
- case 13://鎶㈤害澶辫触锛屽彲浠�one鐗规畩闊?
- if(newPara.KeySound!=0) beepStart(TONE_SPECIAL);
- break;
- }
- }
- /*POC宸插惎鍔ㄦ垚鍔?*/
- static void pocStartMsg(void){
- sutApp.pocInitStatus=1;
- }
- /*褰撳墠璐﹀彿鎵€灞炵兢缁勫垪琛ㄤ俊鎭?涓€娆℃€ц幏鍙栨墍鏈?
- 涓嶅悓搴旂敤閲囩敤涓嶅悓闇€姹傛寚浠?
- 浠庝笉鍦ㄧ嚎鍒扮櫥褰曚細涓诲姩涓婃姤涓€娆″垪琛?
- 鍙慉T+POC=0D0000涔熶細涓婃姤涓€娆″垪琛?
- msg:000000,iiii(缁勫垪琛ㄧ储寮?,dddddddd(缁処D),nnnn(缁勬垚鍛樻暟),mmmmmm(缁勫悕绉?*/
- static void pro80Msg(char *msg){
- char Groupname[POC_GROUP_USER_NAME_LEN];
- char len;
- char Idbuf[5]={0};
- if(msg[8]=='2')return;
- len=strlen(&msg[29]);
- memcpy(Groupname, &msg[29], len);
- memcpy(Idbuf,&msg[25],4);
- //MakeStrEndByNewLine(msg);
- memset(sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name,0,sizeof(sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name));
- msg[25]=0;
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID=htoi(&msg[17]);
-
- if(sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID==0xFFFFFFFF){
- if(sutUIstatus.Status==UIS_MENU_FRIEND_SEL){
- sutPocStatus.ListUpdate=1;
- sutPocStatus.ListDetailValid=1;
- sutPocStatus.ListCurOnlineNum=htoi(Idbuf);
- //if(sutPocStatus.danHuStatus!=0)sutPocStatus.ListCurOnlineNum--;// 鑼朵綑鍗曞懠鍘绘帀涓存椂缇ょ粍
- MSG_INFO(1, "friend:%d", sutPocStatus.ListCurOnlineNum);
- }
- return;
- }
-
-
- if(sutPocStatus.ListFillIndex>0){
- if(sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID==sutPocStatus.AllGroups[sutPocStatus.ListFillIndex-1].ID){
- MSG_INFO(1,"id===chongfu==================%d\r\n",sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID);
- return;
- }
- }
-
- if(msg[29]==0) sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[0]=' ';
- else {
- LwEndingToBiEndingStr(Groupname,len);
- unicodeToGbk(Groupname, sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name, &len);
- }
- //msg[29+8]=0;
- MSG_INFO(1,"AllGroups===%s,%d,%d\r\n",sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name,sutPocStatus.ExceptionReadNum,sutPocStatus.ListFillIndex);
-
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].status=2;
- sutPocStatus.ListFillIndex++;
- MSG_INFO(1,"get groups end\r\n");
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- MSG_INFO(1,"get groups finish--\r\n");
- sutPocStatus.ListGetOneFlag=1;
- }
- }
- /*鎵€鍦ㄧ粍鎴愬憳淇℃伅鍒楄〃
- 鍙慉T+POC=0E0000xxxxxxxx鏌ヨ�
- msg:010000,iiii(鎴愬憳鍒楄〃绱㈠紩),dddddddd(鎴愬憳ID),mmmmmmmm(鎴愬憳鍚嶇О)*/
- static void pro81Msg(char *msg){
- char Username[POC_GROUP_USER_NAME_LEN];
- char len;
- unsigned char i=0;
- if(sutPocStatus.NeedGetUser==2){
- len=strlen(&msg[25]);
- memcpy(Username, &msg[25], len);
- memset(UserArr[sutPocStatus.ListFillIndex].UserName,0,POC_GROUP_USER_NAME_LEN);
- msg[25]=0;
- UserArr[sutPocStatus.ListFillIndex].id=htoi(&msg[17]);
- /*
- if(sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID==0xFFFFFFFF){
- return;
- }
- */
- if(msg[29]==0) UserArr[sutPocStatus.ListFillIndex].UserName[0]=' ';
- else {
- LwEndingToBiEndingStr(Username,len);
- unicodeToGbk(Username, UserArr[sutPocStatus.ListFillIndex].UserName, &len);
- }
-
-
- MSG_INFO(1,"GetAllUsers===%s,%d\r\n",UserArr[sutPocStatus.ListFillIndex].UserName,sutPocStatus.ListFillIndex);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.UserSum){
- sutPocStatus.NeedGetUser=0;
- /*
- 如果有新用户需添加至leader
- */
-
-
- }
- }
- if(sutPocStatus.NeedGetUser!=0)return;//获取所有成员信息
- len=strlen(&msg[25]);
- memcpy(Username, &msg[25], len);
- memset(sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name,0,POC_GROUP_USER_NAME_LEN);
- msg[25]=0;
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=htoi(&msg[17]);
- if(sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID==0xFFFFFFFF){
- return;
- }
-
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].status=msg[8]-0x30;
- //1
- if(sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].status==1&&sutUIstatus.Status==UIS_MENU_USER_SEL)return; //涓嶅湪绾� 涓嶆樉绀�
- if(msg[29]==0) sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[0]=' ';
- else {
- LwEndingToBiEndingStr(Username,len);
- unicodeToGbk(Username, sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name, &len);
- }
- //msg[29+8]=0;
-
- MSG_INFO(1,"AllUsers===%s,%d,%d\r\n",sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name,sutPocStatus.ExceptionReadNum,sutPocStatus.ListFillIndex);
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].status=msg[8]-0x30;
-
-
- sutPocStatus.ListFillIndex++;
-
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- MSG_INFO(1,"get users finish--\r\n");
- }
-
- }
- /*鐧诲綍鐘舵€佷俊鎭?
- msg:ss(00鏈�櫥褰?02宸茬櫥褰?,dddddddd(鎴愬憳id),mmmmmmmm(鐘舵€佷俊鎭�唴瀹?
- 00 CEDECDF8C2E7C1ACBDD3 琛ㄧず涓嶅湪绾匡紝杈撳嚭淇℃伅涓?鏃犵綉缁滆繛鎺?鎷ㄥ彿娌?鎴愬姛)
- 00 CEDEB7A8C1ACBDD3 琛ㄧず涓嶅湪绾匡紝杈撳嚭淇℃伅涓?鏃犳硶杩炴帴(IP 涓嶅�鎴栧畾 鍚戝崱)
- 00 C3BBD3D0B7FECEF1 琛ㄧず涓嶅湪绾匡紝杈撳嚭淇℃伅涓?娌℃湁鏈嶅姟(娌℃敞鍐?
- 00 B5C7C2BDCAA7B0DC 琛ㄧず涓嶅湪绾匡紝杈撳嚭淇℃伅涓?鐧婚檰澶辫触(璐﹀彿閿欒�)
- 00 0D5CBBAC5D0C5CFA2B4EDCEF3 璐﹀彿淇℃伅閿欒�
- 02 0001A750 B2E2CAD431BAC5(娴嬭瘯 1 鍙?,*/
- static void pro82Msg(char *msg){
- char buf[3],*pName;
- int type,len,i;
- char Username[POC_GROUP_USER_NAME_LEN*2];
- buf[0]=msg[7];buf[1]=msg[8];buf[2]=0;
- type=atoi(buf);
- switch(type){
- case 0:
- sutPocStatus.logined=0;
- break;
- case 2:
- sutPocStatus.PocLineOffReason=0;
- len = strlen(&msg[17]);
- memcpy(Username,&msg[17],len);
- Username[len]=0;
- LwEndingToBiEndingStr(Username,len);
- unicodeToGbk(Username,sutPocStatus.LocalUser.name,&len);
- msg[17]=0;
- sutPocStatus.LocalUser.ID=strtol(&msg[9],&pName,16);
- MSG_INFO(1, "Login ok");
- //getNameFlag=1;//
- sutPocStatus.loginResult=3;
- break;
- }
- }
- /*鏈変汉璇磋瘽
- msg:00,dddddddd(鎴愬憳id),nnnnnnnn(鎴愬憳鍚嶇О)*/
- static void pro83Msg(char *msg){
- int len;
- char callerName[POC_GROUP_USER_NAME_LEN*2];
- char *pName;
- unsigned short i=0;
- unsigned char Needcat=1;
- char temp[POC_GROUP_USER_NAME_LEN];
- len=strlen(msg);
-
- paControl(true);
- sutPocStatus.PaDlyStart=1;
- if(memcmp(&msg[len-28],"2857B28BDD8B2E002E002E000000",28)!=0)return;
- backLightReset();//闁衡偓鐠哄搫鐓傞柡鍫濐槷濮瑰�鎷犵壕瀣�▓
- len=strlen(&msg[17])-28;//鍘绘帀 姝e湪瀵硅�璇濆瓧鏍�---鑼朵綑
-
- if(len>POC_GROUP_USER_NAME_LEN) len=POC_GROUP_USER_NAME_LEN;
- //else i++;//鎶婃渶鍚�0 涔熸嫹璐濊繘鏉�
-
- memcpy(callerName,&msg[17],len);
-
- LwEndingToBiEndingStr(callerName,len);
- unicodeToGbk(callerName, sutPocStatus.CallName, &len);
- //StrUnicodeToAnsiBig(sutPocStatus.Callname,i,&msg[17+8]);
- *(msg+17) = 0;
- sutPocStatus.CallID = strtol(&msg[9],&pName,16);
- msg[17]=0;
- for(i=0;i<MAX_USER;i++){
- if(UserArr[i].id==sutPocStatus.CallID){
- Needcat=0;
- break;
- }
- }
- if(Needcat){
- snprintf(temp,sizeof(temp),"监听组-%s",sutPocStatus.CallName);
- strcpy(sutPocStatus.CallName,temp);
- MSG_INFO(1,"监听组---%s",temp);
- }
- }
- /*鍗曞懠鍝嶅簲淇℃伅
- msg:00,mmmmmmmmmm(鍗曞懠缁撴灉淇℃伅)
- BAF4BDD0B3C9B9A6 琛ㄧず 鍛煎彨鎴愬姛
- BAF4BDD0CAA7B0DC 琛ㄧず 鍛煎彨澶辫触
- CDCBB3F6C1D9CAB1BAF4BDD0 琛ㄧず 閫€鍑轰复鏃跺懠鍙?
- C1D9CAB1BAF4BDD031BAC5BBFA 琛ㄧず 涓存椂鍛煎彨 1 鍙锋満*/
- static void pro84Msg(char *msg){
- LwEndingToBiEndingStr(msg+2,strlen(msg+2));
- ttsPlay(ENCODE_USER_UNICODE_BE, msg+2); //ENCODE_USER_UNICODE_BE
-
- if(0==memcmp(msg+2, "C1D9CAB1", 8)) sutPocStatus.danHuStatus=1;
- else if(0==memcmp(msg+2, "CDCBB3F6", 8)) sutPocStatus.danHuStatus=0;
- else if(0==memcmp(msg+2, "BAF4BDD0B3C9B9A6", 16)) sutPocStatus.danHuStatus=1;
-
- }
- /*鍒囨崲缇ょ粍瀹屾垚鎸囦护(琛ㄧず宸茬櫥褰?
- msg:00,dddddddd(缁刬d),nnnnnnnn(缁勫悕绉?*/
- static void pro86Msg(char *msg){
- char buf[POC_GROUP_USER_NAME_LEN*4+40],*pName;
- int len,i;
- char GroupName[POC_GROUP_USER_NAME_LEN*2]={0};
- char tmp[POC_GROUP_USER_NAME_LEN*2+20]={0};
- char needTTs=0;
- if(msg[9]=='F'&&msg[10]=='F')return ;
-
- sutPocStatus.logined=1;
- if(msg[8]=='0'){
- len = strlen(&msg[17]);
- MSG_INFO(1,"len====%d",len);
- memcpy(GroupName,&msg[17],len);
- GroupName[len]=0;
- msg[17]=0;
- sutPocStatus.LocalGroup.ID=strtol(&msg[9],&pName,16);
- LwEndingToBiEndingStr(GroupName,len);
- unicodeToGbk(GroupName, sutPocStatus.LocalGroup.name, &len);
- MSG_INFO(1,"groupnamelen======%d",len);
- MSG_INFO(1,"groupname======%s",sutPocStatus.LocalGroup.name);
- sutPocStatus.danHuStatus=0;
- snprintf(tmp,sizeof(tmp),"AT+POC=3B0000%08x\r\n",sutPocStatus.LocalGroup.ID);
- ModemSendAt(tmp);
- sutPocStatus.NeedGetUser=1;
-
- }else if(msg[8]=='1'){
- //鍗曞懠妯″紡
- sutPocStatus.danHuStatus=1;
- }
- backLightReset();
- sutPocStatus.firstLogin=1;
- }
- /*鏌ヨ�鎵€灞炵兢缁勬€绘暟鐨勫搷搴?
- 鍙慉T+POC=3D0000鑾峰緱
- msg:000000,nnnn(鎵€灞炲�灏戜釜缇ょ粍)*/
- static void pro3dMsg(char *msg){
- char *pName;
- sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
- sutPocStatus.ListUpdate=1;
- MSG_INFO(1, "groupNum:%d", sutPocStatus.ListCurOnlineNum);
- }
- /*鏌ヨ�鎵€灞炲湪绾挎垚鍛樻€绘暟鐨勫搷搴?
- 鍙慉T+POC=3E0000鑾峰緱
- msg:000000,nnnn(鎵€灞炲�灏戜釜鍦ㄧ嚎鎴愬憳)*/
- static void pro3eMsg(char *msg){
- char *pName;
- sutPocStatus.ListCurOnlineNum=strtol(&msg[6],&pName,16);
- sutPocStatus.ListUpdate=1;
- MSG_INFO(1, "userNum:%d", sutPocStatus.ListCurOnlineNum);
- }
- /*瀹氶噺鏌ヨ�鎵€鍦ㄧ兢缁勪腑鐨勫湪绾挎垚鍛樹俊鎭�搷搴?
- 鍙慉T+POC=1E0000xxxxx鑾峰緱
- msg:010000,iiii(鎴愬憳鍒楄〃绱㈠紩),dddddddd(鎴愬憳ID),mmmmmmmm(鎴愬憳鍚嶇О)*/
- static void pro1eMsg(char *msg){
- char name[POC_GROUP_USER_NAME_LEN*2+1];
- int len;
- unsigned long id;
- char *pTemp;
-
- if(!uiAssist.status)return 1;
- len = strlen(&msg[18]);
- if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
- memcpy(name, &msg[18], len);
- name[len]=0;
- msg[18]=0;
- id=strtol(&msg[10],&pTemp,16);
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=id;
- if(name[0]==0){
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[0]=' ';
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name[1]=0;
- }else StrAsciiToHex(name, sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- sutPocStatus.ListDetailValid=1;
- }
- }
- /*瀹氭椂鏌ヨ�鎵€灞炵粍淇℃伅
- 鍙慉T+POC=1D0000xxxxx鑾峰緱
- msg:000000,iiii(缁勫垪琛ㄧ储寮?,dddddddd(缁処D),nnnn(鎴愬憳涓�暟),mmmmmmmmm(鍚嶇О)*/
- static void pro1dMsg(char *msg){
- unsigned short num;
- char name[POC_GROUP_USER_NAME_LEN*2+1];
- unsigned long id;
- unsigned short index;
- char *pTemp;
- int len;
- if(!uiAssist.status)return ;
- len = strlen(&msg[22]);//瀹告彃骞撻幒澶婃礀鏉烇附宕茬悰?
- if(len >= POC_GROUP_USER_NAME_LEN*2) len = POC_GROUP_USER_NAME_LEN*2;
- memcpy(name, &msg[22], len);
- name[len]=0;
- msg[22]=0;
- num=strtol(&msg[18],&pTemp,16);
- msg[18]=0;
- id=strtol(&msg[10],&pTemp,16);
-
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID=id;
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].usernum=num;
- if(name[0]==0){
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[0]=' ';
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name[1]=0;
- }else
- StrAsciiToHex(name, sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- sutPocStatus.ListDetailValid=1;
- }
-
- }
- /*
- +POC_VER:01027
- msg=01027
- */
- static void pocGetVer(char *msg){
- snprintf(sutApp.pocVersion, sizeof(sutApp.pocVersion), "%s",msg);
- }
- /*
- +NOTE:0,1
- msg=0,1+鍥炶溅
- */
- static void proNoteMsg(char *msg){
- MSG_INFO(1,"authAck:%s",msg);
- }
- /*
- +CTEC: 0,0
- msg=0,0
- */
- static void proNetMode(char *msg){
- unsigned char netModeValue;
- char cmd[30];
- if(msg[0]<'0' || msg[0]>'9') return;
- netModeValue=atoi(msg);
- ctecCurrentSet=netModeValue;
- if(ctecCurrentSet != newPara.netMode){
- snprintf(cmd, sizeof(cmd),"AT+CTEC=%d,%d\r\n", ctecCurrentSet, newPara.netMode);
- msgAtSend(cmd);
- }
- }
- /*
- +COPS: 0,2,"46000",7
- msg=+COPS: 0,2,"46000",7
- */
- static void proCopsMsg(char *msg){
- int i,j=0,codeType;
- char w=0;
- unsigned char netModeValue;
-
- for(i=0;i<strlen(msg);i++){
- if(msg[i]==','){
- if(++j==3){
- codeType=msg[i+1]-0x30;
- if(codeType==7) codeType=4;
- if(netshowvalue!=codeType) netshowvalue=codeType;
- return;
- }
- }else if(msg[i]=='"'){
- if(++w==1){
- codeType=atoi(msg+i+1);
- if(codeType>0 && codeType != sutApp.copstype) sutApp.copstype=codeType;
- }
- }
- }
- }
- /*
- +SIMCROSS:0
- msg=0/1
- */
- static void proSimMode(char *msg){
- unsigned char tmpSim;
-
- tmpSim=msg[0]-0x30;
- if(tmpSim!=0 && tmpSim!=1) return;
- sutApp.simSel=tmpSim;
- }
- /*
- +FOTA:1,0
- +FOTA:1,XXX
- +FOTA:0
- +FOTA:1
- +FOTA:2
- msg=1,xxxx
- */
- static void proFotaMsg(char *msg){
- if(msg[1]==','){
- if(msg[2]=='0' && msg[3]==0) sutApp.fotaStatus=1;
- else{
- strcpy(sutApp.fotaVersion, msg+2);
- sutApp.fotaStatus=2;
- }
- }else if(msg[1]==0){
- if(msg[0]=='0') sutApp.fotaStatus=3;
- else if(msg[0]=='1') sutApp.fotaStatus=4;
- else if(msg[0]=='2') sutApp.fotaStatus=5;
- }
- }
- /*
- SV63302_T02
- msg=SV63302_T02
- */
- static void proGmrMsg(char *msg){
- snprintf(sutApp.modemVer, sizeof(sutApp.modemVer), "%s", msg);
- }
- /*
- +SMS:1,B2E2CAD4313233
- msg=1,B2E2CAD4313233
- */
- static void proSmsMsg(char *msg){
- unsigned char smsType=msg[0]-0x30;
- unsigned len=strlen(msg+2);
- if(len%2 || 0!=restoreDataFormatByHex(msg+2,len)){
- MSG_WARN(1, "sms data error");
- return;
- }
- len /= 2;
- sutMess.codeType=smsType;
- sutSms.smsUpdate=1;
- memcpy(sutMess.GBKMess1+4, msg+2, len);
- }
- /*
- +CSQ: 14,99
- msg=14,99
- */
- static void proCsqMsg(char *msg){
- int csq=atoi(msg);
- if(csq != sutApp.g_iCSQ) sutApp.g_iCSQ=csq;
- }
- static void pro96Msg(char *msg){
- if(msg[10]=='0'){
- sutPocStatus.PaDlyStart=1;
- paControl(true);
- sutPocStatus.mic=1;
-
- }
- else if(msg[10]=='3'){
- paControl(true);
- backLightReset();
- sutPocStatus.logined=1;
- sutPocStatus.spk=1;
- sutPocStatus.mic=0;
-
- }else if(msg[10]=='4'){
- sutPocStatus.spk=0;
- sutPocStatus.TTS=0;
- sutPocStatus.PaDlyStart=1;
-
- }else if(msg[10]=='1'){
- sutPocStatus.PaDlyStart=1;
- sutPocStatus.mic=0;
-
- }
- }
- /*
- +POC:2800000016010A101F2401
- */
- static void pro28Msg(char *msg){
-
- char buf[20];
- if(msg[7]=='F' && msg[8]=='F')return;
- if(msg[5]=='2' && msg[6]=='8'){
- //PocGetTime=1;
- //+POC:2800000014040e10132002
- StrAsciiToHex(&msg[13],buf);
- My_Clock.year=buf[0];;
- My_Clock.month=buf[1];;
- My_Clock.day=buf[2];;
- My_Clock.hour=buf[3];;
- My_Clock.min=buf[4];;
- My_Clock.sec=buf[5];
- MSG_INFO(1,"NewTime:%02d-%02d-%02d %02d:%02d:%02d",
- My_Clock.year,My_Clock.month,My_Clock.day,
- My_Clock.hour,My_Clock.min,My_Clock.sec);
- sutApp.PocGetTime=1;
- return ;
- }
- }
- static void pro0dMsg(char *msg){
-
- if(sutUIstatus.Status!=UIS_MENU_GROUP_SEL)return;
- sutPocStatus.ListUpdate=1;
- sutPocStatus.ListDetailValid=1;
- sutPocStatus.ListCurOnlineNum=htoi(&msg[13])-1;
- if(sutPocStatus.danHuStatus!=0)sutPocStatus.ListCurOnlineNum--;// 鑼朵綑鍗曞懠鍘绘帀涓存椂缇ょ粍
- MSG_INFO(1, "groupNum:%d", sutPocStatus.ListCurOnlineNum);
- }
- static void pro0eMsg(char *msg){
- sutPocStatus.ListUpdate=1;
- sutPocStatus.ListDetailValid=1;
- sutPocStatus.ListCurOnlineNum=htoi(&msg[13])-1;
- if(sutPocStatus.danHuStatus!=0)sutPocStatus.ListCurOnlineNum--;// 鑼朵綑鍗曞懠鍘绘帀涓存椂缇ょ粍
- MSG_INFO(1, "friend:%d", sutPocStatus.ListCurOnlineNum);
- }
- //+POC:3b 00 0000 006c 0002 0001
- //+POC:3b000000006c00020001
- static void pro3bMsg (char *msg){
- char buf[40];
- if(msg[5]=='3' && msg[6]=='B'){
- if(sutPocStatus.NeedGetUser==0){
- sutPocStatus.ListUpdate=1;
- sutPocStatus.ListDetailValid=1;
- }
-
- sutPocStatus.ListCurOnlineNum =htoi(&msg[21]);
- msg[17]=0;
- sutPocStatus.UserSum= htoi(&msg[13]);
- if(sutPocStatus.NeedGetUser){
- snprintf(buf, sizeof(buf), "AT+POC=130000%08x0000006400000000\r\n",sutPocStatus.LocalGroup.ID);//默认成员100
- sutPocStatus.ListFillIndex=0;
- sutPocStatus.NeedGetUser=2;
- if(sutPocStatus.UserSum==0)sutPocStatus.NeedGetUser=0;
- msgAtSend(buf);
- //MSG_INFO(1,buf);
- }
- MSG_INFO(1, "UserSum:%d,UserOnline:%d",sutPocStatus.UserSum,sutPocStatus.ListCurOnlineNum);
- }
- }
- static void Pro7DMsg(char *msg){
- int i,j,len,ver;
- char bufTemp[40];
- len = strlen(msg);
- j=0;
- StrAsciiToHex(msg,bufTemp);
- strncpy(sutApp.pocVersion,bufTemp,sizeof(sutApp.pocVersion));
- }
- /*
- +HEADSET:1
- msg=1
- */
- void proHeadSet(char *msg){
- switch(msg[0]){
- case '0'://HEADSET CONNECT
- sutApp.earLev=1;
- //msgAtSend("AT+AUDCH=1,3\r\n");
- sutApp.pcant=2;
- VolMicUpdate();
- VolSpkUpdate();
- break;//HEADSET DISCONNECTED
- case '1':
- sutApp.earLev=0;
- //msgAtSend("AT+AUDCH=0,0\r\n");
- sutApp.pcant=4;
- VolMicUpdate();
- VolSpkUpdate();
- break;//HEADSET BTN PRESS
- case '2':
- micPttHandler(1);
- break;//HEADSET BTN RELEASED
- case '3':
- micPttHandler(0);
- break;
- }
- }
- /*
- +CCID: 898604851920C0133569
- msg=898604851920C0133569
- */
- void proCCIDMsg(char *msg){
- sutApp.cardStatus=1;
- msg[6]=0;
- sutApp.copstype=atoi(msg+4);
- }
- void LogoutOutTimeCheck(unsigned int interval){
- //鎺夌嚎鍚庤秴杩�3鍒嗛挓鍐嶇櫥褰曪紝闇€瑕佹挱鏀剧櫥褰曚俊鎭�
- static unsigned char lastLoginStatus=0;
- static unsigned int cnt=0;
- if(sutApp.reloginStatus == lastLoginStatus) return;
- if(sutApp.reloginStatus==0){//鐢卞湪绾垮彉鎴愭帀绾�
- if(++cnt>=(180000/interval)){
- cnt=0;
- sutApp.reloginTts=1;
- }
- }else{//鐢辨帀绾垮啀涓婄嚎
- cnt=0;
- }
- lastLoginStatus=sutApp.reloginStatus;
- }
- /*
- +CACCP: "04000a00"
- msg="04000a00"
- */
- static bool proMicGain(char *msg){
- if(0==strncmp(msg+1, "00000000", 8)) sutApp.audioReconfig=1;
- else sutApp.audioReconfig=0;
- MSG_INFO(1, ">>NeedReconfigAudio:%s", sutApp.audioReconfig?"yes":"no");
- return (sutApp.audioReconfig?true:false);
- }
- char *ohpocGetIMEI(void){
- static char imei[16]={0};
- if(imei[0]==0){
- if(LSAPI_SIM_GetIMEI(imei)==0){
- return imei;
- }
- }
- return NULL;
- }
- void ohpocGetClock(MY_CLOCK *myclock){
- return;
- }
- //+POC:8C00934C0008 2222222222//data: cmd data
- void pro8CMsg(char *msg){
- char buf[500];
- char temp[3]={0};
- char cmd=0;
-
- memcpy(temp,msg+17,2);
- cmd=htoi(temp);
- switch(cmd){
- case NULLCMD://信标
- Recv_PackNewxinbiaopage(msg);
- break;
- case YAOYUN:
- LeaderRecv_handler(msg,1);
- break;
- case YAOBI:
- LeaderRecv_handler(msg,2);
- break;
- case GPSALLON:
- break;
- }
- }
|