You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.1 KiB
98 lines
2.1 KiB
#include "app_task_tcp_control.h"
|
|
#include "../msp/uart0.h"
|
|
#include "../app/app_common.h"
|
|
#include "../app/app_task_gm35.h"
|
|
#include "../app/app_task_tcp.h"
|
|
|
|
TS_tcp_control ts_tcp_control;
|
|
|
|
void L3_task_tcp_control_init(void)
|
|
{
|
|
L1_task_init(&ts_tcp_control.task);
|
|
L3_task_s_go(ts_tcp_control,D_task_init);
|
|
ts_tcp_control.conn_ok_pool = 0;
|
|
ts_tcp_control.tcp_send_stmp = 0;
|
|
}
|
|
|
|
#define D_task_tcp_control_01 0x51
|
|
#define D_task_tcp_control_02 0x52
|
|
|
|
|
|
void L3_task_tcp_control_handle(TS_tcp_control *s)
|
|
{
|
|
TTSS_Task_init();
|
|
L2_task_go(D_task_tcp_control_01);
|
|
|
|
TTSS_Task_step(D_task_tcp_control_01)
|
|
//TODO 连接状态改变,重新认证
|
|
//G.authed = 0;
|
|
L2_task_go(D_task_tcp_control_02);
|
|
|
|
TTSS_Task_step(D_task_tcp_control_02)
|
|
//3s一次发送数据包
|
|
if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 3)
|
|
{
|
|
if(!G.authed)
|
|
{
|
|
//发送认证包
|
|
G.ccmd_slaver_info[0].mask = 1;
|
|
}
|
|
else if(!G.flowStarted)
|
|
{
|
|
//发送流程开始包
|
|
G.ccmd_slaver_info[2].mask = 1;
|
|
}
|
|
else
|
|
{
|
|
G.ccmd_slaver_info[3].mask = 1;
|
|
}
|
|
ts_tcp_control.tcp_send_stmp = s_nos_tick.t_1s;
|
|
}
|
|
L2_task_go(D_task_tcp_control_01);
|
|
TTSS_Task_end();
|
|
}
|
|
|
|
|
|
#if 0
|
|
void L3_task_tcp_control_handle111(TS_tcp_control *s)
|
|
{
|
|
TTSS_Task_init();
|
|
L2_task_go(D_task_tcp_control_01);
|
|
|
|
TTSS_Task_step(D_task_tcp_control_01)
|
|
if(s->conn_ok_pool != g_at_send_status.conn_ok)
|
|
{
|
|
if(g_at_send_status.conn_ok)
|
|
{
|
|
L3_task_tcp_init();
|
|
|
|
//发送认证包
|
|
G.ccmd_slaver_info[0].mask = 1;
|
|
|
|
//发送流程开始包
|
|
if(G.flowStarted == 0)
|
|
{
|
|
G.flowStart = 1;
|
|
G.ccmd_slaver_info[2].mask = 1;
|
|
}
|
|
ts_tcp_control.tcp_send_stmp = s_nos_tick.t_1s;
|
|
}
|
|
s->conn_ok_pool = g_at_send_status.conn_ok;
|
|
}
|
|
|
|
if(s->conn_ok_pool)
|
|
{
|
|
if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 3)
|
|
{
|
|
G.ccmd_slaver_info[3].mask = 1;
|
|
ts_tcp_control.tcp_send_stmp = s_nos_tick.t_1s;
|
|
}
|
|
}
|
|
|
|
L2_task_go(D_task_tcp_control_01);
|
|
|
|
TTSS_Task_end();
|
|
}
|
|
#endif
|
|
|
|
|
|
|