|
@@ -655,25 +655,55 @@ void TcpCallBack(void)
|
|
|
}
|
|
|
static void process3AppTask(void* arg)
|
|
|
{
|
|
|
+ CHAR SN[] = "GYTEST00000000001";
|
|
|
CHAR serverip[] = "47.97.127.222";
|
|
|
UINT16 serverport = 8712;
|
|
|
int TcpConnectID = -1;
|
|
|
int TcpSendID = -1;
|
|
|
+ uint16_t data_len = 0x0000;
|
|
|
PROC_Can_STATE_SWITCH(PROCESS_STATE_IDLE);
|
|
|
OsaUtcTimeTValue timestracture;
|
|
|
- uint8_t TcpSendBuffer[92] = {0x23,0x23,0x02,0xFE,0x47,0x59,0x54,0x45,0x53,0x54,
|
|
|
- 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
|
|
|
- 0x32,0x01,0x00,0x43,0x14,0x0B,0x07,0x0E,0x39,0x37,
|
|
|
+ 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};
|
|
|
+ 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;
|
|
|
+
|
|
|
+ uint8_t TcpSendBuffer[92];
|
|
|
+ memset(TcpSendBuffer,0,92);
|
|
|
TcpSendBuffer[0] = 0x23;
|
|
|
TcpSendBuffer[1] = 0x23;
|
|
|
- TcpSendBuffer[3] = 0x02;
|
|
|
+ TcpSendBuffer[2] = 0x02;
|
|
|
+ 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)
|
|
@@ -684,28 +714,12 @@ static void process3AppTask(void* arg)
|
|
|
}
|
|
|
case PROCESS_STATE_WORK:
|
|
|
{
|
|
|
- while(TcpConnectID<0)
|
|
|
- {
|
|
|
- TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
|
|
|
- }
|
|
|
- appGetSystemTimeUtcSync(×tracture);
|
|
|
- TcpSendBuffer[24] = timestracture.UTCtimer1>>16;
|
|
|
- TcpSendBuffer[24] = TcpSendBuffer[24]-0x07D0;
|
|
|
- TcpSendBuffer[25] = timestracture.UTCtimer1>>8;
|
|
|
- TcpSendBuffer[26] = timestracture.UTCtimer1;
|
|
|
- TcpSendBuffer[27] = timestracture.UTCtimer2>>24;
|
|
|
- TcpSendBuffer[28] = timestracture.UTCtimer2>>16;
|
|
|
- TcpSendBuffer[29] = timestracture.UTCtimer2>>8;
|
|
|
-
|
|
|
- TcpSendBuffer[31] = TcpSendBuffer[24];
|
|
|
- TcpSendBuffer[32] = TcpSendBuffer[25];
|
|
|
- TcpSendBuffer[33] = TcpSendBuffer[26];
|
|
|
- TcpSendBuffer[34] = TcpSendBuffer[27];
|
|
|
- TcpSendBuffer[35] = TcpSendBuffer[28];
|
|
|
- TcpSendBuffer[36] = TcpSendBuffer[29];
|
|
|
-
|
|
|
- TcpSendBuffer[91] = bcc_chk(TcpSendBuffer,91);
|
|
|
- TcpSendID = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,92,PNULL,PNULL,PNULL);
|
|
|
+ // while(TcpConnectID<0)
|
|
|
+ // {
|
|
|
+ // TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
|
|
|
+ // }
|
|
|
+ // TcpSendID = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,92,PNULL,PNULL,PNULL);
|
|
|
+
|
|
|
#ifdef USING_PRINTF
|
|
|
printf("[%d]TcpConnectID:%d \r\n",__LINE__,TcpConnectID);
|
|
|
#endif
|