Files
kunlun/export/inc/sg_lib/proto_3762_fj.h
2024-09-28 14:24:04 +08:00

355 lines
12 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef PROTO_3762_FJ_H
#define PROTO_3762_FJ_H
#include "proto_3762.h"
#ifdef __cplusplus
extern "C" {
#endif
/* pack for the structures in the whole file */
#pragma pack(push) /* save the pack status */
#pragma pack(1) /* 1 byte align */
/* app function number definition */
#define PROTO_3762_FJ_AFN_50 (0x50)
#define PROTO_3762_FJ_AFN_51 (0x51)
#define PROTO_3762_FJ_AFN_52 (0x52)
#define PROTO_3762_FJ_AFN_53 (0x53)
#define PROTO_3762_FJ_AFN_55 (0x55)
#define PROTO_3762_FJ_AFN_56 (0x56)
/* communication object type */
#define PROTO_3762_FJ_OBJ_RSVD (0)
#define PROTO_3762_FJ_OBJ_CCO (2)
#define PROTO_3762_FJ_OBJ_METER (3)
#define PROTO_3762_FJ_OBJ_STA (5)
#define PROTO_3762_FJ_OBJ_COLLECTOR (7)
/* proto mode */
#define PROTO_3762_FJ_PRO_MODE_GW (1)
#define PROTO_3762_FJ_PRO_MODE_FJ (2)
/* communication delay time, unit 10ms */
#define PROTO_3762_FJ_COMM_DELAY (100)
/* uart baud rate type */
#define PROTO_3762_FJ_BAUD_300 (0)
#define PROTO_3762_FJ_BAUD_600 (1)
#define PROTO_3762_FJ_BAUD_1200 (2)
#define PROTO_3762_FJ_BAUD_2400 (3)
#define PROTO_3762_FJ_BAUD_4800 (4)
#define PROTO_3762_FJ_BAUD_7200 (5)
#define PROTO_3762_FJ_BAUD_9600 (6)
#define PROTO_3762_FJ_BAUD_19200 (7)
#define PROTO_3762_FJ_BAUD_38400 (8)
#define PROTO_3762_FJ_BAUD_57600 (9)
#define PROTO_3762_FJ_BAUD_115200 (10)
/* uart baud rate recover time, unit is 1min */
#define PROTO_3762_FJ_BAUD_REC_TIME_MIN (16)
#define PROTO_3762_FJ_BAUD_REC_TIME_MAX (1400)
/* uart baud rate auto recover max reset cnt */
#define PROTO_3762_FJ_REC_MAX_RESET_CNT (5)
/* bcast channel delay time, unit is 10ms */
#define PROTO_3762_FJ_BCAST_CHANNEL_DELAY_TIME (100)
typedef struct _afn52_fn01_data_fwd_dl {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* forward communication control, reserved */
uint8_t ctrl;
/* receive data timeout, unit see timeout_unit */
uint8_t recv_data_timeout :7,
/* unit for receive data timeout, 0 - 10ms, 1 - 1s */
timeout_unit :1;
/* receive byte timeout, unit 10ms */
uint8_t recv_byte_timeout;
/* meter reading data len */
uint16_t data_len;
/* meter reading data */
uint8_t data[0];
} afn52_fn01_data_fwd_dl_t;
typedef struct _afn52_fn01_data_fwd_ul {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* meter reading data len */
uint16_t data_len;
/* meter reading data */
uint8_t data[0];
} afn52_fn01_data_fwd_ul_t;
typedef struct _communication_object {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
} communication_object_t;
typedef struct _afn53_fn01_predict_mr_param_qr {
/* count of supported meter reading */
uint16_t max_cnt;
/* count of per meter reading */
uint8_t mr_cnt;
} afn53_fn01_predict_mr_param_qr_t;
typedef struct _afn53_fn02_cco_mac {
/* major node mac address, little-endian */
uint8_t cco_mac[IOT_MAC_ADDR_LEN];
} afn53_fn02_cco_mac_t;
typedef struct _afn53_fn04_hw_info_req {
/* communication object info */
communication_object_t comm_obj;
} afn53_fn04_hw_info_req_t;
typedef struct _afn53_fn04_hw_info_rsp {
/* communication object info */
communication_object_t comm_obj;
/* module info */
mod_hw_info_t hw_info;
} afn53_fn04_hw_info_rsp_t;
typedef struct _afn53_fn05_phase_req {
/* communication object info */
communication_object_t comm_obj;
} afn53_fn05_phase_req_t;
typedef struct _afn53_fn05_phase_rsp {
/* communication object info */
communication_object_t comm_obj;
/* physical phase A */
uint16_t phy_phase;
} afn53_fn05_phase_rsp_t;
typedef struct _afn53_fn06_uart_conf {
/* uart config baud rate type */
uint8_t baud;
/* uart config max baud rate */
uint8_t max_baud;
/* auto recover default baud rate time, unit is 1min */
uint16_t rec_time;
} afn53_fn06_uart_conf_t;
typedef struct _predict_node_info {
/* predict node index */
uint16_t idx;
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* node mac addr, little-endian */
uint8_t mac[PROTO_3762_MAC_ADDR_LEN];
} predict_node_info_t;
/* predict meter reading node down link data */
typedef struct _afn55_fn09_predict_mr_node_req {
/* total node count */
uint16_t total_cnt;
/* fix the communication delay flag */
uint8_t delay_fix_flag;
/* predict node infomation */
predict_node_info_t node[0];
} afn55_fn09_predict_mr_node_req_t;
typedef struct _afn53_fn10_query_proto_mode {
/* proto type, see PROTO_3762_FJ_PRO_MODE_XXX */
uint8_t proto_mode :2,
/* reserved */
rsvd :6;
} afn53_fn10_query_proto_mode_t;
typedef struct _afn55_fn01_set_master_address_req {
uint8_t mac[PROTO_3762_MAC_ADDR_LEN];
} afn55_fn01_set_master_address_req_t;
typedef struct _afn55_fn03_bcast_cmd {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* bcast time, unit is 1min */
uint8_t bcast_time;
/* bcast data length */
uint8_t len;
/* bcast data */
uint8_t data[0];
} afn55_fn03_bcast_cmd_t;
typedef struct _afn55_fn04_bcast_cmd {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* bcast time, unit is 1min */
uint8_t bcast_time;
} afn55_fn04_bcast_cmd_t;
typedef struct _evt_rpt_ctrl {
/* communication object info */
communication_object_t comm_obj;
/* event report state, 0 - disable, 1 - enable */
uint8_t enable;
} evt_rpt_ctrl_t;
typedef struct _afn55_fn02_node_evt_rpt_ctrl {
/* set event report count */
uint8_t total_cnt;
/* event report control info */
evt_rpt_ctrl_t evt_ctrl[0];
} afn55_fn02_node_evt_rpt_ctrl_t;
typedef struct _afn55_fn06_start_node_reg {
/* node registration duration, unit is 1min */
uint16_t duration;
} afn55_fn06_start_node_reg_t;
typedef struct _afn55_fn10_set_proto_mode {
/* proto type, see PROTO_3762_FJ_PRO_MODE_XXX */
uint8_t proto_mode :2,
/* reserved */
rsvd :6;
} afn55_fn10_set_proto_mode_t;
typedef struct _afn55_fn11_set_baud_rate {
/* uart config baud rate type, see PROTO_3762_FJ_BAUD_XXX */
uint8_t baud;
} afn55_fn11_set_baud_rate_t;
typedef struct _afn55_fn12_set_baud_rec_time {
/* auto recover baud rate time, unit is 1min */
uint16_t rec_time;
} afn55_fn12_set_baud_rec_time_t;
typedef struct _afn55_fn13_set_max_baud_rate {
/* set uart config max baud rate, see PROTO_3762_FJ_BAUD_XXX */
uint8_t max_baud;
} afn55_fn13_set_max_baud_rate_t;
typedef struct _afn56_fn01_sec_node_info {
/* node report count */
uint8_t sec_node_count;
/* node report address */
uint8_t mac_addr[0][IOT_MAC_ADDR_LEN];
} afn56_fn01_sec_node_info_t;
typedef struct _afn56_fn02_node_evt_rpt {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* node mac addr, little-endian */
uint8_t mac_addr[PROTO_3762_MAC_ADDR_LEN];
/* event report data len */
uint8_t data_len;
/* event report data */
uint8_t data[0];
} afn56_fn02_node_evt_rpt_t;
typedef struct _afn56_fn03_fn13_amr_data_ul {
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* communication delay time, unit 10ms. */
uint16_t delay_time;
} afn56_fn03_fn13_amr_data_ul_t;
typedef struct _afn56_fn03_amr_data_dl {
/* plan id */
uint16_t plan_id;
/* specific cmd id */
uint16_t cmd_id;
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* meter reading data len */
uint8_t data_len;
/* meter reading data */
uint8_t data[0];
} afn56_fn03_amr_data_dl_t;
typedef struct _afn_56_fn_05_channel_delay_dl {
/* bcast data length */
uint8_t len;
/* bcast data */
uint8_t data[0];
} afn_56_fn_05_channel_delay_dl_t;
typedef struct _afn_56_fn_05_channel_delay_ul {
/* communication delay time, unit is 10ms */
uint16_t delay_time;
} afn_56_fn_05_channel_delay_ul_t;
typedef struct _afn56_fn13_amr_data_dl {
/* plan id */
uint16_t plan_id;
/* specific cmd id */
uint16_t cmd_id;
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* proto type, see PROTO_TYPE_XXX */
uint8_t proto_type;
/* reserved */
uint8_t rsvd;
/* meter reading data len */
uint16_t data_len;
/* meter reading data */
uint8_t data[0];
} afn56_fn13_amr_data_dl_t;
typedef struct _afn56_fn04_amr_data_rpt_ul {
/* plan id */
uint16_t plan_id;
/* specific cmd id */
uint16_t cmd_id;
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* meter reading data len */
uint8_t data_len;
/* meter reading data */
uint8_t data[0];
} afn56_fn04_amr_data_rpt_ul_t;
typedef struct _afn56_fn14_amr_data_rpt_ul_t {
/* plan id */
uint16_t plan_id;
/* specific cmd id */
uint16_t cmd_id;
/* communication object type, see PROTO_3762_FJ_OBJ_XXX */
uint8_t obj_type;
/* communication object address, little-endian */
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
/* meter reading data len */
uint16_t data_len;
/* meter reading data */
uint8_t data[0];
} afn56_fn14_amr_data_rpt_ul_t;
#pragma pack(pop) /* restore the pack status */
#ifdef __cplusplus
}
#endif
#endif /* PROTO_3762_FJ_H */