|
@@ -223,7 +223,7 @@ static void TcpTask(void* arg)
|
|
static void TcpDataInfoAssembleSend()
|
|
static void TcpDataInfoAssembleSend()
|
|
{
|
|
{
|
|
OsaUtcTimeTValue TimeStracture;
|
|
OsaUtcTimeTValue TimeStracture;
|
|
- UINT8 csq=0;
|
|
|
|
|
|
+
|
|
INT8 snr=0;
|
|
INT8 snr=0;
|
|
INT8 rsnr=0;
|
|
INT8 rsnr=0;
|
|
|
|
|
|
@@ -237,34 +237,9 @@ static void TcpDataInfoAssembleSend()
|
|
UINT8 i = 0;
|
|
UINT8 i = 0;
|
|
INT16 len = -1;
|
|
INT16 len = -1;
|
|
UINT8 *SendBuffer = NULL;
|
|
UINT8 *SendBuffer = NULL;
|
|
- //电池工作模式的延迟转换由Maintask负责,发送频率调节由tcp负责
|
|
|
|
- switch (BattWorkStateDelay)
|
|
|
|
- {
|
|
|
|
- case BATT_IDLE_SYM:
|
|
|
|
- {
|
|
|
|
- BattSendFreq = AppDataInfo.BattInfoSendFreqLow;
|
|
|
|
- GpsSendFreq = AppDataInfo.PosInfoSendFreqLow;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case BATT_CHARGE_SYM:
|
|
|
|
- {
|
|
|
|
- BattSendFreq = AppDataInfo.BattInfoSendFreqHigh;
|
|
|
|
- GpsSendFreq = AppDataInfo.PosInfoSendFreqLow;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case BATT_DISCHARGE_SYM:
|
|
|
|
- {
|
|
|
|
- BattSendFreq = AppDataInfo.BattInfoSendFreqNomal;
|
|
|
|
- GpsSendFreq = AppDataInfo.PosInfoSendFreqHigh;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- default:
|
|
|
|
- {
|
|
|
|
- BattSendFreq = AppDataInfo.BattInfoSendFreqNomal;
|
|
|
|
- GpsSendFreq = AppDataInfo.PosInfoSendFreqNormal;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ appGetSignalInfoSync(&csq,&snr,&rsnr);
|
|
|
|
+ BattSendFreq = AppDataInfo.BattInfoSendFreqNomal;
|
|
|
|
+ GpsSendFreq = AppDataInfo.PosInfoSendFreqNormal;
|
|
if(getbit(PadInterrupt,3)==1||getbit(PadInterrupt,4)==1)//有震动产生,提高位置信息发送频率
|
|
if(getbit(PadInterrupt,3)==1||getbit(PadInterrupt,4)==1)//有震动产生,提高位置信息发送频率
|
|
{
|
|
{
|
|
GpsSendFreq = AppDataInfo.PosInfoSendFreqHigh;
|
|
GpsSendFreq = AppDataInfo.PosInfoSendFreqHigh;
|
|
@@ -274,7 +249,8 @@ static void TcpDataInfoAssembleSend()
|
|
clrbit(PadInterrupt,4);
|
|
clrbit(PadInterrupt,4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(send_counter%BattSendFreq==0 && send_counter!=0)
|
|
|
|
|
|
+ /*
|
|
|
|
+ if(FALSE)
|
|
{
|
|
{
|
|
UINT16 ErrorTemp = 0x00;
|
|
UINT16 ErrorTemp = 0x00;
|
|
UINT8 ProtocolHeaderLen = 25; //电池信息协议头部加校验码长度,此长度不更改
|
|
UINT8 ProtocolHeaderLen = 25; //电池信息协议头部加校验码长度,此长度不更改
|
|
@@ -382,6 +358,7 @@ static void TcpDataInfoAssembleSend()
|
|
}
|
|
}
|
|
SendBuffer=NULL;
|
|
SendBuffer=NULL;
|
|
}
|
|
}
|
|
|
|
+ */
|
|
if(send_counter%GpsSendFreq==0 && send_counter!=0)
|
|
if(send_counter%GpsSendFreq==0 && send_counter!=0)
|
|
{
|
|
{
|
|
GPSInfo *GpsRecvData=NULL;
|
|
GPSInfo *GpsRecvData=NULL;
|
|
@@ -542,12 +519,73 @@ static void TcpDataInfoAssembleSend()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(send_counter%30==0)//调试信息暂时不发,需调整之后发送
|
|
|
|
|
|
+ if((send_counter)%10==0)//90发送
|
|
{
|
|
{
|
|
|
|
+ appGetSystemTimeUtcSync(&TimeStracture);
|
|
|
|
+ year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
|
|
+ month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
|
|
+ day=TimeStracture.UTCtimer1&0xff;
|
|
|
|
+ hour=(TimeStracture.UTCtimer2&0xff000000)>>24;
|
|
|
|
+ minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
|
|
+ sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
|
|
+ UTCToBeijing((UTC8TimeType *)&UTC8TimeTcp,year,month,day,hour,minute,sec);
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
- UINT16 BufferLen = 1000;
|
|
|
|
|
|
+ UINT8 Tcptype =0x90;
|
|
|
|
+ UINT16 BufferLen1 = 0x55,BufferLen = 0;
|
|
|
|
+ UINT8 *rbuf = NULL;
|
|
|
|
+ rbuf = malloc(BufferLen1);
|
|
|
|
+ BufferLen = BufferLen1*2;
|
|
SendBuffer = malloc(BufferLen+sizeof(DebugMsgInfo));
|
|
SendBuffer = malloc(BufferLen+sizeof(DebugMsgInfo));
|
|
- memset(SendBuffer+sizeof(DebugMsgInfo)-1, 0x41,BufferLen);
|
|
|
|
|
|
+ TcpDataAssemble(Tcptype,rbuf,UTC8TimeTcp);
|
|
|
|
+ for(UINT16 i=0;i<BufferLen1;i++)
|
|
|
|
+ {
|
|
|
|
+ sprintf((char *)(SendBuffer+sizeof(DebugMsgInfo)-1+i*2),"%02x",*(rbuf+i));
|
|
|
|
+ }
|
|
|
|
+ if(rbuf!=NULL)
|
|
|
|
+ {
|
|
|
|
+ free(rbuf);
|
|
|
|
+ }
|
|
|
|
+ rbuf=NULL;
|
|
|
|
+ DataLen=sizeof(DebugMsgInfo.DebugInfo) + BufferLen;
|
|
|
|
+ DebugMsgInfo.startSymbol[0] = TCP_START_SYM1;
|
|
|
|
+ DebugMsgInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
|
+ DebugMsgInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
|
+ DebugMsgInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
|
+ memcpy(DebugMsgInfo.SN, AppNVMData.battSN,BATT_SN_LEN);
|
|
|
|
+ DebugMsgInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
|
+ DebugMsgInfo.dataLength[0] = (DataLen>>8) & 0xFF;
|
|
|
|
+ DebugMsgInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[0] = (UTC8TimeTcp.year - 0x07D0) & 0xFF; //year
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; //month
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; //day
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; //hour
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; //mins
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; //sec
|
|
|
|
+ DebugMsgInfo.DebugInfo.msgMark = DEBUGMSG;
|
|
|
|
+ DebugMsgInfo.DebugInfo.DebugLen[0] = BufferLen>>8;
|
|
|
|
+ DebugMsgInfo.DebugInfo.DebugLen[1] = BufferLen;
|
|
|
|
+ memcpy(SendBuffer,(UINT8 *)&DebugMsgInfo,sizeof(DebugMsgInfo)-1);
|
|
|
|
+ DebugMsgInfo.CRC = bcc_chk(SendBuffer, BufferLen+sizeof(DebugMsgInfo)-1);
|
|
|
|
+ memcpy(SendBuffer+BufferLen+sizeof(DebugMsgInfo)-1,&DebugMsgInfo.CRC,1);
|
|
|
|
+ len = tcpipConnectionSend(socContext.id, SendBuffer, BufferLen+sizeof(DebugMsgInfo), 0, 0, 0);
|
|
|
|
+ #ifdef USING_PRINTF
|
|
|
|
+ printf("[%d]DebugMsg-[%d]-[%d]:\n",__LINE__,BufferLen,len);
|
|
|
|
+ #endif
|
|
|
|
+ #ifdef USING_PRINTF1
|
|
|
|
+ printf("[%d]DebugMsg-[%d]:\n",__LINE__,len);
|
|
|
|
+ for (UINT16 i = 0; i < BufferLen*2+sizeof(DebugMsgInfo); i++)
|
|
|
|
+ {
|
|
|
|
+ printf("%02x ",*(SendBuffer + i));
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+ if(SendBuffer!=NULL)
|
|
|
|
+ {
|
|
|
|
+ free(SendBuffer);
|
|
|
|
+ }
|
|
|
|
+ SendBuffer=NULL;
|
|
|
|
+ }
|
|
|
|
+ if((send_counter+1)%10==0)//91发送
|
|
|
|
+ {
|
|
appGetSystemTimeUtcSync(&TimeStracture);
|
|
appGetSystemTimeUtcSync(&TimeStracture);
|
|
year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
@@ -556,6 +594,23 @@ static void TcpDataInfoAssembleSend()
|
|
minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
UTCToBeijing((UTC8TimeType *)&UTC8TimeTcp,year,month,day,hour,minute,sec);
|
|
UTCToBeijing((UTC8TimeType *)&UTC8TimeTcp,year,month,day,hour,minute,sec);
|
|
|
|
+ DebugMsgtoTcpType DebugMsgInfo;
|
|
|
|
+ UINT8 Tcptype =0x91;
|
|
|
|
+ UINT16 BufferLen1 = 0x52 + numOfCells*2 + numOfCellTemp,BufferLen = 0;
|
|
|
|
+ UINT8 *rbuf = NULL;
|
|
|
|
+ BufferLen = BufferLen1*2;
|
|
|
|
+ rbuf = malloc(BufferLen1);
|
|
|
|
+ SendBuffer = malloc(BufferLen+sizeof(DebugMsgInfo));
|
|
|
|
+ TcpDataAssemble(Tcptype,rbuf,UTC8TimeTcp);
|
|
|
|
+ for(UINT16 i=0;i<BufferLen1;i++)
|
|
|
|
+ {
|
|
|
|
+ sprintf((char *)(SendBuffer+sizeof(DebugMsgInfo)-1+i*2),"%02x",*(rbuf+i));
|
|
|
|
+ }
|
|
|
|
+ if(rbuf!=NULL)
|
|
|
|
+ {
|
|
|
|
+ free(rbuf);
|
|
|
|
+ }
|
|
|
|
+ rbuf=NULL;
|
|
DataLen=sizeof(DebugMsgInfo.DebugInfo) + BufferLen;
|
|
DataLen=sizeof(DebugMsgInfo.DebugInfo) + BufferLen;
|
|
DebugMsgInfo.startSymbol[0] = TCP_START_SYM1;
|
|
DebugMsgInfo.startSymbol[0] = TCP_START_SYM1;
|
|
DebugMsgInfo.startSymbol[1] = TCP_START_SYM2;
|
|
DebugMsgInfo.startSymbol[1] = TCP_START_SYM2;
|
|
@@ -579,10 +634,13 @@ static void TcpDataInfoAssembleSend()
|
|
memcpy(SendBuffer+BufferLen+sizeof(DebugMsgInfo)-1,&DebugMsgInfo.CRC,1);
|
|
memcpy(SendBuffer+BufferLen+sizeof(DebugMsgInfo)-1,&DebugMsgInfo.CRC,1);
|
|
len = tcpipConnectionSend(socContext.id, SendBuffer, BufferLen+sizeof(DebugMsgInfo), 0, 0, 0);
|
|
len = tcpipConnectionSend(socContext.id, SendBuffer, BufferLen+sizeof(DebugMsgInfo), 0, 0, 0);
|
|
#ifdef USING_PRINTF
|
|
#ifdef USING_PRINTF
|
|
- printf("DebugMsg-[%d]:\n",len);
|
|
|
|
- for (int i = 0; i < BufferLen+sizeof(DebugMsgInfo); i++)
|
|
|
|
|
|
+ printf("[%d]DebugMsg-[%d]-[%d]:\n",__LINE__,BufferLen,len);
|
|
|
|
+ #endif
|
|
|
|
+ #ifdef USING_PRINTF1
|
|
|
|
+ printf("[%d]DebugMsg-[%d]:\n",__LINE__,len);
|
|
|
|
+ for (UINT16 i = 0; i < BufferLen*2+sizeof(DebugMsgInfo); i++)
|
|
{
|
|
{
|
|
- printf("%02x ",*(SendBuffer + i));
|
|
|
|
|
|
+ printf("%c ",*(SendBuffer + i));
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
if(SendBuffer!=NULL)
|
|
if(SendBuffer!=NULL)
|
|
@@ -591,6 +649,72 @@ static void TcpDataInfoAssembleSend()
|
|
}
|
|
}
|
|
SendBuffer=NULL;
|
|
SendBuffer=NULL;
|
|
}
|
|
}
|
|
|
|
+ if((send_counter+2)%60==0)//92发送
|
|
|
|
+ {
|
|
|
|
+ appGetSystemTimeUtcSync(&TimeStracture);
|
|
|
|
+ year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
|
|
+ month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
|
|
+ day=TimeStracture.UTCtimer1&0xff;
|
|
|
|
+ hour=(TimeStracture.UTCtimer2&0xff000000)>>24;
|
|
|
|
+ minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
|
|
+ sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
|
|
+ UTCToBeijing((UTC8TimeType *)&UTC8TimeTcp,year,month,day,hour,minute,sec);
|
|
|
|
+ DebugMsgtoTcpType DebugMsgInfo;
|
|
|
|
+ UINT8 Tcptype =0x92;
|
|
|
|
+ UINT16 BufferLen1 = 0x4D,BufferLen = 0;
|
|
|
|
+ UINT8 *rbuf = NULL;
|
|
|
|
+ rbuf = malloc(BufferLen1);
|
|
|
|
+ BufferLen = BufferLen1*2;
|
|
|
|
+ SendBuffer = malloc(BufferLen+sizeof(DebugMsgInfo));
|
|
|
|
+ TcpDataAssemble(Tcptype,rbuf,UTC8TimeTcp);
|
|
|
|
+ for(UINT16 i=0;i<BufferLen1;i++)
|
|
|
|
+ {
|
|
|
|
+ sprintf((char *)(SendBuffer+sizeof(DebugMsgInfo)-1+i*2),"%02x",*(rbuf+i));
|
|
|
|
+ }
|
|
|
|
+ if(rbuf!=NULL)
|
|
|
|
+ {
|
|
|
|
+ free(rbuf);
|
|
|
|
+ }
|
|
|
|
+ rbuf=NULL;
|
|
|
|
+ #ifdef USING_PRINTF
|
|
|
|
+ printf("[%d]DebugMsg-[%d]:\n",__LINE__,BufferLen);
|
|
|
|
+ #endif
|
|
|
|
+ DataLen=sizeof(DebugMsgInfo.DebugInfo) + BufferLen;
|
|
|
|
+ DebugMsgInfo.startSymbol[0] = TCP_START_SYM1;
|
|
|
|
+ DebugMsgInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
|
+ DebugMsgInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
|
+ DebugMsgInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
|
+ memcpy(DebugMsgInfo.SN, AppNVMData.battSN,BATT_SN_LEN);
|
|
|
|
+ DebugMsgInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
|
+ DebugMsgInfo.dataLength[0] = (DataLen>>8) & 0xFF;
|
|
|
|
+ DebugMsgInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[0] = (UTC8TimeTcp.year - 0x07D0) & 0xFF; //year
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; //month
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; //day
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; //hour
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; //mins
|
|
|
|
+ DebugMsgInfo.DebugInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; //sec
|
|
|
|
+ DebugMsgInfo.DebugInfo.msgMark = DEBUGMSG;
|
|
|
|
+ DebugMsgInfo.DebugInfo.DebugLen[0] = BufferLen>>8;
|
|
|
|
+ DebugMsgInfo.DebugInfo.DebugLen[1] = BufferLen;
|
|
|
|
+ memcpy(SendBuffer,(UINT8 *)&DebugMsgInfo,sizeof(DebugMsgInfo)-1);
|
|
|
|
+ DebugMsgInfo.CRC = bcc_chk(SendBuffer, BufferLen+sizeof(DebugMsgInfo)-1);
|
|
|
|
+ memcpy(SendBuffer+BufferLen+sizeof(DebugMsgInfo)-1,&DebugMsgInfo.CRC,1);
|
|
|
|
+ len = tcpipConnectionSend(socContext.id, SendBuffer, BufferLen+sizeof(DebugMsgInfo), 0, 0, 0);
|
|
|
|
+ #ifdef USING_PRINTF1
|
|
|
|
+ printf("[%d]DebugMsg-[%d]:\n",__LINE__,len);
|
|
|
|
+ for (UINT16 i = 0; i < BufferLen*2+sizeof(DebugMsgInfo); i++)
|
|
|
|
+ {
|
|
|
|
+ printf("%c ",*(SendBuffer + i));
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+ if(SendBuffer!=NULL)
|
|
|
|
+ {
|
|
|
|
+ free(SendBuffer);
|
|
|
|
+ }
|
|
|
|
+ SendBuffer=NULL;
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
if(FALSE)//调试信息暂时不发,需调整之后发送
|
|
if(FALSE)//调试信息暂时不发,需调整之后发送
|
|
{
|
|
{
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
@@ -598,7 +722,7 @@ static void TcpDataInfoAssembleSend()
|
|
slpManWakeSrc_e Wakeup_source;
|
|
slpManWakeSrc_e Wakeup_source;
|
|
Wakeup_source = slpManGetWakeupSrc();//获取唤醒源
|
|
Wakeup_source = slpManGetWakeupSrc();//获取唤醒源
|
|
#ifdef DEBUGLOG
|
|
#ifdef DEBUGLOG
|
|
- Debug_printf("[%d,%d,%d]\n",Wakeup_source,AppDataInfo.SysReStartCount,AppDataInfo.AccMileage);
|
|
|
|
|
|
+ Debug_printf("[%d]\n",Wakeup_source);
|
|
#endif
|
|
#endif
|
|
BufferLen = Debug_GetSize();
|
|
BufferLen = Debug_GetSize();
|
|
if(BufferLen==0)
|
|
if(BufferLen==0)
|
|
@@ -665,6 +789,7 @@ static void TcpDataInfoAssembleSend()
|
|
}
|
|
}
|
|
SendBuffer=NULL;
|
|
SendBuffer=NULL;
|
|
}
|
|
}
|
|
|
|
+ */
|
|
if(send_counter>0xffff)
|
|
if(send_counter>0xffff)
|
|
{
|
|
{
|
|
send_counter = 0;
|
|
send_counter = 0;
|
|
@@ -734,70 +859,6 @@ static void TcpDataInfoRecvHandle()
|
|
{
|
|
{
|
|
Fota_Func(Ptr,socContext.id);
|
|
Fota_Func(Ptr,socContext.id);
|
|
}
|
|
}
|
|
- else if(*(Ptr+30)==0x80)//远程锁定命令
|
|
|
|
- {
|
|
|
|
- TcpCmdAnswer[3] = 0x01;
|
|
|
|
- memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
|
|
|
|
- TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
|
|
|
|
- TcpCmdAnswer[22] = 0x00;
|
|
|
|
- TcpCmdAnswer[23] = 0x06;
|
|
|
|
- memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
|
|
|
|
- TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
|
|
|
|
- if(*(Ptr+31)==0x01)//0x01代表锁定
|
|
|
|
- {
|
|
|
|
- AppDataInfo.appDataModify = TRUE;
|
|
|
|
- AppDataInfo.BattLock = TRUE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- else if(*(Ptr+31)==0x02) //0x02代表解锁
|
|
|
|
- {
|
|
|
|
- AppDataInfo.appDataModify = TRUE;
|
|
|
|
- AppDataInfo.BattLock = FALSE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else if(*(Ptr+30)==0x8A)//继电器控制
|
|
|
|
- {
|
|
|
|
- TcpCmdAnswer[3] = 0x01;
|
|
|
|
- memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
|
|
|
|
- TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
|
|
|
|
- TcpCmdAnswer[22] = 0x00;
|
|
|
|
- TcpCmdAnswer[23] = 0x06;
|
|
|
|
- memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
|
|
|
|
- TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
|
|
|
|
- if(*(Ptr+31)==0x01)//0x01代表断开
|
|
|
|
- {
|
|
|
|
- AppDataInfo.appDataModify = TRUE;
|
|
|
|
- AppDataInfo.RelayControl = TRUE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- else if(*(Ptr+31)==0x00) //0x00代表关闭
|
|
|
|
- {
|
|
|
|
- AppDataInfo.appDataModify = TRUE;
|
|
|
|
- AppDataInfo.RelayControl = FALSE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else if(*(Ptr+30)==0x89)//蜂鸣器控制
|
|
|
|
- {
|
|
|
|
- TcpCmdAnswer[3] = 0x01;
|
|
|
|
- memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
|
|
|
|
- TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
|
|
|
|
- TcpCmdAnswer[22] = 0x00;
|
|
|
|
- TcpCmdAnswer[23] = 0x06;
|
|
|
|
- memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
|
|
|
|
- TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
|
|
|
|
- if(*(Ptr+31)==0x01) //0x01代表断开
|
|
|
|
- {
|
|
|
|
- BuzzerControl = TRUE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- else if(*(Ptr+31)==0x00) //0x00代表关闭
|
|
|
|
- {
|
|
|
|
- BuzzerControl = FALSE;
|
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
else
|
|
else
|
|
{
|
|
{
|
|
TcpCmdAnswer[3] = 0x0f;
|
|
TcpCmdAnswer[3] = 0x0f;
|