yuliang 6 days ago
commit 577668830a

@ -51,17 +51,21 @@
#define CSG_FIFO_TREND "CSG_FIFO_TREND"
#define CSG_CMD_FIFO_NUM (16)
#define CSG_PRPS_FIFO_NUM (8)
#define CSG_EVENT_FIFO_NUM (4)
#define CSG_TREND_FIFO_NUM (2)
#define CSG_EVENT_FIFO_NUM (32)
#define CSG_TREND_FIFO_NUM (4)
#define CSG_HEAD_LEN (32)
#define CSG_TOTLE_LEN (26)
#define CSG_PKT_LEN (1300)
#define CSG_BUF_LEN (1500)
#define MAX_FILES (128)
#define MAX_PATH_LEN (256)
#define THRESHOLD_MS 10 // 时间差阈值
#define UDP_SEND_TIMEOUT (2)
#define CSG_SEND_ERR_CNT (3)
#define DAU_INSERT 1
#define DAU_UNPLUG 0
/* 配置文件结构体 */
#define FILE_FIFO_PATH_LEN 256
@ -80,6 +84,7 @@ enum CSG_CMD
CSG_C_CONTACT = 1,
CSG_C_ADD_DAU = 2,
CSG_C_RESET = 3,
CSG_C_DEL_DAU = 4,
CSG_C_UPDATE = 5,
CSG_C_DEV_INFO_SET = 6, /* 设备基本信息设置 */
CSG_C_DEV_INFO_GET = 7, /* 设备基本信息获取 */
@ -101,6 +106,10 @@ enum DEBUG_CM_CMD
CSG_PRV_EVENT = 12
};
typedef int32_t (*csg_send_cb)(uint8_t, uint8_t, void*);
typedef void (*csg_send_fun_cb)(uint8_t, void*);
// 定义命令字常量
typedef enum {
//CMD_CONTACT = 0x00,
@ -139,10 +148,13 @@ typedef struct
int32_t fifo_prps_id; // 实时图谱 fifo
int32_t fifo_event_id; // 事件 fifo
int32_t fifo_trend_id; // 趋势 fifo
char buf_send[1500];
char buf_recv[1500];
char event_booster_buf[1500];
char trend_booster_buf[1500];
char buf_send[CSG_BUF_LEN];
char buf_recv[CSG_BUF_LEN];
char real_buf[CSG_BUF_LEN];
char event_buf[CSG_BUF_LEN];
char trend_buf[CSG_BUF_LEN];
char event_booster_buf[CSG_BUF_LEN];
char trend_booster_buf[CSG_BUF_LEN];
struct sockaddr_in server;
int32_t server_ip; // server ip.
uint16_t server_port; // server port.
@ -152,6 +164,7 @@ typedef struct
time_t heartbeat_timeout_cnt;
pthread_mutex_t mutex;
pthread_mutex_t lock;
csg_send_cb send_cb;
} csg_t;
/* 报文头结构. */
@ -188,6 +201,12 @@ typedef struct
uint8_t dau_port_num[4]; // 采集板端口数量.
} csg_heartbeat_t;
typedef struct
{
uint32_t sec;
uint32_t msec;
} csg_timestamp_t;
typedef struct{
uint8_t type_m; // 主设备号
uint8_t type_s; // 次设备号
@ -245,6 +264,12 @@ typedef struct {
int16_t denoise_manual; // 手动底噪等级
int16_t denoise_auto; // 自动降噪水平
}csg_config_port_t;
typedef struct {
uint8_t vport; // 通道编号.
uint8_t result; // 应答结果. 0:成功 1:失败
uint8_t reserved[2]; // 保留
}csg_config_port_ack_t;
typedef struct
{
@ -359,30 +384,6 @@ typedef struct
uint8_t port_type[8];
} csg_contact_t;
typedef struct
{
uint8_t type_m; // 主设备号
uint8_t type_s; // 次设备号
uint8_t slot; // 槽位号
uint8_t status; // 1:插入 0:拔出
uint32_t dev_id; // 设备ID
char hostname[FILE_NAME_LEN]; // 设备名 128byte
uint32_t factory_date; // 出厂日期.
uint32_t deployment_date; // 部署日期.
uint8_t app_version[DEV_VERSION_STR_LEN]; // 软件版本
uint8_t app_compile_time[DEV_VERSION_STR_LEN]; // 软件编译时间
uint8_t hardware_version[DEV_VERSION_STR_LEN]; // 硬件版本
uint8_t FPGA_version[DEV_VERSION_STR_LEN]; // fpga版本
uint32_t ip; // 本机 IP.
uint32_t mask; // 本机 MASK.
uint32_t gw; // 本机网关
uint8_t mac[MAC_ADDR_LEN]; // MAC地址.
uint16_t server_port; // 服务器端口号.
uint32_t server_ipv4; // 服务器 IP.
uint8_t port[PD_PORT_SUM];
uint8_t port_type[PD_PORT_SUM];
} csg_add_dau_t;
typedef struct
{
uint32_t dev_id;
@ -404,7 +405,7 @@ extern int32_t csg_handle_init_after(void);
extern void csg_upgrade_result_send(int32_t rv, char *buf);
extern void _print_sockaddr_in(const struct sockaddr_in *addr);
extern command_handler _csg_get_table_handle(command_entry *ptable, command_type cmd);
extern void _csg_send_data(uint8_t cmd_type, uint8_t cmd, char *pkt, int32_t len);
extern void _csg_send_data(uint8_t cmd_type, uint8_t cmd, char *pkt, int32_t len, uint8_t);
#endif
#endif
/************************ (C) COPYRIGHT LandPower ***** END OF FILE ****************/

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save