15 changed files with 707 additions and 270 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,411 @@ |
|||
//////////////////////////////////////////////////////////////////////////// |
|||
///@copyright Copyright (c) 2018, 传控科技 All rights reserved. |
|||
///------------------------------------------------------------------------- |
|||
/// @file bsp_test.c.c |
|||
/// @brief bsp @ driver config |
|||
///------------------------------------------------------------------------- |
|||
/// @version 1.0 |
|||
/// @author CC |
|||
/// @date 20180331 |
|||
/// @note cc_AS_stc02 |
|||
////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#include "app_task_gm35.h" |
|||
|
|||
#include "../clib/bit.h" |
|||
#include "../clib/clib.h" |
|||
#include "../msp/uart0.h" |
|||
|
|||
#include "../msp/uart4.h" |
|||
#include "../app/app_common.h" |
|||
#include "../app/app_task_wdt.h" |
|||
#include "../app/app_paraid.h" |
|||
#include "../app/app_common.h" |
|||
|
|||
struct _at_send_status g_at_send_status; |
|||
struct _s_task_gm35_gprs_ s_task_gm35_flow; |
|||
struct _s_task_gm35_gprs_ s_task_gm35_daemon; |
|||
// struct _s_task_gm35_gprs_ s_task_gm35_send; |
|||
|
|||
#define LEN_GPRS_TCP_PKG 18 |
|||
|
|||
U8 ins_cipsend[30] = "AT+CIPSEND=000\r\n"; |
|||
|
|||
#define GM35_TCP_CIPSEND(x) L0_uart4_sendstr(x); g_at_send_status.send_lock = 1 |
|||
#define GM35_TCP_CIPSEND_COMPLETE() g_at_send_status.send_lock = 0 |
|||
|
|||
U8 * _cipsend_hex(U8 len) |
|||
{ |
|||
U8 pos = libc_strlen("AT+CIPSEND="); |
|||
ins_cipsend[pos++] = len % 1000 / 100 + '0'; |
|||
ins_cipsend[pos++] = len % 100 / 10 + '0'; |
|||
ins_cipsend[pos++] = len % 10 / 1 + '0'; |
|||
|
|||
return ins_cipsend; |
|||
} |
|||
|
|||
//将数据放入gm35待发送缓冲区 |
|||
void L3_gm35_send(U8 *buf , U8 len) |
|||
{ |
|||
//g_at_send_status.tcp_last_send_stmp = s_nos_tick.t_1s; |
|||
int i = 0x20000; |
|||
GM35_TCP_CIPSEND(_cipsend_hex(len)); |
|||
while(i--); |
|||
L0_uart4_sendArray(buf,len); |
|||
GM35_TCP_CIPSEND_COMPLETE(); |
|||
} |
|||
|
|||
|
|||
//------------------------------------------------------ gm35 tasks -------------------------------- |
|||
|
|||
// void L3_task_gm35_send_init(void) |
|||
// { |
|||
// L1_task_init(&s_task_gm35_send.task); |
|||
// L3_task_s_go(s_task_gm35_send,D_task_init); |
|||
// } |
|||
|
|||
void L3_task_gm35_flow_init(void) |
|||
{ |
|||
U8 i = 0; |
|||
|
|||
//task init; |
|||
L1_task_init(&s_task_gm35_flow.task); |
|||
L3_task_s_go(s_task_gm35_flow,D_task_init); |
|||
|
|||
//data init; |
|||
g_at_send_status.send_lock = 0; |
|||
g_at_send_status.module_ok = 0; |
|||
g_at_send_status.sim_ok = 0; |
|||
g_at_send_status.net_ok = 0; |
|||
g_at_send_status.gprs_ok = 0; |
|||
g_at_send_status.conn_ok = 0; |
|||
g_at_send_status.status = STATUS_GM35_INIT; |
|||
|
|||
g_at_send_status.heart_stmp = 0; |
|||
g_at_send_status.data_stmp = 0; |
|||
|
|||
g_at_send_status.sign_flag = 0; |
|||
g_at_send_status.heart_flag = 0; |
|||
g_at_send_status.data_flag = 0; |
|||
g_at_send_status.ack_flag = 0; |
|||
|
|||
g_at_send_status.ins_flag = 0; |
|||
|
|||
g_at_send_status.tcp_close_stmp = s_nos_tick.t_1s; //重新上电和检测到断开时设置 |
|||
g_at_send_status.ins_stmp = 0; //每次发送指令时设置 |
|||
g_at_send_status.tcp_last_recv_stmp = 0; //连接成功和接收到数据时设置 |
|||
} |
|||
|
|||
void L3_task_gm35_daemon_init(void) |
|||
{ |
|||
L1_task_init(&s_task_gm35_daemon.task); |
|||
L3_task_s_go(s_task_gm35_daemon,D_task_init); |
|||
} |
|||
|
|||
//------------------------ GM35 Daemon Handle ----------------------------------- |
|||
#define TTSS_TASK_GM35_DAEMON_CIPSTATUS 0x01 |
|||
#define TTSS_TASK_GM35_DAEMON_JUDGE 0x02 |
|||
#define TTSS_TASK_GM35_DAEMON_CLOSE0 0x03 |
|||
#define TTSS_TASK_GM35_DAEMON_REBOOT0 0x04 |
|||
#define TTSS_TASK_GM35_DAEMON_REBOOT1 0x05 |
|||
#define TTSS_TASK_GM35_DAEMON_REBOOT2 0x06 |
|||
#define TTSS_TASK_BOARD_REBOOT 0x0A |
|||
|
|||
#define TCP_MAX_IDLE 130 |
|||
#define TCP_MAX_DISCONN 120 |
|||
#define GM35_REBOOT_MAXTIMES 10 |
|||
|
|||
void L2_task_gm35_daemon_handle(struct _s_task_gm35_gprs_ *s) |
|||
{ |
|||
TTSS_Task_init(); |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_10s); |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_CIPSTATUS) |
|||
if(0 == g_at_send_status.send_lock) |
|||
{ |
|||
L0_uart4_sendstr(AT_INS_CIPSTATUS); |
|||
} |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_JUDGE,D_Tdelay_2s); |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_JUDGE) |
|||
if(1 == g_at_send_status.conn_ok) |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.tcp_last_recv_stmp > TCP_MAX_IDLE * 2) |
|||
{ |
|||
//g_at_send_status.conn_ok = 0; //强制关闭连接 |
|||
//g_at_send_status.tcp_close_stmp = s_nos_tick.t_1s; |
|||
//L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_JUDGE,D_Tdelay_1s); |
|||
|
|||
L0_uart0_sendstr("GM35 reboot."); |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_REBOOT0,0); //重启GM35 |
|||
} |
|||
else if(s_nos_tick.t_1s - g_at_send_status.tcp_last_recv_stmp > TCP_MAX_IDLE) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CLOSE0,0); //关闭连接 |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_3s); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if(g_at_send_status.gm35_reboot_times >= GM35_REBOOT_MAXTIMES) |
|||
{ |
|||
L0_uart0_sendstr("Board reboot."); |
|||
g_at_send_status.gm35_reboot_times = 0; //重启需要时间,这里提前设置一下 |
|||
|
|||
//不写入继电器状态,重启自动回到初始状态 |
|||
//L3_flash_write_page0(); //写继电器状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_BOARD_REBOOT,0); //重启板卡 |
|||
} |
|||
else if(s_nos_tick.t_1s - g_at_send_status.tcp_close_stmp > TCP_MAX_DISCONN) |
|||
{ |
|||
L0_uart0_sendstr("GM35 reboot."); |
|||
g_at_send_status.tcp_close_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_REBOOT0,0); //重启GM35 |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_3s); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_CLOSE0) |
|||
L0_uart4_sendstr(AT_INS_CLOSED); |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_3s); |
|||
#ifdef BOARD_MAIN04_GM35_M42 |
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_REBOOT0) |
|||
//set low |
|||
L2_gm35_disable(); |
|||
g_at_send_status.gm35_reboot_times++; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_REBOOT1,D_Tdelay_1s); |
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_REBOOT1) |
|||
//set high |
|||
L2_gm35_enable(); |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_REBOOT2,D_Tdelay_1s); |
|||
#elif defined BOARD_MAIN03_A9 |
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_REBOOT0) |
|||
L0_uart4_sendstr(AT_RESET); |
|||
g_at_send_status.gm35_reboot_times++; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_REBOOT2,D_Tdelay_1s); |
|||
#endif |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_DAEMON_REBOOT2) |
|||
L3_task_gm35_flow_init(); |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_3s); |
|||
|
|||
TTSS_Task_step(TTSS_TASK_BOARD_REBOOT) |
|||
//s_task_wdt.seed_flag = FLAG_WDT_hunger; //饿死看门狗 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_DAEMON_CIPSTATUS,D_Tdelay_3s); |
|||
|
|||
TTSS_Task_end(); |
|||
} |
|||
|
|||
//------------------------ GM35 Flow Handle ----------------------------------- |
|||
|
|||
#define TTSS_TASK_GM35_FLOW_ATEQV 0x01 |
|||
#define TTSS_TASK_GM35_FLOW_ATEQV_WAIT 0x02 |
|||
#define TTSS_TASK_GM35_FLOW_CCID 0x03 |
|||
#define TTSS_TASK_GM35_FLOW_CCID_WAIT 0x04 |
|||
#define TTSS_TASK_GM35_FLOW_CREG 0x05 |
|||
#define TTSS_TASK_GM35_FLOW_CREG_WAIT 0x06 |
|||
#define TTSS_TASK_GM35_FLOW_GPRS 0x07 |
|||
#define TTSS_TASK_GM35_FLOW_GPRS_WAIT 0x08 |
|||
#define TTSS_TASK_GM35_FLOW_CIPSTART 0x09 |
|||
#define TTSS_TASK_GM35_FLOW_CIPSTART_WAIT 0x0A |
|||
#define TTSS_TASK_GM35_FLOW_CIPSTART_SUCCESS 0x0B |
|||
|
|||
#define INS_TIMEOUT 10 |
|||
#define GM35_SEND_DATA_INTERVAL 300 |
|||
#define GM35_SEND_HEART_INTERVAL 60 |
|||
#define GM35_SEND_CIPSTATUS_INTERVAL 5 |
|||
|
|||
void L2_task_gm35_flow_handle(struct _s_task_gm35_gprs_ *s) |
|||
{ |
|||
TTSS_Task_init() |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_ATEQV,D_Tdelay_2s);//上电等待10s |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_ATEQV) |
|||
L0_uart4_sendstr(AT_INS_ATEQV); |
|||
g_at_send_status.module_ok = 0; |
|||
g_at_send_status.ins_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_ATEQV_WAIT,D_Tdelay_300ms); //指令发送完毕等待300ms |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_ATEQV_WAIT) |
|||
if(1 == g_at_send_status.module_ok) |
|||
{ |
|||
G.boardstatus.a9Status = STATUS_GM35_MODULE_OK;//修改状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CCID,0); |
|||
} |
|||
else |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.ins_stmp > INS_TIMEOUT) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_ATEQV,0); |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_ATEQV_WAIT,D_Tdelay_300ms); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CCID) |
|||
L0_uart4_sendstr(AT_INS_CCID); |
|||
g_at_send_status.sim_ok = 0; |
|||
g_at_send_status.ins_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CCID_WAIT,D_Tdelay_300ms); //指令发送完毕等待300ms |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CCID_WAIT) |
|||
if(1 == g_at_send_status.sim_ok) |
|||
{ |
|||
//Lc_print_buf("ccid: %s,",G.ccid); |
|||
L0_uart0_sendArray(G.ccid,20); |
|||
Lc_delay_ms(100);// 2000--7s |
|||
//L0_uart0_uc('S'); |
|||
//L0_uart0_sendArray(G.ccid_passwd,21); |
|||
//Lc_print_buf("%s\r\n",G.ccid_passwd); |
|||
|
|||
G.boardstatus.a9Status = STATUS_GM35_SIM_OK;//修改状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CREG,0); |
|||
} |
|||
else |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.ins_stmp > INS_TIMEOUT) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CCID,0); |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CCID_WAIT,D_Tdelay_300ms); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CREG) |
|||
L0_uart4_sendstr(AT_INS_CREG); |
|||
g_at_send_status.net_ok = 0; |
|||
g_at_send_status.ins_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CREG_WAIT,D_Tdelay_300ms); //指令发送完毕等待300ms |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CREG_WAIT) |
|||
if(1 == g_at_send_status.net_ok) |
|||
{ |
|||
L0_uart0_sendstr("net ok"); |
|||
G.boardstatus.a9Status = STATUS_GM35_NET_OK;//修改状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_GPRS,0); |
|||
} |
|||
else |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.ins_stmp > INS_TIMEOUT) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CREG,0); |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CREG_WAIT,D_Tdelay_300ms); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_GPRS) |
|||
L0_uart4_sendstr(AT_INS_GPRS); |
|||
g_at_send_status.gprs_ok = 0; |
|||
g_at_send_status.ins_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_GPRS_WAIT,D_Tdelay_300ms); //指令发送完毕等待300ms |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_GPRS_WAIT) |
|||
if(1 == g_at_send_status.gprs_ok) |
|||
{ |
|||
L0_uart0_sendstr("gprs ok"); |
|||
G.boardstatus.a9Status = STATUS_GM35_GPRS_OK;//修改状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART,0); |
|||
} |
|||
else |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.ins_stmp > INS_TIMEOUT) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_GPRS,0); |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_GPRS_WAIT,D_Tdelay_300ms); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CIPSTART) |
|||
L0_uart0_uc('L'); |
|||
L0_uart0_uc( g_at_send_status.conn_ok + '0'); |
|||
L0_uart4_sendstr(AT_INS_CIPSTART); |
|||
g_at_send_status.conn_ok = 0; |
|||
g_at_send_status.ins_stmp = s_nos_tick.t_1s; |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART_WAIT,D_Tdelay_300ms); //指令发送完毕等待300ms |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CIPSTART_WAIT) |
|||
if(1 == g_at_send_status.conn_ok) |
|||
{ |
|||
L0_uart0_sendstr("conn ok"); |
|||
//L3_task_gm35_send_init(); //初始化发送任务 |
|||
|
|||
g_at_send_status.heart_stmp = s_nos_tick.t_1s; |
|||
g_at_send_status.data_stmp = s_nos_tick.t_1s;//连接成功后立刻发送账号密码 |
|||
|
|||
g_at_send_status.sign_flag = 1; |
|||
g_at_send_status.heart_flag = 0; |
|||
g_at_send_status.data_flag = 0; //login |
|||
g_at_send_status.ack_flag = 0; |
|||
//g_at_send_status.pending_flag = 0; |
|||
|
|||
g_at_send_status.tcp_last_recv_stmp = s_nos_tick.t_1s; //设置数据接收时间 |
|||
g_at_send_status.gm35_reboot_times = 0; //gm35重启次数清0 |
|||
G.boardstatus.a9Status = STATUS_GM35_TCP_OK;//修改状态 |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART_SUCCESS,0); |
|||
} |
|||
else |
|||
{ |
|||
if(s_nos_tick.t_1s - g_at_send_status.ins_stmp > INS_TIMEOUT) |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART,0); |
|||
} |
|||
else |
|||
{ |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART_WAIT,D_Tdelay_300ms); |
|||
} |
|||
} |
|||
|
|||
TTSS_Task_step(TTSS_TASK_GM35_FLOW_CIPSTART_SUCCESS) |
|||
if(1 == g_at_send_status.conn_ok) |
|||
{ |
|||
//连续20s没有收到数据,断线重连 |
|||
if(s_nos_tick.t_1s - g_at_send_status.tcp_last_recv_stmp >= 60) //20 |
|||
{ |
|||
L0_uart0_uc('D'); |
|||
L0_uart4_sendstr(AT_INS_CLOSED); |
|||
g_at_send_status.conn_ok = 0; //等待收到close 自动关闭 |
|||
} |
|||
} |
|||
|
|||
if(0 == g_at_send_status.conn_ok) |
|||
{ |
|||
//L0_uart4_uc(0x1a); //关闭send |
|||
L2_task_go_Tdelay(TTSS_TASK_GM35_FLOW_CIPSTART,D_Tdelay_300ms); //断线重连 |
|||
} |
|||
|
|||
TTSS_Task_end(); |
|||
} |
|||
|
|||
//------------------------ GM35 Core Handle ----------------------------------- |
|||
|
|||
void L3_task_gm35_core_init(void) |
|||
{ |
|||
g_at_send_status.gm35_reboot_times = 0; |
|||
|
|||
//L3_task_gm35_daemon_init(); |
|||
L3_task_gm35_flow_init(); |
|||
} |
|||
|
|||
void L3_task_gm35_core_handle() |
|||
{ |
|||
//L2_task_gm35_daemon_handle(&s_task_gm35_daemon); |
|||
L2_task_gm35_flow_handle(&s_task_gm35_flow); |
|||
} |
|||
|
|||
|
@ -0,0 +1,108 @@ |
|||
//////////////////////////////////////////////////////////////////////////// |
|||
///@copyright Copyright (c) 2018, 传控科技 All rights reserved. |
|||
///------------------------------------------------------------------------- |
|||
/// @file bsp_gc6133.c.h |
|||
/// @brief bsp @ driver config |
|||
///------------------------------------------------------------------------- |
|||
/// @version 1.0 |
|||
/// @author CC |
|||
/// @date 20180331 |
|||
/// @note cc_AS_stc02 |
|||
|
|||
////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#ifndef _app_gm35_gprs_H |
|||
#define _app_gm35_gprs_H |
|||
|
|||
#include "../bsp/bsp_config.h" |
|||
#include "../bsp/bsp_gm35.h" |
|||
#include "../tpc/tpc_uart.h" |
|||
#include "../ctask/task.h" |
|||
|
|||
////<<<<<<<<<<<<<<<<<<< GM35模块 AT操作指令 <<<<<<<<<<<<<<<<<<<<<<<< |
|||
#define AT_INS_ATEQV "ATE0Q0V1\r\n" //模块查询指令 |
|||
#define AT_INS_CCID "AT+CCID\r\n" //SIM卡查询指令 |
|||
#define AT_INS_CREG "AT+CREG?\r\n" //网络查询指令 |
|||
#define AT_INS_GPRS "AT+CGATT=1;+CGDCONT=1,\"IP\",\"CMNET\";+CGACT=1,1\r\n" //GPRS操作指令 |
|||
//#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"test.tall.wiki\",38195\r\n" |
|||
#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"www.tall.wiki\",8195\r\n" |
|||
//#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"43.249.193.233\",38916\r\n" |
|||
//#define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"weizezhao.imwork.net\",49809\r\n" //连接服务器 |
|||
// #define AT_INS_CIPSTART "AT+CIPSTART=\"TCP\",\"43.249.193.233\",38916\r\n" //连接服务器 |
|||
#define AT_INS_CIPSEND "AT+CIPSEND\r\n" //发送数据 |
|||
#define AT_INS_CLOSED "AT+CIPCLOSE\r\n" //主动关闭连接 |
|||
#define AT_INS_CIPSTATUS "AT+CIPSTATUS\r\n" //查询连接状态 |
|||
#define AT_INS_CSQ "AT+CSQ\r\n" //查询信号指令 |
|||
|
|||
#define AT_RESET "AT+RST=2\r\n" //a9重启指令 AT+RST=2硬件重启(vUSB供电) AT+RST=1软件重启 |
|||
|
|||
////<<<<<<<<<<<<<<<<<<<_s_task_test_<<<<<<<<<<<<<<<<<<<<<<<< |
|||
struct _s_task_gm35_gprs_ |
|||
{ |
|||
TS_task task; |
|||
}; |
|||
|
|||
#define STATUS_GM35_INIT 0 |
|||
#define STATUS_GM35_MODULE_OK 1 |
|||
#define STATUS_GM35_SIM_OK 2 |
|||
#define STATUS_GM35_NET_OK 3 |
|||
#define STATUS_GM35_GPRS_OK 4 |
|||
#define STATUS_GM35_TCP_OK 5 |
|||
|
|||
|
|||
#define BUF_SIZE 5 |
|||
#define BUF_MAX 32 //注意缓冲区的长度 |
|||
|
|||
struct _at_send_status |
|||
{ |
|||
vU8 send_lock; |
|||
vU8 module_ok; |
|||
vU8 sim_ok; |
|||
vU8 net_ok; |
|||
vU8 gprs_ok; |
|||
vU8 conn_ok; |
|||
vU8 status; |
|||
vU32 ins_stmp; //指令时间戳 |
|||
vU32 tcp_last_recv_stmp; //上次接收数据时间戳 |
|||
vU32 tcp_close_stmp; //断开连接时间戳 |
|||
|
|||
vU32 heart_stmp; //连接成功后,等待发送时间 |
|||
vU32 data_stmp;//数据发送时间记录 |
|||
|
|||
vU8 sign_flag; //发送登录数据标志 |
|||
vU8 heart_flag; //发送心跳标志 |
|||
vU8 data_flag;//定时发送数据标志 |
|||
vU8 ack_flag;//下行数据ack |
|||
vU8 gm35_reboot_times; //gm35重启次数 |
|||
vU8 ins_flag; //at指令ok标志 |
|||
}; |
|||
|
|||
extern struct _at_send_status g_at_send_status; |
|||
extern struct _s_task_gm35_gprs_ s_task_gm35_gprs; |
|||
extern struct _s_task_gm35_gprs_ s_task_connect_gprs; |
|||
|
|||
extern void L3_task_gm35_core_init(void); |
|||
extern void L3_task_gm35_core_handle(void); |
|||
extern void L3_gm35_send(U8 *d , U8 len); |
|||
|
|||
#endif |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue