Files

104 lines
3.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef PLAT_COMM_TASK_H
#define PLAT_COMM_TASK_H
#ifdef __cplusplus /*C++编译环境下兼容C语言*/
extern "C" {
#endif
/*------ Exported includes(头文件) ----------------------*/
#include "main.h"
#include "../mylog/mylog.h"
#include "plat_comm/impl/bs_public_impl.h"
#include "plat_comm/impl/bs_connect_impl.h"
#include "tls/bs_tls_mbed.h"
/*------ Exported macro(宏定义) -------------------------*/
#define Plat_Comm_LOG(fmt, ...) \
MYLOG_MSG(TASK_ID_PlatComm,fmt, ##__VA_ARGS__) // PlatComm 任务通用打印
#define OCPP_PRINT_FLAG MYLOG_ID_FORCE_OCPP /**< OCPP 强制打印,见 OCPP_PRINTF_LOG */
#define IES_PRINT_FLAG MYLOG_ID_FORCE_IES /**< IES 强制打印,见 IES_PRINTF_LOG */
#if (BS_IES_EN)
#include "plat_comm/ieszt/bs_ies_ctrl.h"
#endif
#if (BS_GWSDK_EN)
#include "plat_comm/gwsdk/bs_gwsdk_ctrl.h"
#endif
#if BS_OCPP_EN //OCPP平台使能
#include "plat_comm/ocpp/BS_ocpp_ctrl.h"
#endif
#define Plat_Send_Sleep (50) //发送延时时间
/*------ Exported struct(结构体定义) --------------------*/
typedef struct
{
U8_T bs_enable; //使能标志
U8_T u8_TCP_connect_flag; //TCP连接建立标志
/** 4Gu8_netType==0):v_set_bs_renew 后置位;仅关模组 Socket 再 QIOPEN,不整网重驻网 */
U8_T u8_4g_soft_tcp_reconnect;
U8_T u8_4g_tcp_soft_fail_streak;
U8_T u8_log_on_flag; //登录标志
U8_T u8_netType; //联网方式 04G 1网线
U8_T u8_updata_flag; //远程升级标志 0未升级 1:ftp升级 2:sdk ota升级
//联网及外部交互控制数据 放置在最外层
struct
{
U8_T u8_pile_state_change_flag; //枪状态变位标志 1说明状态变化 0未变化
U8_T txFlag_tradUpload; //交易记录上送标识
U8_T online_flag; //重新上电标识
U8_T txFlag_startResult; //启动结果上送标识
U8_T txFlag_stopResult; //停止结果上送标识
U8_T txFlag_autoStart; //即插即充鉴权发送标志
U8_T txFlag_autoRwsult; //即插即充鉴权结果 0无意义 1鉴权成功 2鉴权失败
U8_T u8_bms_sendCnt; //bms属性发送次数
U8_T u8_tradUpload_cnt; //订单发送次数
U16_T u16_cmplte_bill_index; //上送订单索引号
}s_gundata[GUN_MAX_CNT];
S32_T fd; //以太网连接专用
ULONG ulong_restart_timer; //超时时间
#if (BS_TLS_MBEDTLS_EN)
U8_T is_secure; //当前 TCP 是否走 TLS0=明文 1=TLS
BS_TLS_CTX tls_ctx; //TLS 上下文,仅在网口+wss 时使用
#endif
}S_BS_CTRL_DATA;
typedef struct
{
U8_T u8_gunCnt; //枪数量
U8_T u8_4g_dispense_en; //4G模块串口分发使能标志
U8_T u8_sendCnt; //发送数量
S_BS_CTRL_DATA s_bs_ctrl[MAX_BS_NUM];
#if (BS_IES_EN)
S_BS_IES_CTRL_DATA s_ies_data;
#endif
#if (BS_GWSDK_EN)
S_GWSDK_CTRL_DATA s_gwsdk_ctrl;
#endif
#if (BS_OCPP_EN) //OCPP平台使能
OCPP_DATA_CTRL ocpp_data;
#endif
}BS_TASK_CTRL_DATA;
/*------ Exported variables(变量定义) -------------------*/
extern BS_TASK_CTRL_DATA s_bs_task_ctrl;
/*------ Exported function prototypes (函数声明) -------*/
void v_set_bs_renew(U8_T u8_bs);
void v_plat_comm_task(void *arg);
#ifdef __cplusplus
}
#endif
#endif /* PLAT_COMM_TASK_H */