470 lines
15 KiB
C
470 lines
15 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_VENDOR_H
|
||
|
#define PROTO_3762_VENDOR_H
|
||
|
|
||
|
#include "os_types_api.h"
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
/* add sunsolar use Information class identification */
|
||
|
#define PROTO_3762_F20 (20)
|
||
|
#define PROTO_3762_F21 (21)
|
||
|
/* end add sunsolar use Information class identification */
|
||
|
|
||
|
#define PROTO_3762_F22 (22)
|
||
|
#define PROTO_3762_F23 (23)
|
||
|
#define PROTO_3762_F28 (28)
|
||
|
#define PROTO_3762_F31 (31)
|
||
|
#define PROTO_3762_F32 (32)
|
||
|
#define PROTO_3762_F33 (33)
|
||
|
#define PROTO_3762_F34 (34)
|
||
|
#define PROTO_3762_F35 (35)
|
||
|
#define PROTO_3762_F105 (105)
|
||
|
#define PROTO_3762_F201 (201)
|
||
|
#define PROTO_3762_F204 (204)
|
||
|
#define PROTO_3762_F207 (207)
|
||
|
#define PROTO_3762_F211 (211)
|
||
|
#define PROTO_3762_F214 (214)
|
||
|
#define PROTO_3762_F218 (218)
|
||
|
#define PROTO_3762_F220 (220)
|
||
|
#define PROTO_3762_F221 (221)
|
||
|
#define PROTO_3762_F222 (222)
|
||
|
#define PROTO_3762_F223 (223)
|
||
|
#define PROTO_3762_F224 (224)
|
||
|
#define PROTO_3762_F233 (233)
|
||
|
#define PROTO_3762_F234 (234)
|
||
|
#define PROTO_3762_F235 (235)
|
||
|
#define PROTO_3762_F236 (236)
|
||
|
#define PROTO_3762_F242 (242)
|
||
|
#define PROTO_3762_F244 (244)
|
||
|
#define PROTO_3762_F245 (245)
|
||
|
#define PROTO_3762_F246 (246)
|
||
|
#define PROTO_3762_F247 (247)
|
||
|
#define PROTO_3762_F248 (248)
|
||
|
#define PROTO_3762_F249 (249)
|
||
|
#define PROTO_3762_F250 (250)
|
||
|
#define PROTO_3762_F251 (251)
|
||
|
#define PROTO_3762_F252 (252)
|
||
|
#define PROTO_3762_F253 (253)
|
||
|
#define PROTO_3762_F254 (254)
|
||
|
#define PROTO_3762_F255 (255)
|
||
|
|
||
|
/* afn + fn data len */
|
||
|
#define PROTO_3762_AFN_FN_LEN 3
|
||
|
|
||
|
/* define the connection state of the control ptoro */
|
||
|
#define PROTO_3762_STATE_DISCONNECTED 0
|
||
|
#define PROTO_3762_STATE_CONNECTED 1
|
||
|
|
||
|
/* define of role the control connected */
|
||
|
#define PROTO_3762_DEV_ROLE_CCO 1
|
||
|
#define PROTO_3762_DEV_ROLE_STA 2
|
||
|
|
||
|
/* branch detect report state */
|
||
|
#define PROTO_3762_BD_STATE_CLEAR (0)
|
||
|
#define PROTO_3762_BD_STATE_SEND (1)
|
||
|
#define PROTO_3762_BD_STATE_TOPO (2)
|
||
|
#define PROTO_3762_BD_STATE_DONE (3)
|
||
|
|
||
|
#define PROTO_3762_2013_BD_DETECT_STOP (0xF5)
|
||
|
|
||
|
/* query physical topo device type */
|
||
|
#define PROTO_3762_BD_DEV_TYPE_POWER_METER (1)
|
||
|
#define PROTO_3762_BD_DEV_TYPE_POWER_METER_3P (2)
|
||
|
#define PROTO_3762_BD_DEV_TYPE_SWITCH_MONITOR (3)
|
||
|
#define PROTO_3762_BD_DEV_TYPE_BRK_MONITOR (4)
|
||
|
|
||
|
#pragma pack(push) /* save the pack status */
|
||
|
#pragma pack(1) /* 1 byte align */
|
||
|
|
||
|
/* for zhhw */
|
||
|
typedef struct _afnf0_fn21_file_process_progress {
|
||
|
/* 0 - all success, allow to receive new file,
|
||
|
* 1 - doing, not allow to receive new file,
|
||
|
* 2 - some nodes fail.
|
||
|
*/
|
||
|
uint8_t result;
|
||
|
/* fail node count */
|
||
|
uint16_t count;
|
||
|
}afnf0_fn21_file_process_progress_t;
|
||
|
|
||
|
/* for zhhw */
|
||
|
typedef struct _afnf0_fn22_qr_fail_node {
|
||
|
/* total node count in network. */
|
||
|
uint16_t total_cnt;
|
||
|
/* report node count. */
|
||
|
uint8_t ack_cnt;
|
||
|
/* fail node address array */
|
||
|
uint8_t addr[0];
|
||
|
}afnf0_fn22_qr_fail_node_t;
|
||
|
|
||
|
/* report while list ii count */
|
||
|
typedef struct _afnf0_fn32_sec_node_num {
|
||
|
/* while list ii count */
|
||
|
uint16_t sec_node_num;
|
||
|
/* max while list ii count */
|
||
|
uint16_t max_sec_node_num;
|
||
|
}afnf0_fn32_sec_node_num_t;
|
||
|
|
||
|
/* query while list ii node info */
|
||
|
typedef struct _afnf0_fn33_sec_node_info_req {
|
||
|
/* start query index */
|
||
|
uint16_t start_index;
|
||
|
/* query count */
|
||
|
uint8_t count;
|
||
|
}afnf0_fn33_sec_node_info_req_t;
|
||
|
|
||
|
/* report query while list ii node info result */
|
||
|
typedef struct _afnf0_fn33_sec_node_info_rsp {
|
||
|
/* total count of secondary nodes */
|
||
|
uint16_t total_count;
|
||
|
/* count of secondary nodes returned in this packet */
|
||
|
uint8_t count;
|
||
|
/* secondary nodes info */
|
||
|
sec_node_info_t sec_node[0];
|
||
|
}afnf0_fn33_sec_node_info_rsp_t;
|
||
|
|
||
|
/* add while list ii node request */
|
||
|
typedef struct _afnf0_fn34_add_sec_node_req {
|
||
|
/* slave count*/
|
||
|
uint8_t sec_node_cnt;
|
||
|
/* node info */
|
||
|
slave_info_entry_2013_t sec_node[0];
|
||
|
}afnf0_fn34_add_sec_node_req_t;
|
||
|
|
||
|
/* remove while list ii node request */
|
||
|
typedef struct _afnf0_fn35_rmv_sec_node_req {
|
||
|
/* node count*/
|
||
|
uint8_t sec_node_cnt;
|
||
|
/* node info */
|
||
|
uint8_t mac_addr[0][IOT_MAC_ADDR_LEN];
|
||
|
} afnf0_fn35_rmv_sec_node_req_t;
|
||
|
|
||
|
/* black list node info */
|
||
|
typedef struct _bl_info_entry_t {
|
||
|
/* node mac */
|
||
|
uint8_t mac[PROTO_3762_MAC_ADDR_LEN];
|
||
|
/* meter proto type, see PROTO_TYPE_XXX */
|
||
|
uint8_t proto_type;
|
||
|
} bl_info_entry_t;
|
||
|
|
||
|
/* set hplc/rf tx power */
|
||
|
typedef struct _afnf0_fn201_set_tx_power_req {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* reserved */
|
||
|
uint8_t rvsd[8];
|
||
|
/* hplc tx power, unit is 1 dbuv */
|
||
|
uint8_t hplc_power;
|
||
|
/* rf tx power, unit is 1 dbm */
|
||
|
int8_t rf_power;
|
||
|
} afnf0_fn201_set_tx_power_req_t;
|
||
|
|
||
|
/* add black list node request */
|
||
|
typedef struct _afnf0_fn220_add_bl_node_req_t {
|
||
|
/* blacklist node count */
|
||
|
uint8_t bl_node_cnt;
|
||
|
/* blacklist node info */
|
||
|
bl_info_entry_t bl_node[0];
|
||
|
} afnf0_fn220_add_bl_node_req_t;
|
||
|
|
||
|
typedef struct _afnf0_fn221_rmv_bl_node_req_t {
|
||
|
/* node count */
|
||
|
uint8_t bl_node_cnt;
|
||
|
/* node addr array */
|
||
|
uint8_t mac_addr[0][IOT_MAC_ADDR_LEN];
|
||
|
} afnf0_fn221_rmv_bl_node_req_t;
|
||
|
|
||
|
typedef struct _afnf0_fn222_bl_num_info_req_t {
|
||
|
/* blacklist node count */
|
||
|
uint16_t bl_node_count;
|
||
|
/* blacklist max support node number */
|
||
|
uint16_t bl_max_node_count;
|
||
|
} afnf0_fn222_bl_num_info_req_t;
|
||
|
|
||
|
typedef struct _afnf0_fn223_bl_node_info_req_t {
|
||
|
/* query start index, blacklist min start index is 1 */
|
||
|
uint16_t start_index;
|
||
|
/* query node count */
|
||
|
uint8_t count;
|
||
|
} afnf0_fn223_bl_node_info_req_t;
|
||
|
|
||
|
/* data to response for query blacklist information */
|
||
|
typedef struct _afnf0_fn223_bl_info_rsp {
|
||
|
/* total count of secondary nodes */
|
||
|
uint16_t total_count;
|
||
|
/* count of secondary nodes returned in this packet */
|
||
|
uint8_t count;
|
||
|
/* secondary nodes info */
|
||
|
sec_node_info_t sec_node[0];
|
||
|
} afnf0_fn223_bl_info_rsp_t;
|
||
|
|
||
|
typedef struct _afnf0_fn235_set_repeater_addr_range_req {
|
||
|
/* FFFFFFFF0001 to FFFFFFFFFFFC, low 2 bytes */
|
||
|
uint16_t repeater_addr_start;
|
||
|
uint16_t repeater_addr_end;
|
||
|
} afnf0_fn235_set_repeater_addr_rang_req_t;
|
||
|
|
||
|
typedef struct _afnf0_fn236_get_repeater_addr_range_req {
|
||
|
/* FFFFFFFF0001 to FFFFFFFFFFFC, low 2 bytes */
|
||
|
uint16_t repeater_addr_start;
|
||
|
uint16_t repeater_addr_end;
|
||
|
} afnf0_fn236_get_repeater_addr_rang_req_t;
|
||
|
|
||
|
/* data to response for query build version info */
|
||
|
typedef struct _afnf0_fn242_build_ver_info {
|
||
|
/* Build type: Release/Debug-(0/1) */
|
||
|
uint8_t type_ver;
|
||
|
/* numerically encoded version, like 0x01020304 */
|
||
|
uint32_t firmware_version;
|
||
|
/* external software version. BCD format. range from 0 - 9999 */
|
||
|
uint16_t sw_ver;
|
||
|
/* app software version. bin format. range from 0 - 1023 */
|
||
|
uint16_t app_ver;
|
||
|
/* build year */
|
||
|
uint8_t year;
|
||
|
/* build month */
|
||
|
uint8_t month;
|
||
|
/* build day */
|
||
|
uint8_t day;
|
||
|
/* build hour */
|
||
|
uint8_t hour;
|
||
|
/* build min */
|
||
|
uint8_t min;
|
||
|
/* build sec */
|
||
|
uint8_t sec;
|
||
|
/* vendor id */
|
||
|
uint16_t vendor_id;
|
||
|
/* device id */
|
||
|
uint8_t dev_id[PROTO_3762_MODULE_ID_INFO_LEN];
|
||
|
/* chip management id */
|
||
|
proto_3762_chip_id_t chip_mmid;
|
||
|
/* image crc check result, 0 mean succeed, 1 mean fail */
|
||
|
uint8_t img_check_result : 1,
|
||
|
/* flag mark to if the device has branch signal receiving capability */
|
||
|
br_ident : 1,
|
||
|
/* flag mark to if enable rf */
|
||
|
rf : 1,
|
||
|
/* non 0 means broadcast packet sent in 3phase simultaneously, 0 means
|
||
|
* broadcast packet sent in 3phase in turn.
|
||
|
*/
|
||
|
tx_3phase_flag : 1,
|
||
|
/* reserve for future */
|
||
|
reserve : 4;
|
||
|
/* hardware version */
|
||
|
uint32_t hw_ver;
|
||
|
/* module mac address */
|
||
|
uint8_t mod_addr[IOT_MAC_ADDR_LEN];
|
||
|
/* user type */
|
||
|
uint8_t user_type;
|
||
|
/* simple pair passcode value. Only same passcode CCO and STA can be
|
||
|
* associated, little endian.
|
||
|
*/
|
||
|
uint16_t passcode;
|
||
|
/* equipment service provider, see IOT_SG_CCO_ESP_XXX */
|
||
|
uint8_t esp;
|
||
|
}afnf0_fn242_build_ver_info_t;
|
||
|
|
||
|
/* query physical topo. */
|
||
|
typedef struct _afnf0_fn244_phy_topo_query_dl {
|
||
|
/* query physical topo start index */
|
||
|
uint16_t start_index;
|
||
|
/* query count */
|
||
|
uint8_t count;
|
||
|
}afnf0_fn244_phy_topo_query_dl_t;
|
||
|
|
||
|
/* location information */
|
||
|
typedef struct _node_location_unit {
|
||
|
/* location unit seconds: BCD code */
|
||
|
uint16_t sec_0 : 4,
|
||
|
sec_1 : 4,
|
||
|
sec_2 : 4,
|
||
|
sec_3 : 4;
|
||
|
/* location unit min: BCD code */
|
||
|
uint8_t min_0 : 4,
|
||
|
min_1 : 4;
|
||
|
/* location unit degree: BCD code */
|
||
|
uint16_t degree_0 : 4,
|
||
|
degree_1 : 4,
|
||
|
degree_2 : 4,
|
||
|
/* 0:north latitude or east longitude,1:south latitude or west longitude */
|
||
|
symbol_3 : 1,
|
||
|
rsvd : 3;
|
||
|
} node_location_unit_t;
|
||
|
|
||
|
/* physical topo */
|
||
|
typedef struct _phy_topo_node_info {
|
||
|
/* node mac addr, little endian */
|
||
|
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
|
||
|
/* device type, see CCTT_DRV_DEV_TYPE_XXX */
|
||
|
uint8_t dev_type;
|
||
|
/* father node mac addr, little endian */
|
||
|
uint8_t father_node[IOT_MAC_ADDR_LEN];
|
||
|
/* phase info */
|
||
|
uint8_t phase : 3,
|
||
|
/* reserved1 */
|
||
|
reserved1 : 1,
|
||
|
/* if phase info is valid */
|
||
|
opposite_phase : 1,
|
||
|
/* phase sequence type */
|
||
|
phase_type : 3;
|
||
|
/* longitude */
|
||
|
node_location_unit_t longitude;
|
||
|
/* latitude */
|
||
|
node_location_unit_t latitude;
|
||
|
/* CT ratio, uint is x1 */
|
||
|
uint16_t i_ratio;
|
||
|
/* PT ratio, uint is x1 */
|
||
|
uint8_t v_ratio;
|
||
|
/* physical phase */
|
||
|
uint8_t phy_phase1 : 2,
|
||
|
phy_phase2 : 2,
|
||
|
phy_phase3 : 2,
|
||
|
/* reserved2 */
|
||
|
reserved2 : 2;
|
||
|
/* reserved3 */
|
||
|
uint8_t reserved3[2];
|
||
|
}phy_topo_node_info_t;
|
||
|
|
||
|
typedef struct _afnf0_fn244_phy_topo_query_ul {
|
||
|
/* total node count */
|
||
|
uint16_t total_cnt;
|
||
|
/* start query index */
|
||
|
uint16_t start_index;
|
||
|
/* report node count */
|
||
|
uint8_t rpt_cnt;
|
||
|
/* physical topo node info */
|
||
|
phy_topo_node_info_t node_info[0];
|
||
|
}afnf0_fn244_phy_topo_query_ul_t;
|
||
|
|
||
|
typedef struct _afnf0_fn245_bd_state_ul {
|
||
|
/* report branch detect state, see PROTO_3762_BD_STATE_XXX */
|
||
|
uint8_t rpt_state;
|
||
|
}afnf0_fn245_bd_state_ul_t;
|
||
|
|
||
|
/* branch identification control parameter structure */
|
||
|
typedef struct _bd_ctrl {
|
||
|
/* branch detect mod, see IOT_SG_CCO_BD_MOD_XXX */
|
||
|
uint8_t bd_mod;
|
||
|
} bd_ctrl_t;
|
||
|
|
||
|
typedef struct _afnf0_fn246_bd_enable {
|
||
|
/* if enable branch detect, 0 stop branch detect, 1 start branch detect */
|
||
|
uint8_t enable;
|
||
|
/* branch identification control parameter structure */
|
||
|
bd_ctrl_t ctrl[0];
|
||
|
}afnf0_fn246_bd_enable_t;
|
||
|
|
||
|
/* debug command to enable network change report. */
|
||
|
typedef struct _afnf0_fn247_debug_dl {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* to enable or disable network change report. */
|
||
|
uint8_t enable;
|
||
|
}afnf0_fn247_debug_dl_t;
|
||
|
|
||
|
/* set cli upgrade type */
|
||
|
typedef struct _afnf0_fn248_set_cliupgrade_dl {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* 0 - don't cli upgrade, other - do cli upgrade */
|
||
|
uint8_t enable;
|
||
|
}afnf0_fn248_set_cliupgrade_dl_t;
|
||
|
|
||
|
/* control actively connects to the target device. */
|
||
|
typedef struct _afnf0_fn249_connect_conf_dl {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* destination device mac addr, the byte order is Big-Endian */
|
||
|
uint8_t dst_mac[6];
|
||
|
} afnf0_fn249_connect_conf_dl_t;
|
||
|
|
||
|
typedef struct _afnf0_fn250_status_rpt_t {
|
||
|
/* connection state, see PROTO_3762_STATE_XXX */
|
||
|
uint8_t ready : 1,
|
||
|
/* connect role , see PROTO_3762_DEV_ROLE_XXX */
|
||
|
connect_role : 2,
|
||
|
/* reserved */
|
||
|
rsvd : 5;
|
||
|
/* remote dev addr connected to it, the byte order is Big-Endian */
|
||
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
||
|
} afnf0_fn250_status_rpt_ul_t;
|
||
|
|
||
|
/* query hardware version. */
|
||
|
typedef struct _afnf0_fn251_hw_version_ul {
|
||
|
/* hardware version */
|
||
|
uint32_t hw_ver;
|
||
|
} afnf0_fn251_hw_version_ul_t;
|
||
|
|
||
|
/* update cco equipment service provider */
|
||
|
typedef struct _afnf0_fn252_update_esp_dl {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* equipment service provider, see IOT_SG_CCO_ESP_XXX */
|
||
|
uint8_t esp;
|
||
|
} afnf0_fn252_update_esp_dl_t;
|
||
|
|
||
|
/* set trans mode */
|
||
|
typedef struct _afnf0_fn253_set_trans_mode {
|
||
|
/* magic number to check if the cmd is valid. */
|
||
|
uint32_t magic_no;
|
||
|
/* 0 - check 645/698 pkg for mr dest mac, others - doesn't check */
|
||
|
uint8_t mode;
|
||
|
} afnf0_fn253_set_trans_mode_t;
|
||
|
|
||
|
/* set passcode */
|
||
|
typedef struct _afnf0_fn254_set_passcode {
|
||
|
/* simple pair passcode value. Only same passcode CCO and STA can be
|
||
|
* associated, little endian.
|
||
|
*/
|
||
|
uint16_t passcode;
|
||
|
/* reserved */
|
||
|
uint8_t rsvd[14];
|
||
|
} afnf0_fn254_set_passcode_t;
|
||
|
|
||
|
/* get passcode */
|
||
|
typedef struct _afnf0_fn255_passcode_rpt {
|
||
|
/* simple pair passcode value. Only same passcode CCO and STA can be
|
||
|
* associated, little endian.
|
||
|
*/
|
||
|
uint16_t passcode;
|
||
|
/* reserved */
|
||
|
uint8_t rsvd[14];
|
||
|
} afnf0_fn255_passcode_rpt_t;
|
||
|
|
||
|
/* set zc notify */
|
||
|
typedef struct _afnf0_fn233_set_zc_notify {
|
||
|
/* zc notify enable: 0 - disabled, 1 - enable */
|
||
|
uint8_t zc_notify;
|
||
|
} afnf0_fn233_set_zc_notify_t;
|
||
|
|
||
|
/* query zc notify */
|
||
|
typedef struct _afnf0_fn234_qry_zc_notify {
|
||
|
/* zc notify enable: 0 - disabled, 1 - enable */
|
||
|
uint8_t zc_notify;
|
||
|
} afnf0_fn234_qry_zc_notify_t;
|
||
|
|
||
|
#pragma pack(pop) /* restore the pack status */
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif /* PROTO_3762_VENDOR_H */
|