|
@@ -3,7 +3,7 @@
|
|
|
* @Date : 2022-02-10 11:43:56
|
|
|
* @Version : V3.0
|
|
|
* @LastEditors : ChenJie
|
|
|
- * @LastEditTime : 2022-02-14 15:50:00
|
|
|
+ * @LastEditTime : 2022-02-23 15:51:23
|
|
|
* @Description : file content
|
|
|
* @FilePath : \S32K146_4G\src\AppTaskUart1.c
|
|
|
*/
|
|
@@ -35,7 +35,7 @@ void InitFunc(void);
|
|
|
sint8 TcpConnectFunc(sint8 *ConnectId);
|
|
|
sint8 TcpDataSendFunc(sint8 ConnectId);
|
|
|
sint8 TcpRegisterChkFunc(void);
|
|
|
-void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,uint16 *SendLen);
|
|
|
+void TcpDataEncode(uint8 **PtrSendAddr, uint16 *SendLen);
|
|
|
void GetUtc8Time(UTC8TimeType *UTC8TimeTcp);
|
|
|
static void AtcmdTransmit(sint8 CmdIdx, uint8 *SetValuePtr, uint16 SetValueLen, sint8 *retFunc);
|
|
|
void Uart_4G_Task(void *pvParameters)
|
|
@@ -63,11 +63,11 @@ void Uart_4G_Task(void *pvParameters)
|
|
|
{
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_REGCHK);
|
|
|
}
|
|
|
- else if(TimerCounter%1000==0)
|
|
|
+ else if (TimerCounter % 1000 == 0)
|
|
|
{
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_SEND);
|
|
|
}
|
|
|
- else if(TimerCounter%100==0)
|
|
|
+ else if (TimerCounter % 100 == 0)
|
|
|
{
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_RECV);
|
|
|
}
|
|
@@ -164,35 +164,12 @@ sint8 TcpDataSendFunc(sint8 ConnectId)
|
|
|
uint16 DataSendLen = 0;
|
|
|
sint8 ATRet = -1;
|
|
|
uint8 ReadLen = 0;
|
|
|
- UTC8TimeType TcpTimeUtc8;
|
|
|
- uint8 DataSendIdx = 0;
|
|
|
- static uint32 TcpSendTimeCounter = 0;
|
|
|
- GetUtc8Time(&TcpTimeUtc8);//时间获取
|
|
|
- //TcpSendTimeCounter++;
|
|
|
- TcpSendTimeCounter = 1;
|
|
|
- memcpy(TcpbattSN,defaultSn,17);
|
|
|
- if(TcpSendTimeCounter == 1)
|
|
|
- {
|
|
|
- DataSendIdx = GpsMsg;//版本信息发送
|
|
|
- }
|
|
|
- else if(TcpSendTimeCounter%10==0)
|
|
|
- {
|
|
|
- DataSendIdx = TruckBattMsg;//电池信息发送
|
|
|
- }
|
|
|
- else if((TcpSendTimeCounter-1)%30==0)
|
|
|
- {
|
|
|
- DataSendIdx = TruckVehiMsg;//车辆信息发送
|
|
|
- }
|
|
|
- else if((TcpSendTimeCounter-2)%30==0)
|
|
|
- {
|
|
|
- DataSendIdx = TruckAcclMsg;//累计信息发送
|
|
|
- }
|
|
|
- else
|
|
|
+ memcpy(TcpbattSN, defaultSn, 17);
|
|
|
+ TcpDataEncode(&pSendData, &DataSendLen); //数据组包,malloc申请在里面,pSendData指向申请的地址
|
|
|
+ if (DataSendLen == 0)
|
|
|
{
|
|
|
- DataSendIdx = 0;//不发送,返回正确
|
|
|
- return 0;
|
|
|
+ return 0; //暂时无数据可以发
|
|
|
}
|
|
|
- TcpDataEncode(TcpTimeUtc8,DataSendIdx,&pSendData,&DataSendLen);//数据组包,malloc申请在里面,pSendData指向申请的地址
|
|
|
//数据准备完成,下面开始发送
|
|
|
char AtCmdSend[10] = {0};
|
|
|
uint8 AtCmdSendTotalLen = 0;
|
|
@@ -208,7 +185,7 @@ sint8 TcpDataSendFunc(sint8 ConnectId)
|
|
|
outValue = 0;
|
|
|
}
|
|
|
}
|
|
|
- if(pSendData!=NULL)
|
|
|
+ if (pSendData != NULL)
|
|
|
{
|
|
|
vPortFree(pSendData);
|
|
|
}
|
|
@@ -305,7 +282,7 @@ sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
|
{
|
|
|
char AtCmdSend[20] = {0};
|
|
|
uint8 AtCmdSendTotalLen = 0;
|
|
|
- sprintf(AtCmdSend, "%d,\"TCP\",%s,%d\r\n", *ConnectId, WebSiteIp,WebSitePort); //此处需要优化
|
|
|
+ sprintf(AtCmdSend, "%d,\"TCP\",%s,%d\r\n", *ConnectId, WebSiteIp, WebSitePort); //此处需要优化
|
|
|
AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
|
AtcmdTransmit(AT_CONNECT, AtCmdSend, AtCmdSendTotalLen, &ATRet);
|
|
|
if (ATRet == 0)
|
|
@@ -513,8 +490,8 @@ static void AtcmdTransmit(sint8 CmdIdx, uint8 *SetValuePtr, uint16 SetValueLen,
|
|
|
uint16 ATCmdTotalLen = 0;
|
|
|
ATCmdFixedLen = mstrlen(Atcmdfunc[CmdIdx].str);
|
|
|
ATCmdTotalLen = ATCmdFixedLen + SetValueLen;
|
|
|
- PtrATCmdSend = malloc(ATCmdTotalLen+1);
|
|
|
- memset(PtrATCmdSend, 0x00, ATCmdTotalLen+1);
|
|
|
+ PtrATCmdSend = malloc(ATCmdTotalLen + 1);
|
|
|
+ memset(PtrATCmdSend, 0x00, ATCmdTotalLen + 1);
|
|
|
memcpy(PtrATCmdSend, Atcmdfunc[CmdIdx].str, ATCmdFixedLen);
|
|
|
if (SetValuePtr != NULL)
|
|
|
{
|
|
@@ -525,7 +502,7 @@ static void AtcmdTransmit(sint8 CmdIdx, uint8 *SetValuePtr, uint16 SetValueLen,
|
|
|
*retFunc = Atcmdfunc[CmdIdx].cb(PtrATCmdSend, RX_Buffer[UART_LPUART1], CmdIdx, ReadLen);
|
|
|
if (PtrATCmdSend != NULL)
|
|
|
{
|
|
|
- memset(PtrATCmdSend, 0x00, ATCmdTotalLen+1);
|
|
|
+ memset(PtrATCmdSend, 0x00, ATCmdTotalLen + 1);
|
|
|
free(PtrATCmdSend);
|
|
|
}
|
|
|
PtrATCmdSend = NULL;
|
|
@@ -637,7 +614,7 @@ sint8 at_callbackFunc(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pRead
|
|
|
if (retptr)
|
|
|
{
|
|
|
retptr = (uint8 *)strstr((char *)pReadStr, (char *)("CIPOPEN:"));
|
|
|
- if(retptr)
|
|
|
+ if (retptr)
|
|
|
{
|
|
|
SocketId = CharToHex(*(retptr + 9));
|
|
|
}
|
|
@@ -659,8 +636,48 @@ sint8 at_callbackFunc(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pRead
|
|
|
}
|
|
|
return OutValue;
|
|
|
}
|
|
|
-void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,uint16 *SendLen)
|
|
|
+void TcpDataEncode(uint8 **PtrSendAddr, uint16 *SendLen)
|
|
|
{
|
|
|
+ uint8 DataIdx = 0;
|
|
|
+ static uint32 TcpSendTimeCounter = 0;
|
|
|
+ TcpSendTimeCounter++;
|
|
|
+
|
|
|
+ if (TcpSendTimeCounter == 1)
|
|
|
+ {
|
|
|
+ DataIdx = VerMsg; //版本信息发送
|
|
|
+ }
|
|
|
+ else if (TcpSendTimeCounter % 120 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = GpsMsg; //定位信息发送
|
|
|
+ }
|
|
|
+#ifdef APP_UART0_ENABLE
|
|
|
+ else if (TcpSendTimeCounter % 60 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = BattMsg; //电池信息发送
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#ifdef APP_CAN_ENABLE
|
|
|
+ else if (TcpSendTimeCounter % 10 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = TruckBattMsg; //电池信息发送
|
|
|
+ }
|
|
|
+ else if ((TcpSendTimeCounter - 1) % 30 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = TruckVehiMsg; //车辆信息发送
|
|
|
+ }
|
|
|
+ else if ((TcpSendTimeCounter - 2) % 30 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = TruckAcclMsg; //累计信息发送
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ else
|
|
|
+ {
|
|
|
+ *SendLen = 0;
|
|
|
+ DataIdx = 0; //不发送,返回
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UTC8TimeType UTC8TimeTcp;
|
|
|
+ GetUtc8Time(&UTC8TimeTcp); //时间获取
|
|
|
uint8 *SendBuffer = NULL;
|
|
|
switch (DataIdx)
|
|
|
{
|
|
@@ -682,19 +699,19 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
GpsToTcpInfo.dataLength[0] = (DataLen >> 8) & 0xFF;
|
|
|
GpsToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
GpsToTcpInfo.gpsInfo.sendTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
- GpsToTcpInfo.gpsInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
- GpsToTcpInfo.gpsInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
- GpsToTcpInfo.gpsInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
- GpsToTcpInfo.gpsInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
- GpsToTcpInfo.gpsInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
+ GpsToTcpInfo.gpsInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ GpsToTcpInfo.gpsInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ GpsToTcpInfo.gpsInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ GpsToTcpInfo.gpsInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ GpsToTcpInfo.gpsInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
GpsToTcpInfo.gpsInfo.msgMark = DataIdx;
|
|
|
- GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year ) & 0xFF; // year
|
|
|
- GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
- GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
- GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
- GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
GpsToTcpInfo.gpsInfo.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
- if (xQueueReceive(GpsDataQueueHandle,&GpsRecvData,0)== pdPASS)
|
|
|
+ if (xQueueReceive(GpsDataQueueHandle, &GpsRecvData, 0) == pdPASS)
|
|
|
{
|
|
|
memcpy((uint8 *)&GpsToTcpInfo.gpsInfo.GpsInfoData, (uint8 *)&GpsRecvData, sizeof(GPSInfo));
|
|
|
}
|
|
@@ -729,7 +746,7 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
GpsToTcpInfo.gpsInfo.zData[0] = xyzDatacahce[2] >> 8;
|
|
|
GpsToTcpInfo.gpsInfo.zData[1] = xyzDatacahce[2];
|
|
|
GpsToTcpInfo.CRC = bcc_chk((uint8 *)&GpsToTcpInfo, sizeof(GPSMsgtoTcpType) - 1);
|
|
|
- memcpy(SendBuffer,&GpsToTcpInfo,sizeof(GpsToTcpInfo));
|
|
|
+ memcpy(SendBuffer, &GpsToTcpInfo, sizeof(GpsToTcpInfo));
|
|
|
break;
|
|
|
}
|
|
|
case 0x86:
|
|
@@ -744,21 +761,21 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
VerMsgToTcpInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
VerMsgToTcpInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
memcpy(VerMsgToTcpInfo.SN, TcpbattSN, BATT_SN_LEN);
|
|
|
- VerMsgToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
+ VerMsgToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; // not encrypt
|
|
|
VerMsgToTcpInfo.dataLength[0] = (DataLen >> 8) & 0xFF;
|
|
|
VerMsgToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; //year
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; //month
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; //day
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; //hour
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; //mins
|
|
|
- VerMsgToTcpInfo.VerInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; //sec
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ VerMsgToTcpInfo.VerInfo.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
VerMsgToTcpInfo.VerInfo.msgMark = DataIdx;
|
|
|
- VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; //year
|
|
|
- VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; //month
|
|
|
- VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; //day
|
|
|
- VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; //hour
|
|
|
- VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; //mins
|
|
|
+ VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
memcpy(VerMsgToTcpInfo.VerInfo.ICCID, IccidNum, 20);
|
|
|
memcpy(VerMsgToTcpInfo.VerInfo.IMEI, ImeiNum, 15);
|
|
@@ -786,13 +803,86 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
VerMsgToTcpInfo.VerInfo.BmsInfo = BMS_INFO;
|
|
|
VerMsgToTcpInfo.VerInfo.DataModuleType = DATA_MODULE_TYPE;
|
|
|
VerMsgToTcpInfo.CRC = bcc_chk((uint8 *)&VerMsgToTcpInfo, sizeof(VerMsgToTcpInfo) - 1);
|
|
|
- memcpy(SendBuffer,&VerMsgToTcpInfo,sizeof(VersionMsgtoTcpType));
|
|
|
+ memcpy(SendBuffer, &VerMsgToTcpInfo, sizeof(VersionMsgtoTcpType));
|
|
|
break;
|
|
|
}
|
|
|
+#ifdef APP_UART0_ENABLE
|
|
|
+ case 0x80:
|
|
|
+ {
|
|
|
+ uint8 ProtocolHeaderLen = 25; //电池信息协议头部加校验码长度,此长度不更改
|
|
|
+ uint8 ProtocolFixedLen = 60; //电池信息协议固定总长度 如协议新增,需要更改此长度
|
|
|
+ uint16 ProtocolFluctedLen = AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + BmsOtherTemp + OtherTemp; //电池信息协议变动长度
|
|
|
+ uint16 DataLen;
|
|
|
+ *SendLen = ProtocolFixedLen + ProtocolFluctedLen;
|
|
|
+ SendBuffer = pvPortMalloc(*SendLen);
|
|
|
+ if (SendBuffer == NULL)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ *(SendBuffer + 0) = TCP_START_SYM1; //起始码-1
|
|
|
+ *(SendBuffer + 1) = TCP_START_SYM2; //起始码-2
|
|
|
+ *(SendBuffer + 2) = TCP_CMD_SYM; //命令标识-3
|
|
|
+ *(SendBuffer + 3) = TCP_ANS_SYM; //应答标识-4
|
|
|
+ memcpy(SendBuffer + 4, TcpbattSN, BATT_SN_LEN); // SN码 5-21
|
|
|
+ *(SendBuffer + 21) = TCP_ENCPT_DISABLE; //加密方式-22
|
|
|
+ DataLen = ProtocolFixedLen + ProtocolFluctedLen - ProtocolHeaderLen; //电池信息单元协议固定长度
|
|
|
+ *(SendBuffer + 22) = (DataLen >> 8) & 0xFF; //数据长度H-23
|
|
|
+ *(SendBuffer + 23) = DataLen & 0xFF; //数据长度L-24
|
|
|
+ *(SendBuffer + 24) = (UTC8TimeTcp.year) & 0xFF; // year-25
|
|
|
+ *(SendBuffer + 25) = UTC8TimeTcp.month & 0xFF; // month-26
|
|
|
+ *(SendBuffer + 26) = UTC8TimeTcp.day & 0xFF; // day-27
|
|
|
+ *(SendBuffer + 27) = UTC8TimeTcp.hour & 0xFF; // hour-28
|
|
|
+ *(SendBuffer + 28) = UTC8TimeTcp.minute & 0xFF; // mins-29
|
|
|
+ *(SendBuffer + 29) = UTC8TimeTcp.second & 0xFF; // sec-30
|
|
|
+ *(SendBuffer + 30) = DataIdx; //电池信息发送-31
|
|
|
+ *(SendBuffer + 31) = (UTC8TimeTcp.year) & 0xFF; // year-32
|
|
|
+ *(SendBuffer + 32) = UTC8TimeTcp.month & 0xFF; // month-33
|
|
|
+ *(SendBuffer + 33) = UTC8TimeTcp.day & 0xFF; // day-34
|
|
|
+ *(SendBuffer + 34) = UTC8TimeTcp.hour & 0xFF; // hour-35
|
|
|
+ *(SendBuffer + 35) = UTC8TimeTcp.minute & 0xFF; // mins-36
|
|
|
+ *(SendBuffer + 36) = UTC8TimeTcp.second & 0xFF; // sec-37
|
|
|
+ *(SendBuffer + 37) = CSQValue; //信号强度-38
|
|
|
+ *(SendBuffer + 38) = 0; //故障等级-39
|
|
|
+ *(SendBuffer + 39) = ErrorTemp >> 8; //故障代码H-40
|
|
|
+ *(SendBuffer + 40) = ErrorTemp & 0xFF; //故障代码L-41
|
|
|
+ *(SendBuffer + 41) = battI >> 8; //电流-42
|
|
|
+ *(SendBuffer + 42) = battI & 0xFF; //电流-43
|
|
|
+ *(SendBuffer + 43) = battPackVol >> 8; //电压-44
|
|
|
+ *(SendBuffer + 44) = battPackVol & 0xFF; //电压-45
|
|
|
+ *(SendBuffer + 45) = battPackVol >> 8; //电压-46
|
|
|
+ *(SendBuffer + 46) = battPackVol & 0xFF; //电压-47
|
|
|
+ *(SendBuffer + 47) = battMOSSwitchState; // mos状态-48
|
|
|
+ *(SendBuffer + 48) = (uint8)(socd_pct_vcuSoc / 10); // soc-49
|
|
|
+ *(SendBuffer + 49) = (uint8)(sohd_pct_bcuSoh / 10); // soh-50
|
|
|
+ *(SendBuffer + 50) = (battBalanceoInfo >> 24) & 0xFF;
|
|
|
+ *(SendBuffer + 51) = (battBalanceoInfo >> 16) & 0xFF;
|
|
|
+ *(SendBuffer + 52) = (battBalanceoInfo >> 8) & 0xFF;
|
|
|
+ *(SendBuffer + 53) = battBalanceoInfo & 0xFF; //均衡状态-51-54
|
|
|
+ *(SendBuffer + 54) = AppDataInfo.BattCellCount; //电压个数-55
|
|
|
+ for (uint8 i = 0; i < AppDataInfo.BattCellCount; i++) //单体电压
|
|
|
+ {
|
|
|
+ *(SendBuffer + 54 + i * 2 + 1) = (battCellU[i] >> 8) & 0xFF;
|
|
|
+ *(SendBuffer + 54 + i * 2 + 2) = battCellU[i] & 0xFF;
|
|
|
+ }
|
|
|
+ *(SendBuffer + 55 + AppDataInfo.BattCellCount * 2) = AppDataInfo.BattTempCount; //模组温度个数
|
|
|
+ memcpy((SendBuffer + 55 + AppDataInfo.BattCellCount * 2 + 1), &battCellTemp, AppDataInfo.BattTempCount); //模组温度
|
|
|
+ *(SendBuffer + 56 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = battWorkState; //电池工作状态
|
|
|
+ *(SendBuffer + 57 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = battHeatEnableState; //电池加热使能
|
|
|
+ *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = BmsOtherTemp + OtherTemp; //其他温度个数
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 1) = MOSTemp; // mos温度
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 2) = packTemp; //环境温度
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 3) = fastChargeTemp; //快充温度
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 4) = normalChargeTemp; //慢充温度
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 5) = heatTemp1; //加热温度1
|
|
|
+ // *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 6) = heatTemp2; //加热温度2
|
|
|
+ *(SendBuffer + 59 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + BmsOtherTemp + OtherTemp) = bcc_chk(SendBuffer, ProtocolFixedLen + ProtocolFluctedLen - 1); //校验码
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#ifdef APP_CAN_ENABLE
|
|
|
case 0x90:
|
|
|
{
|
|
|
*SendLen = 0x52;
|
|
|
- SendBuffer = pvPortMalloc(*SendLen);
|
|
|
+ SendBuffer = pvPortMalloc(*SendLen);
|
|
|
*(SendBuffer + 0) = TCP_START_SYM1;
|
|
|
*(SendBuffer + 1) = TCP_START_SYM2;
|
|
|
*(SendBuffer + 2) = TCP_CMD_SYM;
|
|
@@ -803,18 +893,18 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
*(SendBuffer + 0x16) = ((DataLen >> 8) & 0xFF); // uint16 DataLen
|
|
|
*(SendBuffer + 0x17) = (DataLen & 0xFF);
|
|
|
*(SendBuffer + 0x18) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
- *(SendBuffer + 0x19) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
- *(SendBuffer + 0x1A) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
- *(SendBuffer + 0x1B) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
- *(SendBuffer + 0x1C) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
- *(SendBuffer + 0x1D) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
- *(SendBuffer + 0x1E) = (DataIdx & 0xFF); // uint8 BATTMSG
|
|
|
+ *(SendBuffer + 0x19) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
+ *(SendBuffer + 0x1A) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
+ *(SendBuffer + 0x1B) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
+ *(SendBuffer + 0x1C) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
+ *(SendBuffer + 0x1D) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
+ *(SendBuffer + 0x1E) = (DataIdx & 0xFF); // uint8 BATTMSG
|
|
|
*(SendBuffer + 0x1F) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
- *(SendBuffer + 0x20) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
- *(SendBuffer + 0x21) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
- *(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
- *(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
- *(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
+ *(SendBuffer + 0x20) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
+ *(SendBuffer + 0x21) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
+ *(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
+ *(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
+ *(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
memcpy(SendBuffer + 0x25, VIN, 17);
|
|
|
*(SendBuffer + 0x36) = (vehicleStatus & 0xFF); // uint8 整车状态
|
|
|
*(SendBuffer + 0x37) = (bmsHVOn & 0xFF); // uint8 bms上高压指令
|
|
@@ -859,43 +949,43 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
uint16 DataLen = 0x3B + 384 * 2 + 64;
|
|
|
*(SendBuffer + 0x16) = ((DataLen >> 8) & 0xFF); // uint16 DataLen
|
|
|
*(SendBuffer + 0x17) = (DataLen & 0xFF);
|
|
|
- *(SendBuffer + 0x18) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
- *(SendBuffer + 0x19) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
- *(SendBuffer + 0x1A) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
- *(SendBuffer + 0x1B) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
- *(SendBuffer + 0x1C) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
- *(SendBuffer + 0x1D) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
- *(SendBuffer + 0x1E) = (DataIdx & 0xFF); // uint8 BATTMSG
|
|
|
- *(SendBuffer + 0x1F) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
- *(SendBuffer + 0x20) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
- *(SendBuffer + 0x21) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
- *(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
- *(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
- *(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
- *(SendBuffer + 0x25) = (CSQValue & 0xFF); // uint8 csq
|
|
|
- *(SendBuffer + 0x26) = (BMS1_SysSts & 0xFF); // uint8 电池管理系统工作状态,0-初始化 1-自检完成允许上电 2-运行状态 3-高压切断 4-故障状态,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x27) = (BMS1_DCChrgConnectSt & 0xFF); // uint8 直流充电枪连接状态,0-未连接 1-单枪连接 2-双枪连接 3-无效,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x28) = (BMS2_FaultLevel & 0xFF); // uint8 当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x29) = (BMS2_FaultCode & 0xFF); // uint8 故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x2A) = (BMS2_RqHVPoerOff & 0xFF); // uint8 BMS下高压请求,0-无效 1-请求下高压 2-不请求下高压 3-无效,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x2B) = (BMS1_ChrgStatus & 0xFF); // uint8 充电状态,0-未充电 1-充电中 2-充电已完成 3-充电错误故障,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x2C) = (BMS2_SOC & 0xFF); // uint8 电池包SOC 精度_0.4,偏移量_0,单位_*(SendBuffer+0x2D) = (BMS2_SOH&0xFF); //uint8 电池包SOH 精度_0.4,偏移量_0,单位_*(SendBuffer+0x2E) = ((BMS2_PackInsideVolt>>8)&0xFF); //uint16 电池包内侧电压 精度_0.1,偏移量_0,单位_V
|
|
|
- *(SendBuffer + 0x2D) = (BMS2_SOH /25/10) & 0xFF; // SOH 精度1%
|
|
|
- *(SendBuffer + 0x2E) = (BMS2_PackInsideVolt >> 8) & 0xFF; //电池包总电压
|
|
|
+ *(SendBuffer + 0x18) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
+ *(SendBuffer + 0x19) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
+ *(SendBuffer + 0x1A) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
+ *(SendBuffer + 0x1B) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
+ *(SendBuffer + 0x1C) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
+ *(SendBuffer + 0x1D) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
+ *(SendBuffer + 0x1E) = (DataIdx & 0xFF); // uint8 BATTMSG
|
|
|
+ *(SendBuffer + 0x1F) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
+ *(SendBuffer + 0x20) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
+ *(SendBuffer + 0x21) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
+ *(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
+ *(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
+ *(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
+ *(SendBuffer + 0x25) = (CSQValue & 0xFF); // uint8 csq
|
|
|
+ *(SendBuffer + 0x26) = (BMS1_SysSts & 0xFF); // uint8 电池管理系统工作状态,0-初始化 1-自检完成允许上电 2-运行状态 3-高压切断 4-故障状态,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x27) = (BMS1_DCChrgConnectSt & 0xFF); // uint8 直流充电枪连接状态,0-未连接 1-单枪连接 2-双枪连接 3-无效,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x28) = (BMS2_FaultLevel & 0xFF); // uint8 当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x29) = (BMS2_FaultCode & 0xFF); // uint8 故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x2A) = (BMS2_RqHVPoerOff & 0xFF); // uint8 BMS下高压请求,0-无效 1-请求下高压 2-不请求下高压 3-无效,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x2B) = (BMS1_ChrgStatus & 0xFF); // uint8 充电状态,0-未充电 1-充电中 2-充电已完成 3-充电错误故障,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x2C) = (BMS2_SOC & 0xFF); // uint8 电池包SOC 精度_0.4,偏移量_0,单位_*(SendBuffer+0x2D) = (BMS2_SOH&0xFF); //uint8 电池包SOH 精度_0.4,偏移量_0,单位_*(SendBuffer+0x2E) = ((BMS2_PackInsideVolt>>8)&0xFF); //uint16 电池包内侧电压 精度_0.1,偏移量_0,单位_V
|
|
|
+ *(SendBuffer + 0x2D) = (BMS2_SOH / 25 / 10) & 0xFF; // SOH 精度1%
|
|
|
+ *(SendBuffer + 0x2E) = (BMS2_PackInsideVolt >> 8) & 0xFF; //电池包总电压
|
|
|
*(SendBuffer + 0x2F) = (BMS2_PackInsideVolt & 0xFF);
|
|
|
*(SendBuffer + 0x30) = ((BMS2_PackCurrent >> 8) & 0xFF); // uint16 电池包总电流,充电为负值,放电为正值 精度_0.1,偏移量_-1000,单位_A
|
|
|
*(SendBuffer + 0x31) = (BMS2_PackCurrent & 0xFF);
|
|
|
*(SendBuffer + 0x32) = ((BMS4_SysInsRes >> 8) & 0xFF); // uint16 系统绝缘电阻 精度_1,偏移量_0,单位_KΩ
|
|
|
*(SendBuffer + 0x33) = (BMS4_SysInsRes & 0xFF);
|
|
|
- *(SendBuffer + 0x34) = (BMS1_MainPosRelaySt & 0xFF); // uint8 主正继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x35) = (BMS1_PreChgRelaySt & 0xFF); // uint8 预充继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x36) = (BMS1_MainNegRelaySt & 0xFF); // uint8 主负继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x37) = (BMS1_DCChrgPos1RelaySt & 0xFF); // uint8 直流充正继电器1状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x38) = (BMS1_DCChrgNeg1RelaySt & 0xFF); // uint8 直流充负继电器1状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x39) = (BMS1_DCChrgPos2RelaySt & 0xFF); // uint8 直流充正继电器2状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x3A) = (BMS1_DCChrgNeg2RelaySt & 0xFF); // uint8 直流充负继电器2状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x3B) = (BMS1_HeatPosRelaySt & 0xFF); // uint8 加热正继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
- *(SendBuffer + 0x3C) = (BMS1_HeatNegRelaySt & 0xFF); // uint8 加热负继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x34) = (BMS1_MainPosRelaySt & 0xFF); // uint8 主正继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x35) = (BMS1_PreChgRelaySt & 0xFF); // uint8 预充继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x36) = (BMS1_MainNegRelaySt & 0xFF); // uint8 主负继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x37) = (BMS1_DCChrgPos1RelaySt & 0xFF); // uint8 直流充正继电器1状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x38) = (BMS1_DCChrgNeg1RelaySt & 0xFF); // uint8 直流充负继电器1状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x39) = (BMS1_DCChrgPos2RelaySt & 0xFF); // uint8 直流充正继电器2状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x3A) = (BMS1_DCChrgNeg2RelaySt & 0xFF); // uint8 直流充负继电器2状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x3B) = (BMS1_HeatPosRelaySt & 0xFF); // uint8 加热正继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
+ *(SendBuffer + 0x3C) = (BMS1_HeatNegRelaySt & 0xFF); // uint8 加热负继电器状态,0-预留 1-断开 2-吸合 ,精度_1,偏移量_0,单位_
|
|
|
|
|
|
*(SendBuffer + 0x50) = ((BMS9_PackTotCellNum >> 8) & 0xFF); // uint16 PACK中单体电芯的总数目
|
|
|
*(SendBuffer + 0x51) = (BMS9_PackTotCellNum & 0xFF);
|
|
@@ -912,7 +1002,7 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
case 0x92:
|
|
|
{
|
|
|
*SendLen = 0x4E;
|
|
|
- SendBuffer = pvPortMalloc(*SendLen);
|
|
|
+ SendBuffer = pvPortMalloc(*SendLen);
|
|
|
*(SendBuffer + 0) = TCP_START_SYM1;
|
|
|
*(SendBuffer + 1) = TCP_START_SYM2;
|
|
|
*(SendBuffer + 2) = TCP_CMD_SYM;
|
|
@@ -922,14 +1012,14 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
uint16 DataLen = 0x35;
|
|
|
*(SendBuffer + 0x16) = ((DataLen >> 8) & 0xFF); // uint16 DataLen
|
|
|
*(SendBuffer + 0x17) = (DataLen & 0xFF);
|
|
|
- *(SendBuffer + 0x18) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
+ *(SendBuffer + 0x18) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
*(SendBuffer + 0x19) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
*(SendBuffer + 0x1A) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
*(SendBuffer + 0x1B) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
|
*(SendBuffer + 0x1C) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
|
*(SendBuffer + 0x1D) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
*(SendBuffer + 0x1E) = (DataIdx & 0xFF); // uint8
|
|
|
- *(SendBuffer + 0x1F) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
+ *(SendBuffer + 0x1F) = ((UTC8TimeTcp.year) & 0xFF); // uint8 year
|
|
|
*(SendBuffer + 0x20) = (UTC8TimeTcp.month & 0xFF); // uint8 month
|
|
|
*(SendBuffer + 0x21) = (UTC8TimeTcp.day & 0xFF); // uint8 day
|
|
|
*(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
@@ -978,6 +1068,7 @@ void TcpDataEncode(UTC8TimeType UTC8TimeTcp,uint8 DataIdx, uint8 **PtrSendAddr,u
|
|
|
*(SendBuffer + 0x4D) = bcc_chk(SendBuffer, 0x4D);
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -990,18 +1081,18 @@ void GetUtc8Time(UTC8TimeType *UTC8TimeTcp)
|
|
|
uint8 ReadLen = 0;
|
|
|
uint8 *retptr = NULL;
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, AtCmdAsk,AtCmdLen , RX_Buffer[UART_LPUART1], &ReadLen, 1000 * 10);
|
|
|
- if(ReadLen>0)
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, AtCmdAsk, AtCmdLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000 * 10);
|
|
|
+ if (ReadLen > 0)
|
|
|
{
|
|
|
if ((uint8 *)strstr((char *)RX_Buffer[UART_LPUART1], (char *)("OK")))
|
|
|
{
|
|
|
retptr = (uint8 *)strstr((char *)RX_Buffer[UART_LPUART1], (char *)("+CCLK:"));
|
|
|
- UTC8TimeTcp->year = CharToHex(*(retptr + 8))*10+CharToHex(*(retptr + 9));
|
|
|
- UTC8TimeTcp->month = CharToHex(*(retptr + 11))*10+CharToHex(*(retptr + 12));
|
|
|
- UTC8TimeTcp->day = CharToHex(*(retptr + 14))*10+CharToHex(*(retptr + 15));
|
|
|
- UTC8TimeTcp->hour = CharToHex(*(retptr + 17))*10+CharToHex(*(retptr + 18));
|
|
|
- UTC8TimeTcp->minute = CharToHex(*(retptr + 20))*10+CharToHex(*(retptr + 21));
|
|
|
- UTC8TimeTcp->second = CharToHex(*(retptr + 23))*10+CharToHex(*(retptr + 24));
|
|
|
+ UTC8TimeTcp->year = CharToHex(*(retptr + 8)) * 10 + CharToHex(*(retptr + 9));
|
|
|
+ UTC8TimeTcp->month = CharToHex(*(retptr + 11)) * 10 + CharToHex(*(retptr + 12));
|
|
|
+ UTC8TimeTcp->day = CharToHex(*(retptr + 14)) * 10 + CharToHex(*(retptr + 15));
|
|
|
+ UTC8TimeTcp->hour = CharToHex(*(retptr + 17)) * 10 + CharToHex(*(retptr + 18));
|
|
|
+ UTC8TimeTcp->minute = CharToHex(*(retptr + 20)) * 10 + CharToHex(*(retptr + 21));
|
|
|
+ UTC8TimeTcp->second = CharToHex(*(retptr + 23)) * 10 + CharToHex(*(retptr + 24));
|
|
|
}
|
|
|
}
|
|
|
}
|