28 changed files with 890 additions and 309 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,28 @@ |
|||
#ifndef APP_TASK_TCP |
|||
#define APP_TASK_TCP |
|||
|
|||
#include "../ctask/task.h" |
|||
#include "../tpc/tpc_ccmodbus.h" |
|||
#include "app_common.h" |
|||
|
|||
typedef struct |
|||
{ |
|||
TS_task task; |
|||
TS_PH3_ccmodbus loopPkg; |
|||
TS_PH3_ccmodbus *pAckPkg; |
|||
U8 slaverIndex; |
|||
U8 pkglen; |
|||
U32 sendStamp; |
|||
U8 retryTimes; |
|||
U8 ackFlag; |
|||
U16 treg; |
|||
}TS_tcp; |
|||
|
|||
#define U485_TIMEOUT 3 //3 x 100ms = 300ms
|
|||
extern TS_tcp ts_tcp; |
|||
|
|||
extern void L3_task_tcp_init(); |
|||
extern void L3_task_tcp_handle(TS_tcp *s); |
|||
|
|||
#endif |
|||
|
@ -1,104 +1,159 @@ |
|||
////////////////////////////////////////////////////////////////////////////
|
|||
///@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_task_w600_H |
|||
#define _app_task_w600_H |
|||
|
|||
#include "../bsp/bsp_config.h" |
|||
#include "../bsp/w600.h" |
|||
#include "../ctask/task.h" |
|||
#include "../tpc/at0d0a.h" |
|||
|
|||
////<<<<<<<<<<<<<<<<<<< GM35模块 AT操作指令 <<<<<<<<<<<<<<<<<<<<<<<<
|
|||
#define AT_INS_ATE0 "ATE1\r\n" //模块查询+关闭回显
|
|||
#define AT_INS_ST "AT+CWMODE=1\r\n" //进入station模式
|
|||
#define AT_INS_ST_WIFI "AT+CWJAP_DEF=\"ccsens\",\"ccsens123\"\r\n" //网络查询指令
|
|||
#define AT_INS_ST_CIPMUX0 "AT+CIPMUX=0\r\n" //GPRS操作指令
|
|||
#define AT_INS_ST_TCP "AT+CIPSTART=\"TCP\",\"192.168.0.79\",4001\r\n" //连接服务器
|
|||
#define AT_INS_ST_CIPMODE1 "AT+CIPMODE=1\r\n" //发送数据
|
|||
#define AT_INS_ST_CIPSEND "AT+CIPSEND\r\n" //主动关闭连接
|
|||
#define AT_INS_ST_CIPMODE0 "AT+CIPMODE=0\r\n" //查询连接状态
|
|||
|
|||
////<<<<<<<<<<<<<<<<<<<_s_task_test_<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
enum _s_w600_mode |
|||
{ |
|||
W600_ST,W600_AP |
|||
}; |
|||
struct _s_task_gm35_gprs_ |
|||
{ |
|||
TS_task task; |
|||
|
|||
vU8 ins_ok; |
|||
vU8 wifi_ok; |
|||
vU8 mode; |
|||
|
|||
vU8 send_lock; |
|||
vU8 module_ok; |
|||
vU8 sim_ok; |
|||
vU8 net_ok; |
|||
vU8 gprs_ok; |
|||
vU8 conn_ok; |
|||
vU8 status_query_ok; |
|||
vU32 ins_stmp; //指令时间戳
|
|||
vU32 gprs_last_recv_stmp; //上次接收指令时间戳
|
|||
vU32 tcp_last_recv_stmp; //上次接收数据时间戳
|
|||
vU32 tcp_conn_stmp; //断开连接时间戳
|
|||
vU32 tcp_close_stmp; //断开连接时间戳
|
|||
|
|||
vU32 heart_stmp; //连接成功后,等待发送时间
|
|||
vU32 data_stmp;//数据发送时间记录
|
|||
|
|||
vU8 sign_flag; //发送登录数据标志
|
|||
vU8 ack_flag;//下行数据ack
|
|||
vU8 gm35_reboot_times; //gm35重启次数
|
|||
}; |
|||
|
|||
#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 //注意缓冲区的长度
|
|||
|
|||
extern struct _s_task_gm35_gprs_ s_task_gm35_flow; |
|||
|
|||
extern void L3_task_gm35_flow_init(U8 mode); |
|||
extern void L2_task_gm35_flow_handle(struct _s_task_gm35_gprs_ *s); |
|||
|
|||
extern void L3_uart2_exp_protocol(TS_Handle_0d0a *p); |
|||
|
|||
|
|||
#endif |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
////////////////////////////////////////////////////////////////////////////
|
|||
///@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_task_w600_H |
|||
#define _app_task_w600_H |
|||
|
|||
#include "../bsp/bsp_config.h" |
|||
#include "../bsp/w600.h" |
|||
#include "../ctask/task.h" |
|||
#include "../tpc/at0d0a.h" |
|||
#include "../tpc/ccmodbus.h" |
|||
|
|||
////<<<<<<<<<<<<<<<<<<< GM35模块 AT操作指令 <<<<<<<<<<<<<<<<<<<<<<<<
|
|||
#define AT_INS_ATE0 "ATE0\r\n" //模块查询+关闭回显
|
|||
#define AT_INS_ST "AT+CWMODE=1\r\n" //进入station模式
|
|||
//#define AT_INS_ST_WIFI "AT+CWJAP_DEF=\"ccsens\",\"ccsens123\"\r\n" //网络查询指令
|
|||
#define AT_INS_ST_CIPMUX0 "AT+CIPMUX=0\r\n" //GPRS操作指令
|
|||
#define AT_INS_ST_TCP "AT+CIPSTART=\"TCP\",\"test.tall.wiki\",49000\r\n" //连接服务器
|
|||
#define AT_INS_ST_CIPMODE1 "AT+CIPMODE=1\r\n" //发送数据
|
|||
#define AT_INS_ST_CIPSEND "AT+CIPSEND\r\n" //主动关闭连接
|
|||
#define AT_INS_ST_CIPMODE0 "AT+CIPMODE=0\r\n" //查询连接状态
|
|||
|
|||
|
|||
#define AT_INS_AP "AT+CWMODE=2\r\n" //进入AP模式
|
|||
#define AT_INS_AP_WIFI "AT+CWSAP=\"ccsens_pen\",\"ccsens123\",10,4,4,0\r\n" //设置AP参数
|
|||
#define AT_INS_AP_CIPMUX1 "AT+CIPMUX=1\r\n" //开启多连接
|
|||
#define AT_INS_AP_SERVER "AT+CIPSERVER=1,1001\r\n" //建立服务器
|
|||
#define AT_INS_AP_TCP_TIME "AT+CIPSTO=300\r\n" |
|||
#define AT_INS_AP_SEND "AT+CIPSENDEX=0,6\r\n" //
|
|||
#define AT_INS_AP_SERVER_CLOSE "AT+CIPSERVER=0\r\n" //
关闭服务器 |
|||
|
|||
////<<<<<<<<<<<<<<<<<<<_s_task_test_<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
enum _s_w600_mode |
|||
{ |
|||
W600_ST,W600_AP |
|||
}; |
|||
struct _s_task_gm35_gprs_ |
|||
{ |
|||
TS_task task; |
|||
vU8 send; |
|||
|
|||
vU8 ins_ok; |
|||
vU8 st_wifi_ok; |
|||
vU8 st_conn_ok; |
|||
vU8 ap_conn_ok; |
|||
vU8 ap_rec_ok; |
|||
vU8 st_cip_ok; |
|||
vU8 ap_tcp_ok; |
|||
vU8 ap_data_ok; |
|||
vU8 st_error; |
|||
vU8 mode; |
|||
|
|||
vU8 send_lock; |
|||
vU8 module_ok; |
|||
vU8 sim_ok; |
|||
vU8 net_ok; |
|||
vU8 gprs_ok; |
|||
vU8 conn_ok; |
|||
vU8 status_query_ok; |
|||
vU32 ins_stmp; //指令时间戳
|
|||
vU32 gprs_last_recv_stmp; //上次接收指令时间戳
|
|||
vU32 tcp_last_recv_stmp; //上次接收数据时间戳
|
|||
vU32 tcp_conn_stmp; //断开连接时间戳
|
|||
vU32 tcp_close_stmp; //断开连接时间戳
|
|||
|
|||
vU32 heart_stmp; //连接成功后,等待发送时间
|
|||
vU32 data_stmp;//数据发送时间记录
|
|||
|
|||
vU8 sign_flag; //发送登录数据标志
|
|||
vU8 ack_flag;//下行数据ack
|
|||
vU8 gm35_reboot_times; //gm35重启次数
|
|||
}; |
|||
extern struct _s_task_gm35_gprs_ s_task_gm35_flow; |
|||
|
|||
#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 //注意缓冲区的长度
|
|||
typedef struct |
|||
{ |
|||
TS_task task; |
|||
TS_PH3_ccmodbus loopPkg; |
|||
TS_PH3_ccmodbus *pAckPkg; |
|||
U8 slaverIndex; |
|||
U8 pkglen; |
|||
U32 sendStamp; |
|||
U8 retryTimes; |
|||
U8 ackFlag; |
|||
U16 treg; |
|||
}TS_tcp; |
|||
|
|||
|
|||
typedef struct |
|||
{ |
|||
TS_task task; |
|||
vU8 conn_ok_pool; |
|||
vU32 tcp_send_stmp; |
|||
}TS_tcp_control; |
|||
|
|||
extern TS_tcp_control ts_tcp_control; |
|||
extern struct _s_task_gm35_gprs_ s_task_gm35_flow; |
|||
extern TS_tcp ts_tcp; |
|||
|
|||
#define U485_TIMEOUT 3 //3 x 100ms = 300ms
|
|||
extern TS_tcp ts_tcp; |
|||
extern void L3_task_tcp_control_init(); |
|||
|
|||
extern void L3_task_tcp_init(); |
|||
|
|||
|
|||
extern struct _s_task_gm35_gprs_ s_task_gm35_flow; |
|||
extern void L3_gm35_send_str(U8 *str); |
|||
|
|||
extern void L3_task_gm35_flow_init(U8 mode); |
|||
extern void L2_task_gm35_flow_handle(struct _s_task_gm35_gprs_ *s); |
|||
|
|||
extern void L3_uart2_exp_protocol(struct _s_PC1_0D0A_ *p); |
|||
|
|||
|
|||
extern void L3_task_tcp_handle(TS_tcp *s); |
|||
|
|||
extern void L3_task_tcp_control_handle(TS_tcp_control *s); |
|||
|
|||
#endif |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue