|
@@ -14,7 +14,6 @@ static StaticTask_t gProcess_Tcp_Task_t;
|
|
|
static UINT8 gProcess_Tcp_TaskStack[PROC_TCP_TASK_STACK_SIZE];
|
|
|
static QueueHandle_t psEventQueueHandle; //状态转换队列句柄
|
|
|
static osThreadId_t TcpTaskId = NULL;
|
|
|
-
|
|
|
static eventCallbackMessage_t *queueItem = NULL;
|
|
|
static UINT8 gImsi[16] = {0};
|
|
|
static UINT32 gCellID = 0;
|
|
@@ -584,11 +583,11 @@ static void TcpDataInfoAssembleSend()
|
|
|
%d,%d,%d,%d,,\
|
|
|
%d,%d,%d,%d,%d,%d,%d,,\
|
|
|
%d,%d,%d,,",
|
|
|
- socd_pct_ahSoc, socd_pct_ekfSoc, socd_pct_battSoc, socd_pct_bcuSoc,pimd_pct_battSoc,
|
|
|
+ socd_pct_ahSoc, socd_pct_ekfSoc, socd_pct_battSoc, socd_pct_bcuSoc, pimd_pct_battSoc,
|
|
|
sfmd_I_curr, sfmd_V_cellUMax, sfmd_V_cellUMin, sfmv_V_cellU[0], sfmv_V_cellU[1], sfmv_V_cellU[2],
|
|
|
cand_idx_cellNr, cand_Q_cellCap, ihd_tm_parkTime, sohd_Q_chrgEo, iscv_Q_remainCpEi[cand_idx_cellNr - 1], iscd_tm_totalEi,
|
|
|
pimd_V_ocv, pimd_R_ohm, pimd_R_polar, pimd_F_polar,
|
|
|
- pimv_V_cellOcv[0], pimv_V_cellOcv[1], pimv_V_cellOcv[2], pimv_R_cellOhm[0], pimv_R_cellOhm[1], pimv_R_cellOhm[2],pimv_R_cellOhm[sfmd_idx_cellUMin],
|
|
|
+ pimv_V_cellOcv[0], pimv_V_cellOcv[1], pimv_V_cellOcv[2], pimv_R_cellOhm[0], pimv_R_cellOhm[1], pimv_R_cellOhm[2], pimv_R_cellOhm[sfmd_idx_cellUMin],
|
|
|
iscd_flg_flt[0], iscd_flg_flt[1], iscd_flg_flt[2]);
|
|
|
if (Debugcounter % 5 == 0)
|
|
|
{
|
|
@@ -647,6 +646,88 @@ static void TcpDataInfoAssembleSend()
|
|
|
}
|
|
|
SendBuffer = NULL;
|
|
|
}
|
|
|
+ if (send_counter == 5 || Rentalupdate == TRUE) //其他信息上传
|
|
|
+ {
|
|
|
+ OtherMsgtoTcpType OtherMsgToTcpInfo;
|
|
|
+ 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);
|
|
|
+ DataLen = (UINT16)sizeof(OtherMsgToTcpInfo.OtherInfo);
|
|
|
+ OtherMsgToTcpInfo.startSymbol[0] = TCP_START_SYM1;
|
|
|
+ OtherMsgToTcpInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
+ OtherMsgToTcpInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
+ OtherMsgToTcpInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
+ memcpy(OtherMsgToTcpInfo.SN, AppNVMData.battSN, BATT_SN_LEN);
|
|
|
+ OtherMsgToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; // not encrypt
|
|
|
+ OtherMsgToTcpInfo.dataLength[0] = (DataLen >> 8) & 0xFF;
|
|
|
+ OtherMsgToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[0] = (UTC8TimeTcp.year - 0x07D0) & 0xFF; // year
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.sendTimeBTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgMark = OTHERMSG;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[0] = (UTC8TimeTcp.year - 0x07D0) & 0xFF; // year
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.HeatTargetT = tmsc_T_closeMinThr;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.HeatOverTime[0] = 0x00;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.HeatOverTime[1] = 0x00;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalType = AppDataInfo.RentalType;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[0] = AppDataInfo.RentalStartTime[0];
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[1] = AppDataInfo.RentalStartTime[1];
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[2] = AppDataInfo.RentalStartTime[2];
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[3] = AppDataInfo.RentalStartTime[3];
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[4] = AppDataInfo.RentalStartTime[4];
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalStartTime[5] = AppDataInfo.RentalStartTime[5];
|
|
|
+ INT16 RetalDays = 0;
|
|
|
+ INT16 ExpiryDays = 0;
|
|
|
+ RetalDays = day_diff(AppDataInfo.RentalStartTime, AppDataInfo.ExpiryTimeArray);
|
|
|
+ ExpiryDays = day_diff(AppDataInfo.ExpiryTimeArray, OtherMsgToTcpInfo.OtherInfo.msgCollectionTimeBTC);
|
|
|
+ printf("%d,%d\n", RetalDays, ExpiryDays);
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalDays[0] = RetalDays >> 8;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.RentalDays[1] = RetalDays;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.ExpiryDays[0] = ExpiryDays >> 8;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.ExpiryDays[1] = ExpiryDays;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleUserID[0] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleUserID[1] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleUserID[2] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleUserID[3] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleCode[0] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleCode[1] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleCode[2] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleCode[3] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[0] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[1] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[2] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[3] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[4] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BleAddress[5] = 0xFF;
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BmsUploadFre[0] = (UINT8)((UINT16)(BattSendFreq * 10) >> 8);
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.BmsUploadFre[1] = (UINT8)((UINT16)(BattSendFreq * 10));
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.PosUploadFre[0] = (UINT8)((UINT16)(GpsSendFreq * 10) >> 8);
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.PosUploadFre[1] = (UINT8)((UINT16)(GpsSendFreq * 10));
|
|
|
+ OtherMsgToTcpInfo.OtherInfo.ChrgPack = 0x00;
|
|
|
+ OtherMsgToTcpInfo.CRC = bcc_chk((UINT8 *)&OtherMsgToTcpInfo, sizeof(OtherMsgToTcpInfo) - 1);
|
|
|
+ len = tcpipConnectionSend(socContext.id, (UINT8 *)&OtherMsgToTcpInfo, sizeof(OtherMsgToTcpInfo), 0, 0, 0);
|
|
|
+ if (len > 0)
|
|
|
+ {
|
|
|
+ Rentalupdate = FALSE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sendQueueMsg(QMSG_ID_NW_IP_SUSPEND, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (send_counter == 0) //调试信息暂时不发,需调整之后发送
|
|
|
{
|
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
@@ -876,14 +957,11 @@ static void TcpDataInfoRecvHandle()
|
|
|
rentaldays = *(Ptr + 38) << 8 | *(Ptr + 39);
|
|
|
ExpiryTimeCal(rentalStartArray, rentaldays, ExpiryUTC8TimeArray);
|
|
|
MEMCPY(AppDataInfo.ExpiryTimeArray, ExpiryUTC8TimeArray, 6);
|
|
|
+ MEMCPY(AppDataInfo.RentalStartTime, rentalStartArray, 6);
|
|
|
AppDataInfo.appDataModify = TRUE;
|
|
|
tcpipConnectionSend(socContext.id, TcpCmdAnswer, 31, 0, 0, 0);
|
|
|
-#ifdef USING_PRINTF1
|
|
|
- printf("rental!\n");
|
|
|
- for (UINT8 i = 0; i < 6; i++)
|
|
|
- printf("%d ", ExpiryUTC8TimeArray[i]);
|
|
|
-#endif
|
|
|
BattLockFunc();
|
|
|
+ Rentalupdate = TRUE;
|
|
|
ihd_flg_DTCClear = 1;
|
|
|
}
|
|
|
else
|