1984 lines
		
	
	
		
			70 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			1984 lines
		
	
	
		
			70 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_SPG_CCO_H
 | |
| #define PROTO_SPG_CCO_H
 | |
| 
 | |
| #include "os_types_api.h"
 | |
| #include "iot_utils_api.h"
 | |
| #include "proto_spg.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #pragma pack(push)  /* save the pack status */
 | |
| #pragma pack(1)     /* 1 byte align */
 | |
| 
 | |
| /* task exe status for 05h_f5 */
 | |
| #define PROTO_SPG_TASK_EXE_STATUS_SUCCESS            (0x00)
 | |
| #define PROTO_SPG_TASK_EXE_STATUS_SEC_NODE_NO_RSP    (0x01)
 | |
| #define PROTO_SPG_TASK_EXE_STATUS_DATA_INVALID       (0x02)
 | |
| #define PROTO_SPG_TASK_EXE_STATUS_OTHER_ERR          (0xFF)
 | |
| 
 | |
| /* Maximum value of the link quality by spg proto */
 | |
| #define SPG_MAX_LINK_QUALITY_VALUE                   (31)
 | |
| 
 | |
| /* task suggest timeout time, uint is 1s */
 | |
| #define PROTO_SGP_TASK_SUGGEST_TIMEOUT               (300)
 | |
| 
 | |
| /* max query sec node phase info count */
 | |
| #define PROTO_SPG_MAX_QUERY_SEC_NODE_PHASE_INFO_CNT  (16)
 | |
| 
 | |
| /* sec node support phase detection */
 | |
| #define PTORO_SPG_SEC_NODE_PHASE_SUPP_DETECT         (0)
 | |
| /* sec node not support phase detection */
 | |
| #define PTORO_SPG_SEC_NODE_PHASE_NOT_SUPP_DETECT     (1)
 | |
| /* sec node phase is unknown */
 | |
| #define PTORO_SPG_SEC_NODE_PHASE_UNKNOWN             (2)
 | |
| 
 | |
| /* file type of spg upgrade */
 | |
| #define PROTO_SPG_UPGRADE_FILE_CLEAR                 (0)
 | |
| #define PROTO_SPG_UPGRADE_FILE_CCO                   (1)
 | |
| #define PROTO_SPG_UPGRADE_FILE_STA                   (2)
 | |
| #define PROTO_SPG_UPGRADE_FILE_COLLECTOR             (3)
 | |
| 
 | |
| /* upgrade progress */
 | |
| /* upgrade succeed */
 | |
| #define PROTO_SPG_UPGRADE_PROGRESS_SUCCEED           (0)
 | |
| /* upgrade is running */
 | |
| #define PROTO_SPG_UPGRADE_PROGRESS_RUNNING           (1)
 | |
| /* upgrade fail */
 | |
| #define PROTO_SPG_UPGRADE_PROGRESS_FAIL              (2)
 | |
| 
 | |
| 
 | |
| /* query result of SEC NODE TSFM */
 | |
| /* the sec node is part of current transformer */
 | |
| #define PROTO_SPG_CCO_RPT_TSFM_RES_0               (0)
 | |
| /* the sec node is out of current transformer */
 | |
| #define PROTO_SPG_CCO_RPT_TSFM_RES_1               (1)
 | |
| /* STA cannot communicate with CCo */
 | |
| #define PROTO_SPG_CCO_RPT_TSFM_RES_2               (2)
 | |
| /* unkown */
 | |
| #define PROTO_SPG_CCO_RPT_TSFM_RES_3               (3)
 | |
| /* not support TSFM */
 | |
| #define PROTO_SPG_CCO_RPT_TSFM_RES_4               (4)
 | |
| 
 | |
| /* event type for other */
 | |
| #define PROTO_SPG_EVENT_NORMAL                     (0)
 | |
| #define PROTO_SPG_EVENT_POWER_DOWN                 (1)
 | |
| #define PROTO_SPG_EVENT_POWER_UP                   (2)
 | |
| #define PROTO_SPG_EVENT_POWER_DOWN_C               (3)
 | |
| #define PROTO_SPG_EVENT_POWER_UP_C                 (4)
 | |
| 
 | |
| /* guangdong protocol power event type */
 | |
| #define PROTO_SPG_EVENT_POWER_DOWN_GUANGDONG       (0x81)
 | |
| #define PROTO_SPG_EVENT_POWER_UP_GUANGDONG         (0x82)
 | |
| 
 | |
| /* STA communication mode */
 | |
| #define PROTO_SPG_COMM_MOD_UNKNOW                  (0)
 | |
| #define PROTO_SPG_COMM_MOD_CARRIER                 (1)
 | |
| #define PROTO_SPG_COMM_MOD_WIRELESS                (2)
 | |
| 
 | |
| /* tsfm state for guangzhou */
 | |
| #define PROTO_SPG_TSFM_STATE_UNKNOW                (0)
 | |
| #define PROTO_SPG_TSFM_STATE_SAME                  (1)
 | |
| #define PROTO_SPG_TSFM_STATE_DIFF                  (2)
 | |
| #define PROTO_SPG_TSFM_STATE_NOSUPP                (3)
 | |
| 
 | |
| /* tsfm dectect result for guangdong */
 | |
| #define PROTO_SPG_TSFM_DECT_RESULT_SAME            (0)
 | |
| #define PROTO_SPG_TSFM_DECT_RESULT_DIFF            (1)
 | |
| #define PROTO_SPG_TSFM_DECT_RESULT_COMM_FAIL       (2)
 | |
| #define PROTO_SPG_TSFM_DECT_RESULT_UNKNOWN         (3)
 | |
| #define PROTO_SPG_TSFM_DECT_RESULT_NOSUPPORT       (4)
 | |
| 
 | |
| /* guangdong report others node tsfm dectect state max count */
 | |
| #define PROTO_SPG_RPT_TSFM_STATE_MAX_CNT           (64)
 | |
| 
 | |
| /* max report node count */
 | |
| #define PROTO_SPG_MAX_RPT_NODE_CNT                 (64)
 | |
| 
 | |
| #define PROTO_SPG_DATETIME_LEN                     (6)
 | |
| 
 | |
| 
 | |
| 
 | |
| /* guangzhou power event report length except data fields for DL/T 645 */
 | |
| #define PROTO_645_POWER_EVT_RPT_DATA_PKT_LEN       (12)
 | |
| 
 | |
| /* query score max node count */
 | |
| #define PROTO_SPG_MAX_QUERY_SCORE_NODE_CNT         (20)
 | |
| /* score parameter */
 | |
| #define PROTO_SPG_CCO_MAX_SCORE                    (100)
 | |
| #define PROTO_SPG_CCO_MIN_SCORE                    (10)
 | |
| 
 | |
| /* collection task structure definition */
 | |
| /* define pm protocol type in collection task structure */
 | |
| #define PROTO_SPG_CLCT_TASK_PROTO_TYPE_UNKNOWN        (0)
 | |
| #define PROTO_SPG_CLCT_TASK_PROTO_TYPE_645_97         (1)
 | |
| #define PROTO_SPG_CLCT_TASK_PROTO_TYPE_645_07         (2)
 | |
| 
 | |
| /* define pm type in collection task structure */
 | |
| #define PROTO_SPG_CLCT_TASK_PM_TYPE_INVALID           (0)
 | |
| #define PROTO_SPG_CLCT_TASK_PM_TYPE_SINGE             (1)
 | |
| #define PROTO_SPG_CLCT_TASK_PM_TYPE_3P                (2)
 | |
| 
 | |
| /* query collection task status max cnt */
 | |
| #define PROTO_SPG_CLCT_MAX_QUERY_STATUS_CNT           (10)
 | |
| /* module support the max cnt of collection task when unicast */
 | |
| #define PROTO_SPG_CLCT_MAX_METER_TASK_CNT             (5)
 | |
| /* module support the max cnt of collection task when bcast */
 | |
| #define PROTO_SPG_CLCT_MAX_ROUTER_TASK_CNT            (16)
 | |
| 
 | |
| /* collection task status */
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_SUCCESS            (0)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_SEC_NODE_NO_RSP    (1)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_DATA_INVALID       (2)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_NO_SUP_CFG         (3)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_PM_TYPE_ERR        (4)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_MAJOR_UNSEND       (6)
 | |
| #define PROTO_SPG_CLCT_TASK_STATUS_OTHER_ERR          (0xFF)
 | |
| 
 | |
| /* collect data read task status */
 | |
| #define PROTO_SPG_CLCT_READ_STATUS_SEC_NODE_NO_RSP    (1)
 | |
| #define PROTO_SPG_CLCT_READ_STATUS_DATA_INVALID       (2)
 | |
| /* routing module and meter module collection task are not synchronized */
 | |
| #define PROTO_SPG_CLCT_READ_STATUS_CRC_DIFF           (3)
 | |
| #define PROTO_SPG_CLCT_READ_STATUS_SEC_ID_INVALID     (4)
 | |
| #define PROTO_SPG_CLCT_READ_STATUS_OTHER_ERR          (0xFF)
 | |
| 
 | |
| /* range of influence from white list */
 | |
| #define PROTO_SPG_WL_INFLUENCE_LIST_FILE              (0)
 | |
| #define PROTO_SPG_WL_INFLUENCE_VENDOR_DEFINE          (1)
 | |
| #define PROTO_SPG_WL_INFLUENCE_ALL                    (2)
 | |
| 
 | |
| /* power event rpt dev type */
 | |
| #define PROTO_SPG_DEV_TYPE_METER                      (0)
 | |
| #define PROTO_SPG_DEV_TYPE_COLLECTOR                  (1)
 | |
| #define PROTO_SPG_DEV_TYPE_COLLECTOR_METER            (2)
 | |
| 
 | |
| /* the max cnt of query node channel info */
 | |
| #define PROTO_SPG_MAX_QR_CHANNEL_STA_CNT              (6)
 | |
| #define PROTO_SPG_MAX_QR_CHANNEL_CCO_CNT              (20)
 | |
| 
 | |
| /* query sec node run state id count */
 | |
| #define PROTO_SPG_QR_ID_CNT_RUNTIME                   (1)
 | |
| #define PROTO_SPG_QR_ID_CNT_ZC_INFO                   (4)
 | |
| 
 | |
| /* ctrl send data type */
 | |
| #define PROTO_SPG_CTRL_DATA_TYPE_CCO_CTRL             (0x00)
 | |
| #define PROTO_SPG_CTRL_DATA_TYPE_PASSTHROUGH          (0x01)
 | |
| 
 | |
| /* manufacture code */
 | |
| #define PROTO_SPG_BASE_INFO_OEM_CODE                  (0x00)
 | |
| /* version id */
 | |
| #define PROTO_SPG_BASE_INFO_VER_INFO                  (0x01)
 | |
| /* bootload version */
 | |
| #define PROTO_SPG_BASE_INFO_BOOTLOADER                (0x02)
 | |
| /* chip code */
 | |
| #define PROTO_SPG_BASE_INFO_CHIP_CODE                 (0x05)
 | |
| /* version date */
 | |
| #define PROTO_SPG_BASE_INFO_VER_DATE                  (0x06)
 | |
| /* module mac addr */
 | |
| #define PROTO_SPG_BASE_INFO_MOD_MAC                   (0x08)
 | |
| /* module hardware version id */
 | |
| #define PROTO_SPG_BASE_INFO_HW_MOD_VER_INFO           (0x09)
 | |
| /* module hardware version date */
 | |
| #define PROTO_SPG_BASE_INFO_HW_MOD_DATE               (0x0A)
 | |
| /* chip software version id */
 | |
| #define PROTO_SPG_BASE_INFO_SW_CHIP_VER_INFO          (0x0B)
 | |
| /* chip software version date */
 | |
| #define PROTO_SPG_BASE_INFO_SW_CHIP_VER_DATE          (0x0C)
 | |
| /* chip hardware version id */
 | |
| #define PROTO_SPG_BASE_INFO_HW_CHIP_VER_INFO          (0x0D)
 | |
| /* chip hardware version date */
 | |
| #define PROTO_SPG_BASE_INFO_HW_CHIP_VER_DATE          (0x0E)
 | |
| /* application version id */
 | |
| #define PROTO_SPG_BASE_INFO_APP_VER_INFO              (0x0F)
 | |
| /* module device id */
 | |
| #define PROTO_SPG_BASE_INFO_DEV_ID                    (0x10)
 | |
| 
 | |
| /* manufacture code reserved length */
 | |
| #define PROTO_SPG_BASE_INFO_OEM_CODE_RSVD_LEN         (2)
 | |
| /* version id */
 | |
| #define PROTO_SPG_BASE_INFO_VER_INFO_RSVD_LEN         (2)
 | |
| /* bootload version */
 | |
| #define PROTO_SPG_BASE_INFO_BOOTLOADER_RSVD_LEN       (1)
 | |
| /* chip code */
 | |
| #define PROTO_SPG_BASE_INFO_CHIP_CODE_RSVD_LEN        (2)
 | |
| /* version date */
 | |
| #define PROTO_SPG_BASE_INFO_VER_DATE_RSVD_LEN         (3)
 | |
| /* module mac addr */
 | |
| #define PROTO_SPG_BASE_INFO_MOD_MAC_RSVD_LEN          (6)
 | |
| /* module hardware version id */
 | |
| #define PROTO_SPG_BASE_INFO_HW_MOD_VER_INFO_RSVD_LEN  (2)
 | |
| /* module hardware version date */
 | |
| #define PROTO_SPG_BASE_INFO_HW_MOD_DATE_RSVD_LEN      (3)
 | |
| /* chip software version id */
 | |
| #define PROTO_SPG_BASE_INFO_SW_CHIP_VER_INFO_RSVD_LEN (2)
 | |
| /* chip software version date */
 | |
| #define PROTO_SPG_BASE_INFO_SW_CHIP_VER_DATE_RSVD_LEN (3)
 | |
| /* chip hardware version id */
 | |
| #define PROTO_SPG_BASE_INFO_HW_CHIP_VER_INFO_RSVD_LEN (2)
 | |
| /* chip hardware version date */
 | |
| #define PROTO_SPG_BASE_INFO_HW_CHIP_VER_DATE_RSVD_LEN (3)
 | |
| /* application version id */
 | |
| #define PROTO_SPG_BASE_INFO_APP_VER_INFO_RSVD_LEN     (2)
 | |
| /* module device id */
 | |
| #define PROTO_SPG_BASE_INFO_DEV_ID_RSVD_LEN           (24)
 | |
| 
 | |
| /* version info device id len */
 | |
| #define PROTO_SPG_DEVICE_ID_LEN                       (11)
 | |
| /* version info chip management id len */
 | |
| #define PROTO_SPG_CHIP_MMID_ID_LEN                    (24)
 | |
| 
 | |
| /* branch detect report state */
 | |
| /* not doing branch detect or branch detect is done */
 | |
| #define PROTO_SPG_BD_STATE_DONE                       (0)
 | |
| /* doing branch detect */
 | |
| #define PROTO_SPG_BD_STATE_DOING                      (1)
 | |
| 
 | |
| /* query physical topo device type */
 | |
| #define PROTO_SPG_BD_DEV_TYPE_POWER_METER             (1)
 | |
| #define PROTO_SPG_BD_DEV_TYPE_POWER_METER_3P          (2)
 | |
| #define PROTO_SPG_BD_DEV_TYPE_SWITCH_MONITOR          (3)
 | |
| 
 | |
| /* spg task info */
 | |
| typedef struct _spg_task_info {
 | |
|     /* task id */
 | |
|     uint16_t     task_id;
 | |
|     /* task priority, 0 - hight priority, 3 - low priority*/
 | |
|     uint8_t      task_pri       : 4;
 | |
|     /* reserve */
 | |
|     uint8_t      reseve_1       : 1,
 | |
|                  reseve_2       : 1,
 | |
|    /* data forward flag for hainan, 0 - needless forward, 1 - need forward */
 | |
|                  forward_flag   : 1,
 | |
|     /* flag of the ack, 0 - need ack, 1 - needless ack */
 | |
|                  ack_flag       : 1;
 | |
|     /* time of the timeout, unit is second */
 | |
|     uint16_t     timeout_dur;
 | |
|     /* length of the app data */
 | |
|     uint8_t      data_len;
 | |
|     /* comment of the app data */
 | |
|     uint8_t      data[0];
 | |
| } spg_task_info_t;
 | |
| 
 | |
| /* add task down link request */
 | |
| typedef struct _spg_afn02_fn01_add_task_dl {
 | |
|     /* spg task information */
 | |
|     spg_task_info_t task_info;
 | |
| } spg_afn02_fn01_add_task_dl_t;
 | |
| 
 | |
| /* remove task down link request */
 | |
| typedef struct _spg_afn02_fn02_rm_task_dl {
 | |
|     /* task id */
 | |
|     uint16_t     task_id;
 | |
| } spg_afn02_fn02_rm_task_dl_t;
 | |
| 
 | |
| /* unfinish task count */
 | |
| typedef struct _spg_afn02_fn03_query_unfinish_task_ul {
 | |
|     /* unfinish task count */
 | |
|     uint16_t     unfinished_cnt;
 | |
| } spg_afn02_fn03_query_unfinish_task_ul_t;
 | |
| 
 | |
| /* pending task information down link request */
 | |
| typedef struct _spg_afn02_fn05_pending_task_info_dl {
 | |
|     /* pending task id */
 | |
|     uint16_t     task_id;
 | |
| } spg_afn02_fn05_pending_task_info_dl_t;
 | |
| 
 | |
| /* pending task information up link request */
 | |
| typedef struct spg_afn02_fn05_pending_task_hdr_ul {
 | |
|     /* pending task id */
 | |
|     uint16_t     task_id;
 | |
|     /* priority level, 0 - hight priority, 3 - low priority */
 | |
|     uint8_t      task_pri : 4,
 | |
|                  reseve_1 : 1,
 | |
|                  reseve_2 : 1,
 | |
|                  reseve_3 : 1;
 | |
|     /* 0 - need ack, 1 - needless ack */
 | |
|     uint8_t      ack_flag : 1;
 | |
|     /* count of the task address */
 | |
|     uint16_t     addr_cnt;
 | |
|     /* address of the task */
 | |
|     uint8_t      addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn02_fn05_pending_task_hdr_ul_t;
 | |
| 
 | |
| /* data in the pending task up link request */
 | |
| typedef struct spg_afn02_fn05_pending_task_data_ul {
 | |
|     /* length of data in a task */
 | |
|     uint8_t      len;
 | |
|     /* content of the task */
 | |
|     uint8_t      data[0];
 | |
| } spg_afn02_fn05_pending_task_data_ul_t;
 | |
| 
 | |
| /* count of the free task, up link response */
 | |
| typedef struct _spg_afn02_fn06_query_free_taskcnt_ul {
 | |
|     /* count of free task */
 | |
|     uint16_t     free_task_cnt;
 | |
| } spg_afn02_fn06_query_free_taskcnt_ul_t;
 | |
| 
 | |
| /* unfinish task id down link request */
 | |
| typedef struct _spg_afn02_fn04_query_unfinished_task_list_dl {
 | |
|     /* start index of unfinished task to be queried,
 | |
|      * start ftom 0 be queried
 | |
|      */
 | |
|     uint16_t     start_index;
 | |
|     /* count to be queried this time */
 | |
|     uint8_t      query_count;
 | |
| } spg_afn02_fn04_query_unfinished_task_list_dl_t;
 | |
| 
 | |
| /* unfinish task id list up link */
 | |
| typedef struct _spg_afn02_fn04_query_unfinish_task_list_ul {
 | |
|     /* unfinish task count */
 | |
|     uint16_t     task_cnt;
 | |
|     /* task id */
 | |
|     uint16_t     task_id[0];
 | |
| } spg_afn02_fn04_query_unfinish_task_list_ul_t;
 | |
| 
 | |
| /* add task down link request */
 | |
| typedef struct _spg_afn02_fn07_add_multi_task_dl {
 | |
|     /* task id */
 | |
|     uint16_t     task_id;
 | |
|     /* task priority, 0 - hight priority, 3 - low priority*/
 | |
|     uint8_t      task_pri       : 4;
 | |
|     /* reserve */
 | |
|     uint8_t      reseve_1       : 1,
 | |
|                  reseve_2       : 1,
 | |
|     /* data forward flag, 0 - needless forward, 1 - need forward */
 | |
|                  forward_flag   : 1,
 | |
|     /* flag of the ack, 0 - need ack, 1 - needless ack */
 | |
|                  ack_flag       : 1;
 | |
|     /* power meter count */
 | |
|     uint16_t     pm_count;
 | |
|     /* power meter mac addr */
 | |
|     uint8_t      pm_mac[0][IOT_MAC_ADDR_LEN];
 | |
|     //spg_afn02_fn07_datagram_t data;
 | |
| } spg_afn02_fn07_add_multi_task_dl_t;
 | |
| 
 | |
| typedef struct _spg_afn02_fn07_datagram {
 | |
|     /* time of the timeout, unit is second */
 | |
|     uint16_t     timeout_dur;
 | |
|     /* length of the app data */
 | |
|     uint8_t      data_len;
 | |
|     /* comment of the app data */
 | |
|     uint8_t      data[0];
 | |
| } spg_afn02_fn07_datagram_t;
 | |
| 
 | |
| typedef struct _spg_afn04_fnc1_edge_computing_set {
 | |
|     /* overvoltage monitor switch, 0 - open, others - close */
 | |
|     uint8_t      overvoltage_switch;
 | |
|     /* overvoltage monitor threshold, unit is volt */
 | |
|     uint16_t     overvoltage_threshold;
 | |
|     /* overvoltage monitor period, unit is 1min */
 | |
|     uint16_t     overvoltage_period;
 | |
|     /* overvoltage collect abnormal report round */
 | |
|     uint8_t      overvoltage_rpt_round;
 | |
|     /* undervoltage monitor switch, 0 - open, others - close */
 | |
|     uint8_t      undervoltage_switch;
 | |
|     /* undervoltage monitor threshold, unit is volt */
 | |
|     uint16_t     undervoltage_threshold;
 | |
|     /* undervoltage monitor period, unit is 1min */
 | |
|     uint16_t     undervoltage_period;
 | |
|     /* undervoltage collect abnormal report round */
 | |
|     uint8_t      undervoltage_rpt_round;
 | |
|     /* clock second pulse monitor switch, 0 - open, others - close */
 | |
|     uint8_t      pulse_switch;
 | |
|     /* clock second pulse monitor threshold, unit is 1ms */
 | |
|     uint16_t     pulse_threshold;
 | |
|     /* power meter health status monitor switch, 0 - open, others - close */
 | |
|     uint8_t      health_status_switch;
 | |
|     /* power meter used time limit threshold, unit is year */
 | |
|     uint8_t      used_limit_threshold;
 | |
| } spg_afn04_fnc1_edge_computing_set_t;
 | |
| 
 | |
| /* query manufacturer and version up link */
 | |
| typedef struct _spg_afn03_fn01_hw_info_ul {
 | |
|     /* hardware information */
 | |
|     mod_spg_hw_info_t info;
 | |
| } spg_afn03_fn01_hw_info_ul_t;
 | |
| 
 | |
| /* local device status msg */
 | |
| typedef struct _spg_afn03_fn02_module_work_mode {
 | |
|     /* enum spg_communication_type */
 | |
|     uint8_t           phy_type : 4;
 | |
|     /* reserved field */
 | |
|     uint8_t           reserved : 4;
 | |
|     /* MTU of the datagram (unit: BYTE)*/
 | |
|     uint16_t          datagram_mtu;
 | |
|     /* MTU of the transmission file (unit: BYTE)*/
 | |
|     uint16_t          file_send_mtu;
 | |
|     /* wait of the time, after the file transfer is completed (unit: MINUTE)*/
 | |
|     uint8_t           upgrade_wait_dur;
 | |
|     /* MAC of the CCO */
 | |
|     uint8_t           cco_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* the maximum secondary node number of support */
 | |
|     uint16_t          sec_node_cnt_max;
 | |
|     /* count of the current secondary node */
 | |
|     uint16_t          sec_node_cnt;
 | |
|     /* count of the single operation */
 | |
|     uint16_t          sec_node_opt_cnt_max;
 | |
|     /* date of the proto */
 | |
|     uint8_t           proto_rel_date[3];
 | |
|     /* info of the manufacture and version */
 | |
|     mod_spg_hw_info_t hw_info;
 | |
| } spg_afn03_fn02_mod_work_mode_t;
 | |
| 
 | |
| /* query CCO address up link */
 | |
| typedef struct _spg_afn03_fn03_cco_mac_ul {
 | |
|     /* CCO address */
 | |
|     uint8_t           mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn03_cco_mac_ul_t;
 | |
| 
 | |
| /* query communication delay time down link */
 | |
| typedef struct _spg_afn03_fn04_comm_delay_dl {
 | |
|     /* communication dest address */
 | |
|     uint8_t           dest_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* data len */
 | |
|     uint8_t           len;
 | |
| } spg_afn03_fn04_comm_delay_dl_t;
 | |
| 
 | |
| /* query communication delay time up link */
 | |
| typedef struct _spg_afn03_fn04_comm_delay_ul {
 | |
|     /* communication dest address */
 | |
|     uint8_t           dest_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* communication delay time */
 | |
|     uint16_t          delay_time;
 | |
|     /* data len */
 | |
|     uint8_t           len;
 | |
| } spg_afn03_fn04_comm_delay_ul_t;
 | |
| 
 | |
| /* query total count of the secondary node up link */
 | |
| typedef struct _spg_afn03_fn05_query_sec_node_count_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t         sec_node_count;
 | |
| } spg_afn03_fn05_query_sec_node_count_ul_t;
 | |
| 
 | |
| /* query secondary node info down link */
 | |
| typedef struct _spg_afn03_fn06_query_sec_node_info_dl {
 | |
|     /* start index of the secondary node to be queried */
 | |
|     uint16_t     start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t      sec_node_count;
 | |
| } spg_afn03_fn06_query_sec_node_info_dl_t;
 | |
| 
 | |
| /* query secondary node info up link */
 | |
| typedef struct _spg_afn03_fn06_query_sec_node_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t         total_count;
 | |
|     /* count of the secondary node in current report */
 | |
|     uint8_t          rps_sec_node_count;
 | |
|     /* mac address list of the secondary node */
 | |
|     uint8_t          mac[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn06_query_sec_node_info_ul_t;
 | |
| 
 | |
| /* secondary node register status up link */
 | |
| typedef struct _spg_afn03_fn07_sec_node_reg_state_ul {
 | |
|     /* 0 - register done, 1 - registering */
 | |
|     uint8_t          reg_state;
 | |
| } spg_afn03_fn07_sec_node_reg_state_ul_t;
 | |
| 
 | |
| /* Parent-node info down link */
 | |
| typedef struct _spg_afn03_fn08_query_parent_node_dl {
 | |
|     /* mac address of the secondary node */
 | |
|     uint8_t      sec_node_mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn08_query_parent_node_dl_t;
 | |
| 
 | |
| /* Parent-node info up link */
 | |
| typedef struct _spg_afn03_fn08_query_parent_node_ul {
 | |
|     /* MAC address of the secondary node */
 | |
|     uint8_t          sec_node_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* MAC address of the parent-node */
 | |
|     uint8_t          parent_node_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* value 0 ~ 31. 0 - worst, 31 - best */
 | |
|     uint8_t          link_quality;
 | |
| } spg_afn03_fn08_query_parent_node_ul_t;
 | |
| 
 | |
| /* query meter mapping count up link */
 | |
| typedef struct _spg_afn03_fn09_query_meter_map_cnt_ul {
 | |
|     /* meter mapping count */
 | |
|     uint16_t         mapping_cnt;
 | |
| } spg_afn03_fn09_query_meter_map_cnt_ul_t;
 | |
| 
 | |
| /* query meter mapping info down link */
 | |
| typedef struct _spg_afn03_fn0a_query_meter_map_info_dl {
 | |
|     /* query start meter mapping index */
 | |
|     uint16_t         start_index;
 | |
|     /* query count */
 | |
|     uint8_t          cnt;
 | |
| } spg_afn03_fn0a_query_meter_map_info_dl_t;
 | |
| 
 | |
| /* spg meter mapping info */
 | |
| typedef struct _spg_meter_mapping_info {
 | |
|     /* node mac address - small endian */
 | |
|     uint8_t          node_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* meter address - small endian */
 | |
|     uint8_t          meter_addr[IOT_METER_ADDR_LEN];
 | |
| } spg_meter_mapping_info_t;
 | |
| 
 | |
| /* query meter mapping info up link */
 | |
| typedef struct _spg_afn03_fn0a_rpt_meter_map_info_ul {
 | |
|     /* total meter mapping index */
 | |
|     uint16_t         total_cnt;
 | |
|     /* rpt count this time */
 | |
|     uint8_t          cnt;
 | |
|     /* meter mapping info */
 | |
|     spg_meter_mapping_info_t meter_map_info[0];
 | |
| } spg_afn03_fn0a_rpt_meter_map_info_ul_t;
 | |
| 
 | |
| /* Parent-node info up link */
 | |
| typedef struct _spg_afn03_fn10_query_detect_status_ul {
 | |
|     /* transformer detect status */
 | |
|     uint8_t          status;
 | |
|     /* transformer detect left time */
 | |
|     uint16_t         left_time;
 | |
|     /* reserved */
 | |
|     uint8_t          resvd;
 | |
| } spg_afn03_fn10_query_detect_status_ul_t;
 | |
| 
 | |
| /* query module mac info down link */
 | |
| typedef struct _spg_afn03_fn13_query_mod_mac_info_dl {
 | |
|     /* start query index of the secondary node, start from 0 */
 | |
|     uint16_t         start_index;
 | |
|     /* query count */
 | |
|     uint8_t          cnt;
 | |
| } spg_afn03_fn13_query_mod_mac_info_dl_t;
 | |
| 
 | |
| /* module mac info */
 | |
| typedef struct _spg_mod_mac_info {
 | |
|     /* meter address, little-endian */
 | |
|     uint8_t          meter_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* module mac address, big-endian */
 | |
|     uint8_t          mod_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* reserved */
 | |
|     uint8_t          rsvd[24];
 | |
| } spg_mod_mac_info_t;
 | |
| 
 | |
| /* query module mac info up link */
 | |
| typedef struct _spg_afn03_fn13_rpt_mod_mac_info_ul {
 | |
|     /* total node cnt */
 | |
|     uint16_t         total_cnt;
 | |
|     /* start query index of the secondary node, start from 0 */
 | |
|     uint16_t         start_index;
 | |
|     /* rpt count this time */
 | |
|     uint8_t          cnt;
 | |
|     /* module property info */
 | |
|     spg_mod_mac_info_t          mac_info[0];
 | |
| } spg_afn03_fn13_rpt_mod_mac_info_ul_t;
 | |
| 
 | |
| /* query other's node tsfm dectect result down link for guangdong */
 | |
| typedef struct _spg_afn03_fn11_query_other_tsfm_result_dl {
 | |
|     /* start query index of the secondary node, start from 0 */
 | |
|     uint16_t         start_index;
 | |
|     /* query count */
 | |
|     uint8_t          cnt;
 | |
| } spg_afn03_fn11_query_other_tsfm_result_dl_t;
 | |
| 
 | |
| /* tsfm dectect report info */
 | |
| typedef struct _spg_tsfm_dect_result {
 | |
|     /* node mac address, little endian */
 | |
|     uint8_t          node_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* tsfm dectect result, see PROTO_SPG_TSFM_DECT_RESULT_XXX */
 | |
|     uint8_t          result;
 | |
|     /* reserved */
 | |
|     uint8_t          rsvd;
 | |
|     /* tsfm dectect mac address, little endian */
 | |
|     uint8_t          tsfm_addr[IOT_MAC_ADDR_LEN];
 | |
| } spg_tsfm_dect_result_t;
 | |
| 
 | |
| /* query other's node tsfm dectect result ul link for guangdong */
 | |
| typedef struct _spg_afn03_fn11_query_other_tsfm_result_ul {
 | |
|     /* tsfm dectect total node count */
 | |
|     uint16_t                    total_cnt;
 | |
|     /* report count */
 | |
|     uint8_t                     rpt_cnt;
 | |
|     /* tsfm dectect result */
 | |
|     spg_tsfm_dect_result_t      tsfm_result[0];
 | |
| } spg_afn03_fn11_query_other_tsfm_result_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn12_query_net_phase_and_tsfm_info_dl {
 | |
|     /* start query index of the secondary node, start from 1 */
 | |
|     uint16_t                    start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t                     count;
 | |
| } spg_afn03_fn12_query_net_phase_and_tsfm_info_dl_t;
 | |
| 
 | |
| typedef struct _spg_sec_node_net_phase_and_tsfm_info {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t                     mac_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* tsfm state, see PROTO_SPG_TSFM_STATE_XXX */
 | |
|     uint8_t                     tsfm_state;
 | |
|     /* node phase identification, D0-D2 : connect with A/B/C phase if set 1,
 | |
|      * otherwise not connect to corresponding phase
 | |
|      */
 | |
|     uint16_t                    phase           : 3,
 | |
|     /* flag to mark if L/N reversed in Single-phase power meter or phase
 | |
|      * sequence reversed in Three-phase power meter.
 | |
|      */
 | |
|                                 opposite_phase  : 2,
 | |
|     /* reserved */
 | |
|                                 rsvd            : 11;
 | |
| } spg_sec_node_net_phase_and_tsfm_info_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn12_query_net_phase_and_tsfm_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                    total_count;
 | |
|     /* start query index of the secondary node, start from 1 */
 | |
|     uint16_t                    start_index;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                     ack_node_count;
 | |
|     /* sec node info of network phase and transformer */
 | |
|     spg_sec_node_net_phase_and_tsfm_info_t  node_info[0];
 | |
| } spg_afn03_fn12_query_net_phase_and_tsfm_info_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn13_query_base_info_dl {
 | |
|     /* meter addr, little endian */
 | |
|     uint8_t     meter_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* element count */
 | |
|     uint8_t     element_cnt;
 | |
|     /* element info */
 | |
|     uint8_t     element[0];
 | |
| } spg_afn03_fn13_query_base_info_dl_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn12_query_base_info_ul {
 | |
|     /* meter addr, little endian */
 | |
|     uint8_t     meter_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* element info */
 | |
|     uint8_t     data[0];
 | |
| } spg_afn03_fn13_query_base_info_ul_t;
 | |
| 
 | |
| typedef struct _spg_node_info_ver_info {
 | |
|     /* mac address of the station: small endian */
 | |
|     uint8_t                     mac[IOT_MAC_ADDR_LEN];
 | |
|     /* node vendor id */
 | |
|     uint16_t                    vendor_id;
 | |
|     /* node chip code */
 | |
|     uint16_t                    chip_code;
 | |
|     /* software version day */
 | |
|     uint8_t                     sw_ver_day;
 | |
|     /* software version month */
 | |
|     uint8_t                     sw_ver_month;
 | |
|     /* software version year */
 | |
|     uint8_t                     sw_ver_year;
 | |
|     /* software version */
 | |
|     uint16_t                    sw_ver;
 | |
| } spg_node_info_ver_info_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn12_fn81_query_vendor_and_ver_dl {
 | |
|     /* start query index, start from 0. 0 is cco, others station */
 | |
|     uint16_t                    start_index;
 | |
|     /* count of the node to be queried */
 | |
|     uint8_t                     count;
 | |
| } spg_afn03_fn12_fn81_query_vendor_and_ver_dl_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn12_fn81_query_vendor_and_ver_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                    total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                     ack_node_count;
 | |
|     /* sec node vendor info */
 | |
|     spg_node_info_ver_info_t    node_info[0];
 | |
| } spg_afn03_fn12_fn81_query_vendor_and_ver_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn14_query_base_info_dl {
 | |
|     /* start query index, start from 0. 0 is cco, others station */
 | |
|     uint16_t                    start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t                     count;
 | |
|     /* element info, see PROTO_SPG_BASE_INFO_XXX */
 | |
|     uint8_t                     element;
 | |
| } spg_afn03_fn14_query_base_info_dl_t;
 | |
| 
 | |
| typedef struct _node_base_info {
 | |
|     /* node mac addr, little endian */
 | |
|     uint8_t                     pm_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* base info */
 | |
|     uint8_t                     data[0];
 | |
| } node_base_info_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn14_query_base_info_ul {
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                     ack_node_count;
 | |
|     /* element info, see PROTO_SPG_CMD_SEC_NODE_INFO_XXX */
 | |
|     uint8_t                     element;
 | |
|     /* node base info */
 | |
|     //node_base_info_t            base_info[0];
 | |
| } spg_afn03_fn14_query_base_info_ul_t;
 | |
| 
 | |
| /* query node vendor info down link */
 | |
| typedef struct _spg_afn03_fn21_query_node_vendor_info_dl {
 | |
|     /* start query index of the secondary node, start from 1 */
 | |
|     uint16_t                    start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t                     count;
 | |
| } spg_afn03_fn21_query_node_vendor_info_dl_t;
 | |
| 
 | |
| /* struct contain info of report node vendor */
 | |
| typedef struct _spg_sec_node_vendor_info {
 | |
|     /* node vendor info */
 | |
|     spg_node_info_ver_info_t    ver_info;
 | |
|     /* flag to mark if have super capacitance */
 | |
|     uint8_t                     super_cap    : 2,
 | |
|     /* flag to mark if could fix position */
 | |
|                                 fix_position : 2,
 | |
|     /* reserved */
 | |
|                                 rsvd         : 4;
 | |
| } spg_sec_node_vendor_info_t;
 | |
| 
 | |
| /* query node vendor info up link */
 | |
| typedef struct _spg_afn03_fn21_query_node_vendor_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                    total_count;
 | |
|     /* start query index of the secondary node */
 | |
|     uint16_t                    start_index;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                     ack_node_count;
 | |
|     /* vendor info of the secondary node */
 | |
|     spg_sec_node_vendor_info_t  node_info[0];
 | |
| } spg_afn03_fn21_query_node_vendor_info_ul_t;
 | |
| 
 | |
| /* query node vendor info down link */
 | |
| typedef struct _spg_afn03_fn22_query_node_vendor_info_dl {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t                     node_addr[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn22_query_node_vendor_info_dl_t;
 | |
| 
 | |
| /* query node vendor info up link */
 | |
| typedef struct _spg_afn03_fn22_query_node_vendor_info_ul {
 | |
|     /* vendor info of the secondary node */
 | |
|     spg_sec_node_vendor_info_t  node_info;
 | |
| } spg_afn03_fn22_query_node_vendor_info_ul_t;
 | |
| 
 | |
| /* task suggest timeout time */
 | |
| typedef struct _spg_afn03_fn0b_rsp_task_timeout {
 | |
|     /* task priority 0 suggest timeout time, uint is 1s */
 | |
|     uint16_t         prio_0_suggest_timeout;
 | |
|     /* task priority 0 suggest timeout time, uint is 1s */
 | |
|     uint16_t         prio_1_suggest_timeout;
 | |
|     /* task priority 0 suggest timeout time, uint is 1s */
 | |
|     uint16_t         prio_2_suggest_timeout;
 | |
|     /* task priority 0 suggest timeout time, uint is 1s */
 | |
|     uint16_t         prio_3_suggest_timeout;
 | |
| } spg_afn03_fn0b_rsp_task_timeout_t;
 | |
| 
 | |
| /* query sec node phase information */
 | |
| typedef struct _spg_afn03_fn0c_query_sec_node_phase_info_dl {
 | |
|     /* count of the secondary node */
 | |
|     uint8_t     sec_node_cnt;
 | |
|     /* mac address list of the secondary node */
 | |
|     uint8_t     mac_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn0c_query_sec_node_phase_info_dl_t;
 | |
| 
 | |
| typedef struct _spg_sec_node_phase_info {
 | |
|     /* node mac addr */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
|     /* node phase identification, D0-D2 : connect with A/B/C phase if set 1,
 | |
|      * otherwise not connect to corresponding phase
 | |
|      */
 | |
|     uint8_t     phase         : 3,
 | |
|     /* node phase feature, see PTORO_SPG_SEC_NODE_PHASE_XXX */
 | |
|                 phase_feature : 2,
 | |
|     /* node phase type, see PROTO_SPG_PHASE_SEQ_XXX */
 | |
|                 phase_type    : 3;
 | |
|     /* protocol type, see PROTO_SPG_PROTO_TYPE_XXX */
 | |
|     uint8_t     proto_type    : 3,
 | |
|     /* reversed */
 | |
|                 reversed      : 3,
 | |
|     /* module type, see PROTO_SPG_MODULE_XXX */
 | |
|                 module_type   : 2;
 | |
| } spg_sec_node_phase_info_t;
 | |
| 
 | |
| typedef struct _spg_sec_node_guangzhou_phase_info {
 | |
|     /* node mac addr */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
|     /* node phase identification, D0-D2 : connect with A/B/C phase if set 1,
 | |
|      * otherwise not connect to corresponding phase
 | |
|      */
 | |
|     uint8_t     phase         : 3,
 | |
|     /* node phase feature, see PTORO_SPG_SEC_NODE_PHASE_XXX */
 | |
|                 phase_feature : 2,
 | |
|     /* flag to mark if L/N reversed in Single-phase power meter or phase
 | |
|      * sequence reversed in Three-phase power meter.
 | |
|      */
 | |
|                 opposite_phase: 2,
 | |
|     /* reversed */
 | |
|                 reversed      : 1;
 | |
|     /* protocol type, see PROTO_SPG_PROTO_TYPE_XXX */
 | |
|     uint8_t     proto_type;
 | |
| } spg_sec_node_guangzhou_phase_info_t;
 | |
| 
 | |
| /* report sec node phase information */
 | |
| typedef struct _spg_afn03_fn0c_rpt_sec_node_phase_info_ul {
 | |
|     /* count of the secondary node for this report */
 | |
|     uint8_t                         ack_node_count;
 | |
|     /* phase info of the secondary node */
 | |
|     spg_sec_node_phase_info_t       node_info[0];
 | |
| } spg_afn03_fn0c_rpt_sec_node_phase_info_ul_t;
 | |
| 
 | |
| /* report sec node guangzhou phase information */
 | |
| typedef struct _spg_afn03_fn0c_rpt_sec_node_guangzhou_phase_info_ul {
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                         ack_node_count;
 | |
|     /* phase info of the secondary node */
 | |
|     spg_sec_node_guangzhou_phase_info_t node_info[0];
 | |
| } spg_afn03_fn0c_rpt_sec_node_guangzhou_phase_info_ul_t;
 | |
| 
 | |
| /* query sec node phase information */
 | |
| typedef struct _spg_afn03_fn0d_query_sec_node_phase_info_dl {
 | |
|     /* start query index of the secondary node, start from 0 */
 | |
|     uint16_t     start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t      count;
 | |
| } spg_afn03_fn0d_query_sec_node_phase_info_dl_t;
 | |
| 
 | |
| /* report sec node phase information*/
 | |
| typedef struct _spg_afn03_fn0d_rpt_sec_node_phase_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                        total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                         ack_node_count;
 | |
|     /* phase info of the secondary node */
 | |
|     spg_sec_node_phase_info_t       node_info[0];
 | |
| } spg_afn03_fn0d_rpt_sec_node_phase_info_ul_t;
 | |
| 
 | |
| /* report sec node guangzhou phase information */
 | |
| typedef struct _spg_afn03_fn0d_rpt_sec_node_guangzhou_phase_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                        total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                         ack_node_count;
 | |
|     /* phase info of the secondary node */
 | |
|     spg_sec_node_guangzhou_phase_info_t node_info[0];
 | |
| } spg_afn03_fn0d_rpt_sec_node_guangzhou_phase_info_ul_t;
 | |
| 
 | |
| /* sec node tsfm result info */
 | |
| typedef struct _spg_sec_node_tsfm_info {
 | |
|     /* node mac addr */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
|     /* transform detection result, see PROTO_SPG_CCO_RPT_TSFM_XXX */
 | |
|     uint8_t     tsfm_result;
 | |
| } spg_sec_node_tsfm_info_t;
 | |
| 
 | |
| /* query sec node transform detection result in white list */
 | |
| typedef struct _spg_afn03_fn0e_query_in_wl_tsfm_result_dl {
 | |
|     /* start query index of the secondary node, start from 0 */
 | |
|     uint16_t     start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t      count;
 | |
| } spg_afn03_fn0e_query_in_wl_tsfm_result_dl_t;
 | |
| 
 | |
| /* report sec node query result in white list */
 | |
| typedef struct _spg_afn03_fn0e_query_in_wl_tsfm_result_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                      total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                       ack_node_count;
 | |
|     /* transform result of the secondary node */
 | |
|     spg_sec_node_tsfm_info_t      node_info[0];
 | |
| } spg_afn03_fn0e_query_in_wl_tsfm_result_ul_t;
 | |
| 
 | |
| /* sec node tsfm result info */
 | |
| typedef struct _spg_other_sec_node_tsfm_info {
 | |
|     /* node mac addr */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
|     /* CCo mac of network that the node last joined */
 | |
|     uint8_t     prev_cco_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* reserve */
 | |
|     uint16_t    reserved;
 | |
| } spg_other_sec_node_tsfm_info_t;
 | |
| 
 | |
| /* query sec node transform detection result not in white list */
 | |
| typedef struct _spg_afn03_fn0f_query_other_tsfm_result_dl {
 | |
|     /* start query result of secondary node, start from 0 */
 | |
|     uint16_t     start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t      count;
 | |
| } spg_afn03_fn0f_query_other_tsfm_result_dl_t;
 | |
| 
 | |
| /* report sec node query result of not in white list */
 | |
| typedef struct _spg_afn03_fn0f_query_other_tsfm_result_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t                        total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t                         ack_node_count;
 | |
|     /* result of the secondary node */
 | |
|     spg_other_sec_node_tsfm_info_t  node_info[0];
 | |
| } spg_afn03_fn0f_query_other_tsfm_result_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn23_query_net_info_dl {
 | |
|     /* start query network info of secondary node, start from 1 */
 | |
|     uint16_t     start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t      count;
 | |
| } spg_afn03_fn23_query_net_info_dl_t;
 | |
| 
 | |
| typedef struct _spg_sec_node_net_info {
 | |
|     /* mac address of the station: little endian */
 | |
|     uint8_t     mac[IOT_MAC_ADDR_LEN];
 | |
|     /* communication mode, see PROTO_SPG_COMM_MOD_XXX */
 | |
|     uint8_t     comm_mode;
 | |
|     /* time of joined network */
 | |
|     uint8_t     join_sec;
 | |
|     uint8_t     join_min;
 | |
|     uint8_t     join_hour;
 | |
|     uint8_t     join_day;
 | |
|     uint8_t     join_mon;
 | |
|     uint8_t     join_year;
 | |
|     /* flag to mark if the sec node in the network */
 | |
|     uint8_t     in_net;
 | |
|     /* cost time form power on to join network, unit is 1s */
 | |
|     uint32_t    cost_time;
 | |
| } spg_sec_node_net_info_t;
 | |
| 
 | |
| typedef struct spg_afn03_fn23_query_net_info_ul_t {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t    total_count;
 | |
|     /* start query index of the secondary node */
 | |
|     uint16_t    start_index;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t     ack_node_count;
 | |
|     /* network info of the secondary node */
 | |
|     spg_sec_node_net_info_t     net_info[0];
 | |
| } spg_afn03_fn23_query_net_info_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn24_query_net_info_dl {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t     node_addr[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn24_query_net_info_dl_t;
 | |
| 
 | |
| typedef struct _spg_afn03_fn24_query_net_info_ul {
 | |
|     /* network info of the secondary node */
 | |
|     spg_sec_node_net_info_t     net_info;
 | |
| } spg_afn03_fn24_query_net_info_ul_t;
 | |
| 
 | |
| /* query topo down link request */
 | |
| typedef struct _spg_afn03_fn65_query_topo_dl {
 | |
|     /* query topo start index */
 | |
|     uint16_t              start_index;
 | |
|     /* query topo node count */
 | |
|     uint8_t               count;
 | |
| } spg_afn03_fn65_query_topo_dl_t;
 | |
| 
 | |
| /* sec node network topo info */
 | |
| typedef struct _spg_node_topo_info_guangdong {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t               mac[IOT_MAC_ADDR_LEN];
 | |
|     /* node identity */
 | |
|     uint16_t              tei;
 | |
|     /* proxy node identity */
 | |
|     uint16_t              pco_tei;
 | |
|     /* station joined time is based on the time of CCO power-on, uint is 1s */
 | |
|     uint32_t              join_ts;
 | |
|     /* change count of the proxy */
 | |
|     uint16_t              proxy_chg_cnt;
 | |
|     /* leaving network count of the station */
 | |
|     uint16_t              leave_cnt;
 | |
|     /* node level */
 | |
|     uint8_t               level :4,
 | |
|     /* node role */
 | |
|                           role  :4;
 | |
| } spg_node_topo_info_guangdong_t;
 | |
| 
 | |
| /* report topo info to cctt */
 | |
| typedef struct _spg_afn03_fn65_query_topo_ul {
 | |
|     /* total node count in network topo */
 | |
|     uint16_t              total_cnt;
 | |
|     /* node start index in network topo */
 | |
|     uint16_t              start_index;
 | |
|     /* acknowledge node count */
 | |
|     uint8_t               ack_count;
 | |
|     /* network topo info list of the node */
 | |
|     spg_node_topo_info_guangdong_t  node_info[0];
 | |
| } spg_afn03_fn65_query_topo_ul_t;
 | |
| 
 | |
| /* query secondary node runtime */
 | |
| typedef struct _spg_afn03_fn66_query_node_runtime_dl {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t               mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn66_query_node_runtime_dl_t;
 | |
| 
 | |
| /* report secondary node runtime */
 | |
| typedef struct _spg_afn03_fn66_query_node_runtime_ul {
 | |
|     /* node runtime */
 | |
|     uint32_t              runtime;
 | |
| } spg_afn03_fn66_query_node_runtime_ul_t;
 | |
| 
 | |
| /* query secondary node reject info */
 | |
| typedef struct _spg_afn03_fn67_query_reject_info_dl {
 | |
|     /* query node start index */
 | |
|     uint16_t              start_index;
 | |
|     /* query node count */
 | |
|     uint8_t               count;
 | |
| } spg_afn03_fn67_query_reject_info_dl_t;
 | |
| 
 | |
| /* report secondary node reject info */
 | |
| typedef struct _spg_afn03_fn67_query_reject_info_ul {
 | |
|     /* total node count */
 | |
|     uint16_t              total_cnt;
 | |
|     /* acknowledge node count */
 | |
|     uint8_t               ack_count;
 | |
|     /* reject node mac addr, little endian */
 | |
|     uint8_t               node_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn67_query_reject_info_ul_t;
 | |
| 
 | |
| /* query neighbor node channel info */
 | |
| typedef struct _spg_afn03_fn68_query_channel_info_dl {
 | |
|     /* neighbor node mac address, little endian */
 | |
|     uint8_t               mac[IOT_MAC_ADDR_LEN];
 | |
|     /* query node start index, start from 0. */
 | |
|     uint16_t              start_index;
 | |
|     /* query node count, query cco max count is 20,
 | |
|      * query sta max count is 6. see PROTO_SPG_MAX_QR_CHANNEL_XXX.
 | |
|      */
 | |
|     uint8_t               cnt;
 | |
| } spg_afn03_fn68_query_channel_info_dl_t;
 | |
| 
 | |
| /* sta neighbor node info */
 | |
| typedef struct _spg_neighbor_node_info {
 | |
|     /* neighbor node mac address, little endian */
 | |
|     uint8_t               mac[IOT_MAC_ADDR_LEN];
 | |
|     /* neighbor node tei */
 | |
|     uint16_t              tei;
 | |
|     /* neighbor node proxy tei */
 | |
|     uint16_t              proxy_tei;
 | |
|     /* neighbor node level */
 | |
|     uint8_t               level;
 | |
|     /* success rate of uplink communication
 | |
|      * between neighbor node and local node
 | |
|      */
 | |
|     uint8_t               ul_sr;
 | |
|     /* success rate of downlink communication
 | |
|      * between neighbor node and local node
 | |
|      */
 | |
|     uint8_t               dl_sr;
 | |
|     /* success rate of uplink and downlink communication
 | |
|      * between neighbor node and local node
 | |
|      */
 | |
|     uint8_t               ul_dl_sr;
 | |
|     /* snr between neighbor node and local node */
 | |
|     int8_t                snr;
 | |
|     /* signal attenuation between neighbor node and local node */
 | |
|     uint8_t               signal_attenuation;
 | |
| } spg_neighbor_node_info_t;
 | |
| 
 | |
| /* report neighbor node channel info */
 | |
| typedef struct _spg_afn03_fn68_query_channel_info_ul {
 | |
|     /* total node count */
 | |
|     uint16_t              total_cnt;
 | |
|     /* report cnt */
 | |
|     uint8_t               cnt;
 | |
|     /* neighbor node info */
 | |
|     spg_neighbor_node_info_t node_info[0];
 | |
| } spg_afn03_fn68_query_channel_info_ul_t;
 | |
| 
 | |
| /* query package log information */
 | |
| typedef struct _spg_afn03_fn69_qr_pkg_log_dl {
 | |
|     /* package type, 0 - app package, 1 - cctt package */
 | |
|     uint8_t               pkg_type;
 | |
|     /* start index, start form 0 */
 | |
|     uint16_t              start_index;
 | |
|     /* query count */
 | |
|     uint8_t               cnt;
 | |
| } spg_afn03_fn69_qr_pkg_log_dl_t;
 | |
| 
 | |
| /* package information */
 | |
| typedef struct _spg_afn03_fn69_pkg_info {
 | |
|     /* package length */
 | |
|     uint16_t              len;
 | |
|     /* package information */
 | |
|     uint8_t               data[0];
 | |
| } spg_afn03_fn69_pkg_info_t;
 | |
| 
 | |
| /* report package log information */
 | |
| typedef struct _spg_afn03_fn69_qr_pkg_log_ul {
 | |
|     /* package total count */
 | |
|     uint16_t              total_cnt;
 | |
|     /* report count */
 | |
|     uint8_t               rpt_cnt;
 | |
|     /* package information */
 | |
|     //spg_afn03_fn69_pkg_info_t pkg_info;
 | |
| } spg_afn03_fn69_qr_pkg_log_ul_t;
 | |
| 
 | |
| /* query secondary node check info */
 | |
| typedef struct _spg_afn03_fn70_query_node_check_info_dl {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t               mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn03_fn70_query_node_check_info_dl_t;
 | |
| 
 | |
| /* report secondary node check info */
 | |
| typedef struct _spg_afn03_fn70_query_node_check_info_ul {
 | |
|     /* zero check result */
 | |
|     uint8_t               zc_result;
 | |
|     /* uart state */
 | |
|     uint8_t               uart_state;
 | |
|     /* leave net reason */
 | |
|     uint8_t               leave_reason;
 | |
|     /* reset reason */
 | |
|     uint8_t               reset_reason;
 | |
| } spg_afn03_fn70_query_node_check_info_ul_t;
 | |
| 
 | |
| /* query topo down link request */
 | |
| typedef struct _spg_afn03_fn11_fn85_query_topo_dl {
 | |
|     /* query topo start index */
 | |
|     uint16_t              start_index;
 | |
|     /* query topo node count */
 | |
|     uint8_t               node_count;
 | |
| } spg_afn03_fn11_fn85_query_topo_dl;
 | |
| 
 | |
| /* sec node network topo info */
 | |
| typedef struct _spg_node_info_for_topo {
 | |
|     /* node mac address - little endian */
 | |
|     uint8_t                   mac[IOT_MAC_ADDR_LEN];
 | |
|     /* node identity */
 | |
|     uint16_t                  tei;
 | |
|     /* proxy node identity */
 | |
|     uint16_t                  pco_tei;
 | |
|     /* node level */
 | |
|     uint8_t                   level : 4;
 | |
|     /* node role */
 | |
|     uint8_t                   role  : 4;
 | |
| } spg_node_info_for_topo_t;
 | |
| 
 | |
| /* report topo info to cctt */
 | |
| typedef struct _spg_afn03_fn11_fn85_query_topo_ul {
 | |
|     /* total node count in network topo */
 | |
|     uint16_t                  node_count;
 | |
|     /* node start index in network topo */
 | |
|     uint16_t                  node_start_index;
 | |
|     /* acknowledge node count */
 | |
|     uint8_t                   ack_node_count;
 | |
|     /* network topo info list of the node */
 | |
|     spg_node_info_for_topo_t  node_info[0];
 | |
| } spg_afn03_fn11_fn85_query_topo_ul_t;
 | |
| 
 | |
| /* report net info to cctt */
 | |
| typedef struct _spg_afn03_fn91_net_info {
 | |
|     /* total node count */
 | |
|     uint8_t               total_node_cnt;
 | |
|     /* local node network nid --3 bytes */
 | |
|     uint8_t               local_nid[PROTO_SPG_NID_LEN];
 | |
|     /* local node mac address */
 | |
|     uint8_t               local_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* neighbour node network nid */
 | |
|     uint8_t               nb_nid[0][PROTO_SPG_NID_LEN];
 | |
| } spg_afn03_fn91_net_info;
 | |
| 
 | |
| /* report net info to cctt from guangdong protocol */
 | |
| typedef struct _spg_afn03_fn91_net_info_gd {
 | |
|     /* total node count */
 | |
|     uint8_t               total_node_cnt;
 | |
|     /* local node network nid */
 | |
|     uint8_t               local_nid;
 | |
|     /* local node mac address */
 | |
|     uint8_t               local_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* neighbour node network nid */
 | |
|     uint8_t               nb_nid[0];
 | |
| } spg_afn03_fn91_net_info_gd;
 | |
| 
 | |
| /* query white list enable info */
 | |
| typedef struct _spg_afn03_fn93_query_wl_enable_ul {
 | |
|     /* flag to mark if white list enable, 0 - disable, 1 - enable */
 | |
|     uint8_t               flag_enable;
 | |
|     /* range of influence from white list, see PROTO_SPG_WL_INFLUENCE_XXX */
 | |
|     uint8_t               range;
 | |
| } spg_afn03_fn93_query_wl_enable_ul_t;
 | |
| 
 | |
| /* set frequency enable flag and threshold value */
 | |
| typedef struct _spg_afn03_fnb0_query_score_param_ul {
 | |
|     /* flag to mark if score report enable */
 | |
|     uint8_t               flag_enable;
 | |
|     /* score report threshold value, BIN format */
 | |
|     uint8_t               threshold;
 | |
| } spg_afn03_fnb0_query_score_param_ul_t;
 | |
| 
 | |
| /* set auto start time */
 | |
| typedef struct _spg_afn03_fnb1_query_auto_start_time_ul {
 | |
|     /* if 0 - every day start, others - every month start. BCD format */
 | |
|     uint8_t               day;
 | |
|     /* BCD format */
 | |
|     uint8_t               hour;
 | |
|     /* BCD format */
 | |
|     uint8_t               minute;
 | |
|     uint8_t               rsvd;
 | |
| } spg_afn03_fnb1_query_auto_start_time_ul_t;
 | |
| 
 | |
| /* query pm score information down link */
 | |
| typedef struct _spg_afn03_fnb2_query_pm_score_info_dl {
 | |
|     /* start query index of the secondary node, start from 1 */
 | |
|     uint16_t              start_index;
 | |
|     /* count of the secondary node to be queried */
 | |
|     uint8_t               count;
 | |
| } spg_afn03_fnb2_query_pm_score_info_dl_t;
 | |
| 
 | |
| /* pm score information */
 | |
| typedef struct _spg_pm_score_info {
 | |
|     /* power meter mac address, little endian */
 | |
|     uint8_t               pm_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* assessment score */
 | |
|     uint8_t               score;
 | |
|     /* trouble data item */
 | |
|     uint32_t              err_bm;
 | |
| } spg_pm_score_info_t;
 | |
| 
 | |
| /* query pm score information up link */
 | |
| typedef struct _spg_afn03_fnb2_query_pm_score_info_ul {
 | |
|     /* total count of the secondary node */
 | |
|     uint16_t              total_count;
 | |
|     /* current ack count of the secondary node */
 | |
|     uint8_t               ack_node_count;
 | |
|     /* score info of the secondary node */
 | |
|     spg_pm_score_info_t   node_info[0];
 | |
| } spg_afn03_fnb2_query_pm_score_info_ul_t;
 | |
| 
 | |
| /* set CCO address down link request*/
 | |
| typedef struct _spg_afn04_fn01_set_cco_addr_dl {
 | |
|     /* cco address */
 | |
|     uint8_t      mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_afn04_fn01_set_cco_addr_dl_t;
 | |
| 
 | |
| /* add secondary node down link request */
 | |
| typedef struct _spg_afn04_fn02_add_sec_node_dl {
 | |
|     /* count of the secondary node to be added */
 | |
|     uint8_t     sec_node_count;
 | |
|     /* mac address list of the secondary node to be added */
 | |
|     uint8_t     mac_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn04_fn02_add_sec_node_dl_t;
 | |
| 
 | |
| /* remove secondary node down link request */
 | |
| typedef struct _spg_afn04_fn03_rm_sec_node_dl {
 | |
|     /* count of the secondary node to be removed */
 | |
|     uint8_t     sec_node_count;
 | |
|     /* mac address list of the secondary node to be removed */
 | |
|     uint8_t     mac_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn04_fn03_rm_sec_node_dl_t;
 | |
| 
 | |
| /* set report event down link request */
 | |
| typedef struct _spg_afn04_fn04_set_sec_node_rpt_dl {
 | |
|     /* 1 - allow report event, 0 - not allow report event  */
 | |
|     uint8_t     rpt_allowed;
 | |
| } spg_afn04_fn04_set_sec_node_rpt_dl_t;
 | |
| 
 | |
| /* add meter mapping request */
 | |
| typedef struct _spg_afn04_fn07_add_node_mapping_dl {
 | |
|     /* add meter mapping count this time */
 | |
|     uint8_t      node_cnt;
 | |
|     /* meter mapping info */
 | |
|     spg_meter_mapping_info_t meter_mapping_info[0];
 | |
| } spg_afn04_fn07_add_meter_mapping_dl_t;
 | |
| 
 | |
| /* start tsfm detect request */
 | |
| typedef struct _spg_afn04_fn80_start_tsfm_detect {
 | |
|     /* broadcast transformer feature time, unit is 1min */
 | |
|     uint16_t     tsfm_feature_bcast_time;
 | |
|     /* reserved */
 | |
|     uint8_t      reserved;
 | |
| } spg_afn04_fn80_start_tsfm_detect_t;
 | |
| 
 | |
| /* set frequency enable flag and threshold value */
 | |
| typedef struct _spg_afn04_fnb0_set_flag_and_threshold {
 | |
|     /* flag to mark if score report enable */
 | |
|     uint8_t              flag_enable;
 | |
|     /* score report threshold value, BIN format */
 | |
|     uint8_t              threshold;
 | |
| } spg_afn04_fnb0_set_flag_and_threshold_t;
 | |
| 
 | |
| /* set auto start time */
 | |
| typedef struct _spg_afn04_fnb1_set_auto_start_time {
 | |
|     /* if 0 - every day start, others - every month start. BCD format */
 | |
|     uint8_t              day;
 | |
|     /* BCD format */
 | |
|     uint8_t              hour;
 | |
|     /* BCD format */
 | |
|     uint8_t              minute;
 | |
|     uint8_t              rsvd;
 | |
| } spg_afn04_fnb1_set_auto_start_time_t;
 | |
| 
 | |
| /* report task data to cctt */
 | |
| typedef struct _spg_afn05_fn01_rpt_task_data_ul {
 | |
|     /* task id */
 | |
|     uint16_t    task_id;
 | |
|     /* length of the task data */
 | |
|     uint8_t     data_len;
 | |
|     /* task data */
 | |
|     uint8_t     data[0];
 | |
| } spg_afn05_fn01_rpt_task_data_ul_t;
 | |
| 
 | |
| /* score event report data in 645 */
 | |
| typedef struct _spg_score_645_data_t {
 | |
|     /* assessment score */
 | |
|     uint8_t     score;
 | |
|     /* trouble data item */
 | |
|     uint32_t    err_bm;
 | |
| } spg_score_645_data_t;
 | |
| 
 | |
| /* score event report data filed in 645 */
 | |
| typedef struct _spg_score_evt_645_data_field {
 | |
|     /* data unit id */
 | |
|     uint8_t      di;
 | |
|     /* data */
 | |
|     uint8_t      data[0];
 | |
| } spg_score_evt_645_data_field_t;
 | |
| 
 | |
| /* data fields in 645 */
 | |
| typedef struct spg_power_rpt_evt_ul_645_data_gz {
 | |
|     /* length of the event report data */
 | |
|     uint8_t     evt_type;
 | |
|     /* event report data */
 | |
|     uint8_t     data[0];
 | |
| } spg_power_rpt_evt_ul_645_data_gz_t;
 | |
| 
 | |
| /* power event rpt data */
 | |
| typedef struct _spg_power_rpt_evt_data_gd {
 | |
|     /* dev type, see PROTO_SPG_DEV_TYPE_XXX */
 | |
|     uint8_t     dev_type;
 | |
|     /* pm addr, little endian */
 | |
|     uint8_t     mac[IOT_MAC_ADDR_LEN];
 | |
| } spg_power_rpt_evt_data_gd_t;
 | |
| 
 | |
| /* power event rpt data fields */
 | |
| typedef struct _spg_power_evt_rpt_data_field_gd {
 | |
|     /* power event type, see PROTO_SPG_EVENT_POWER_XXX */
 | |
|     uint8_t     evt_type;
 | |
|     /* event report data */
 | |
|     uint8_t     data[0];
 | |
| } spg_power_evt_rpt_data_field_gd_t;
 | |
| 
 | |
| /* report event to cctt */
 | |
| typedef struct _spg_afn05_fn02_rpt_evt_ul {
 | |
|     /* length of the event report data */
 | |
|     uint8_t     data_len;
 | |
|     /* event report data */
 | |
|     uint8_t     data[0];
 | |
| } spg_afn05_fn02_rpt_evt_ul_t;
 | |
| 
 | |
| /* report secondary node info up link */
 | |
| typedef struct _spg_afn05_fn03_rpt_sec_node_ul {
 | |
|     /* report count of the secondary node current */
 | |
|     uint8_t     sec_node_count;
 | |
|     /* mac address list of the secondary node to be reported */
 | |
|     uint8_t     mac[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn05_fn03_rpt_sec_node_ul_t;
 | |
| 
 | |
| /* report task data to cctt */
 | |
| typedef struct _spg_afn05_fn05_rpt_task_status_ul {
 | |
|     /* task id */
 | |
|     uint16_t    task_id;
 | |
|     /* sec node mac addr */
 | |
|     uint8_t     mac[IOT_MAC_ADDR_LEN];
 | |
|     /* task exe status */
 | |
|     uint8_t     exe_status;
 | |
| } spg_afn05_fn05_rpt_task_status_ul_t;
 | |
| 
 | |
| /* report collection task status */
 | |
| typedef struct _spg_afn05_fn06_rpt_clct_task_status_ul {
 | |
|     /* clct task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* sec node mac addr */
 | |
|     uint8_t     mac[IOT_MAC_ADDR_LEN];
 | |
|     /* collection task status, see PROTO_SPG_CLCT_TASK_STATUS_XXX */
 | |
|     uint8_t     clct_task_status;
 | |
| } spg_afn05_fn06_rpt_clct_task_status_ul_t;
 | |
| 
 | |
| /* report collection data read task status */
 | |
| typedef struct _spg_afn05_fn07_rpt_clct_data_read_status_ul {
 | |
|     /* clct task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* collection task sn */
 | |
|     uint8_t     clct_task_sn;
 | |
|     /* sec node mac addr */
 | |
|     uint8_t     mac[IOT_MAC_ADDR_LEN];
 | |
|     /* read collection task data status, see PROTO_SPG_CLCT_READ_STATUS_XXX */
 | |
|     uint8_t     read_data_status;
 | |
| } spg_afn05_fn07_rpt_clct_data_read_status_ul_t;
 | |
| 
 | |
| /* collection read task data */
 | |
| typedef struct _spg_clct_read_task_data {
 | |
|     /* datagram control code */
 | |
|     uint8_t     fn;
 | |
|     /* this data as same as 645 data */
 | |
|     uint8_t     data[0];
 | |
|     /* There is a CS check behind the data
 | |
|      * check from data
 | |
|      */
 | |
|     //uint8_t     cs;
 | |
| } spg_clct_read_task_data_t;
 | |
| 
 | |
| /* report collection read task data */
 | |
| typedef struct _spg_afn05_fn08_rpt_clct_read_task_data_ul {
 | |
|     /* collection task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* collection task sn */
 | |
|     uint8_t     clct_task_sn;
 | |
|     /* this CRC as same as add task CRC */
 | |
|     uint16_t    crc;
 | |
|     /* collection read task data */
 | |
|     //spg_clct_read_task_data_t     read_task_data[0];
 | |
| } spg_afn05_fn08_rpt_clct_read_task_data_ul_t;
 | |
| 
 | |
| typedef struct _spg_afn05_fn80_tsfm_info_rpt {
 | |
|     /* sec node addr */
 | |
|     uint8_t     pm_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* device type */
 | |
|     uint8_t     dev_type;
 | |
|     /* power meter count of collector connected */
 | |
|     uint8_t     pm_cnt;
 | |
|     /* the major addr of same transformer */
 | |
|     uint8_t     tsfm_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* reserved */
 | |
|     uint16_t    reserved;
 | |
|     /* power meter node addr info if device type is collector */
 | |
|     uint8_t     node_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn05_fn80_tsfm_info_rpt_t;
 | |
| 
 | |
| /* report power event to cctt */
 | |
| typedef struct _spg_afn05_fn81_node_evt_rpt {
 | |
|     /* device type, see IOT_SG_CCO_DEV_TYPE_XXX */
 | |
|     uint8_t             dev_type;
 | |
|     /* proto type */
 | |
|     uint8_t             proto_type;
 | |
|     /* length of the event report data */
 | |
|     uint8_t             data_len;
 | |
|     /* event report data */
 | |
|     uint8_t             data[0];
 | |
| }spg_afn05_fn81_node_evt_rpt;
 | |
| 
 | |
| typedef struct _spg_afn06_fn01_correct_time {
 | |
|     uint8_t         sec;
 | |
|     uint8_t         min;
 | |
|     uint8_t         hour;
 | |
|     uint8_t         day;
 | |
|     uint8_t         mon;
 | |
|     uint8_t         year_l;
 | |
| } spg_afn06_fn01_correct_time_t;
 | |
| 
 | |
| /* upgrade data down link request */
 | |
| typedef struct _spg_afn07_fn02_trans_file_dl_data_t {
 | |
|     /* file segment index */
 | |
|     uint16_t   index;
 | |
|     /* file length */
 | |
|     uint16_t   length;
 | |
|     /* segment data */
 | |
|     uint8_t    data[0];
 | |
| } spg_afn07_fn02_trans_file_dl_data_t;
 | |
| 
 | |
| /* 16 bits crc value of the upgrade data down link request */
 | |
| typedef struct _spg_afn07_fn02_trans_file_dl_crc_t {
 | |
|     /* 16 bits crc value of segment */
 | |
|     uint16_t   crc16;
 | |
| } spg_afn07_fn02_trans_file_dl_crc_t;
 | |
| 
 | |
| /* start upgrade down link request */
 | |
| typedef struct _spg_afn07_fn01_start_upgrade_dl_t {
 | |
|     /* file type see - PROTO_SPG_UPGRADEFILE_XXX */
 | |
|     uint8_t    type;
 | |
|     /* file identity */
 | |
|     uint8_t    id;
 | |
|     /* detection mac addr */
 | |
|     uint8_t    dest_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* file total segment count */
 | |
|     uint16_t   block_cnt;
 | |
|     /* file size - unit: byte */
 | |
|     uint32_t   file_size;
 | |
|     /* 16 bits crc value of upgrade file */
 | |
|     uint16_t   crc16;
 | |
|     /* window time of upgrade - unit: minute */
 | |
|     uint8_t    time_window;
 | |
| } spg_afn07_fn01_start_upgrade_dl_t;
 | |
| 
 | |
| /* report upgrade file information to cctt */
 | |
| typedef struct _spg_afn07_fn03_rpt_upgrade_info_ul {
 | |
|     /* file type see - PROTO_SPG_UPGRADEFILE_XXX */
 | |
|     uint8_t    type;
 | |
|     /* file identity */
 | |
|     uint8_t    id;
 | |
|     /* detection mac addr */
 | |
|     uint8_t    dest_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* file total segment count */
 | |
|     uint16_t   block_cnt;
 | |
|     /* file size - unit: byte */
 | |
|     uint32_t   file_size;
 | |
|     /* 16 bits crc value of upgrade file */
 | |
|     uint16_t   crc16;
 | |
|     /* received block count */
 | |
|     uint16_t   received_cnt;
 | |
| } spg_afn07_fn03_rpt_upgrade_info_ul_t;
 | |
| 
 | |
| /* report upgrade file information to cctt */
 | |
| typedef struct _spg_afn07_fn04_rpt_upgrade_progress_ul {
 | |
|     /* upgrade progress see - PROTO_SPG_UPGRADE_PROGRESS_XXX */
 | |
|     uint8_t    progress;
 | |
|     /* file identity */
 | |
|     uint8_t    id;
 | |
|     /* upgrade fail count */
 | |
|     uint16_t   fail_cnt;
 | |
| } spg_afn07_fn04_rpt_upgrade_progress_ul_t;
 | |
| 
 | |
| /* report upgrade fail node information to cctt */
 | |
| typedef struct _spg_afn07_fn05_req_upgrade_node_info_dl {
 | |
|     /* req start index */
 | |
|     uint16_t   start_index;
 | |
|     /* current report count */
 | |
|     uint8_t    cur_cnt;
 | |
| } spg_afn07_fn05_req_upgrade_node_info_dl_t;
 | |
| 
 | |
| /* report upgrade fail node information to cctt */
 | |
| typedef struct _spg_afn07_fn05_rpt_upgrade_node_info_ul {
 | |
|     /* total count of upgrade fail */
 | |
|     uint16_t   total_cnt;
 | |
|     /* current report count */
 | |
|     uint8_t    cur_cnt;
 | |
|     /* node mac address */
 | |
|     uint8_t    addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn07_fn05_rpt_upgrade_node_info_ul_t;
 | |
| 
 | |
| /* collection di structure in collection task info for dl/t 645-97 */
 | |
| typedef struct _spg_clct_task_id_97 {
 | |
|     /* control code */
 | |
|     uint8_t     control_code;
 | |
|     /* di of collection data */
 | |
|     uint16_t    di;
 | |
|     /* length of collection data */
 | |
|     uint8_t     len_data;
 | |
| } spg_clct_task_id_97_t;
 | |
| 
 | |
| /* collection di structure in collection task info for dl/t 645-07 */
 | |
| typedef struct _spg_clct_task_id_07 {
 | |
|     /* control code */
 | |
|     uint8_t     control_code;
 | |
|     /* di of collection data */
 | |
|     uint32_t    di;
 | |
|     /* length of collection data */
 | |
|     uint8_t     len_data;
 | |
| } spg_clct_task_id_07_t;
 | |
| 
 | |
| /* collection fn structure in collection task */
 | |
| typedef struct _spg_clct_task_fn {
 | |
|     /* type of pm protocol, see PROTO_SPG_CLCT_TASK_PROTO_TYPE_XXX */
 | |
|     uint16_t    proto_type   :3,
 | |
|     /* type of pm,  see PROTO_SPG_CLCT_TASK_PM_TYPE_XXX */
 | |
|                 meter_type   :2,
 | |
|     /* reserved for future */
 | |
|                 rsvd         :11;
 | |
| } spg_clct_task_fn_t;
 | |
| 
 | |
| /* collection data time structure, Guangdong appendix A.1 */
 | |
| typedef struct _spg_clct_task_data_time {
 | |
|     /* data time, BIN type */
 | |
|     uint16_t    base_min     :6,  /* D0 - D5 */
 | |
|                 base_hour    :5,  /* D6 - D10 */
 | |
|                 base_day     :5;  /* D11 - D15 */
 | |
| } spg_clct_task_data_time_t;
 | |
| 
 | |
| /* collection task info structure in collection task */
 | |
| typedef struct _spg_clct_task_info {
 | |
|     /* task id */
 | |
|     uint8_t     task_id;
 | |
|     /* task control code */
 | |
|     spg_clct_task_fn_t fn;
 | |
|     /* task timout time, uint is 1s */
 | |
|     uint16_t    timeout;
 | |
|     /* collection base time */
 | |
|     spg_clct_task_data_time_t base_time;
 | |
|     /* collection period */
 | |
|     uint8_t     period;
 | |
|     /* cnt of di */
 | |
|     uint8_t     di_cnt;
 | |
|     /* collection data info, see spg_clct_task_id_97_t or
 | |
|      * spg_clct_task_id_07_t base on proto_type.
 | |
|      */
 | |
|     uint8_t     data[0];
 | |
|     /* There is a CRC check behind the data
 | |
|      * CRC check from fn to data
 | |
|      */
 | |
|     //uint16_t  crc;
 | |
| } spg_clct_task_info_t;
 | |
| 
 | |
| /* delete collect task */
 | |
| typedef struct _spg_afn08_fn01_add_clct_task {
 | |
|     /* delete collect task id */
 | |
|     spg_clct_task_info_t    clct_task_info;
 | |
| } spg_afn08_fn01_add_clct_task_t;
 | |
| 
 | |
| /* delete collect task */
 | |
| typedef struct _spg_afn08_fn02_delete_clct_task {
 | |
|     /* delete collect task id */
 | |
|     uint8_t     clct_task_id;
 | |
| } spg_afn08_fn02_delete_clct_task_t;
 | |
| 
 | |
| /* query collection task id up link */
 | |
| typedef struct _spg_afn08_fn03_query_clct_task_id_ul {
 | |
|     /* the module supports the max count of collection tasks */
 | |
|     uint8_t     max_task_cnt;
 | |
|     /* the current count of collection tasks */
 | |
|     uint8_t     cur_task_cnt;
 | |
|     /* clct task id data */
 | |
|     uint8_t     clct_task_id[0];
 | |
| } spg_afn08_fn03_query_clct_task_id_ul_t;
 | |
| 
 | |
| /* query collection task detailed information down link */
 | |
| typedef struct _spg_afn08_fn04_query_clct_task_info_dl {
 | |
|     /* task id */
 | |
|     uint8_t     clct_task_id;
 | |
| } spg_afn08_fn04_query_clct_task_info_dl_t;
 | |
| 
 | |
| /* query collection task detailed information up link */
 | |
| typedef struct _spg_afn08_fn04_query_clct_task_info_ul {
 | |
|     /* task id */
 | |
|     spg_clct_task_info_t    clct_task_info;
 | |
| } spg_afn08_fn04_query_clct_task_info_ul_t;
 | |
| 
 | |
| /* add collection data read task */
 | |
| typedef struct _spg_afn08_fn05_add_clct_data_read_dl {
 | |
|     /* task priority, 0 - hight priority, 3 - low priority */
 | |
|     uint8_t     task_pri    :4,
 | |
|     /* reserved */
 | |
|                 reserved    :4;
 | |
|     /* timeout */
 | |
|     uint16_t    timeout;
 | |
|     /* collection task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* collection task sn */
 | |
|     uint8_t     clct_task_sn;
 | |
|     /* start time */
 | |
|     spg_clct_task_data_time_t   start_time;
 | |
|     /* time count */
 | |
|     uint8_t     time_cnt;
 | |
| } spg_afn08_fn05_add_clct_data_read_dl_t;
 | |
| 
 | |
| /* delete collection data read task */
 | |
| typedef struct _spg_afn08_fn06_del_clct_data_read_dl {
 | |
|     /* task id */
 | |
|     uint8_t     clct_task_id;
 | |
| } spg_afn08_fn06_del_clct_data_read_dl_t;
 | |
| 
 | |
| /* query collection data read task infomation down link */
 | |
| typedef struct _spg_afn08_fn07_query_clct_data_read_info_dl {
 | |
|     /* task id */
 | |
|     uint8_t     clct_task_id;
 | |
| } spg_afn08_fn07_query_clct_data_read_info_dl_t;
 | |
| 
 | |
| /* query collection data read task infomation up link */
 | |
| typedef struct _spg_afn08_fn07_query_clct_data_read_info_ul {
 | |
|     /* task priority, 0 - hight priority, 3 - low priority */
 | |
|     uint8_t     task_pri : 4,
 | |
|     /* reserved */
 | |
|                 reserved : 4;
 | |
|     /* timeout */
 | |
|     uint16_t    timeout;
 | |
|     /* collection task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* collection task sn */
 | |
|     uint8_t     clct_task_sn;
 | |
|     /* start time */
 | |
|     spg_clct_task_data_time_t   start_time;
 | |
|     /* time count */
 | |
|     uint8_t     time_cnt;
 | |
| } spg_afn08_fn07_query_clct_data_read_info_ul_t;
 | |
| 
 | |
| /* query collection task status down link by addr */
 | |
| typedef struct _spg_afn08_fn08_query_clct_task_status_dl {
 | |
|     /* current query secondary node count */
 | |
|     uint8_t     cur_cnt;
 | |
|     /* secondary node mac address */
 | |
|     uint8_t     addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afn08_fn08_query_clct_task_status_dl_t;
 | |
| 
 | |
| /* collection task status data */
 | |
| typedef struct _spg_clct_task_status_data {
 | |
|     /* task id */
 | |
|     uint8_t     clct_task_id;
 | |
|     /* collection task status */
 | |
|     uint8_t     clct_task_status;
 | |
| } spg_clct_task_status_data_t;
 | |
| 
 | |
| /* secondary node collection task status */
 | |
| typedef struct _spg_sec_clct_task_status {
 | |
|     /* secondary node mac address */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
|     /* secondary node collection task count */
 | |
|     uint8_t     clct_task_cnt;
 | |
|     /* collection task status data */
 | |
|     spg_clct_task_status_data_t     status_data[0];
 | |
| } spg_sec_clct_task_status_t;
 | |
| 
 | |
| /* query collection task status ul link */
 | |
| typedef struct _spg_afn08_fn08_query_clct_task_status_ul {
 | |
|     /* current report secondary node count */
 | |
|     uint8_t     cur_cnt;
 | |
|     /* collection task status */
 | |
|     //spg_sec_clct_task_status_t    clct_task_status[0];
 | |
| } spg_afn08_fn08_query_clct_task_status_ul_t;
 | |
| 
 | |
| /* query collection task status down link by index */
 | |
| typedef struct _spg_afn08_fn09_query_clct_task_status_dl {
 | |
|     /* query secondary node start index, starting from 0 */
 | |
|     uint16_t    start_index;
 | |
|     /* secondary node count */
 | |
|     uint8_t     sec_cnt;
 | |
| } spg_afn08_fn09_query_clct_task_status_dl_t;
 | |
| 
 | |
| /* query collection task status ul link */
 | |
| typedef struct _spg_afn08_fn09_query_clct_task_status_ul {
 | |
|     /* current report secondary node count */
 | |
|     uint8_t     cur_cnt;
 | |
|     /* collection task status */
 | |
|     //spg_sec_clct_task_status_t    clct_task_status[0];
 | |
| } spg_afn08_fn09_query_clct_task_status_ul_t;
 | |
| 
 | |
| /* data send dl link */
 | |
| typedef struct _spg_afn22_fn01_data_send_dl {
 | |
|     /* data type, see PROTO_SPG_CTRL_DATA_TYPE_XXX */
 | |
|     uint8_t     data_type;
 | |
|     /* data send param */
 | |
|     uint8_t     data_para[8];
 | |
|     /* data send length */
 | |
|     uint16_t    data_len;
 | |
|     /* send data */
 | |
|     uint8_t     data[0];
 | |
| } spg_afn22_fn01_data_send_dl_t;
 | |
| 
 | |
| /* data send ul link */
 | |
| typedef struct _spg_afn22_fn01_data_send_ul {
 | |
|     /* data type, see PROTO_SPG_CTRL_DATA_TYPE_XXX */
 | |
|     uint8_t     data_type;
 | |
|     /* data send param */
 | |
|     uint8_t     data_para[8];
 | |
|     /* data send length */
 | |
|     uint16_t    data_len;
 | |
|     /* send data */
 | |
|     uint8_t     data[0];
 | |
| } spg_afn22_fn01_data_send_ul_t;
 | |
| 
 | |
| /* node info */
 | |
| typedef struct _spg_ctrl_node_info_t {
 | |
|     /* newwork id */
 | |
|     uint32_t    nid : 24,
 | |
|     /* band id */
 | |
|                 band_id : 8;
 | |
|     /* node mac address : small endian */
 | |
|     uint8_t     addr[IOT_MAC_ADDR_LEN];
 | |
| } spg_ctrl_node_info_t;
 | |
| 
 | |
| /* report scan node information to app */
 | |
| typedef struct _spg_afn41_fn01_rpt_node_info_ul {
 | |
|     /* total count of scan node */
 | |
|     uint8_t      total_cnt;
 | |
|     /* node info */
 | |
|     spg_ctrl_node_info_t node_info[0];
 | |
| } spg_afn41_fn01_rpt_node_info_ul;
 | |
| 
 | |
| /* request connect node down link */
 | |
| typedef struct _spg_afn41_fn02_req_connect_node_dl {
 | |
|     /* req connect node */
 | |
|     uint8_t    addr[IOT_MAC_ADDR_LEN];
 | |
|     /* reserved */
 | |
|     uint16_t   reserved;
 | |
| } spg_afn41_fn02_req_connect_node_dl_t;
 | |
| 
 | |
| /* request connect node down link */
 | |
| typedef struct _spg_afnf0_fn01_req_connect_node_dl {
 | |
|     /* req connect node */
 | |
|     uint8_t    addr[IOT_MAC_ADDR_LEN];
 | |
| } spg_afnf0_fn01_req_connect_node_dl_t;
 | |
| 
 | |
| /* set band up link, for guangzhou protocol */
 | |
| typedef struct _spg_afnf0_fn01_set_band_ul {
 | |
|     /* result, 00 00 00 00 is success, otherwise is fail*/
 | |
|     uint8_t     ret[4];
 | |
| } spg_afnf0_fn01_set_band_ul_t;
 | |
| 
 | |
| typedef struct _spg_afnf0_fnf4_phy_topo_query_dl {
 | |
|     /* query physical topo start index */
 | |
|     uint16_t    start_index;
 | |
|     /* query count */
 | |
|     uint8_t     count;
 | |
| } spg_afnf0_fnf4_phy_topo_query_dl_t;
 | |
| 
 | |
| /* physical topo */
 | |
| typedef struct _spg_phy_topo_node_info {
 | |
|     /* node mac addr, little endian */
 | |
|     uint8_t     mac_addr[IOT_MAC_ADDR_LEN];
 | |
|     /* device type, see PROTO_SPG_BD_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,
 | |
|     /* node phase feature, see PTORO_SPG_SEC_NODE_PHASE_XXX */
 | |
|                 phase_feature       : 2,
 | |
|     /* node phase type, see PROTO_SPG_PHASE_SEQ_XXX */
 | |
|                 phase_type          : 3;
 | |
|     /* proto type, see PROTO_SPG_PROTO_TYPE_XXX */
 | |
|     uint8_t     proto_type          : 3,
 | |
|     /* reserved1 */
 | |
|                 reserved1           : 3,
 | |
|     /* module type, see PROTO_SPG_MODULE_XXX */
 | |
|                 module_type         : 2;
 | |
|     /* reserved2 */
 | |
|     uint8_t     reserved2[15];
 | |
| } spg_phy_topo_node_info_t;
 | |
| 
 | |
| typedef struct _spg_afnf0_fnf4_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 */
 | |
|     spg_phy_topo_node_info_t  node_info[0];
 | |
| } spg_afnf0_fnf4_phy_topo_query_ul_t;
 | |
| 
 | |
| typedef struct _spg_afnf0_fnf5_bd_state_ul {
 | |
|     /* report branch detect state, see PROTO_SPG_BD_STATE_XXX */
 | |
|     uint8_t     rpt_state;
 | |
| } spg_afnf0_fnf5_bd_state_ul_t;
 | |
| 
 | |
| typedef struct _spg_afnf0_fnf6_bd_enable {
 | |
|     /* if enable branch detect, 0 stop branch detect, 1 start branch detect */
 | |
|     uint8_t     enable;
 | |
|     /* reserved */
 | |
|     uint8_t     reserved[5];
 | |
| } spg_afnf0_fnf6_bd_enable_t;
 | |
| 
 | |
| /* transformer detect enable for guangzhou */
 | |
| typedef struct _spg_afnf0_fn10_enable_tsfm {
 | |
|     /* start time */
 | |
|     uint8_t     start_time[PROTO_SPG_DATETIME_LEN];
 | |
|     /* tsfm duration, unit is 1min */
 | |
|     uint16_t    duration;
 | |
|     /* sec node retry count */
 | |
|     uint8_t     retry_cnt;
 | |
|     /* each wait tick is 150ms */
 | |
|     uint8_t     wait_tick_cnt;
 | |
| } spg_afnf0_fn10_enable_tsfm_t;
 | |
| 
 | |
| /* data to response for query build version info */
 | |
| typedef struct _spg_afnf0_fnde_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_SPG_DEVICE_ID_LEN];
 | |
|     /* chip management id */
 | |
|     uint8_t chip_mmid[PROTO_SPG_CHIP_MMID_ID_LEN];
 | |
|     /* 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;
 | |
| }spg_afnf0_fnde_build_ver_info_t;
 | |
| 
 | |
| /* report while list ii count */
 | |
| typedef struct _spg_afnf0_fn13_node_info {
 | |
|     /* while list ii count */
 | |
|     uint16_t        sec_node_num;
 | |
|     /* max while list ii count */
 | |
|     uint16_t        max_sec_node_num;
 | |
| } spg_afnf0_fn13_node_info_t;
 | |
| 
 | |
| /* query while list ii node info */
 | |
| typedef struct _spg_afnf0_fn14_node_info_req {
 | |
|     /* start query index */
 | |
|     uint16_t        start_index;
 | |
|     /* query count */
 | |
|     uint8_t         count;
 | |
| } spg_afnf0_fn14_node_info_req_t;
 | |
| 
 | |
| /* report query while list ii node info result */
 | |
| typedef struct _spg_afnf0_fn14_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 */
 | |
|     /* mac address list of the secondary node */
 | |
|     uint8_t         mac[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afnf0_fn14_node_info_rsp_t;
 | |
| 
 | |
| /* add white list ii node */
 | |
| typedef struct _spg_afnf0_fn15_add_wlii_dl {
 | |
|     /* count of the secondary node to be added */
 | |
|     uint8_t     sec_node_count;
 | |
|     /* mac address list of the secondary node to be added */
 | |
|     uint8_t     mac_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afnf0_fn15_add_wlii_dl_t;
 | |
| 
 | |
| /* remove while list ii node request */
 | |
| typedef struct _spg_afnf0_fn16_rmv_wlii_dl {
 | |
|     /* count of the secondary node to be remove */
 | |
|     uint8_t         sec_node_cnt;
 | |
|     /* mac address list of the secondary node to be remove */
 | |
|     uint8_t         mac_addr[0][IOT_MAC_ADDR_LEN];
 | |
| } spg_afnf0_fn16_rmv_wlii_dl_t;
 | |
| 
 | |
| /* set frequency band parameter */
 | |
| typedef struct _spg_set_freq_band {
 | |
|     uint8_t                     freq_band;
 | |
| } spg_set_freq_band_t;
 | |
| 
 | |
| /* query sec node frequency band information */
 | |
| typedef struct _spg_query_freq_band {
 | |
|     uint8_t                     freq_band;
 | |
| } spg_query_freq_band_t;
 | |
| 
 | |
| #pragma pack(pop)   /* restore the pack status */
 | |
| 
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif /* PROTO_SPG_CCO_H */
 |