|
@@ -40,7 +40,7 @@ extern UartReadMsgType UartReadMsg;
|
|
|
extern osMutexId_t UartMutex;
|
|
|
extern osMutexId_t GpsMutex;
|
|
|
extern UINT8 GpsData[16];
|
|
|
-CHAR BattSN[BATT_SN_LEN] = "GYTEST00000000003";//SN仍在测试
|
|
|
+extern AppNVMDataType AppNVMData;
|
|
|
//局部变量申请
|
|
|
AppSocketConnectionContext socContext = {-1, APP_SOCKET_CONNECTION_CLOSED};
|
|
|
static StaticTask_t gProcess_Tcp_Task_t;
|
|
@@ -226,8 +226,8 @@ static void TcpDataInfoAssembleSend()
|
|
|
UINT8 TEMP_NUM=0;
|
|
|
TEMP_NUM = BATT_TEMP_NUM+2;//TEMP_NUM为温度总检测数量
|
|
|
UINT16 DataLen;
|
|
|
- //if(send_counter%1==0)
|
|
|
- if(0)
|
|
|
+ if(send_counter%1==0)
|
|
|
+ //if(0)
|
|
|
{
|
|
|
osStatus_t result = osMutexAcquire(UartMutex, osWaitForever);
|
|
|
appGetSystemTimeUtcSync(&TimeStracture);
|
|
@@ -237,7 +237,7 @@ static void TcpDataInfoAssembleSend()
|
|
|
BattToTcpInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
BattToTcpInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
BattToTcpInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
- memcpy(BattToTcpInfo.SN, BattSN,BATT_SN_LEN);
|
|
|
+ memcpy(BattToTcpInfo.SN, AppNVMData.battSN,BATT_SN_LEN);
|
|
|
BattToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
BattToTcpInfo.dataLength[0] = (DataLen>>8) & 0xFF;
|
|
|
BattToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
@@ -260,17 +260,17 @@ static void TcpDataInfoAssembleSend()
|
|
|
BattToTcpInfo.battInfo.errCode[0] = 0x00;
|
|
|
BattToTcpInfo.battInfo.errCode[1] = 0x00;
|
|
|
Batt_current = (UartReadMsg.data[(0x02+BATT_CELL_VOL_NUM)*2]<<8)|(UartReadMsg.data[(0x02+BATT_CELL_VOL_NUM)*2+1]);
|
|
|
- if (Batt_current>0x8000)
|
|
|
+ if (Batt_current>0x8000)//放电为正,充电为负
|
|
|
{
|
|
|
Batt_current = Batt_current|0x7fff;
|
|
|
Batt_current = Batt_current/10;
|
|
|
- Batt_current = 0x2710 - Batt_current;
|
|
|
+ Batt_current = 0x2710 + Batt_current;
|
|
|
Batt_current = Batt_current;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Batt_current = Batt_current/10;
|
|
|
- Batt_current = Batt_current+0x2710;
|
|
|
+ Batt_current = 0x2710 - Batt_current;
|
|
|
Batt_current = Batt_current;
|
|
|
}
|
|
|
BattToTcpInfo.battInfo.battI[0] = Batt_current>>8;
|
|
@@ -302,8 +302,8 @@ static void TcpDataInfoAssembleSend()
|
|
|
tcpipConnectionSend(socContext.id, (UINT8 *)&BattToTcpInfo, sizeof(BattToTcpInfo), 0, 0, 0);
|
|
|
|
|
|
}
|
|
|
- //if(send_counter%6==0)
|
|
|
- if(0)
|
|
|
+ if(send_counter%6==0)
|
|
|
+ //if(0)
|
|
|
{
|
|
|
osStatus_t result = osMutexAcquire(GpsMutex, osWaitForever);
|
|
|
appGetSystemTimeUtcSync(&TimeStracture);
|
|
@@ -312,7 +312,7 @@ static void TcpDataInfoAssembleSend()
|
|
|
GpsToTcpInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
GpsToTcpInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
GpsToTcpInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
- memcpy(GpsToTcpInfo.SN, BattSN,BATT_SN_LEN);
|
|
|
+ memcpy(GpsToTcpInfo.SN, AppNVMData.battSN,BATT_SN_LEN);
|
|
|
GpsToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
GpsToTcpInfo.dataLength[0] = (DataLen>>8) & 0xFF;
|
|
|
GpsToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
@@ -337,7 +337,8 @@ static void TcpDataInfoAssembleSend()
|
|
|
tcpipConnectionSend(socContext.id, (UINT8 *)&GpsToTcpInfo, sizeof(GpsToTcpInfo), 0, 0, 0);
|
|
|
}
|
|
|
}
|
|
|
- if(send_counter==0)
|
|
|
+ //if(send_counter==0)
|
|
|
+ if(0)
|
|
|
{
|
|
|
CHAR iccid[20];
|
|
|
CHAR imei[15];
|
|
@@ -349,7 +350,7 @@ static void TcpDataInfoAssembleSend()
|
|
|
VerMsgToTcpInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
VerMsgToTcpInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
VerMsgToTcpInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
- memcpy(VerMsgToTcpInfo.SN, BattSN,BATT_SN_LEN);
|
|
|
+ memcpy(VerMsgToTcpInfo.SN, AppNVMData.battSN,BATT_SN_LEN);
|
|
|
VerMsgToTcpInfo.encryptMethod = TCP_ENCPT_DISABLE; //not encrypt
|
|
|
VerMsgToTcpInfo.dataLength[0] = (DataLen>>8) & 0xFF;
|
|
|
VerMsgToTcpInfo.dataLength[1] = DataLen & 0xFF;
|
|
@@ -578,8 +579,8 @@ void socketAppConnectionCallBack(UINT8 connectionEventType, void *bodyEvent)
|
|
|
if(rcvInd != PNULL)
|
|
|
{
|
|
|
uint8_t* Ptr;
|
|
|
- osMessageQueuePut(TcpRecvHandle,rcvInd,0,2000);
|
|
|
- sendQueueMsg(QMSG_ID_SOCK_RECVPKG, 0);
|
|
|
+ //osMessageQueuePut(TcpRecvHandle,rcvInd,0,2000);
|
|
|
+ //sendQueueMsg(QMSG_ID_SOCK_RECVPKG, 0);
|
|
|
#ifdef USING_PRINTF
|
|
|
Ptr=rcvInd->data;
|
|
|
printf("socketAppConnectionCallBack socket connection %u receive length %u data:", rcvInd->connectionId, rcvInd->length);
|