|
@@ -664,31 +664,12 @@ static void process3AppTask(void* arg)
|
|
|
PROC_Can_STATE_SWITCH(PROCESS_STATE_IDLE);
|
|
|
OsaUtcTimeTValue timestracture;
|
|
|
uint8_t battbuffer[67] = { 0x14,0x0B,0x07,0x0E,0x39,0x37,
|
|
|
- 0x80,0x14,0x0B,0x07,0x0E,0x39,0x37,0x1A,0x00,0x00,
|
|
|
- 0x00,0x00,0x00,0x02,0x15,0x02,0x15,0x03,0x43,0x64,
|
|
|
- 0x00,0x00,0x00,0x00,0x0E,0x0E,0x53,0x0E,0x53,0x0E,
|
|
|
- 0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,
|
|
|
- 0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,
|
|
|
- 0x53,0x0E,0x53,0x05,0x13,0x13,0x13,0x13,0x13,0x00,
|
|
|
- 0x00,0x00};
|
|
|
- appGetSystemTimeUtcSync(×tracture);
|
|
|
- battbuffer[0] = timestracture.UTCtimer1>>16;
|
|
|
-
|
|
|
- battbuffer[0] = TcpSendBuffer[24]-0x07D0;
|
|
|
- battbuffer[1] = timestracture.UTCtimer1>>8;
|
|
|
- battbuffer[2] = timestracture.UTCtimer1;
|
|
|
- battbuffer[3] = timestracture.UTCtimer2>>24;
|
|
|
- battbuffer[4] = timestracture.UTCtimer2>>16;
|
|
|
- battbuffer[5] = timestracture.UTCtimer2>>8;
|
|
|
- battbuffer[6] = 0x80;//信息体标志,此处为电池信息
|
|
|
- battbuffer[7] = battbuffer[0];
|
|
|
- battbuffer[8] = battbuffer[1];
|
|
|
- battbuffer[9] = battbuffer[2];
|
|
|
- battbuffer[10] = battbuffer[3];
|
|
|
- battbuffer[11] = battbuffer[4];
|
|
|
- battbuffer[12] = battbuffer[5];
|
|
|
- data_len = sizeof(battbuffer)/2;
|
|
|
-
|
|
|
+ 0x80,0x14,0x0B,0x07,0x0E,0x39,0x37,
|
|
|
+ 0x1A,0x00,0x00,0x00,0x00,0x00,0x02,0x15,0x02,0x15,0x03,0x43,0x64,
|
|
|
+ 0x00,0x00,0x00,0x00,0x0E,
|
|
|
+ 0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,0x0E,0x53,
|
|
|
+ 0x05,0x13,0x13,0x13,0x13,0x13,0x00,
|
|
|
+ 0x00};
|
|
|
uint8_t TcpSendBuffer[92];
|
|
|
memset(TcpSendBuffer,0,92);
|
|
|
TcpSendBuffer[0] = 0x23;
|
|
@@ -697,13 +678,6 @@ static void process3AppTask(void* arg)
|
|
|
TcpSendBuffer[3] = 0xfe;
|
|
|
memcpy(&TcpSendBuffer[4],SN,17);
|
|
|
|
|
|
- TcpSendBuffer[21] = 0x01;
|
|
|
- TcpSendBuffer[22] = data_len>>8;//数据长度未指定
|
|
|
- TcpSendBuffer[23] = data_len;//数据长度未指定
|
|
|
-
|
|
|
- memcpy(&TcpSendBuffer[24],battbuffer,data_len);
|
|
|
- TcpSendBuffer[91] = bcc_chk(TcpSendBuffer,91);
|
|
|
-
|
|
|
while(1)
|
|
|
{
|
|
|
switch(gProc3State)
|
|
@@ -714,31 +688,61 @@ static void process3AppTask(void* arg)
|
|
|
}
|
|
|
case PROCESS_STATE_WORK:
|
|
|
{
|
|
|
- // while(TcpConnectID<0)
|
|
|
- // {
|
|
|
- // TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
|
|
|
- // }
|
|
|
- // TcpSendID = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,92,PNULL,PNULL,PNULL);
|
|
|
-
|
|
|
+ while(TcpConnectID<0)
|
|
|
+ {
|
|
|
+ TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
|
|
|
+ }
|
|
|
+
|
|
|
+ appGetSystemTimeUtcSync(×tracture);
|
|
|
+ battbuffer[0] = timestracture.UTCtimer1>>16;
|
|
|
+ battbuffer[0] = battbuffer[0] - 0x07D0;
|
|
|
+ battbuffer[0] = battbuffer[0];
|
|
|
+ battbuffer[1] = timestracture.UTCtimer1>>8;
|
|
|
+ battbuffer[2] = timestracture.UTCtimer1;
|
|
|
+ battbuffer[3] = timestracture.UTCtimer2>>24;
|
|
|
+ battbuffer[4] = timestracture.UTCtimer2>>16;
|
|
|
+ battbuffer[5] = timestracture.UTCtimer2>>8;
|
|
|
+ battbuffer[6] = 0x80;//信息体标志,此处为电池信息
|
|
|
+ battbuffer[7] = battbuffer[0];
|
|
|
+ battbuffer[8] = battbuffer[1];
|
|
|
+ battbuffer[9] = battbuffer[2];
|
|
|
+ battbuffer[10] = battbuffer[3];
|
|
|
+ battbuffer[11] = battbuffer[4];
|
|
|
+ battbuffer[12] = battbuffer[5];
|
|
|
+ data_len = sizeof(battbuffer);
|
|
|
+
|
|
|
+
|
|
|
+ TcpSendBuffer[21] = 0x01;
|
|
|
+ TcpSendBuffer[22] = data_len>>8;//数据长度未指定
|
|
|
+ TcpSendBuffer[23] = data_len;//数据长度未指定
|
|
|
+
|
|
|
+ memcpy(&TcpSendBuffer[24],battbuffer,data_len);
|
|
|
+ TcpSendBuffer[91] = bcc_chk(TcpSendBuffer,sizeof(TcpSendBuffer)-1);
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("[%d]sizeof:%d \r\n",__LINE__,sizeof(TcpSendBuffer)-1);
|
|
|
+ #endif
|
|
|
#ifdef USING_PRINTF
|
|
|
- printf("[%d]TcpConnectID:%d \r\n",__LINE__,TcpConnectID);
|
|
|
+ printf("[%d]Tcpchk:%#X \r\n",__LINE__,TcpSendBuffer[91]);
|
|
|
#endif
|
|
|
#ifdef USING_PRINTF
|
|
|
- printf("[%d]TcpSendID:%d \r\n",__LINE__,TcpSendID);
|
|
|
+ printf("[%d]datalen:%#X \r\n",__LINE__,data_len);
|
|
|
#endif
|
|
|
#ifdef USING_PRINTF
|
|
|
- printf("[%d]Time1:%x TIme2:%x \r\n",__LINE__,timestracture.UTCtimer1,timestracture.UTCtimer2);
|
|
|
+ printf("[%d]Time1:%#X TIme2:%#X \r\n",__LINE__,timestracture.UTCtimer1,timestracture.UTCtimer2);
|
|
|
#endif
|
|
|
for (int i = 0; i < 92; i++)
|
|
|
{
|
|
|
#ifdef USING_PRINTF
|
|
|
- printf("%x ",TcpSendBuffer[i]);
|
|
|
+ printf("%X ",TcpSendBuffer[i]);
|
|
|
#endif
|
|
|
}
|
|
|
#ifdef USING_PRINTF
|
|
|
printf("\r\n ");
|
|
|
#endif
|
|
|
+ TcpSendID = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,sizeof(TcpSendBuffer),PNULL,PNULL,PNULL);
|
|
|
+
|
|
|
PROC_NB_STATE_SWITCH(PROCESS_STATE_IDLE);
|
|
|
+ osDelay(100);
|
|
|
break;
|
|
|
}
|
|
|
case PROCESS_STATE_SLEEP:
|