|
@@ -741,6 +741,10 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
{
|
|
|
DataIdx = 0x93; //储能电量信息发送
|
|
|
}
|
|
|
+ else if ((TcpSendTimeCounter+4) % 60 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = 0x8A; //累计信息发送
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
*SendLen = 0;
|
|
@@ -1050,6 +1054,65 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
*PtrSendAddr = (uint32)SendBuffer;
|
|
|
break;
|
|
|
}
|
|
|
+ case 0x8A:
|
|
|
+ {
|
|
|
+ AccInfoToTcp AccInfoToTcpMsg;
|
|
|
+ *SendLen = sizeof(AccInfoToTcpMsg);
|
|
|
+ SendBuffer = malloc(*SendLen);
|
|
|
+ uint16 DataLen = 0;
|
|
|
+ DataLen = (uint16)sizeof(AccInfoToTcpMsg.AccMsg);
|
|
|
+ AccInfoToTcpMsg.startSymbol[0] = TCP_START_SYM1;
|
|
|
+ AccInfoToTcpMsg.startSymbol[1] = TCP_START_SYM2;
|
|
|
+ AccInfoToTcpMsg.cmdSymbol = TCP_CMD_SYM;
|
|
|
+ AccInfoToTcpMsg.ansSymbol = TCP_ANS_SYM;
|
|
|
+ memcpy(AccInfoToTcpMsg.SN, TcpbattSN, BATT_SN_LEN);
|
|
|
+ AccInfoToTcpMsg.encryptMethod = TCP_ENCPT_DISABLE; // not encrypt
|
|
|
+ AccInfoToTcpMsg.dataLength[0] = (DataLen >> 8) & 0xFF;
|
|
|
+ AccInfoToTcpMsg.dataLength[1] = DataLen & 0xFF;
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ AccInfoToTcpMsg.AccMsg.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgMark = DataIdx;
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ AccInfoToTcpMsg.AccMsg.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accOnlineDays[0] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accOnlineDays[1] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDrvMiles[0] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDrvMiles[1] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.sohNoCalibrTime[0] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.sohNoCalibrTime[1] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgEng[0] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgEng[1] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgEng[2] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgEng[3] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgEng[0] = 0x00;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgEng[1] = 0x00;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgEng[2] = 0x00;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgEng[3] = 0x08;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgCap[0] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgCap[1] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgCap[2] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accChrgCap[3] = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgCap[0] = AppConfigInfo.AppDataInfo.battDischrgAccCap>>24;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgCap[1] = AppConfigInfo.AppDataInfo.battDischrgAccCap>>16;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgCap[2] = AppConfigInfo.AppDataInfo.battDischrgAccCap>>8;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accDischrgCap[3] = AppConfigInfo.AppDataInfo.battDischrgAccCap;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accOverChrgTimes= 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accOverDischrgTimes = 0;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accCycleTimes[0] = AppConfigInfo.AppDataInfo.battCycleTimes>>8;
|
|
|
+ AccInfoToTcpMsg.AccMsg.accCycleTimes[1] = AppConfigInfo.AppDataInfo.battCycleTimes;
|
|
|
+ AccInfoToTcpMsg.CRC = bcc_chk((uint8 *)&AccInfoToTcpMsg, sizeof(AccInfoToTcpMsg) - 1);
|
|
|
+ memcpy(SendBuffer, &AccInfoToTcpMsg, sizeof(AccInfoToTcpMsg));
|
|
|
+ *PtrSendAddr = (uint32)SendBuffer;
|
|
|
+ break;
|
|
|
+ }
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -1161,10 +1224,9 @@ static void TcpDataInfoRecvHandle(uint8 *DataRecv, uint16 DataRecvLen)
|
|
|
TcpCmdAnswer[0] = TCP_START_SYM1;
|
|
|
TcpCmdAnswer[1] = TCP_START_SYM1;
|
|
|
TcpCmdAnswer[2] = TCP_CONCMD_SYM;
|
|
|
- if (*(Ptr + 30) == 0x01) //远程升级指令
|
|
|
+ if (*(Ptr + 30) == 0x83) //远程升级指令
|
|
|
{
|
|
|
- //Fota_Func(Ptr, SocketId);
|
|
|
- //Fota_Ftp();
|
|
|
+ Fota_Ftp();
|
|
|
}
|
|
|
else if (*(Ptr + 30) == 0x80) //远程锁定命令
|
|
|
{
|