|
@@ -306,9 +306,11 @@ static void TcpDataInfoAssembleSend()
|
|
|
break;
|
|
|
case 0x01:
|
|
|
GpsSendFreq = AppDataInfo.GpsDisChrgInfoSendFreq/5;
|
|
|
+ BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
|
|
|
break;
|
|
|
case 0x02:
|
|
|
BattSendFreq = AppDataInfo.BmsChrgInfoSendFreq/5;
|
|
|
+ GpsSendFreq = AppDataInfo.GpsChrgInfoSendFreq/5;
|
|
|
break;
|
|
|
default:
|
|
|
BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
|
|
@@ -663,59 +665,72 @@ static void TcpDataInfoRecvHandle()
|
|
|
}
|
|
|
switch (Tcp_Cmd)
|
|
|
{
|
|
|
- case TCP_QUERY_SYM:
|
|
|
- break;
|
|
|
- case TCP_SETCMD_SYM:
|
|
|
- break;
|
|
|
- case TCP_CONCMD_SYM:
|
|
|
- {
|
|
|
- TcpCmdAnswer[2] = TCP_CONCMD_SYM;
|
|
|
- if(*(Ptr+30)==0x01)//远程升级命令
|
|
|
- {
|
|
|
- Fota_Func(Ptr,socContext.id);
|
|
|
- }
|
|
|
- else if(*(Ptr+30)==0x88)//BMS远程升级数据传输命令
|
|
|
- {
|
|
|
- Fota_Func(Ptr,socContext.id);
|
|
|
- }
|
|
|
- else if(*(Ptr+30)==0x80)//远程锁定命令
|
|
|
+ case TCP_QUERY_SYM:
|
|
|
+ break;
|
|
|
+ case TCP_SETCMD_SYM:
|
|
|
+ break;
|
|
|
+ case TCP_CONCMD_SYM:
|
|
|
{
|
|
|
- //osMutexAcquire(UartMutex, osWaitForever);
|
|
|
- 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代表锁定
|
|
|
+ TcpCmdAnswer[2] = TCP_CONCMD_SYM;
|
|
|
+ if(*(Ptr+30)==0x01)//远程升级命令
|
|
|
+ {
|
|
|
+ Fota_Func(Ptr,socContext.id);
|
|
|
+ }
|
|
|
+ else if(*(Ptr+30)==0x88)//BMS远程升级数据传输命令
|
|
|
{
|
|
|
- AppNVMData.appDataModify = TRUE;
|
|
|
- AppNVMData.isBattLocked = TRUE;
|
|
|
- UartWriteCmd.WriteCmd = 0x01;
|
|
|
- UartWriteCmd.Data[0] = 0x00;
|
|
|
- UartWriteCmd.Data[1] = 0x00;
|
|
|
- if(battWorkState ==0x00)
|
|
|
+ Fota_Func(Ptr,socContext.id);
|
|
|
+ }
|
|
|
+ else if(*(Ptr+30)==0x80)//远程锁定命令
|
|
|
+ {
|
|
|
+ //osMutexAcquire(UartMutex, osWaitForever);
|
|
|
+ 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代表锁定
|
|
|
{
|
|
|
+ AppNVMData.appDataModify = TRUE;
|
|
|
+ AppNVMData.isBattLocked = TRUE;
|
|
|
+ UartWriteCmd.WriteCmd = 0x01;
|
|
|
+ UartWriteCmd.Data[0] = 0x00;
|
|
|
+ UartWriteCmd.Data[1] = 0x00;
|
|
|
+ if(battWorkState ==0x00)
|
|
|
+ {
|
|
|
+ osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
|
|
|
+ }
|
|
|
+ tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
+ }
|
|
|
+ else //0x02代表解锁
|
|
|
+ {
|
|
|
+ AppNVMData.appDataModify = TRUE;
|
|
|
+ AppNVMData.isBattLocked = FALSE;
|
|
|
+ UartWriteCmd.WriteCmd = 0x01;
|
|
|
+ UartWriteCmd.Data[0] = 0x00;
|
|
|
+ UartWriteCmd.Data[1] = 0x03;
|
|
|
osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
|
|
|
+ tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
}
|
|
|
- tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
+ //osMutexRelease(UartMutex);
|
|
|
+ TcpService=0x00;
|
|
|
+
|
|
|
}
|
|
|
- else //0x02代表解锁
|
|
|
+ else
|
|
|
{
|
|
|
- AppNVMData.appDataModify = TRUE;
|
|
|
- AppNVMData.isBattLocked = FALSE;
|
|
|
- UartWriteCmd.WriteCmd = 0x01;
|
|
|
- UartWriteCmd.Data[0] = 0x00;
|
|
|
- UartWriteCmd.Data[1] = 0x03;
|
|
|
- osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
|
|
|
+ TcpCmdAnswer[3] = 0x0f;
|
|
|
+ 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);
|
|
|
tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
}
|
|
|
- //osMutexRelease(UartMutex);
|
|
|
- TcpService=0x00;
|
|
|
-
|
|
|
+ break;
|
|
|
}
|
|
|
- else
|
|
|
+ default:
|
|
|
{
|
|
|
TcpCmdAnswer[3] = 0x0f;
|
|
|
memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
|
|
@@ -725,11 +740,8 @@ static void TcpDataInfoRecvHandle()
|
|
|
memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
|
|
|
TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
|
|
|
tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
free(TcpRecvData);
|