123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- #include "includes.h"
- int g_iModemVer=0;
- unsigned char g_iPocVer[20];
- SUT_POC_STATUS sutPocStatus;
- unsigned char danhureport[POC_GROUP_NAME_LEN];
- unsigned long g_ulGroupID;
- //+POC:1D00000000000000539B000BC4ACC8CFC8BAD7E9
- int GetAllGroups(char *msg)
- {
- unsigned short num;
- char name[POC_GROUP_NAME_LEN*2+1];
- unsigned long id;
- unsigned short index;
- char *pTemp;
- unsigned char len;
- // 当前index 组ID 组内成员个数 组名
- //+POC:1D000000 0001 0000539C 000B B2E2CAD4D7E931
-
- //成员查询 当前index 成员ID 成员名
- //+POC:1E010000 0000 0001CC49 3237
- if(msg[5]=='1' && msg[6]=='D'){
- if(!uiAssist.status)return 1;
- len = strlen(&msg[29])-2;
- if(len >= POC_GROUP_NAME_LEN*2) len = POC_GROUP_NAME_LEN*2;
- memcpy(name, &msg[29], len);
- name[len]=0;
- //组内成员个数
- msg[29]=0;
- num=strtol(&msg[25],&pTemp,16);
- //组ID
- msg[25]=0;
- id=strtol(&msg[17],&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);
- //printf("name====%s\r\n",sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name);
- sutPocStatus.ListFillIndex++;
- // printf("ListFillIndex==%d,ExceptionReadNum-==%d---------\r\n",sutPocStatus.ListFillIndex,sutPocStatus.ExceptionReadNum);
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- //printf("ListGetOneFlag==1----------\r\n");
- }
- return 1;
- }
-
- //+POC:groups,3,1,1,112213,4B6DD58BA47FC47E31000000
- if(0==ModemStrCmp(msg,"+POC:groups,"))
- {
- index=IndexReturnBySymbol(msg,',',4);
- sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].ID=atoi(&msg[index]);
- index=IndexReturnBySymbol(msg,',',5);
- ExchangeHighLowByte(&msg[index],strlen(&msg[index])-2);
- StrUnicodeToAnsi(sutPocStatus.AllGroups[sutPocStatus.ListFillIndex].name,strlen(&msg[index])-2,&msg[index]);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- //printf("ListGetOneFlag==1----------\r\n");
- }
- return 1;
- }
-
-
-
- return 0;
- }
- int GetAllUsers(char *msg)
- {
- unsigned short num;
- char name[POC_USER_NAME_LEN*2+1];
- unsigned long id;
- unsigned short index;
- char *pTemp;
- unsigned char len;
- //成员查询 当前index 成员ID 成员名
- //+POC:1E010000 0000 0001CC49 3237
- if(msg[5]=='1' && msg[6]=='E'){
- if(!uiAssist.status)return 1;
- len = strlen(&msg[25])-2;
- if(len >= POC_USER_NAME_LEN*2) len = POC_USER_NAME_LEN*2;
- memcpy(name, &msg[25], len);
- name[len]=0;
- // //
- // msg[29]=0;
- // num=strtol(&msg[25],&pTemp,16);
- //成员ID
- msg[25]=0;
- id=strtol(&msg[17],&pTemp,16);
- //添加
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=id;
- //sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].usernum=num;
- 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);
- // printf("Username====%s\r\n",sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum)sutPocStatus.ListGetOneFlag=1;
- return 1;
- }
-
- //+POC:members,4,0,1,65985,2875376230000000 总数4 索引0 状态1(1-离线2--在线不在本组 3在线在组) ID 名称
-
- if(0==ModemStrCmp(msg,"+POC:members,"))
- {
- index=IndexReturnBySymbol(msg,',',3);
- if(atoi(&msg[index])!=3)return 1;
- index=IndexReturnBySymbol(msg,',',4);
- sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].ID=atoi(&msg[index]);
-
- index=IndexReturnBySymbol(msg,',',5);
- ExchangeHighLowByte(&msg[index],strlen(&msg[index])-2);
- StrUnicodeToAnsi(sutPocStatus.AllUsers[sutPocStatus.ListFillIndex].name,strlen(&msg[index])-2,&msg[index]);
- sutPocStatus.ListFillIndex++;
- if(sutPocStatus.ListFillIndex==sutPocStatus.ExceptionReadNum){
- sutPocStatus.ListGetOneFlag=1;
- //printf("ListGetOneFlag==1----------\r\n");
- }
- return 1;
- }
- return 0;
- }
- char PocHandle(char *msg)
- {
- uint8_t temp[4];
- SUTDS ds;
- SUTDL dl;
- char buf[102];//100
- char *pName;
- unsigned char len,type;
- char pGroup[POC_GROUP_NAME_LEN*2]={0};
- static int Table[POC_GROUP_NAME_LEN*2]={0};
- unsigned short Index=0;
- int i;
- static unsigned char getNameFlag=0;
- static char Username[POC_USER_NAME_LEN+1];//因为播报时是先存了用户名,后面才存群组名,然后一起播报,故此值要是静态的,否则有时用户名会播报不出来
- char Groupname[POC_GROUP_NAME_LEN+1];
- //=============+LSHTTS: END
- if(msg[1]=='L' && msg[2]=='S' && msg[3]=='H' && msg[4]=='T' && msg[9]=='E'){
- sutPocStatus.TTS=0;
- if(sutPocStatus.Speaker==0)SpeakerDisable();
- return 1;
- }
-
- //+POC:0BXXYYYY
- //请求PTT返回
- //XX:00请求成功,可以不处理,因为同时有8Bxxyy回来处理打开喇叭
- //XX:FF请求失败,播报特tone音,与抢麦失败一样
- //YYYY:操作ID,不处理
- if(msg[5] == '0' && msg[6] == 'B')
- {
- // if(msg[7] == 'F' && msg[8] == 'F')
- // {
- // SpeakerEnable();
- // SetBeep(1000,10);
- // }
- // else if(msg[7] == '0' && msg[8] == '0')
- // {
- // sutPocStatus.Mic=1;
- // SpeakerEnable();
- // SetBeep(500,10);
- // //SlwTrace(INF, "Speak",1);
- // }
- return 1;
- }
-
- //+TONEON
- if(msg[5] == 'T' && msg[6] == 'O')
- {
- if(msg[7] == 'N' && msg[8] == 'E')
- {
- SpeakerEnable();
- uTimerCreate(UTIMER_BEEP,20);
- }
- return 1;
- }
-
- //+POC:8bxxyy
- //xx--mic控制 01--打开MIC
- // 00--关闭MIC
- //yy--speaker控制
- // 00--关闭speaker并要产生成功的滴音
- // 01--对方说话,打开speaker,并产生成功的滴音
- // 13--抢麦失败,打开speaker,并产生失败的滴音
- if(msg[5]=='8' && msg[6]=='B')
- {
- if( msg[7]=='0'&& msg[8]=='1')//xx == 01
- {
- enableDataSend();
- sutPocStatus.Mic=1;
- MicEnable();
- //SpeakerEnable();wjl
- //SetBeep(500,10);
- //uTimerCreate(UTIMER_BEEP,20);//wjl
- sutPocStatus.Speaker=0;
- //SpeakerDisable();
- sutPocStatus.Logined=1;
- }else if( msg[9]=='0'&& msg[10]=='2'){
- SpeakerEnable();
- }else if(msg[9]=='0' && msg[10] == '1')
- {//yy == 00 对方说话开始
- SpeakerEnable();
- enableDataSend();
- LCDBackLight(1);
- LcdOnTimeCt=0;
- ///////////////////
- //uTimerCreate(UTIMER_BEEP,20);
- // SetBeep(500,10);
- sutPocStatus.Logined=1;
- sutPocStatus.Speaker=1;
- sutPocStatus.Mic=0;
- // if(newPara.KeySound!=0){
- // SetBeep(500,10);
- // }
- }else if(msg[7]=='0'&& msg[8]=='0'&& msg[9]=='0' && msg[10] == '0')//xx == 00
- {
- sutPocStatus.Speaker=0;
- sutPocStatus.Mic=0;
- //SpeakerEnable();//wjl
- SpeakerDisable();//wjl
- //SetBeep(500,10);
- //uTimerCreate(UTIMER_BEEP,20);//wjl
- }
- if(msg[9]=='1' && msg[10]=='3')
- {
- //yy == 13 抢麦不成功滴音
- sutPocStatus.statusChaned=1;
- //sutPocStatus.Speaker=1;//3;//屏蔽掉后:能达到修改记录中的第6点
- SpeakerEnable();
- SetBeep(1000,10);
- }
- return 1;
- }
-
- //==============+POC:xxxx=============
- //+POC:820100000000 +POC:8201ffffffff
- //+POC:82 02 00002c8d 4b6dd58b3100300032000000 登陆成功,提示“测试102”
- //+POC:82 02 0000D590 B5E7C1BFB2E2CAD432 登陆成功 提示"电量测试2"
- if(msg[5]=='8' && msg[6]=='2')
- {
- buf[0] = msg[7];
- buf[1] = msg[8];
- buf[2] = 0;
- type = atoi(buf);
- switch(type)
- {
- case 0://离线 ID无效
- //if(sutPocStatus.Logined) HigosStartCnt(1);
- sutPocStatus.danHunStatus=0;//掉线,清单呼显示状态为非单呼状态
- sutPocStatus.Logined=0;
- sutGpsInfo.isGpsAuthOk=0;
- snprintf(buf, sizeof(buf),"[msg]");
- if(msg[17] == 'B' && msg[18]== '5' && msg[25] == 'C' && msg[26] == 'A')
- {//帐号信息错误
- pocTimeOutTime=5;
- sutPocStatus.loginResult=1;
- strcat(buf, "账号信息错误");
- }
- else
- if(msg[17] == 'C' && msg[18]== 'E' && msg[25] == 'C' && msg[26] == '2')
- {//无网络连接
-
- if(sutPocStatus.loginResult != 1)
- sutPocStatus.loginResult=2;
- strcat(buf, "无网络连接");
- }else if(msg[17] == 'C' && msg[18]== 'E' && msg[25] == 'C' && msg[26] == '1'){
- sutPocStatus.loginResult=5;
- strcat(buf, "无法连接");
- }else if(msg[17] == 'C' && msg[18]== '3' && msg[25] == 'B' && msg[26] == '7'){
- if(sutPocStatus.loginResult!=4) sutPocStatus.loginResult=6;
- strcat(buf, "没有服务");
- }
- else strcat(buf, "No login");
- SlwTrace(INF, buf, 1);
- break;
- case 1://登陆中 ID无效
- SlwTrace(INF, "login ing",1);
- break;
- case 2://登陆成功 ID为用户ID
- len = strlen(&msg[17])-2;
- if(len >= POC_USER_NAME_LEN) len = POC_USER_NAME_LEN;
- memcpy(Username,&msg[17],len);
- Username[len]=0;
- StrAsciiToHex(Username,sutPocStatus.LocalUser.name);
- msg[17]=0;
- sutPocStatus.LocalUser.ID=strtol(&msg[9],&pName,16);
- SlwTrace(INF, "login ok",1);
- getNameFlag=1;//登陆成功时,获取过了用户名字,后面可以播报了
- sutPocStatus.loginResult=3;
- break;
- case 3://注销中 ID无效
- SlwTrace(INF, "logout ing",1);
- break;
- }
- return 1;
- }
-
- //+POC:3D000003
- //+POC:3E000000 0001
- if(msg[5]=='3' && (msg[6]=='D'||msg[6]=='E')){
- sutPocStatus.ListCurOnlineNum=strtol(&msg[13],&pName,16);
- if(msg[6]=='E')sutPocStatus.UserOnLineNum=sutPocStatus.ListCurOnlineNum;
- sutPocStatus.ListUpdate=1;
- return 1;
- }
-
-
-
-
-
-
- //获取所有组列表,也就是处理+POC:80xxxs
- if(GetAllGroups(msg))return 1;
- if(GetAllUsers(msg))return 1;
-
- //获取所有成员列表,也就是处理+POC:81XXX
- //if(GetAllUsers(msg))return 1;
- //+POC:86 00 000000dc a47fc47e3300 0000 进入群组,提示“群组3”(群组ID为000000dc,群组名为“群组3”即a47fc47e3300)
- // 86 00 0000009a d89ea48ba47fc47e0000 默认群组
- //+POC:86 00 00000366 0000
- if(msg[5]=='8' && msg[6]=='6')
- {//----获取本机当前群组名及群组ID
- //HigosStopCnt();//正常登陆了,停止计数
- sutPocStatus.Logined=1;
- pocTimeOutTime=30;
- if(msg[8] == '0')
- {//GB2312
- len = strlen(&msg[17])-2;
- if(len >= POC_GROUP_NAME_LEN) len = POC_GROUP_NAME_LEN;
- memcpy(Groupname,&msg[17],len);
- Groupname[len]=0;
- msg[17]=0;
- sutPocStatus.LocalGroup.ID=strtol(&msg[9],&pName,16);
- StrAsciiToHex(Groupname,sutPocStatus.LocalGroup.name);
- if(sutPocStatus.FirstLogined==0)
- {//登陆成功用户名群组名只播报一次
- if(getNameFlag == 0)
- snprintf(buf, sizeof(buf), "%s",sutPocStatus.LocalGroup.name);
- else
- {
- getNameFlag=0;
- //snprintf(buf, sizeof(buf), "%s2CD2D1B5C7C2BD2C%s",Username,Groupname);
- snprintf(buf, sizeof(buf), "%s,已登录,%s",sutPocStatus.LocalUser.name,sutPocStatus.LocalGroup.name);
- }
- MeSpeak(ENCODE_ASCII, buf);
- }else
- {//其它形式进入
- if(g_ucEnterGroupFlag==1)
- {
- g_ucEnterGroupFlag=0;
- snprintf(buf, sizeof(buf), "进入,%s",sutPocStatus.LocalGroup.name);
- MeSpeak(ENCODE_ASCII, buf);
- }
- }
- }
- LcdOnTimeCt=0;
- sutPocStatus.danHunStatus=0;//收到这个直接设置为非单呼模式,否在会在单呼模式下如果被创建了临时群组,之后会一直显示单呼模式
- //if(sutPocStatus.FirstLogined==0) ModemSendAt("AT+CCLK?\r\n");
- sutPocStatus.FirstLogined=1;
- return 1;
- }
-
- //+POC:830000002e650000 对方话语权
- //+POC:83000000420c330067004b6dd58b3200f7530000
- //+POC:8300000045544800530031003500310057004b6dd58b300033000000
- //+POC:83000000D592 303738
- if(msg[5]=='8' && msg[6]=='3' && msg[7]=='0' && msg[8]=='0')
- {
- //最新POC版本快速短按PTT放开会只发这条过来,实际是没有请麦来的
- //因此不做灯与喇叭,LCD背光等控制
- ReplaceStrWithN(&msg[17]);
-
- //如果他只发ID不发对方名,要记得修改防护
- i=strlen(&msg[17]);
- if(i>=POC_USER_NAME_LEN) i=POC_USER_NAME_LEN;
- else i++;//把0结束也拷过去
- StrAsciiToHex(&msg[17], sutPocStatus.Callname);
- *(msg+17) = 0;
- sutPocStatus.CallID = strtol(&msg[9],&pName,16);
- msg[17]=0;
- return 1;
- }
- //+POC:8301ffffffff0000 对方释放话语权
- if(msg[5]=='8' && msg[6]=='3' && msg[7]=='0' && msg[8]=='1'){
- //最新POC版本目前没有这条指令,也忽视吧
- // sutPocStatus.Speaker=0;
- // SpeakerDisable();
- return 1;
- }
- //+POC:91010103
- if(msg[5]=='9' && msg[6]=='1'){
- //PocAddUserStatusToList(&msg[7]);
- return 1;
- }
- //+POC:0E00 0000 0002
- if(msg[5]=='0'&& msg[6]=='E'){
- msg[17]=0;
- StrAsciiToHex(&msg[13], temp);
- ds.Data.ucData.b1=temp[1];
- ds.Data.ucData.b2=temp[2];
- sutPocStatus.UserOnLineNum=ds.Data.usData;
- sutPocStatus.UserNum_Update=1;
- snprintf(buf, sizeof(buf), "oneLine:%d",sutPocStatus.UserOnLineNum);
- SlwTrace(INF, buf, 1);
- }
-
- //+POC:84 00 xxx //单呼提示
- if(msg[5]=='8' && msg[6]=='4')
- {
- MakeStrEndByNewLine(msg);
- StrAsciiToHex(&msg[9],danhureport);
- MeSpeak(ENCODE_ASCII , danhureport);
- //MeSpeak(ENCODE_ASCII , &msg[9]);
- //检测是哪种单呼
- if(memcmp(&msg[9], "C1D9CAB1", 8)==0)
- {//临时呼叫xxxx 被呼成功
- sutPocStatus.danHunStatus=1;//进入单显示
- }else if(memcmp(&msg[9], "CDCBB3F6", 8)==0)
- {//退出临时呼叫 退出单呼状态
- sutPocStatus.danHunStatus=0;
- }else if(memcmp(&msg[9], "BAF4BDD0B3C9B9A6", 16)==0)
- {//呼叫成功 主单呼
- sutPocStatus.danHunStatus=1;
- }
- return 1;
- }
-
- //+POC:1000000007 0004 00000BF9 0003 D1D0B7A2B2E2CAD4D7E93030
- //+POC:1000000008 0004 00000BF9 0003 D1D0B7A2B2E2CAD4D7E93030
- // 组索引 组ID 成员数 组名字
- //xxxxxxxx 4字节ID
- //nnnnnnnn 名称
- if(msg[5] == '1' &&
- msg[7] == '0' &&
- (msg[14] == '7' || msg[14] == '8'))
- {
- memset(sutPocStatus.GroupIdTemp, 0, POC_USER_ID_LEN);
- memcpy(sutPocStatus.GroupIdTemp, &msg[19], POC_USER_ID_LEN-1); //-1
- memcpy(sutPocStatus.switchGroupID,&msg[19], 8);
- MakeStrEndByNewLine(&msg[31]);
- //MeSpeak(ENCODE_GBK, &msg[31]);
-
- g_ucEnterGroupFlag=1;
- SpeakerCtrl(1);
- snprintf(buf, sizeof(buf),"AT+POC=090000%s\r\n",sutPocStatus.GroupIdTemp);
- ModemSendAt(buf);
-
- return 1;
- }
-
-
-
- //+POC:21 000000 0000D590 B5E7C1BFB2E2CAD432
- //+POC:21 000000 0001CC4B BAECC0F0D3E3D3EBC2CCC0F0D3E3D1BD
- // 关键字 保留 UID 名称
- if(msg[5]=='2' && msg[6]=='1'){
- MakeStrEndByNewLine(msg);
-
- //MeSpeak(ENCODE_GBK ,"B5E7C1BFB2E2CAD432",0);
- MeSpeak(ENCODE_GBK , &msg[21]);
- msg[21]=0;
- strncpy(sutPocStatus.UserIdTemp,&msg[13],POC_USER_ID_LEN);
-
- return 1;
- }
-
-
-
-
-
- // if(0==ModemStrCmp(msg,"+POC:naud"))
- // {
- // if(msg[10]=='1')SpeakerEnable();
- // else if(msg[10]=='0')SpeakerDisable();
- // return 1;
- // }
-
- if(0==ModemStrCmp(msg,"+LSPA:"))
- {
- if(msg[7]=='1'){
- ModemSendAt("AT+LSPA=1,1\r\n");
- SpeakerEnable();
- ModemSendAt("AT+LSPA=1,2\r\n");
- LCDBackLight(1);
- LcdOnTimeCt=0;
- }
- else if(msg[7]=='0'){
- ModemSendAt("AT+LSPA=1,3\r\n");
- SpeakerDisable();
- ModemSendAt("AT+LSPA=1,4\r\n");
- }
- return 1;
- }
-
-
- if(0==ModemStrCmp(msg,"+POC:nloginstat,2,"))
- {
- Index=IndexReturnBySymbol(msg,',',2);
- sutPocStatus.LocalUser.ID = atoi(&msg[Index]);
- Index=IndexReturnBySymbol(msg,',',3);
- sutPocStatus.LocalUser.ID = atoi(&msg[Index]);
- printf("len====%d\r\n",strlen(&msg[Index])-2);
- memset(Username,0,sizeof(Username));
- ExchangeHighLowByte(&msg[Index],strlen(&msg[Index])-2);
- StrUnicodeToAnsi(Username,strlen(&msg[Index])-2,&msg[Index]);
- printf("------%s\r\n",Username);
- strcpy(sutPocStatus.LocalUser.name,Username);
- return 1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:nloginstat,1"))
- {
- sutPocStatus.Logined=0;
- return 1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:groupnum,"))
- {
- Index=IndexReturnBySymbol(msg,',',2);
- sutPocStatus.ListCurOnlineNum=atoi(&msg[Index]);
- sutPocStatus.ListUpdate=1;
- sutPocStatus.UserNum_Update=1;
- snprintf(buf, sizeof(buf), "oneLine:%d",sutPocStatus.ListCurOnlineNum);
- SlwTrace(INF, buf, 1);
- return 1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:membernum,"))
- {
- //+POC:membernum,1,5,3,2 总数 5,在线个数 3,在线且在本组个数 2
-
- Index=IndexReturnBySymbol(msg,',',4);
- sutPocStatus.ListCurOnlineNum=atoi(&msg[Index]);
- sutPocStatus.ListUpdate=1;
- sutPocStatus.UserNum_Update=1;
- snprintf(buf, sizeof(buf), "oneLine:%d",sutPocStatus.ListCurOnlineNum);
- SlwTrace(INF, buf, 1);
- return 1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:ncurrgroup,0"))
- {
- sutPocStatus.Logined=1;
- sutPocStatus.FirstLogined=1;
- sutPocStatus.danHunStatus=0;
- Index=IndexReturnBySymbol(msg,',',2);
- sutPocStatus.LocalGroup.ID = atoi(&msg[Index]);
- Index=IndexReturnBySymbol(msg,',',3);
- printf("len====%d\r\n",strlen(&msg[Index])-2);
- printf("content====%s\r\n",&msg[Index]);
- memset(Groupname,0,sizeof(Groupname));
- /*先高低字节转换*/
- ExchangeHighLowByte(&msg[Index],strlen(&msg[Index])-2);
- StrUnicodeToAnsi(Groupname,strlen(&msg[Index])-2,&msg[Index]);
- //StrUnicodeToAnsi(Groupname,12,"a47fc47e6b51");
- for(i=0;i<strlen(Groupname);i++)
- {
- printf("%02x",Groupname[i]);
- }
- printf("\r\n");
- strcpy(sutPocStatus.LocalGroup.name,Groupname);
- return 1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:ncurrgroup,2"))sutPocStatus.danHunStatus=1;
- /*
- //请麦
- AT+POC=ptt,1
- 请麦成功: +POC: ptt,1,1
- 请麦失败: +POC:ptt,0,1
- //放麦
- AT+POC=ptt,0
- 放麦成功: +POC: ptt,1,0
- 放麦失败: +POC:ptt,0,0
- */
- if(0==ModemStrCmp(msg,"+POC:ptt,1")){
- Index=IndexReturnBySymbol(msg,',',2);
- sutPocStatus.Mic= atoi(&msg[Index]);
- }
- /*
- //+POC:nspk,0,2099357,30003100340031000000
- StrAsciiToHex(&msg[17], sutPocStatus.Callname);
- *(msg+17) = 0;
- sutPocStatus.CallID = strtol(&msg[9],&pName,16);
- msg[17]=0;
- */
- if(0==ModemStrCmp(msg,"+POC:nspk,0")){
- Index=IndexReturnBySymbol(msg,',',2);
- if(0==atoi(&msg[Index]))return 1;
- sutPocStatus.CallID= atoi(&msg[Index]);
- Index=IndexReturnBySymbol(msg,',',3);
- ExchangeHighLowByte(&msg[Index],strlen(&msg[Index])-2);
- StrUnicodeToAnsi(sutPocStatus.Callname,strlen(&msg[Index])-2,&msg[Index]);
- sutPocStatus.Speaker=1;
- }
-
- if(0==ModemStrCmp(msg,"+POC:nspk,1")){
- sutPocStatus.Speaker=0;
- }
-
- //+POC:nuserchanged,1880496172,2099354,5
- if(0==ModemStrCmp(msg,"+POC:nuserchanged")){
- // Index=IndexReturnBySymbol(msg,',',3);
- // if(atoi(&msg[Index])==5)sutPocStatus.danHunStatus=1;
- // else if(atoi(&msg[Index])==2)sutPocStatus.danHunStatus=0;
- }
-
- //+POC:ngps,1,30
- // if(0==ModemStrCmp(msg,"+POC:ngps")){
- // Index=IndexReturnBySymbol(msg,',',1);
- // g_uiGpsStat=atoi(&msg[Index]);
- // return 1;
- // }
-
-
- // //ptt,1
- // if(0==ModemStrCmp(msg,"ptt,1")){
- // SpeakerEnable();
- // }
-
- return 0;
-
- }
- void ExchangeHighLowByte(char *src,unsigned short lenth)
- {
- unsigned short i;
- unsigned char temp;
- for(i=0;i<lenth;i+=4)
- {
- temp=src[i];
- src[i]=src[i+2];
- src[i+2]=temp;
- temp=src[i+1];
- src[i+1]=src[i+3];
- src[i+3]=temp;
- }
- }
- char IndexReturnBySymbol(char *src,char Symbol,char num)
- {
- char i=0;
- char index=0;
- while(*src){
- if(*src==Symbol) i++;
- src++;
- index++;
- if(num==i)return index;
- }
- return 0;
- }
- /******************************************************************************
- *******************************************************************************/
- void TTSdaxieguibi(char *src) //
- {
- int srclen;
- unsigned char *p;
- int i,j;
- char flag=0;
- char buf[300];//100
- memset(buf,0,sizeof(buf));
- srclen=strlen(src);
- p=(unsigned char *)src;
- i=0;
- j=0;
- while(i<(srclen)){
- if(*p>0x9f){
- if(flag){
- buf[j++]=',';
- flag=0;
- }
- buf[j++]=*p;
- p+=1;
- buf[j++]=*p;
- p+=1;
- i+=2;
- }else{
- if((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')){
- flag=1;
- }
- else flag=0;
- buf[j]=*p;
- p+=1;
- i+=1;
- j+=1;
- }
- }
- buf[j]=0;
- // printf("buf====%s\r\n",buf);
- ModemSendAt(buf);
- }
|