|
|
|
#ifndef __CA_DBG_H__
|
|
|
|
#define __CA_DBG_H__
|
|
|
|
|
|
|
|
#ifdef CFG_DEV_TYPE_LAND_CA
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "ca_main.h"
|
|
|
|
/* Define --------------------------------------------------------------------*/
|
|
|
|
#define DEBUG_BUG_SIZE 1512
|
|
|
|
#define DEBUG_CJSON_BUG_SIZE 1512
|
|
|
|
#define DEBUG_PKT_DATA_POS (8)
|
|
|
|
//#define DEBUG_MSG_INVALID_LEN (10) //head+cmd+len+verify
|
|
|
|
|
|
|
|
#define DEBUG_CONFIG_GET (0x0001)//获取json配置
|
|
|
|
#define DEBUG_CONFIG_SET (0x0002)//设置json配置
|
|
|
|
#define DEBUG_REBOOT (0x0003)//重启
|
|
|
|
#define DEBUG_SET_TIME (0x0004)//对时
|
|
|
|
#define DEBUG_GET_REALDATA (0x0005)//获取实时数据
|
|
|
|
#define DEBUG_GET_HISDATA (0x0006)//获取历史
|
|
|
|
#define DEBUG_DAU_WAVE (0x0007)//手动高频录波
|
|
|
|
#define DEBUG_CAU_WAVE (0x0008)//手动工频录波
|
|
|
|
#define DEBUG_ADJUST_TASK (0x0009)//启动校准任务
|
|
|
|
#define DEBUG_ADJUST_RESULT (0x000A)//校准结束反馈结果
|
|
|
|
#define DEBUG_GET_ADJUST_PARAM (0x000B)//获取校准系数
|
|
|
|
#define DEBUG_UPGRADE_ARM (0x00EF)//ARM升级
|
|
|
|
#define DEBUG_DAUPowerControl (0x000C)//DAU电源控制
|
|
|
|
#define DEBUG_HFCTFreDetection (0x000D)//反馈高频特征值
|
|
|
|
#define DEBUG_AdjustValidation (0x000E)//校准参数验证
|
|
|
|
#define DEBUG_AdjustCl106dValue (0x000F)//设置校准源输出值
|
|
|
|
#define DEBUG_GetHWMQTTCFG (0x0010)//获取MQTT配置信息
|
|
|
|
#define DEBUG_SetHWMQTTCFG (0x0011)//设置MQTT配置
|
|
|
|
#define DEBUG_ManualAdjust (0x0012)//进入手动校准模式
|
|
|
|
#define DEBUG_ManualCalcu (0x0013)//手动计算
|
|
|
|
#define DEBUG_LOAD_CSGMQTTCFG (0x0014)//获取南网MQTT配置
|
|
|
|
#define DEBUG_SAVE_CSGMQTTCFG (0x0015)//保存南网MQTT配置
|
|
|
|
#define DEBUG_INVALID (0xFFFF)
|
|
|
|
|
|
|
|
|
|
|
|
#define BITMAP_SAVE_FILE (1 << 0)
|
|
|
|
#define BITMAP_IP_CHANGE (1 << 1)
|
|
|
|
|
|
|
|
#define DEBUG_MANAGE_TOOL_PORT (10086)
|
|
|
|
|
|
|
|
#define UPDATE_PACK_LENGTH (1024)
|
|
|
|
#define UPDATE_FILE_PATH "/home/Cable"
|
|
|
|
#define UPDATE_FILE_NAME "update.zip"
|
|
|
|
#define UPDATE_TMP_FILE_NAME "update_tmp.zip"
|
|
|
|
|
|
|
|
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
|
|
/* 端口校准系数. */
|
|
|
|
typedef struct {
|
|
|
|
uint16_t point[4]; // 通道分段点.
|
|
|
|
uint16_t param_a[5]; // 通道线性度校准系数 a.
|
|
|
|
uint16_t param_b[5]; // 通道线性度校准系数 b.
|
|
|
|
uint16_t alarm_ref; // 断线告警比较值.
|
|
|
|
uint16_t reserve;
|
|
|
|
} debug_pkt_adj_vport_t;
|
|
|
|
|
|
|
|
/* 端口状态, 主要是 ADC 原始值和校准后的值.*/
|
|
|
|
typedef struct {
|
|
|
|
uint16_t value_adc;
|
|
|
|
int16_t value_adj;
|
|
|
|
} debug_pkt_port_state_t;
|
|
|
|
|
|
|
|
/* 设备状态. */
|
|
|
|
typedef struct {
|
|
|
|
uint32_t idx; // 编号.
|
|
|
|
uint32_t UTC_TimeScale; // UTC 时标
|
|
|
|
float F50Hz_Frequency; // 同步 50Hz 频率.
|
|
|
|
uint8_t F50Hz_SynStatus; // 同步状态.
|
|
|
|
uint8_t dau_status; // 插件状态.
|
|
|
|
uint16_t sensor_status; // 传感器断线状态.
|
|
|
|
uint16_t is_server_link; // 是否连接上后台.
|
|
|
|
uint16_t version; // 软件版本
|
|
|
|
uint32_t communication_time; // 上一次通讯的时间
|
|
|
|
uint32_t run_time; // 设备运行时间
|
|
|
|
} debug_pkt_status_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GateWay_t gateway;
|
|
|
|
LandDevCfg_t landDevCfg;
|
|
|
|
//HWMQTTCfg_t mqttCfg;
|
|
|
|
CAUInitHexCfg_t CAUInit[MAX_CAU_CHANNEL*3];
|
|
|
|
}debug_pkt_device_cfg_t;//朗德协议上传的配置相关配置结构体
|
|
|
|
|
|
|
|
typedef struct updatePack_s{
|
|
|
|
U32 totalLen;//升级包的总长度
|
|
|
|
U32 currLen; //dataArea的真实数据长度,如果length != sizeof(dataArea) 代表这是最后一包了
|
|
|
|
U8 dataArea[UPDATE_PACK_LENGTH];//实际数据
|
|
|
|
}updatePack_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint16_t cmd; // 命令.
|
|
|
|
uint32_t len; // 消息长度.
|
|
|
|
char *pbuf; // 消息指针.
|
|
|
|
} debug_msg_info_t;
|
|
|
|
|
|
|
|
typedef int (*MsgProcessFxn)(debug_msg_info_t *msg);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint32_t uiMsgId;
|
|
|
|
MsgProcessFxn pfMsgProcFxn;
|
|
|
|
}msg_proc_t;
|
|
|
|
|
|
|
|
/* 报文头. */
|
|
|
|
typedef struct{
|
|
|
|
uint16_t head; // 0x55aa.
|
|
|
|
uint16_t cmd; // 命令.
|
|
|
|
uint32_t len; // 包长.
|
|
|
|
} debug_pkt_head_t;
|
|
|
|
|
|
|
|
/* 调试工具全局结构 */
|
|
|
|
typedef struct{
|
|
|
|
int fd; // TCP server 监听使用的 socket.
|
|
|
|
int fd_client; // TCP client 通讯使用的 socket.
|
|
|
|
char buf[DEBUG_BUG_SIZE]; // 通讯使用收法包 buffer.
|
|
|
|
char buf_post[DEBUG_BUG_SIZE]; // 主动上传通讯使用收法包 buffer.
|
|
|
|
int is_manual_col; // 是否手动采集.
|
|
|
|
} debug_ctrl_t;
|
|
|
|
|
|
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/* Extern global variables ---------------------------------------------------*/
|
|
|
|
extern debug_ctrl_t debug_ctrl;
|
|
|
|
|
|
|
|
/* Extern functions ----------------------------------------------------------*/
|
|
|
|
extern int32_t debug_handle_init(void);
|
|
|
|
//extern int32_t debug_pkt_port_state_post(void)
|
|
|
|
extern int _debug_pkt_send_data(int cmd, char *psrc, int len);
|
|
|
|
extern int _dbg_get_current_cau_values(float *fdestArr);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|