2264 lines
82 KiB
C
2264 lines
82 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_645_VENDOR_H
|
|
#define PROTO_645_VENDOR_H
|
|
|
|
#include "iot_utils_api.h"
|
|
#include "iot_sg_sta_tsfm.h"
|
|
#include "iot_sg_proto.h"
|
|
#include "iot_plc_hw_tsfm_api.h"
|
|
#include "proto_645.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* DI of trigger topology */
|
|
#define PROTO_645_EXT_BR2_LAUNCH_START (0x01010004u)
|
|
/* DI of bsrm extend cmd */
|
|
#define PROTO_645_EXT_BSRM_DI_TANS_CMD (0x0101FF21)
|
|
/* DI: read bsrm search table results */
|
|
#define PROTO_645_2007_EXT_READ_SMC_RESULT (0x02810000u)
|
|
|
|
/* DI: cumulative number of Qiedian events */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_QD_NUM (0x03810000u)
|
|
/* DI: records of qiedian event */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_QD_REC_BASE (0x03810001u)
|
|
|
|
/* DI: cumulative number of meter change events */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_PM_CHG_NUM (0x03820000u)
|
|
/* DI: records of meter change event */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_PM_CHG_REC_BASE (0x03820001u)
|
|
|
|
/* DI: records of meter A-phase max valtage base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_A_V_REC_BASE (0x03820100u)
|
|
/* DI: records of meter B-phase max valtage base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_B_V_REC_BASE (0x03820200u)
|
|
/* DI: records of meter C-phase max valtage base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_C_V_REC_BASE (0x03820300u)
|
|
/* DI: records of meter A-phase max current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_A_I_REC_BASE (0x03820400u)
|
|
/* DI: records of meter B-phase max current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_B_I_REC_BASE (0x03820500u)
|
|
/* DI: records of meter C-phase max current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MAX_C_I_REC_BASE (0x03820600u)
|
|
|
|
/* DI: records of meter A-phase min valtage max */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_A_V_REC_BASE (0x03830100u)
|
|
/* DI: records of meter B-phase min valtage max */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_B_V_REC_BASE (0x03830200u)
|
|
/* DI: records of meter C-phase min valtage max */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_C_V_REC_BASE (0x03830300u)
|
|
/* DI: records of meter A-phase min current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_A_I_REC_BASE (0x03830400u)
|
|
/* DI: records of meter B-phase min current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_B_I_REC_BASE (0x03830500u)
|
|
/* DI: records of meter C-phase min current base */
|
|
#define PROTO_645_2007_EXT_BRM_DI_MIN_C_I_REC_BASE (0x03830600u)
|
|
|
|
/* DI of cco read tsfm info command */
|
|
#define PROTO_645_2007_EXT_DI_READ_TSFM_INFO (0x04400001u)
|
|
/* DI of cco write tsfm info command */
|
|
#define PROTO_645_2007_EXT_DI_WRITE_TSFM_INFO (0x04400014u)
|
|
|
|
/* DI: extend 645 protocol to read station version for nw protocol. */
|
|
#define PROTO_645_2007_READ_NW_VER (0x04810001u)
|
|
|
|
/* DI: module basic information read for hunan protocol */
|
|
#define PROTO_645_2007_EXT_HUNAN_BASIC_INFO_READ (0x04900001u)
|
|
/* DI: firmware sha1 check code read for hunan protocol */
|
|
#define PROTO_645_2007_EXT_HUNAN_CHECK_CODE_READ (0x04900002u)
|
|
|
|
/* DI: module basic information read for beijing protocol */
|
|
#define PROTO_645_2007_EXT_BJ_BASIC_INFO_READ (0x04900501u)
|
|
/* DI: firmware sha1 check code read for beijing protocol */
|
|
#define PROTO_645_2007_EXT_BJ_CHECK_CODE_READ (0x04900502u)
|
|
|
|
/* DI: hourly frozen, sigle-phase total active energy data of phase A/B/C */
|
|
#define PROTO_645_2007_EXT_DI_HF_EP_A_B_C_BASE (0x0504FE00u)
|
|
/* DI: daily frozen, sigle-phase total active energy data of phase A/B/C */
|
|
#define PROTO_645_2007_EXT_DI_DF_EP_A_B_C_BASE (0x0506FE00u)
|
|
|
|
/* DI: custom data blocks */
|
|
#define PROTO_645_2007_EXT_CR_EP_DATA_BLOCKS (0x0610FF00u)
|
|
/* DI: A-phase positive active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_POS_A (0x0610FF01u)
|
|
/* DI: A-phase negative active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_NEG_A (0x0610FF02u)
|
|
/* DI: B-phase positive active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_POS_B (0x0610FF03u)
|
|
/* DI: B-phase negative active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_NEG_B (0x0610FF04u)
|
|
/* DI: C-phase positive active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_POS_C (0x0610FF05u)
|
|
/* DI: C-phase negative active energy */
|
|
#define PROTO_645_2007_EXT_CR_EP_NEG_C (0x0610FF06u)
|
|
/* DI: temperature */
|
|
#define PROTO_645_2007_EXT_CR_TEMPERATURE (0x0610FF07u)
|
|
/* DI: humidity */
|
|
#define PROTO_645_2007_EXT_CR_HUMIDITY (0x0610FF08u)
|
|
|
|
/* DI: read curve records current at specified times, time accuracy is 1s */
|
|
#define PROTO_645_2007_EXT_CR_I_A (0x0620FF01u)
|
|
#define PROTO_645_2007_EXT_CR_I_B (0x0620FF02u)
|
|
#define PROTO_645_2007_EXT_CR_I_C (0x0620FF03u)
|
|
#define PROTO_645_2007_EXT_CR_I_ALL (0x0620FF04u)
|
|
|
|
/* DI: extend 645 protocol for tcz read version */
|
|
#define PROTO_645_2007_EXT_DI_TCZ_READ_VER (0x075A4354)
|
|
|
|
/* DI: extend 645 protocol for branch recognition launch for XIONGAN */
|
|
#define PROTO_645_2007_EXT_DI_BR2_LAUNCH_XIONGAN (0x08c0c001)
|
|
/* DI: extend 645 protocol for branch recognition read record for XIONGAN */
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECV_RECORD_XIONGAN (0x08c0c002)
|
|
|
|
/* DI: extend 645 protocol for branch2 recognition clear record for hunan */
|
|
#define PROTO_645_2007_EXT_DI_BR2_CLEAR_HN (0x08c0c000)
|
|
/* DI: extend 645 protocol for branch2 recognition read record for hunan */
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECV_RECORD_HN (0x08c0c001)
|
|
/* DI: extend 645 protocol for branch2 recognition launch */
|
|
#define PROTO_645_2007_EXT_DI_BR2_LAUNCH (0x09080106u)
|
|
/* DI: extend 645 protocol for branch2 recognition read record */
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECV_RECORD (0x09080016u)
|
|
/* DI: extend 645 protocol for branch2 recognition read record */
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECV_RECORD_ZJ (0x09080018u)
|
|
/* DI: extend 645 protocol for branch event read */
|
|
#define PROTO_645_2007_EXT_DI_BR2_EVT_RECORD_ZJ (0x09080500u)
|
|
|
|
/* DI: extend 645 protocol for branch event read for qingdao dingxin */
|
|
#define PROTO_645_2007_EXT_DI_BR2_EVT_RECORD_DX (0x09080600u)
|
|
|
|
/* DI: extend 645 protocol for branch2 recognition launch.
|
|
* only for zhejiang protocol
|
|
*/
|
|
#define PROTO_645_2007_EXT_DI_BR2_LAUNCH_ZJ (0x09080109u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_CNT (0x09080700u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST1 (0x09080701u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST2 (0x09080702u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST3 (0x09080703u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST4 (0x09080704u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST5 (0x09080705u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST6 (0x09080706u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST7 (0x09080707u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST8 (0x09080708u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST9 (0x09080709u)
|
|
#define PROTO_645_2007_EXT_DI_BR2_RECORD_LAST10 (0x0908070Au)
|
|
|
|
/* DI: extend 645 protocol for read station version */
|
|
#define PROTO_645_2007_EXT_DI_READ_VER (0xFF000001u)
|
|
/* DI: extend 645 protocol for set station id information
|
|
* include chip management id and module id.
|
|
*/
|
|
#define PROTO_645_2007_EXT_DI_SET_ID_INFO (0xFF000002u)
|
|
/* DI: extend 645 protocol for read the second station version */
|
|
#define PROTO_645_2007_EXT_DI_READ_VER_2 (0xFF000003u)
|
|
/* DI: event reporting request */
|
|
#define PROTO_645_2007_EXT_DI_EVT_RPT_REQ (0xFF000004u)
|
|
/* DI: set tsfm addr */
|
|
#define PROTO_645_2007_EXT_SET_TSFM_ADDR (0xFF000005u)
|
|
|
|
/* DI: extend 645 protocol for read core temperature */
|
|
#define PROTO_645_2007_EXT_READ_CORE_TEMPERATURE (0xFF000006u)
|
|
|
|
/* DI: extend 645 protocol for ftm uart command */
|
|
#define PROTO_645_2007_EXT_DI_FTM_UART_COMMMAND (0xFF000007u)
|
|
|
|
/* DI: extend 645 protocol for node in neighbor state query */
|
|
#define PROTO_645_2007_EXT_DI_NODE_IN_NEIG (0xFF000008u)
|
|
|
|
/* DI: extend 645 protocol for repeater mac addr */
|
|
#define PROTO_645_2007_EXT_DI_REPEATER_MAC (0xFF000100u)
|
|
|
|
/* DI: extend 645 protocol for branch recognition launch */
|
|
#define PROTO_645_2007_EXT_DI_BR_LAUNCH (0xFF000200u)
|
|
/* DI: extend 645 protocol for branch recognition launch state query */
|
|
#define PROTO_645_2007_EXT_DI_BR_LAUNCH_STATE (0xFF000201u)
|
|
/* DI: extend 645 protocol for branch recognition information query */
|
|
#define PROTO_645_2007_EXT_DI_BR_INFO_QUERY (0xFF000202u)
|
|
/* DI: extend 645 protocol for branch recognition information clean */
|
|
#define PROTO_645_2007_EXT_DI_BR_INFO_CLEAN (0xFF000203u)
|
|
/* DI: extend 645 protocol for branch recognition meter info query */
|
|
#define PROTO_645_2007_EXT_DI_BR_METER_QUERY (0xFF000204u)
|
|
/* DI: extend 645 protocol for branch test */
|
|
#define PROTO_645_2007_EXT_DI_BR_TEST (0xFF000205u)
|
|
/* DI: extend 645 protocol for branch test reault query */
|
|
#define PROTO_645_2007_EXT_DI_BR_TEST_QUERY (0xFF000206u)
|
|
/* DI: extend 645 protocol for transformer detect */
|
|
#define PROTO_645_2007_EXT_DI_TSFM_LAUNCH (0xFF000207u)
|
|
/* DI: extend 645 protocol for transformer detect clear */
|
|
#define PROTO_645_2007_EXT_DI_TSFM_LAUNCH_CLEAR (0xFF000208u)
|
|
/* DI: extend 645 protocol for III collection neighbor node info query
|
|
*/
|
|
#define PROTO_645_2007_EXT_BRM_DI_NEI_NODE_INFO (0xFF00020Au)
|
|
/* DI: extend 645 protocol for neighbor node tsfm info query. only for
|
|
* III connectionless forward to sta
|
|
*/
|
|
#define PROTO_645_2007_EXT_BRM_DI_CONN_NODE_TSFM_INFO (0xFF00020Bu)
|
|
/* DI: extend 645 protocol for branch recognition init */
|
|
#define PROTO_645_2007_EXT_DI_BR_BJ_INIT (0xFF00020Cu)
|
|
/* DI: extend 645 protocol for branch recognition launch */
|
|
#define PROTO_645_2007_EXT_DI_BR_BJ_LAUNCH (0xFF00020Du)
|
|
/* DI: extend 645 protocol for branch recognition information query */
|
|
#define PROTO_645_2007_EXT_DI_BR_BJ_INFO_QUERY (0xFF00020Eu)
|
|
|
|
/* data identification for read mean square of current */
|
|
#define PROTO_645_2007_EXT_DI_I_MS (0xFF000301u)
|
|
|
|
/* data identification for zero cross circuit check */
|
|
#define PROTO_645_2007_EXT_DI_CHECK_ZC (0xFF000302u)
|
|
|
|
/* data identification for event gpio interrupt check */
|
|
#define PROTO_645_2007_EXT_DI_CHECK_EVENT_INTERRUPT (0xFE000303u)
|
|
|
|
/* define III collector extend protocol DI */
|
|
/* data identification for read III collector the MAC address request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_READ_MAC_ADDR (0xFFA00301u)
|
|
/* data identification for read location info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_READ_LOCATION (0xFFA00302u)
|
|
/* data identification for read pm table list info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_READ_PM (0xFFA00303u)
|
|
/* data identification for read run info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_RUN_INFO (0xFFA00304u)
|
|
/* data identification for read humidity request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_READ_HUMIDITY (0xFFA00305u)
|
|
/* data identification for high-precision current RMS */
|
|
#define PROTO_645_2007_EXT_BRM_DI_HP_I (0xFFA00306u)
|
|
/* data identification for high-precision active power RMS */
|
|
#define PROTO_645_2007_EXT_BRM_DI_HP_P (0xFFA00307u)
|
|
/* data identification for high-precision reactive power RMS */
|
|
#define PROTO_645_2007_EXT_BRM_DI_HP_Q (0xFFA00308u)
|
|
/* data identification for high-precision apparent power RMS */
|
|
#define PROTO_645_2007_EXT_BRM_DI_HP_S (0xFFA00309u)
|
|
|
|
/* data identification for set location info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_SET_LOCATION (0xFFA00401u)
|
|
/* data identification for add pm table list info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_ADD_PM (0xFFA00402u)
|
|
/* data identification for del pm table list info request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_DEL_PM (0xFFA00403u)
|
|
|
|
/* data identification for initialization command */
|
|
#define PROTO_645_2007_EXT_BRM_DI_INIT_HARDWARE (0xFFA00404)
|
|
#define PROTO_645_2007_EXT_BRM_DI_INIT_DATA (0xFFA00405)
|
|
/* DI: Terminal alarm event enabling flag bit DL/T 645-2007 */
|
|
#define PROTO_645_2007_EXT_BRM_EVT_CONFIG_EN (0xFFA00406u)
|
|
/* data identification for add pm table list info request from cco */
|
|
#define PROTO_645_2007_EXT_BRM_CCO_ADD_PM (0xFFA00408u)
|
|
/* data identification for correct time. only for
|
|
* III connectionless forward to sta
|
|
*/
|
|
#define PROTO_645_2007_EXT_BRM_CONN_CORRECT (0xFFA00409u)
|
|
|
|
/* DI: Terminal qiedian event config information DL/T 645-2007 */
|
|
#define PROTO_645_2007_EXT_BRM_QIEDIAN_EVT_CONFIG (0xFFA00501u)
|
|
/* data identification for read III collector request basic information */
|
|
#define PROTO_645_2007_EXT_BRM_METER_INFO (0xFFA00503u)
|
|
|
|
/* data identification for get qiedian data request */
|
|
#define PROTO_645_2007_EXT_BRM_DI_GET_QD_DATA (0xFFA00502u)
|
|
|
|
/* one key assembly check request for BRM */
|
|
#define PROTO_645_2007_EXT_BRM_DI_ASS_CHK_REQ (0xFFA00601u)
|
|
/* query assembly check results */
|
|
#define PROTO_645_2007_EXT_BRM_DI_ASS_CHK_QUERY (0xFFA00602u)
|
|
|
|
/* DI: set module id */
|
|
#define PROTO_645_2007_EXT_BRM_SET_MODULE_ID (0xFFA00700u)
|
|
|
|
/* DI: terminal information */
|
|
#define PROTO_645_2007_EXT_BRM_TERMINAL_CFG (0xFFA00800u)
|
|
|
|
/* DI: calibration id */
|
|
/* DI: oneshot calibration request */
|
|
#define PROTO_645_2007_EXT_BRM_ONESHOT_CALI_REQ (0xFFA00900u)
|
|
/* DI: oneshot calibration status query */
|
|
#define PROTO_645_2007_EXT_BRM_ONESHOT_CALI_QUERY (0xFFA00901u)
|
|
/* DI: current ratio coefficient */
|
|
#define PROTO_645_2007_EXT_BRM_CURRENT_COEFF (0xFEA00902u)
|
|
|
|
/* DI: forward data to others sta */
|
|
#define PROTO_645_2007_EXT_BRM_FWD_DATA (0xFFA0A000u)
|
|
/* DI: detect station by different ppm */
|
|
#define PROTO_645_2007_EXT_BRM_PPM_PING (0xFFA0A001u)
|
|
|
|
/* DI: read tsfm info record */
|
|
#define PROTO_645_2007_EXT_BRM_DBG_TSFN_INFO (0xFFA0FD01u)
|
|
|
|
/* DI: redefine cumulative number of Qiedian events */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_QD_NUM2 (0xFFA10000u)
|
|
/* DI: redefine records of qiedian event */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_QD_REC_BASE2 (0xFFA10001u)
|
|
|
|
/* DI: redefine cumulative number of meter change events */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_PM_CHG_NUM2 (0xFFA10100u)
|
|
/* DI: redefine records of meter change event */
|
|
#define PROTO_645_2007_EXT_BRM_DI_EVT_PM_CHG_REC_BASE2 (0xFFA10101u)
|
|
|
|
/* DI: bsrm event nodify */
|
|
#define PROTO_645_2007_EXT_BSRM_DI_EVT_NODIFY (0xFEA20000u)
|
|
|
|
/* DI: bsrm event content query */
|
|
#define PROTO_645_2007_EXT_BSRM_DI_EVT_QUERY (0xFEA20001u)
|
|
|
|
/* DI: bsrm inform event report result */
|
|
#define PROTO_645_2007_EXT_BSRM_DI_EVT_RESP (0xFEA20002u)
|
|
|
|
/* DI: network state sync to device command */
|
|
#define PROTO_645_2007_EXT_NET_STATE_SYNC_DI (0xFEA20003u)
|
|
|
|
/* DI: read or write passcode */
|
|
#define PROTO_645_2007_EXT_PASSCODE_REQ (0xFFFE0001u)
|
|
|
|
/* data identification for query snr rssi */
|
|
#define PROTO_645_2007_EXT_QUERY_SIGNAL_ID (0xFFFFFF01u)
|
|
/* data identification for query production test info */
|
|
#define PROTO_645_2007_EXT_QUERY_PT_INFO (0xFFFFFF02u)
|
|
/* data identification for write compensation ppm from tool */
|
|
#define PROTO_645_2007_EXT_WRITE_TOOL_PPM (0xFFFFFF03u)
|
|
|
|
/* define 645-2007 extend protocol fn */
|
|
/* FN: branch recognition */
|
|
#define PROTO_645_2007_EXT_FN_BR (0x0)
|
|
/* FN: event report */
|
|
#define PROTO_645_2007_EXT_FN_EVT_RPT (0x06)
|
|
/* FN: query ID info */
|
|
#define PROTO_645_2007_EXT_FN_QUERY_ID (0x1f)
|
|
/* FN: set baud for nw 21meter */
|
|
#define PROTO_645_2007_EXT_FN_SET_BAUD (0x1f)
|
|
|
|
/* define 645-2007 extend protocol error code length */
|
|
#define PROTO_645_2007_EXT_QUERY_ID_ERR_LEN (1)
|
|
|
|
/* define 645-2007 extend protocol error code */
|
|
#define PROTO_645_2007_EXT_QUERY_ID_ERR (1)
|
|
|
|
/* define 645-2007 extend protocol ID info type */
|
|
/* ID info type is chip id type */
|
|
#define PROTO_645_2007_EXT_CHIP_ID (0x01)
|
|
/* ID info type is module id type */
|
|
#define PROTO_645_2007_EXT_MODULE_ID (0x02)
|
|
/* ID info type is zc info type */
|
|
#define PROTO_645_2007_EXT_ZC_INFO_ID (0x3A)
|
|
/* ID info type is internal software version type */
|
|
#define PROTO_645_2007_EXT_INTER_VER_ID (0x3B)
|
|
/* ID info type is module id and chip id type */
|
|
#define PROTO_645_2007_EXT_MC_ID (0xF0)
|
|
/* ID info type is station version id type */
|
|
#define PROTO_645_2007_EXT_VER_ID (0xF1)
|
|
/* ID info type is station version 2 id type */
|
|
#define PROTO_645_2007_EXT_VER2_ID (0xF2)
|
|
/* ID info type is station nw version id type */
|
|
#define PROTO_645_2007_EXT_NW_VER_ID (0xF3)
|
|
|
|
/* response version info device id len */
|
|
#define PROTO_645_2007_EXT_DEVICE_ID_LEN (11)
|
|
/* response version info chip management id len */
|
|
#define PROTO_645_2007_EXT_CHIP_MMID_ID_LEN (24)
|
|
|
|
/* response result code for set id information */
|
|
#define ERR_OK_SET_ID_INFO 0
|
|
#define ERR_EXIST_SET_ID_INFO 1
|
|
#define ERR_INVAL_SET_ID_INFO 2
|
|
|
|
/* definition hardware transformer detect response result code */
|
|
#define PROTO_645_2007_EXT_TSFM_RESULT_OK 0
|
|
#define PROTO_645_2007_EXT_TSFM_RESULT_BUSY 1
|
|
|
|
/* definition branch recognition phase type */
|
|
#define PROTO_645_2007_EXT_BRM_PHASE_ALL 0
|
|
#define PROTO_645_2007_EXT_BRM_PHASE_A 1
|
|
#define PROTO_645_2007_EXT_BRM_PHASE_B 2
|
|
#define PROTO_645_2007_EXT_BRM_PHASE_C 3
|
|
|
|
/* defined max phase number for BRM */
|
|
#define PROTO_645_2007_EXT_MAX_PHASE_NUM 3
|
|
|
|
/* define the port where the node is located */
|
|
#define PROTO_645_PORT_RS485 0
|
|
#define PROTO_645_PORT_PLC_WEAK 1
|
|
#define PROTO_645_PORT_PLC 2
|
|
#define PROTO_645_PROT_PLC_WEAK_NOT_SAME_VENDOR 3
|
|
|
|
/* station transformer detect result */
|
|
#define PROTO_645_TSFM_DETECT_RET_UNKNOWN (0)
|
|
#define PROTO_645_TSFM_DETECT_RET_SAME (1)
|
|
#define PROTO_645_TSFM_DETECT_RET_DIFFERENT (2)
|
|
|
|
/* define module version length */
|
|
#define PROTO_645_EXT_MOD_VER_LEN 2
|
|
/* define software version length */
|
|
#define PROTO_645_EXT_SW_VER_LEN 4
|
|
/* define chip version length */
|
|
#define PROTO_645_EXT_CHIP_VER_LEN 4
|
|
/* define humidity data length */
|
|
#define PROTO_645_EXT_HUM_LEN (2)
|
|
/* define high-precision current RMS length -- xxx.xxxxx */
|
|
#define PROTO_645_2007_EXT_BRM_HP_I_LEN (4)
|
|
/* define high-precision power RMS length -- xx.xxxxxx */
|
|
#define PROTO_645_2007_EXT_BRM_HP_P_LEN (4)
|
|
|
|
/* define branch recognition repeat max cnt */
|
|
#define PROTO_645_EXT_BRM_REPEAT_CNT_MAX 5
|
|
|
|
/* tsfm sign send retry cnt */
|
|
#define PROTO_645_EXT_TSFM_SEND_REPEAT_CNT_DEF 2
|
|
#define PROTO_645_EXT_TSFM_SEND_REPEAT_CNT_MAX 4
|
|
|
|
/* tsfm sign send interval time, uint is 1s,
|
|
* set to 600 by default if the received value is
|
|
* less than 400 or greater than 900.
|
|
* */
|
|
#define PROTO_645_EXT_TSFM_SEND_INTERVAL_MIN 400
|
|
#define PROTO_645_EXT_TSFM_SEND_INTERVAL_DEF 600
|
|
#define PROTO_645_EXT_TSFM_SEND_INTERVAL_MAX 900
|
|
|
|
/* define switch band response data len */
|
|
#define PROTO_645_EXT_BADN_SWITCH_DATA_LEN 8
|
|
|
|
/* event reporting request message marked magic number */
|
|
#define PROTO_645_EXT_EVT_RPT_REQ_MARK (0xA2D5B13F)
|
|
|
|
/* define wiring status */
|
|
#define PROTO_645_EXT_BRM_ASS_WIRE_OK 0
|
|
/* negative power, two possibilities:
|
|
* 1. CT reverse connection
|
|
* 2. voltage line sequence and current line sequence is not match
|
|
*/
|
|
#define PROTO_645_EXT_BRM_ASS_WIRE_ERR1 1
|
|
/* current line sequence error or the voltage terminal is not connected */
|
|
#define PROTO_645_EXT_BRM_ASS_WIRE_ERR2 2
|
|
/* cannot receive branch signal */
|
|
#define PROTO_645_EXT_BRM_ASS_WIRE_ERR3 3
|
|
|
|
/* define the assembly check mode under PLC connection mode */
|
|
#define PROTO_645_EXT_BRM_ASS_CHK_PLC_MODE_SAME 0 /* same network */
|
|
#define PROTO_645_EXT_BRM_ASS_CHK_PLC_MODE_DIFF 1 /* different networks */
|
|
|
|
/* define the assembly check band under PLC connection mode */
|
|
#define PROTO_645_EXT_BRM_ASS_CHK_PLC_BAND_2 0 /* use PLC_LIB_FREQ_BAND_2 */
|
|
#define PROTO_645_EXT_BRM_ASS_CHK_PLC_BAND_1 1 /* use PLC_LIB_FREQ_BAND_1 */
|
|
#define PROTO_645_EXT_BRM_ASS_CHK_PLC_BAND_8 2 /* use PLC_LIB_FREQ_BAND_8 */
|
|
|
|
/* branch2 transmit type:
|
|
* 0: module deals with sending signals, not transmitting through,
|
|
* 1: module is not processed and is transmitted through to the device,
|
|
* 2: Module processing and transmitting to equipment.
|
|
*/
|
|
#define PROTO_645_EXT_BR2_HANDLE 0
|
|
#define PROTO_645_EXT_BR2_TRANS 1
|
|
#define PROTO_645_EXT_BR2_HANDLE_AND_TRANS 2
|
|
|
|
/* define branch2 interval of tsfm topo repeat, uint is 1s. */
|
|
#define PROTO_645_EXT_TOPO_REPEAT_INTERVAL 160
|
|
|
|
/* define oneshot calibration status value. */
|
|
#define PROTO_645_ONESHOT_CALIBRATION_IDLE 0
|
|
#define PROTO_645_ONESHOT_CALIBRATION_DOING 1
|
|
#define PROTO_645_ONESHOT_CALIBRATION_SUCCESS 2
|
|
#define PROTO_645_ONESHOT_CALIBRATION_FAIL 3
|
|
|
|
/* define oneshot calibration fail code. */
|
|
#define PROTO_645_ONESHOT_CALIBRATION_FAIL_NONE 0
|
|
#define PROTO_645_ONESHOT_CALIBRATION_FAIL_INIT 1
|
|
#define PROTO_645_ONESHOT_CALIBRATION_FAIL_REG 2
|
|
#define PROTO_645_ONESHOT_CALIBRATION_FAIL_SAVE 3
|
|
|
|
/* defien firmware check address len */
|
|
#define PROTO_645_EXT_CHECK_ADDR_lEN 4
|
|
|
|
/* define branch recognition invalid energy value */
|
|
#define PROTO_645_EXT_BRM_INVALID_ENERGY (0xFFFF)
|
|
|
|
/* define feature current signal modulate pulse signal frequence data length */
|
|
#define PROTO_645_EXT_FC_PULSE_FREQ_LEN 3
|
|
|
|
/* define ZJ event read reserved length */
|
|
#define PROTO_645_EXT_EVT_READ_RESERVE_LEN_ZJ 12
|
|
|
|
/* define qingdao dingxin branch detect identification code length */
|
|
#define PROTO_645_EXT_BRANCH_ID_CODE_DX 4
|
|
|
|
/* define bsrm extend cmd fn */
|
|
/* write current ratio coefficient FN */
|
|
#define PROTO_645_EXT_BSRM_TANS_CMD_FN_W_CT_COEFF (0x05)
|
|
/* read current ratio coefficient FN */
|
|
#define PROTO_645_EXT_BSRM_TANS_CMD_FN_R_CT_COEFF (0x06)
|
|
|
|
#define PROTO_645_EXT_CHECK_FN_REQ (0)
|
|
#define PROTO_645_EXT_CHECK_FN_QUERY (1)
|
|
|
|
#define PROTO_645_EXT_CHECK_EVENT_SUCCESS (0)
|
|
#define PROTO_645_EXT_CHECK_EVENT_RUNNING (1)
|
|
#define PROTO_645_EXT_CHECK_EVENT_NOSUPPORT (2)
|
|
#define PROTO_645_EXT_CHECK_EVENT_FAIL (4)
|
|
|
|
#define PROTO_645_EXT_BRANCH_ENERGY_BCD_LEN_HN (3)
|
|
#define PROTO_645_EXT_BRANCH_CODE_LEN_HN (2)
|
|
|
|
#define PROTO_645_EXT_BRM_PPM_PING_RSVD_LEN (247)
|
|
|
|
/* define load capacity: */
|
|
/* constant resistance mode with peak value of 2000 mA */
|
|
#define PROTO_645_EXT_BR_LOAD_CAP_2000MA (2)
|
|
/* constant current mode with peak value of 400mA */
|
|
#define PROTO_645_EXT_BR_LOAD_CAP_400MA (1)
|
|
|
|
/* define bsrm event report result value */
|
|
/* define bsrm event report succeed */
|
|
#define PROTO_645_EXT_BSRM_EVT_RPT_SUCCEED (0)
|
|
/* define bsrm event report overtime */
|
|
#define PROTO_645_EXT_BSRM_EVT_RPT_TIMEOUT (1)
|
|
|
|
/* define bsrm power meter proto type id. */
|
|
#define PROTO_645_EXT_BSRM_PM_DATA_TYPE_64507 (2)
|
|
#define PROTO_645_EXT_BSRM_PM_DATA_TYPE_69845 (3)
|
|
|
|
/* define the maximum supported node number of 645 extension protocol,
|
|
* only for Beijing.
|
|
*/
|
|
#define PROTO_645_EXT_BR_BJ_NODE_ID_MAX (2047)
|
|
|
|
/* maximum characteristics bit during time for Beijing br protocol,
|
|
* uint is 1ms.
|
|
*/
|
|
#define PROTO_645_EXT_BR_BJ_CHARA_BIT_DUR_MAX (600)
|
|
|
|
/* default characteristics bit during time for Beijing br protocol,
|
|
* uint is 1ms.
|
|
*/
|
|
#define PROTO_645_EXT_BR_BJ_CHARA_BIT_DUR_DEFAULT (300)
|
|
|
|
/* define network state sync value */
|
|
#define PROTO_645_EXT_NET_STATE_OFFLINE_WITH_POWER_ON (0)
|
|
#define PROTO_645_EXT_NET_STATE_ONLINE (1)
|
|
#define PROTO_645_EXT_NET_STATE_OFFLINE (2)
|
|
|
|
/* define network state sync function */
|
|
#define PROTO_645_EXT_NET_STATE_SYNC_FN (0x1E)
|
|
|
|
/* define query id infomation data field len */
|
|
#define PROTO_645_EXT_QUERY_ID_DATA_LEN 1
|
|
|
|
/* define ftm uart command */
|
|
#define PROTO_646_EXT_FTM_UART_CMD_FIX_BAUD (0x00)
|
|
#define PROTO_646_EXT_FTM_UART_CMD_SWITCH_FTM_MODE (0x01)
|
|
|
|
/* define factory test function code */
|
|
#define PROTO_645_EXT_FT_MODE_GET_CHIP_MMID (0x44)
|
|
#define PROTO_645_EXT_FT_MODE_SET_CHIP_MMID (0x43)
|
|
#define PROTO_645_EXT_FT_MODE_ZC_CHECK (0x3A)
|
|
#define PROTO_645_EXT_FT_MODE_GET_SW_VER (0x3B)
|
|
#define PROTO_645_EXT_FT_MODE_SET_COMM_ADDR (0x86)
|
|
#define PROTO_645_EXT_FT_MODE_GET_COMM_ADDR (0x87)
|
|
|
|
/* define factory test zero-crossing detection mode */
|
|
#define PROTO_645_EXT_ZC_CLCT_MODE_FALLING (1)
|
|
#define PROTO_645_EXT_ZC_CLCT_MODE_RISING (2)
|
|
|
|
/* define factory test meter phase types */
|
|
#define PROTO_645_EXT_ZC_METER_PHASE_SINGLE (1)
|
|
#define PROTO_645_EXT_ZC_METER_PHASE_THREE (2)
|
|
|
|
#define PROTO_645_EXT_ZC_PHASE_COUNT (3)
|
|
|
|
#pragma pack(push) /* save the pack status */
|
|
#pragma pack(1) /* 1 byte align */
|
|
|
|
/* modular id information and chip management id information */
|
|
typedef struct _proto_645_ext_mc_id_info {
|
|
/* modular id */
|
|
uint8_t mod_id[PROTO_645_2007_EXT_DEVICE_ID_LEN];
|
|
/* chip management id */
|
|
uint8_t chip_mmid[PROTO_645_2007_EXT_CHIP_MMID_ID_LEN];
|
|
} proto_645_ext_mc_id_info_t;
|
|
|
|
/* request for set sta id information */
|
|
typedef struct _proto_645_ext_set_id_info_req {
|
|
/* id type, see PROTO_645_2007_EXT_XXX_ID */
|
|
uint8_t id_type;
|
|
/* id information data len, unit is byte */
|
|
uint8_t data_len;
|
|
/* data, when id_type is PROTO_645_2007_EXT_MC_ID
|
|
* data structure is proto_645_ext_mc_id_info_t.
|
|
*/
|
|
uint8_t data[0];
|
|
} proto_645_ext_set_id_info_req_t;
|
|
|
|
/* device MAC address */
|
|
typedef struct _proto_645_ext_mac_addr {
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_mac_addr_t;
|
|
|
|
/* response for set sta id information */
|
|
typedef struct _proto_645_ext_set_id_info_rsp {
|
|
/* set result, see ERR_XXX_SET_ID_INFO */
|
|
uint8_t ret;
|
|
} proto_645_ext_set_id_info_rsp_t;
|
|
|
|
/* response tcz version info payload */
|
|
typedef struct _proto_645_ext_read_tcz_ver_rsp {
|
|
/* vendor id */
|
|
uint16_t vendor_id;
|
|
/* chip type */
|
|
uint8_t chip_type;
|
|
/* module type */
|
|
uint8_t module_type;
|
|
/* build day */
|
|
uint8_t day;
|
|
/* build month */
|
|
uint8_t month;
|
|
/* build year */
|
|
uint8_t year;
|
|
/* external software version. BCD format. range from 0 - 9999 */
|
|
uint16_t sw_ver;
|
|
} proto_645_ext_read_tcz_ver_rsp_t;
|
|
|
|
/* response version info payload */
|
|
typedef struct _proto_645_ext_read_ver_rsp {
|
|
/* 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_645_2007_EXT_DEVICE_ID_LEN];
|
|
/* chip management id */
|
|
uint8_t chip_mmid[PROTO_645_2007_EXT_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,
|
|
/* reserve for future */
|
|
reserve : 5;
|
|
/* hardware version */
|
|
uint32_t hw_ver;
|
|
/* module mac address */
|
|
uint8_t mod_addr[IOT_MAC_ADDR_LEN];
|
|
/* user type, see USER_TYPE_XXX */
|
|
uint8_t user_type;
|
|
} proto_645_ext_read_ver_rsp_t;
|
|
|
|
/* read tsfm info response */
|
|
typedef struct _proto_645_ext_tsfm_info_to_cco {
|
|
/* di of tsfm info */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* tsfm info */
|
|
iot_sg_sta_tsfm_chip_info_t tsfm_info;
|
|
/* type of node */
|
|
uint8_t type[3];
|
|
/* reserve for future */
|
|
uint8_t reserve_0[12];
|
|
/* parent node address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* reserve for future */
|
|
uint8_t reserve_1[27];
|
|
} proto_645_ext_tsfm_info_to_cco_t;
|
|
|
|
/* read parent node address response */
|
|
typedef struct _proto_645_ext_parent_addr_to_cco {
|
|
/* di of tsfm info */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* parent node address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_parent_addr_to_cco_t;
|
|
|
|
/* response chip id info payload */
|
|
typedef struct _proto_645_ext_query_chip_id_rsp {
|
|
/* id info type */
|
|
uint8_t info_type;
|
|
/* id info len */
|
|
uint8_t info_len;
|
|
/* chip id info */
|
|
uint8_t chip_mmid[PROTO_645_2007_EXT_CHIP_MMID_ID_LEN];
|
|
} proto_645_ext_query_chip_id_rsp_t;
|
|
|
|
/* response module id info payload */
|
|
typedef struct _proto_645_ext_query_module_id_rsp {
|
|
/* id info type */
|
|
uint8_t info_type;
|
|
/* id info len */
|
|
uint8_t info_len;
|
|
/* module id info */
|
|
uint8_t dev_id[PROTO_645_2007_EXT_DEVICE_ID_LEN];
|
|
} proto_645_ext_query_module_id_rsp_t;
|
|
|
|
/* branch2 recognition launch payload */
|
|
typedef struct _proto_645_ext_br2_launch {
|
|
/* trans type, see PROTO_645_EXT_BR2_XXX. */
|
|
uint8_t trans_type;
|
|
/* time - BCD code, if receiving time is full FF, indicating that the
|
|
* signal is sent immediately. There is no need to set the time.
|
|
*/
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* sequence number */
|
|
uint16_t sn;
|
|
/* code len */
|
|
uint8_t code_len;
|
|
/* code data */
|
|
uint8_t code[0];
|
|
} proto_645_ext_br2_launch_t;
|
|
|
|
/* trigger topology */
|
|
typedef struct _proto_645_ext_br2_launch_fn {
|
|
/* Send interval(reserve): 00 BIN.*/
|
|
uint8_t interval;
|
|
/* code len */
|
|
uint8_t code_len;
|
|
/* code data */
|
|
uint8_t code[0];
|
|
}proto_645_ext_br2_launch_fn_t;
|
|
|
|
/* branch2 recognition launch payload */
|
|
typedef struct _proto_645_ext_br2_pulse_width {
|
|
/* signal high level pulse width, uint is 1us. */
|
|
uint16_t high_level;
|
|
/* signal low level pulse width, uint is 1us. */
|
|
uint16_t low_level;
|
|
} proto_645_ext_br2_pulse_width_t;
|
|
|
|
/* branch2 recognition result */
|
|
typedef struct _proto_645_ext_br2_launch_result {
|
|
/* sequence number */
|
|
uint16_t sn;
|
|
/* roll call time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
} proto_645_ext_br2_launch_result_t;
|
|
|
|
/* location information */
|
|
typedef struct _proto_645_ext_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;
|
|
} proto_645_ext_location_unit_t;
|
|
|
|
/* meter descriptor version 0 of meter box */
|
|
typedef struct _proto_645_ext_br_pm_info_v0 {
|
|
/* pm mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_br_pm_info_v0_t;
|
|
|
|
/* meter descriptor version 1 of meter box */
|
|
typedef struct _proto_645_ext_br_pm_info_v1 {
|
|
/* pm mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* CT ratio, uint is x1 */
|
|
uint16_t i_ratio;
|
|
/* PT ratio, uint is x1 */
|
|
uint8_t v_ratio;
|
|
/* reserved for further use */
|
|
uint8_t rsvd[2];
|
|
} proto_645_ext_br_pm_info_v1_t;
|
|
|
|
/* branch recognition meter information response */
|
|
typedef struct _proto_645_ext_br_meter_info_rsp {
|
|
/* longitude */
|
|
proto_645_ext_location_unit_t longitude;
|
|
/* latitude */
|
|
proto_645_ext_location_unit_t latitude;
|
|
/* branch recognition data block total */
|
|
uint8_t data_block_total;
|
|
/* response data block sequence */
|
|
uint8_t data_block_seq : 6,
|
|
/* meter descriptor version, see PROTO_645_EXT_BR_PM_INFO_XXX */
|
|
ver : 2;
|
|
/* data len */
|
|
uint8_t data_len;
|
|
/* total meter conut */
|
|
uint16_t total_cnt;
|
|
/* reprot meter count */
|
|
uint8_t rpt_cnt;
|
|
/* power meter info */
|
|
uint8_t data[0];
|
|
} proto_645_ext_br_meter_info_rsp_t;
|
|
|
|
/* branch recognition clear launch response */
|
|
typedef struct _proto_645_ext_br_clear_rsp {
|
|
/* flag to mark if the device has branch signal receiving capability */
|
|
uint8_t br_ident : 1,
|
|
/* reserved for future */
|
|
rsvd1 : 7;
|
|
/* supported sending modes, see IOT_PLC_HW_TSFM_MODE_XXX */
|
|
uint8_t send_supp_mode;
|
|
/* reserved for future */
|
|
uint8_t rsvd2[6];
|
|
} proto_645_ext_br_clear_rsp_t;
|
|
|
|
/* branch detect send stage rspond data when rsp->formate 1 */
|
|
typedef struct _proto_645_ext_br_send_rsp {
|
|
/* use send mode see IOT_PLC_HW_TSFM_SEND_MODE_XXX */
|
|
uint8_t send_mode;
|
|
/* load capacity, see PROTO_645_EXT_BR_LOAD_CAP_XXX*/
|
|
uint8_t load_capacity;
|
|
/* reserved */
|
|
uint8_t rsvd[14];
|
|
} proto_645_ext_br_send_rsp_t;
|
|
|
|
/* branch recognition response cache data */
|
|
typedef struct _proto_645_ext_br_rsp_cache {
|
|
/* DI */
|
|
uint32_t di;
|
|
/* response result, see PROTO_645_2007_EXT_BR_RESULT_XXX */
|
|
uint8_t result :4,
|
|
/* data format. 0 mean data structure is bitmap format,
|
|
* see proto_645_ext_br_info_rsp_t. 1 mean data structure is energy list,
|
|
* see proto_645_ext_br_energy_rsp_t.
|
|
*/
|
|
format :1,
|
|
/* reserved */
|
|
reserved :3;
|
|
/* recognition response data len */
|
|
uint8_t data_len;
|
|
/* target mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* recognition response data */
|
|
uint8_t *data;
|
|
} proto_645_ext_br_rsp_cache_t;
|
|
|
|
/* transformer monitor tsfm detect request */
|
|
typedef struct _proto_645_ext_tsfm_launch_req {
|
|
/* duration of bit data output, uint is 1us
|
|
* less than or equal to IOT_PLC_HW_TSFM_OUTPUT_MAX_TIME,
|
|
* greater than or equal to IOT_PLC_HW_TSFM_OUTPUT_MIN_TIME.
|
|
*/
|
|
uint16_t dur_output;
|
|
/* ahead interval time of sending data relative to zero-crossing point,
|
|
* uint is 1us. less than or equal to IOT_PLC_HW_TSFM_MAX_AHEAD_TIME,
|
|
* greater than or equal to IOT_PLC_HW_TSFM_MIN_AHEAD_TIME.
|
|
*/
|
|
uint16_t ahead;
|
|
/* repeat count */
|
|
uint8_t repeat_cnt;
|
|
/* sending data interval, unit is 1s */
|
|
uint16_t send_interval;
|
|
/* transformer addr, little endian */
|
|
uint8_t tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
/* transformer sequence number. */
|
|
uint8_t sn;
|
|
/* plc rising edge zc send tsfm flag, it's phase negative zc flag. */
|
|
uint8_t is_rising : 1,
|
|
/* reserved for future */
|
|
rsvd1 : 7;
|
|
/* reserved for future */
|
|
uint8_t rsvd[8];
|
|
} proto_645_ext_tsfm_launch_req_t;
|
|
|
|
/* transformer monitor tsfm detect result */
|
|
typedef struct _proto_645_ext_tsfm_launch_rsp {
|
|
/* see - PROTO_645_2007_EXT_TSFM_RESULT_XXX */
|
|
uint8_t ret;
|
|
} proto_645_ext_tsfm_launch_rsp_t;
|
|
|
|
typedef struct _proto_645_ext_node_in_neig_info {
|
|
/* node addr, little-endian */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* node state */
|
|
uint8_t is_neighbor : 1,
|
|
/* reserved for future */
|
|
reserved : 7;
|
|
} proto_645_ext_node_in_neig_info_t;
|
|
|
|
/* node is in neighbor state query response */
|
|
typedef struct _proto_645_ext_node_in_neig_resp {
|
|
/* node number */
|
|
uint8_t node_num;
|
|
/* node info list */
|
|
proto_645_ext_node_in_neig_info_t node_info[0];
|
|
} proto_645_ext_node_in_neig_resp_t;
|
|
|
|
/* III controler pm info */
|
|
typedef struct _proto_645_ext_brm_pm {
|
|
/* add pm mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* pm proto, see - PROTO_TYPE_XXX */
|
|
uint8_t proto;
|
|
/* node port, see PORT_645_PORT_XXX */
|
|
uint8_t port : 3,
|
|
/* baud id */
|
|
baud_id : 3,
|
|
/* reserved for further use */
|
|
rsvd1 : 2;
|
|
/* pm CT ratio, uint is x1 */
|
|
uint16_t i_ratio;
|
|
/* pm PT ratio, uint is x1 */
|
|
uint8_t v_ratio;
|
|
/* assembly number */
|
|
uint8_t ass_pos : 6,
|
|
/* reserved for further use */
|
|
rsvd2 : 2;
|
|
/* rsvd */
|
|
uint8_t rsvd3;
|
|
} proto_645_ext_brm_pm_t;
|
|
|
|
/* add III controler pm info download */
|
|
typedef struct _proto_645_ext_brm_add_pm_req {
|
|
/* add pm count */
|
|
uint8_t cnt;
|
|
/* pm info array */
|
|
proto_645_ext_brm_pm_t pm[0];
|
|
} proto_645_ext_brm_add_pm_req_t;
|
|
|
|
/* response pm info */
|
|
typedef struct _proto_645_ext_brm_get_pm_rsp {
|
|
/* rsp pm total count */
|
|
uint8_t cnt : 6,
|
|
/* version */
|
|
ver : 2;
|
|
/* pm info array */
|
|
proto_645_ext_brm_pm_t data[0];
|
|
} proto_645_ext_brm_get_pm_rsp_t;
|
|
|
|
/* del III controler pm info download */
|
|
typedef struct _proto_645_ext_brm_del_pm_req {
|
|
/* del pm count */
|
|
uint8_t cnt;
|
|
/* pm address */
|
|
uint8_t data[0][IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_brm_del_pm_req_t;
|
|
|
|
/* get III controler pm info download */
|
|
typedef struct _proto_645_ext_brm_get_pm_req {
|
|
/* pm start index */
|
|
uint8_t statrt_index;
|
|
/* get pm count */
|
|
uint8_t cnt;
|
|
} proto_645_ext_brm_get_pm_req_t;
|
|
|
|
/* III or II controler run info. */
|
|
typedef struct _proto_645_ext_run_info {
|
|
/* reset counter */
|
|
uint16_t reset_cnt;
|
|
/* online state: 1 - online, 0 - not */
|
|
uint8_t is_online :1,
|
|
/* message version */
|
|
ver :2,
|
|
/* reserved for further use */
|
|
rsvd :5;
|
|
/* network addr */
|
|
uint8_t nw_addr[IOT_MAC_ADDR_LEN];
|
|
/* number to join the network */
|
|
uint16_t join_cnt;
|
|
/* total run time, uint is 1s */
|
|
uint32_t run_time;
|
|
/* 0 - transformer detect in progress, 1 - transformer detect done */
|
|
uint8_t hw_tsfm_done;
|
|
/* real transformer mac address, little-endian */
|
|
uint8_t hw_tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
/* tsfm detect result see - - PROTO_645_TSFM_DETECT_RET_XXX */
|
|
uint8_t hw_tsfm_result;
|
|
/* 0 - transformer detect in progress, 1 - transformer detect done */
|
|
uint8_t sw_tsfm_done;
|
|
/* real transformer mac address, little-endian */
|
|
uint8_t sw_tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
/* tsfm detect result see - IOT_SG_STA_TSFM_DETECT_RET_XXX */
|
|
uint8_t sw_tsfm_result;
|
|
/* RTC time */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
|
|
} proto_645_ext_run_info_t;
|
|
|
|
/* dev mac address and version info payload */
|
|
typedef struct _proto_645_ext_mac_and_ver_info {
|
|
/* dev mac address, big endian */
|
|
uint8_t mac[IOT_MAC_ADDR_LEN];
|
|
/* vendor id. ASCII format. */
|
|
uint16_t vendor_id;
|
|
/* module version, use BCD code to represent */
|
|
uint8_t module_ver[PROTO_645_EXT_MOD_VER_LEN];
|
|
/* chip code. ASCII format. */
|
|
uint16_t chip_code;
|
|
/* module version date, use BCD code to represent */
|
|
uint8_t module_ver_day;
|
|
uint8_t module_ver_month;
|
|
uint8_t module_ver_year;
|
|
} proto_645_ext_mac_and_ver_info_t;
|
|
|
|
/* response core temperature info */
|
|
typedef struct _proto_645_ext_core_temperature
|
|
{
|
|
/* core temperature calibrated, uint is 0.01°C, bin code */
|
|
uint32_t temp_cali :31,
|
|
/* sign: 0 is +, 1 is - */
|
|
temp_cali_sign :1;
|
|
/* core temperature not calibrated, uint is 0.01°C, bin code */
|
|
uint32_t temp_not_cali :31,
|
|
/* sign: 0 is +, 1 is - */
|
|
temp_not_cali_sign :1;
|
|
} proto_645_ext_core_temperature_t;
|
|
|
|
/* threshold parameters of qiedian event */
|
|
typedef struct _proto_645_ext_brm_qd_thr {
|
|
/* current threshold for qiedian event occurrence, uint is 0.001A */
|
|
uint32_t enter_i_thr;
|
|
/* current threshold for qiedian event exit, uint is 0.001A */
|
|
uint32_t exit_i_thr;
|
|
/* The stability threshold is event occurrence */
|
|
uint8_t stable_thr_enter;
|
|
/* stability threshold for event exit */
|
|
uint8_t stable_thr_exit;
|
|
} proto_645_ext_brm_qd_thr_t;
|
|
|
|
/* branch recognition test reault response */
|
|
typedef struct _proto_645_ext_br_test_rsp {
|
|
/* branch recognition phase receive info
|
|
* bit0 represent phase A
|
|
* bit1 represent phase B
|
|
* bit2 represent phase C
|
|
*/
|
|
uint8_t br_phase_rec;
|
|
} proto_645_ext_br_test_rsp_t;
|
|
|
|
/* response version2 info payload */
|
|
typedef struct _proto_645_ext_read_ver_rsp_v2 {
|
|
/* vendor id. ASCII format. */
|
|
uint16_t vendor_id;
|
|
/* chip code. ASCII format. */
|
|
uint16_t chip_code;
|
|
/* module version, use BCD code to represent */
|
|
uint8_t module_ver[PROTO_645_EXT_MOD_VER_LEN];
|
|
/* module version date, use BCD code to represent */
|
|
uint8_t module_ver_day;
|
|
uint8_t module_ver_month;
|
|
uint8_t module_ver_year;
|
|
/* external software version, use ASCII code to represent */
|
|
uint8_t sw_ver[PROTO_645_EXT_SW_VER_LEN];
|
|
/* software version date, use BCD code to represent */
|
|
uint8_t sw_day;
|
|
uint8_t sw_month;
|
|
uint8_t sw_year;
|
|
/* chip version, use ASCII code to represent */
|
|
uint8_t chip_ver[PROTO_645_EXT_CHIP_VER_LEN];
|
|
/* chip version date, use BCD code to represent */
|
|
uint8_t chip_ver_day;
|
|
uint8_t chip_ver_month;
|
|
uint8_t chip_ver_year;
|
|
/* module mac address, big endian */
|
|
uint8_t dev_mac_addr[IOT_MAC_ADDR_LEN];
|
|
/* internal software version */
|
|
uint32_t build_sw_ver;
|
|
} proto_645_ext_read_ver_rsp_v2_t;
|
|
|
|
/* III controler basic information */
|
|
typedef struct _proto_645_ext_brm_basic_info {
|
|
/* voltage RMS, uint is 0.1V, BCD */
|
|
uint8_t v[PROTO_645_2007_EXT_MAX_PHASE_NUM][PROTO_645_V_LEN];
|
|
/* current RMS, uint is 0.001A, BCD */
|
|
uint8_t i[PROTO_645_2007_EXT_MAX_PHASE_NUM][PROTO_645_07_A_LEN];
|
|
/* active power, uint is 0.0001 KW, BCD */
|
|
uint8_t p[PROTO_645_2007_EXT_MAX_PHASE_NUM][PROTO_645_07_P_LEN];
|
|
/* three-phase sum active power, uint is 0.0001 KW, BCD */
|
|
uint8_t all_p[PROTO_645_07_P_LEN];
|
|
/* power factor, uint is 0.001, BCD */
|
|
uint8_t pf[PROTO_645_2007_EXT_MAX_PHASE_NUM][PROTO_645_07_PF_LEN];
|
|
/* three-phase sum power factor, uint is 0.001, BCD */
|
|
uint8_t all_pf[PROTO_645_07_PF_LEN];
|
|
/* positive active energy, uint is 1/ec kwh, BCD */
|
|
uint8_t ept_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* negative active energy, uint is 1/ec kwh, BCD */
|
|
uint8_t ept_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* temperature, uint is 0.1 centigrade, BCD */
|
|
uint8_t temperature[PROTO_645_07_TEMP_LEN];
|
|
/* humidity, unit is 0.1 %RH, BCD */
|
|
uint8_t humidity[PROTO_645_EXT_HUM_LEN];
|
|
/* time */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
} proto_645_ext_brm_basic_info_t;
|
|
|
|
/* event reporting request message */
|
|
typedef struct _proto_645_ext_evt_rpt_req {
|
|
/* message marking, used for message legitimacy checking */
|
|
uint32_t mark;
|
|
} proto_645_ext_evt_rpt_req_t;
|
|
|
|
/* event enble value. */
|
|
typedef struct _proto_645_ext_event_en_t {
|
|
uint8_t rsvd0 : 2,
|
|
qiedian_evt : 1,
|
|
rsvd1 : 5;
|
|
}proto_645_ext_event_en_t;
|
|
|
|
/* get III controler qiedian data download */
|
|
typedef struct _proto_645_ext_brm_get_qd_data_req {
|
|
/* pm start index */
|
|
uint8_t start_index;
|
|
/* get pm count */
|
|
uint8_t cnt;
|
|
} proto_645_ext_brm_get_qd_data_req_t;
|
|
|
|
/* qiedian data */
|
|
typedef struct _proto_645_ext_brm_qd_data {
|
|
/* pm address - little endian */
|
|
uint8_t mac_addr[IOT_MAC_ADDR_LEN];
|
|
/* phase voltage, use 2 bytes of BCD code to represent the voltage.
|
|
* for example, 220.0V uses 2 bytes of BCD code to represent
|
|
* the following 0x22, 0x00.
|
|
*/
|
|
uint8_t v_a[PROTO_645_V_LEN];
|
|
uint8_t v_b[PROTO_645_V_LEN];
|
|
uint8_t v_c[PROTO_645_V_LEN];
|
|
/* phase current.use 3 bytes of BCD code to represent the current.
|
|
* for example, 123.456A uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56.
|
|
*/
|
|
uint8_t i_a[PROTO_645_07_A_LEN];
|
|
uint8_t i_b[PROTO_645_07_A_LEN];
|
|
uint8_t i_c[PROTO_645_07_A_LEN];
|
|
/* N-line current, uint is 0.001A - BCD code */
|
|
uint8_t i_n[PROTO_645_07_A_LEN];
|
|
/* pm time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* number of opening covers - BCD code */
|
|
uint8_t open_cover_n[PROTO_645_NUM_LEN];
|
|
/* status words - BIN code */
|
|
uint16_t words[PROTO_645_07_MAX_STATUS_WORDS_INDEX];
|
|
} proto_645_ext_brm_qd_data_t;
|
|
|
|
/* response qiedian info */
|
|
typedef struct _proto_645_ext_brm_get_qd_data_rsp {
|
|
/* pm total count */
|
|
uint8_t total_cnt;
|
|
/* start pm index */
|
|
uint8_t start_index;
|
|
/* rsp pm total count */
|
|
uint8_t cnt;
|
|
/* qiedian data array */
|
|
proto_645_ext_brm_qd_data_t data[0];
|
|
} proto_645_ext_brm_get_qd_data_rsp_t;
|
|
|
|
/* assembly check request layout */
|
|
typedef struct _proto_645_ext_brm_ass_chk_req {
|
|
/* longitude */
|
|
proto_645_ext_location_unit_t longitude;
|
|
/* latitude */
|
|
proto_645_ext_location_unit_t latitude;
|
|
/* time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* voltage ratio */
|
|
uint8_t v_ratio :4,
|
|
/* current ratio */
|
|
i_ratio :4;
|
|
/* flag mart to the nodes are connected by PLC */
|
|
uint8_t is_plc_con :1,
|
|
/* enable terminal transparent reading mode check */
|
|
check_en_for_3761 :1,
|
|
/* PLC connect mode, only bit "is_plc_con"set, these bit fields
|
|
* are valid, see PROTO_645_EXT_BRM_ASS_CHK_PLC_MODE_XXX
|
|
*/
|
|
plc_mode :2,
|
|
/* PLC band, only bit "is_plc_con"set, these bit fields are valid,
|
|
* see PROTO_645_EXT_BRM_ASS_CHK_PLC_BAND_XXX
|
|
*/
|
|
band :2,
|
|
/* reserved for further use */
|
|
rsvd :2;
|
|
/* pm cnt */
|
|
uint8_t cnt;
|
|
/* pm addr's to be checked */
|
|
uint8_t addr[0][IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_brm_ass_chk_req_t;
|
|
|
|
/* assembly check request layout */
|
|
typedef struct _proto_645_ext_brm_ass_chk_qr {
|
|
/* starting index of query, starting from 0 */
|
|
uint8_t start_index;
|
|
/* number to query */
|
|
uint8_t num;
|
|
/* payload length limit of query response message */
|
|
uint8_t len_limit;
|
|
} proto_645_ext_brm_ass_chk_qr_t;
|
|
|
|
/* power meter assembly information results */
|
|
typedef struct _proto_645_ext_brm_ass_pm_chk_result {
|
|
/* pm addr */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* 1 - assembly ok, 0 assembly fail */
|
|
uint8_t result : 1,
|
|
/* pm proto, see - PROTO_TYPE_XXX */
|
|
pid : 3,
|
|
/* buad id */
|
|
bid : 3,
|
|
/* rsvd */
|
|
rsvd : 1;
|
|
} proto_645_ext_brm_ass_pm_chk_result_t;
|
|
|
|
/* query assembly check result response */
|
|
typedef struct _proto_645_ext_brm_ass_chk_rsp {
|
|
/* longitude */
|
|
proto_645_ext_location_unit_t longitude;
|
|
/* latitude */
|
|
proto_645_ext_location_unit_t latitude;
|
|
/* time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* check state:
|
|
* 0 - never checked.
|
|
* 1 - being check.
|
|
* 2 - check done.
|
|
*/
|
|
uint8_t state :2,
|
|
/* phase 1 wiring status, see PROTO_645_EXT_BRM_ASS_WIRE_XXX */
|
|
phase1_wire_st :2,
|
|
/* phase 2 wiring status, see PROTO_645_EXT_BRM_ASS_WIRE_XXX */
|
|
phase2_wire_st :2,
|
|
/* phase 3 wiring status, see PROTO_645_EXT_BRM_ASS_WIRE_XXX */
|
|
phase3_wire_st :2;
|
|
/* time consumption of check, uint is 1s */
|
|
uint16_t time_cons;
|
|
/* voltage ratio */
|
|
uint8_t v_ratio :4,
|
|
/* current ratio */
|
|
i_ratio :4;
|
|
/* if set, indicating that there is more node information */
|
|
uint8_t more :1,
|
|
/* total pm cnt */
|
|
total_cnt :7;
|
|
/* pm cnt */
|
|
uint8_t cnt;
|
|
/* assembly check result array */
|
|
proto_645_ext_brm_ass_pm_chk_result_t result[0];
|
|
} proto_645_ext_brm_ass_chk_rsp_t;
|
|
|
|
/* report meter add or delete data */
|
|
typedef struct _proto_645_ext_brm_meter_chg_evt_data {
|
|
/* add or delete meter event, 0: delete meter, 1: add meter */
|
|
uint8_t flag;
|
|
/* time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* meter number */
|
|
uint8_t cnt;
|
|
/* add meter information */
|
|
struct {
|
|
/* add meter addr, little-endian */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* proto type, see - PROTO_TYPE_XXX */
|
|
uint16_t port :2,
|
|
/* node port, see - PORT_645_PORT_XXX */
|
|
proto_type :3,
|
|
/* rsvd */
|
|
rsvd :11;
|
|
} data[0];
|
|
}proto_645_ext_brm_meter_chg_evt_data_t;
|
|
|
|
/* brm custom data blocks response */
|
|
typedef struct _proto_645_ext_brm_cus_data_blocks_rsp {
|
|
/* version number */
|
|
uint8_t version : 3,
|
|
/* is valid, 0 : invalid, 1: valid */
|
|
is_valid : 1,
|
|
/* rsvd */
|
|
rsvd1 : 4;
|
|
/* A-phase positive active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t a_ept_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* A-phase negative active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t a_ept_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* B-phase positive active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t b_ept_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* B-phase negative active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t b_ept_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* C-phase positive active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t c_ept_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* C-phase negative active energy, uint is 0.01/ec kwh - BCD code */
|
|
uint8_t c_ept_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* temperature, uint is 0.1 centigrade, BCD */
|
|
uint8_t temperature[PROTO_645_07_TEMP_LEN];
|
|
/* humidity, unit is 0.1 %RH, BCD */
|
|
uint8_t humidity[PROTO_645_EXT_HUM_LEN];
|
|
/* rsvd */
|
|
uint8_t rsvd2[16];
|
|
} proto_645_ext_brm_cus_data_blocks_rsp_t;
|
|
|
|
/* set tsfm info */
|
|
typedef struct _proto_645_ext_tsfm_info_set_t {
|
|
/* tsfm addr, little-endian */
|
|
uint8_t tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
/* reserved for further use */
|
|
uint8_t rsvd[6];
|
|
} proto_645_ext_tsfm_info_set_t;
|
|
|
|
/* extern curve Read Downlink Information descriptor. */
|
|
typedef struct _proto_645_07_ext_curve_dl {
|
|
/* curve point num to Read */
|
|
uint8_t n;
|
|
/* the specified time is seconds, minutes, hours, days and years. */
|
|
uint8_t second;
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t mday;
|
|
uint8_t mon;
|
|
uint8_t year;
|
|
} proto_645_07_ext_curve_dl_t;
|
|
|
|
/* extern read signal of current dev response */
|
|
typedef struct _proto_645_07_ext_signal_resp {
|
|
/* snr of ul */
|
|
int8_t ul_snr;
|
|
/* rssi of ul */
|
|
int8_t ul_rssi;
|
|
/* snr of dl */
|
|
int8_t dl_snr;
|
|
/* rssi of dl */
|
|
int8_t dl_rssi;
|
|
/* fill data */
|
|
uint8_t fill_data[0];
|
|
} proto_645_07_ext_signal_resp_t;
|
|
|
|
/* extern read max min voltage response */
|
|
typedef struct _proto_645_07_ext_max_min_v_resp {
|
|
/* phase voltage, use 2 bytes of BCD code to represent the voltage.
|
|
* for example, 220.0V uses 2 bytes of BCD code to represent
|
|
* the following 0x22, 0x00.
|
|
*/
|
|
uint8_t v[PROTO_645_V_LEN];
|
|
/* occur time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
} proto_645_07_ext_max_min_v_resp_t;
|
|
|
|
/* extern read max min current response */
|
|
typedef struct _proto_645_07_ext_max_min_a_resp {
|
|
/* phase current.use 3 bytes of BCD code to represent the current.
|
|
* for example, 123.456A uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56.
|
|
*/
|
|
uint8_t i[PROTO_645_07_A_LEN];
|
|
/* occur time - BCD code */
|
|
proto_645_07_time_ymdhms_t tm;
|
|
} proto_645_07_ext_max_min_a_resp_t;
|
|
|
|
/* terminal information */
|
|
typedef struct _proto_645_07_ext_brm_terminal_cfg {
|
|
/* terminal address configuration */
|
|
union {
|
|
/* terminal address 698, little-endian */
|
|
uint8_t trans_698_addr[IOT_MAC_ADDR_LEN];
|
|
struct {
|
|
/* administrative region code */
|
|
uint16_t area_code;
|
|
/* terminal address region */
|
|
uint16_t dev_addr;
|
|
}trans_3761;
|
|
} terminal_addr;
|
|
/* reserved for further use */
|
|
uint8_t rsvd1;
|
|
/* terminal type, if 0: 3761 terminal, 1: 698 terminal */
|
|
uint8_t is_698 :1,
|
|
/* reserved for further use */
|
|
rsvd2 :7;
|
|
} proto_645_07_ext_brm_terminal_cfg_t;
|
|
|
|
/* oneshot calibration request information */
|
|
typedef struct _proto_645_07_ext_brm_cali_req {
|
|
/* EC constant */
|
|
uint32_t ec; /* low 16bit */
|
|
/* voltage channel transfer rate */
|
|
uint32_t u_rate;
|
|
/* current channel sample resistance value. unit: ohm */
|
|
uint32_t i_r_sample;
|
|
/* current channel transfer rate */
|
|
uint32_t i_rate;
|
|
/* calibration voltage param unit: 0.1V */
|
|
uint16_t u;
|
|
/* calibration current param unit: 0.01A */
|
|
uint16_t i;
|
|
/* input max sample times */
|
|
uint16_t max_smpl;
|
|
/* reserved for future */
|
|
uint8_t rsvd[10];
|
|
} proto_645_07_ext_brm_cali_req_t;
|
|
|
|
/* oneshot calibration status */
|
|
typedef struct _proto_645_07_ext_brm_cali_sts {
|
|
/* see - PROTO_645_ONESHOT_CALIBRATION_XXX */
|
|
uint8_t status;
|
|
/* see - PROTO_645_ONESHOT_CALIBRATION_FAIL_XXX */
|
|
uint8_t fail_code;
|
|
} proto_645_07_ext_brm_cali_sts_t;
|
|
|
|
/* basic information */
|
|
typedef struct _proto_645_07_ext_basic_info {
|
|
/* cpu number, bin format */
|
|
uint8_t cpu_num;
|
|
/* vendor id, ASCII format little-endian */
|
|
uint16_t vendor_id;
|
|
/* version date, reserved for further use */
|
|
uint8_t ver_rsvd1 :3,
|
|
/* version date, day */
|
|
ver_day :5;
|
|
/* version date, month */
|
|
uint16_t ver_month :4,
|
|
/* version date, year */
|
|
ver_year :12;
|
|
/* hardware version, bcd format little-endian */
|
|
uint16_t hw_ver;
|
|
/* software version, bcd format little-endian */
|
|
uint16_t sw_ver;
|
|
/* mcu name length, bin format */
|
|
uint8_t mcu_name_len;
|
|
/* mcu name, ASCII format */
|
|
uint8_t mcu_name[0];
|
|
} proto_645_07_ext_basic_info_t;
|
|
|
|
/* firmware sha1 check code read request */
|
|
typedef struct _proto_645_07_ext_sha1_check_code_req {
|
|
/* cpu number, bin format */
|
|
uint8_t cpu_num;
|
|
/* check start address, little-endian */
|
|
uint8_t check_addr[PROTO_645_EXT_CHECK_ADDR_lEN];
|
|
/* check length */
|
|
uint16_t check_len;
|
|
} proto_645_07_ext_sha1_check_code_req_t;
|
|
|
|
/* node info structure in proto_645_07_ext_brm_nei_node_info_ul_t.
|
|
* for PROTO_645_2007_EXT_DI_NEI_NODE_INFO
|
|
*/
|
|
typedef struct _proto_645_07_ext_brm_nei_data {
|
|
/* neighbor network node address, little-endian */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* rx snr of this node */
|
|
int8_t snr;
|
|
/* flag to mark if node vendor id is the same as CCO */
|
|
uint8_t same_vendor :1,
|
|
/* reserved for further use */
|
|
rsvd :7;
|
|
} proto_645_07_ext_brm_nei_data_t;
|
|
|
|
/* query neighbor network node info up-link.
|
|
* for PROTO_645_2007_EXT_DI_NEI_NODE_INFO
|
|
*/
|
|
typedef struct _proto_645_07_ext_brm_nei_node_info_ul {
|
|
/* flag of follow up data */
|
|
uint8_t flw_flg : 1,
|
|
/* reserved for further use */
|
|
rsvd : 7;
|
|
/* packet serial number of neighbor network node info */
|
|
uint8_t sn;
|
|
/* node cnt in node data */
|
|
uint8_t cnt;
|
|
/* node info */
|
|
proto_645_07_ext_brm_nei_data_t node[0];
|
|
} proto_645_07_ext_brm_nei_node_info_ul_t;
|
|
|
|
/* query neighbor network node tsfm info up-link.
|
|
* for PROTO_645_2007_EXT_DI_NEI_NODE_TSFM_INFO
|
|
*/
|
|
typedef struct _proto_645_07_ext_brm_nei_node_tsfm_ul {
|
|
/* cco address, little-endian */
|
|
uint8_t cco_addr[IOT_MAC_ADDR_LEN];
|
|
/* tsfm address, little-endian */
|
|
uint8_t tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
/* node first physical phase line, see GW_APP_DATA_PHASE_XXX */
|
|
uint8_t phase_1 : 2,
|
|
/* node second physical phase line, see GW_APP_DATA_PHASE_XXX */
|
|
phase_2 : 2,
|
|
/* node third physical phase line, see GW_APP_DATA_PHASE_XXX */
|
|
phase_3 : 2,
|
|
/* reserve for future */
|
|
reserve : 2;
|
|
} proto_645_07_ext_brm_nei_node_tsfm_ul_t;
|
|
|
|
/* node info structure in proto_645_07_ext_brm_cco_add_pm_dl_t.
|
|
* for PROTO_645_2007_EXT_BRM_CCO_ADD_PM
|
|
*/
|
|
typedef struct _proto_645_07_ext_brm_pm_from_cco {
|
|
/* pm address, little-endian */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* protocol type, see IOT_BRM_PROTO_XXX*/
|
|
uint8_t pro_type : 4,
|
|
/* port number, see PROTO_645_PORT_XXX. PROTO_645_PORT_RS485 is invalid*/
|
|
port_num : 4;
|
|
/* reserved for further use */
|
|
uint8_t rsvd;
|
|
} proto_645_07_ext_brm_pm_from_cco_t;
|
|
|
|
/* add pm table list info request from cco down-link.
|
|
* for PROTO_645_2007_EXT_BRM_CCO_ADD_PM
|
|
*/
|
|
typedef struct _proto_645_07_ext_brm_cco_add_pm_dl {
|
|
/* historical node data clear flag */
|
|
uint8_t flg_clear : 1,
|
|
/* reserve for future */
|
|
reserve : 7;
|
|
/* add pm cnt */
|
|
uint8_t cnt;
|
|
/* pm info */
|
|
proto_645_07_ext_brm_pm_from_cco_t pm[0];
|
|
} proto_645_07_ext_brm_cco_add_pm_dl_t;
|
|
|
|
/* debug info record read command message layout */
|
|
typedef struct _proto_645_ext_brm_dbg_rec_dl {
|
|
/* start index of records to be read */
|
|
uint8_t start_index;
|
|
/* number of records to be read */
|
|
uint8_t cnt;
|
|
} proto_645_ext_brm_dbg_rec_dl_t;
|
|
|
|
/* debug info record report message layout */
|
|
typedef struct _proto_645_ext_brm_dbg_rec_ul {
|
|
/* record total cnt */
|
|
uint8_t total_cnt;
|
|
/* record start index of this report */
|
|
uint8_t strat_index;
|
|
/* reported records counter */
|
|
uint8_t rpt_cnt;
|
|
/* records data payload */
|
|
uint8_t rec_data[0];
|
|
} proto_645_ext_brm_dbg_rec_ul_t;
|
|
|
|
/* report layout of tsfm debug info record */
|
|
typedef struct _proto_645_ext_brm_dbg_tsfm_rec {
|
|
/* report record format version, the current is 0 */
|
|
uint8_t ver : 2,
|
|
/* the phase line where the tsfm info is received,
|
|
* see PROTO_645_2007_EXT_BRM_PHASE_XXX.
|
|
*/
|
|
phase : 2,
|
|
/* flag to mark if it is reverse zero crossing reception*/
|
|
is_reverse_zc : 1,
|
|
/* flag to mark if the received tsfm info is valid */
|
|
is_valid : 1,
|
|
/* reserve for future */
|
|
rsvd : 2;
|
|
/* energy: average zc delta, uint is 1us */
|
|
uint16_t energy;
|
|
/* time stamp */
|
|
proto_645_07_time_ymdhms_t time;
|
|
/* received tsfm address */
|
|
uint8_t tsfm_addr[IOT_MAC_ADDR_LEN];
|
|
} proto_645_ext_brm_dbg_tsfm_rec_t;
|
|
|
|
/* write passcode down-link request for PROTO_645_2007_EXT_PASSCODE_REQ */
|
|
typedef struct _proto_645_ext_write_passcode_dl {
|
|
/* simple pair passcode value, little endian */
|
|
uint16_t passcode;
|
|
/* reserve for future */
|
|
uint8_t rsvd[14];
|
|
} proto_645_ext_write_passcode_dl_t;
|
|
|
|
/* br2 launch payload, only for zhejiang */
|
|
typedef struct _proto_645_ext_br2_launch_zj_hdr {
|
|
/* trans type, see PROTO_645_EXT_BR2_XXX. */
|
|
uint8_t trans_type;
|
|
/* start time, if receiving time is full FF, indicating that the
|
|
* signal should be sent immediately. There is no need to set the time.
|
|
*/
|
|
proto_645_07_time_ymdhms_t tm;
|
|
/* characteristics data per bit duration time, unit: 1ms */
|
|
uint16_t chara_bit_dur;
|
|
/* modulate pulse signal frequence, little endian, uint: 0.01Hz */
|
|
uint8_t freq[PROTO_645_EXT_FC_PULSE_FREQ_LEN];
|
|
/* code len */
|
|
uint8_t code_len;
|
|
/* code data */
|
|
uint8_t code[0];
|
|
} proto_645_ext_br2_launch_zj_hdr_t;
|
|
|
|
/* br2 launch payload, only for zhejiang */
|
|
typedef struct _proto_645_ext_br2_launch_zj_tail {
|
|
/* modulate pulse signal high duration time, unit: 1us */
|
|
uint16_t pulse_high_dur;
|
|
/* modulate pulse signal low duration time, unit: 1us */
|
|
uint16_t pulse_low_dur;
|
|
/* extend data, reserve for future */
|
|
uint8_t code[12];
|
|
} proto_645_ext_br2_launch_zj_tail_t;
|
|
|
|
/* branch identification launch message layout, only for Beijing */
|
|
typedef struct _proto_645_ext_br_launch_bj {
|
|
/* characteristics bit duration time, unit: 1ms */
|
|
uint16_t chara_bit_dur;
|
|
/* modulate pulse signal high duration time, unit: 1us */
|
|
uint16_t pulse_high_dur;
|
|
/* modulate pulse signal low duration time, unit: 1us */
|
|
uint16_t pulse_low_dur;
|
|
/* node sequence number */
|
|
uint16_t node_seq;
|
|
/* launch sn */
|
|
uint16_t launch_sn;
|
|
/* reserve for future */
|
|
uint8_t rsvd[12];
|
|
} proto_645_ext_br_launch_bj_t;
|
|
|
|
/* branch identification receive init message layout, only for Beijing */
|
|
typedef struct _proto_645_ext_br_init_bj {
|
|
/* characteristics bit duration time, unit: 1ms */
|
|
uint16_t chara_bit_dur;
|
|
/* modulate pulse signal frequence, little endian, uint: 0.01Hz */
|
|
uint8_t freq[PROTO_645_EXT_FC_PULSE_FREQ_LEN];
|
|
/* similarity threshold, uint is 0.1% */
|
|
uint16_t similarity_thr;
|
|
/* reserve for future */
|
|
uint8_t rsvd[14];
|
|
} proto_645_ext_br_init_bj_t;
|
|
|
|
/* br2 launch record cnt response, only for zhejiang */
|
|
typedef struct _proto_645_ext_br2_record_cnt_rsp {
|
|
/* record cnt */
|
|
uint8_t record_cnt;
|
|
} proto_645_ext_br2_record_cnt_rsp_t;
|
|
|
|
/* br2 launch record data response, only for zhejiang */
|
|
typedef struct _proto_645_ext_br2_record_resp {
|
|
/* send start time - BCD code */
|
|
proto_645_07_time_ymdhms_t start_tm;
|
|
/* send end time - BCD code */
|
|
proto_645_07_time_ymdhms_t end_tm;
|
|
} proto_645_ext_br2_record_resp_t;
|
|
|
|
/* format of reading instruction sent by terminal */
|
|
typedef struct _proto_645_ext_br2_recv_rec_dl {
|
|
/* read amount */
|
|
uint8_t cnt;
|
|
/* start order */
|
|
uint16_t start_index;
|
|
/* read start time */
|
|
proto_645_corr_time_t start_time;
|
|
} proto_645_ext_br2_recv_rec_dl_t;
|
|
|
|
/* format of reading instruction sent by terminal */
|
|
typedef struct _proto_645_ext_br2_recv_rec_dl_xiongan {
|
|
/* read amount */
|
|
uint16_t cnt;
|
|
/* start order */
|
|
uint16_t start_index;
|
|
} proto_645_ext_br2_recv_rec_dl_xiongan_t;
|
|
|
|
/* format of reading instruction sent by terminal */
|
|
typedef struct _proto_645_ext_br2_recv_rec_dl_hn {
|
|
/* start order [1, 255] */
|
|
uint8_t start_index;
|
|
/* read amount */
|
|
uint8_t cnt;
|
|
} proto_645_ext_br2_recv_rec_dl_hn_t;
|
|
|
|
typedef struct _proto_645_ext_br2_recv_rec_entry_hn {
|
|
/* signal start time */
|
|
proto_645_corr_time_t signal_time;
|
|
/* phase: bit0:A,bit1:B,bit2:C */
|
|
uint8_t phase;
|
|
/* energy value, BCD xxxx.xx */
|
|
uint8_t energy[PROTO_645_EXT_BRANCH_ENERGY_BCD_LEN_HN];
|
|
/* branch singnal code data */
|
|
uint8_t code[PROTO_645_EXT_BRANCH_CODE_LEN_HN];
|
|
} proto_645_ext_br2_recv_rec_entry_hn_t;
|
|
|
|
/* record read reply format hu nan */
|
|
typedef struct _proto_645_ext_br2_recv_rec_ul_hn {
|
|
/* reply count */
|
|
uint8_t count;
|
|
/* reply branch result entry */
|
|
proto_645_ext_br2_recv_rec_entry_hn_t data[0];
|
|
} proto_645_ext_br2_recv_rec_ul_hn_t;
|
|
|
|
/* branch detect proto formats */
|
|
typedef struct {
|
|
/* signal time*/
|
|
proto_645_corr_time_t signal_time;
|
|
/* success flag */
|
|
uint8_t is_vaild;
|
|
/* phase see, IOT_PLC_PHASE_XXX */
|
|
uint8_t phase;
|
|
/* signal intensity 1 */
|
|
float signal1_rssi;
|
|
/* signal intensity 2 */
|
|
float signal2_rssi;
|
|
/* base wave intensity */
|
|
float base_rssi;
|
|
/* background noise */
|
|
float noise;
|
|
/* reserved */
|
|
uint8_t reserved[4];
|
|
} proto_645_ext_br2_recv_rec_entry_t;
|
|
|
|
/* record read reply format */
|
|
typedef struct _proto_645_ext_br2_recv_rec_ul {
|
|
/* number of branch detact during communication */
|
|
uint16_t total_cnt;
|
|
/* reply count */
|
|
uint8_t count;
|
|
/* start order*/
|
|
uint16_t start_index;
|
|
/* read start time */
|
|
proto_645_corr_time_t start_time;
|
|
/* read results */
|
|
proto_645_ext_br2_recv_rec_entry_t result[0];
|
|
} proto_645_ext_br2_recv_rec_ul_t;
|
|
|
|
/* branch detect record read reply header, respond header + id code + tail */
|
|
typedef struct {
|
|
/* signal time*/
|
|
proto_645_corr_time_t signal_time;
|
|
/* phase see, IOT_PLC_PHASE_XXX */
|
|
uint8_t phase;
|
|
/* signal intensity 1 */
|
|
float signal1_rssi;
|
|
/* signal intensity 2 */
|
|
float signal2_rssi;
|
|
/* background noise */
|
|
float noise;
|
|
} proto_645_ext_br2_recv_rec_entry_zj_head_t;
|
|
|
|
/* branch detect record read reply header tail */
|
|
typedef struct {
|
|
/* reserved */
|
|
uint8_t reserved[12];
|
|
}roto_645_ext_br2_recv_rec_entry_zj_tail_t;
|
|
|
|
/* record read reply format zj */
|
|
typedef struct _proto_645_ext_br2_recv_rec_ul_zj {
|
|
/* number of branch detact during communication */
|
|
uint16_t total_cnt;
|
|
/* reply count */
|
|
uint8_t count;
|
|
/* start order */
|
|
uint16_t start_index;
|
|
/* read start time */
|
|
proto_645_corr_time_t start_time;
|
|
/* length of signature code information */
|
|
uint8_t code_len;
|
|
/* record entry label */
|
|
uint8_t data[0];
|
|
} proto_645_ext_br2_recv_rec_ul_zj_t;
|
|
|
|
/* branch detect record read reply header, respond header + id code + tail */
|
|
typedef struct {
|
|
/* signal time*/
|
|
proto_645_07_time_ymdhms_t signal_time;
|
|
/* phase , 0:unknow, 1:phaseA, 2:phaseB, 3:phaseC, 4:phaseALL */
|
|
uint8_t phase;
|
|
/* signal intensity, BCD code format xxxxx.xxx */
|
|
uint8_t signal_rssi[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* base wave intensity, , BCD code format xxxxx.xxx */
|
|
uint8_t base_rssi[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* background noise, , BCD code format xxxxx.xxx */
|
|
uint8_t noise[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* reserved for further use */
|
|
uint8_t rsvd[2];
|
|
} proto_645_ext_br2_recv_rec_entry_xiongan_t;
|
|
|
|
/* record read reply format breaker */
|
|
typedef struct _proto_645_ext_br2_recv_rec_ul_xiongan {
|
|
/* number of branch detact during communication */
|
|
uint16_t total_cnt;
|
|
/* reply count */
|
|
uint8_t count;
|
|
/* record entry label */
|
|
uint8_t data[0];
|
|
} proto_645_ext_br2_recv_rec_ul_xiongan_t;
|
|
|
|
/* branch detect event formats */
|
|
typedef struct {
|
|
/* signal time*/
|
|
proto_645_corr_time_t signal_time;
|
|
/* success flag */
|
|
uint8_t phase;
|
|
/* signal intensity 1 */
|
|
float signal1_rssi;
|
|
/* signal intensity 2 */
|
|
float signal2_rssi;
|
|
/* background noise */
|
|
float noise;
|
|
/* identity code */
|
|
uint8_t id_code[0];
|
|
} proto_645_ext_br2_evt_rec_entry_t;
|
|
|
|
/* event reply format */
|
|
typedef struct _proto_645_ext_br2_evt_rec_ul {
|
|
/* number of data actually recorded */
|
|
uint8_t signal_cnt;
|
|
/* length of identification signal */
|
|
uint8_t id_len;
|
|
/* data entry */
|
|
uint8_t data[0];
|
|
} proto_645_ext_br2_evt_rec_ul_t;
|
|
|
|
/* branch detect event formats for qingdao dingxin */
|
|
typedef struct {
|
|
/* signal time*/
|
|
proto_645_corr_time_t signal_time;
|
|
/* result, 0 - failure, 1 - success */
|
|
uint8_t result;
|
|
/* success flag */
|
|
uint8_t phase;
|
|
/* signal intensity 1 */
|
|
float signal1_rssi;
|
|
/* signal intensity 2 */
|
|
float signal2_rssi;
|
|
/* signal intensity 2 */
|
|
float signal_fund_wave;
|
|
/* background noise */
|
|
float noise;
|
|
/* identity code */
|
|
uint8_t id_code[PROTO_645_EXT_BRANCH_ID_CODE_DX];
|
|
} proto_645_ext_br2_evt_rec_entry_dx_t;
|
|
|
|
/* event reply format for qingdao dingxin */
|
|
typedef struct _proto_645_ext_br2_evt_rec_dx_ul {
|
|
/* number of data actually recorded */
|
|
uint8_t signal_cnt;
|
|
/* data entry */
|
|
proto_645_ext_br2_evt_rec_entry_dx_t data[0];
|
|
} proto_645_ext_br2_evt_rec_dx_ul_t;
|
|
|
|
/* event number reply format */
|
|
typedef struct _proto_645_ext_br2_evt_cnt_ul {
|
|
/* number of events currently logged */
|
|
uint8_t evt_cnt[PROTO_645_NUM_LEN];
|
|
} proto_645_ext_br2_evt_cnt_ul_t;
|
|
|
|
/* bsrm extend cmd */
|
|
typedef struct _proto_645_ext_bsrm_trans_cmd {
|
|
/* fn */
|
|
uint8_t fn;
|
|
/* fn data content */
|
|
uint8_t data[0];
|
|
} proto_645_ext_bsrm_trans_cmd_t;
|
|
|
|
/* extend cmd current ratio coefficient */
|
|
typedef struct _proto_645_ext_ct_coeff {
|
|
/* base current ratio: 4000 : 1, samp resistance: 4.4 Ohm;
|
|
* CT ratio 5000:1, samp resistance 2 Ohm
|
|
* Then the coefficient = (5000 / 2) / (4000 / 4.4) * 10000 = 27500
|
|
*/
|
|
uint32_t coeff;
|
|
} proto_645_ext_ct_coeff_t;
|
|
|
|
/* read mean square of current response format */
|
|
typedef struct _proto_645_ext_i_ms_ul {
|
|
/* mean square of current for each phase */
|
|
uint32_t ms_i[PROTO_645_2007_EXT_MAX_PHASE_NUM];
|
|
} proto_645_ext_i_ms_ul_t;
|
|
|
|
/* zero cross test request format */
|
|
typedef struct _proto_645_ext_check_zc_dl {
|
|
/* function code, 0 - start test; 1 - read result */
|
|
uint8_t fn;
|
|
/* zero cross circuit bitmap:
|
|
* bit0 - phase A, bit1 - phase B, bit2 - phase C,
|
|
* bit3 - phase A ext, bit4 - phase B ext, bit5 - phase C ext
|
|
*/
|
|
uint8_t zc_bm;
|
|
} proto_645_ext_check_zc_dl_t;
|
|
|
|
/* zero cross circuit check response data format */
|
|
typedef struct _proto_645_ext_check_zc_data {
|
|
/* zero cross circuit bitmap:
|
|
* bit0 - phase A, bit1 - phase B, bit2 - phase C,
|
|
* bit3 - phase A ext, bit4 - phase B ext, bit5 - phase C ext
|
|
*/
|
|
uint8_t zc_bm;
|
|
/* zero cross period */
|
|
uint32_t period[2 * PROTO_645_2007_EXT_MAX_PHASE_NUM];
|
|
} proto_645_ext_check_zc_data_t;
|
|
|
|
/* zero cross circuit check response head format */
|
|
typedef struct _proto_645_ext_check_zc_ul {
|
|
/* function code, 0 - start test; 1 - read result */
|
|
uint8_t fn;
|
|
/* test status: 0 - not start, 1 - busy, 2 - finish */
|
|
uint8_t status;
|
|
/* extend data filled:
|
|
* if fn is 0, not use this filled;
|
|
* if fn is 1, see proto_645_ext_check_zc_data_t. */
|
|
uint8_t data[0];
|
|
} proto_645_ext_check_zc_ul_t;
|
|
|
|
/* bsrm event notification structure */
|
|
typedef struct _proto_645_ext_bsrm_evt_nodify {
|
|
/* 1 - occurs, 0 - clears */
|
|
uint8_t flag;
|
|
/* reserved for further use */
|
|
uint8_t rsvd[7];
|
|
} proto_645_ext_bsrm_evt_nodify_t;
|
|
|
|
/* bsrm event gpio interrupt check download struct */
|
|
typedef struct _proto_645_ext_bsrm_evt_check_dl {
|
|
/* fn: see - PROTO_645_EXT_CHECK_EVENT_FN_XXX */
|
|
uint8_t fn;
|
|
} proto_645_ext_bsrm_evt_check_dl_t;
|
|
|
|
/* bsrm event gpio interrupt check upload struct */
|
|
typedef struct _proto_645_ext_bsrm_evt_check_ul {
|
|
/* fn: see - PROTO_645_EXT_CHECK_EVENT_FN_XXX */
|
|
uint8_t fn;
|
|
/* event check result: see - PROTO_645_EXT_CHECK_EVENT_XXX */
|
|
uint8_t result;
|
|
/* event interrupt count */
|
|
uint16_t count;
|
|
} proto_645_ext_bsrm_evt_check_ul_t;
|
|
|
|
/* PPM ping struct */
|
|
typedef struct _proto_645_ext_brm_ppm_ping {
|
|
/* package serial number */
|
|
uint32_t seq;
|
|
/* empty data to send large packets */
|
|
int8_t reserve[PROTO_645_EXT_BRM_PPM_PING_RSVD_LEN];
|
|
} proto_645_ext_brm_ppm_ping_t;
|
|
|
|
/* bsrm event report content query download struct */
|
|
typedef struct _proto_645_ext_bsrm_evt_query_dl {
|
|
/* reserve for future */
|
|
uint8_t reserve[4];
|
|
}proto_645_ext_bsrm_evt_query_dl_t;
|
|
|
|
/* bsrm event report content query upload struct */
|
|
typedef struct _proto_645_ext_bsrm_evt_query_ul {
|
|
/* event data length */
|
|
uint8_t len;
|
|
/* event data */
|
|
uint8_t data[0];
|
|
}proto_645_ext_bsrm_evt_query_ul_t;
|
|
|
|
/* bsrm event report result download struct */
|
|
typedef struct _proto_645_ext_bsrm_evt_rpt_result_dl {
|
|
/* event report result, see PROTO_645_EXT_BSRM_EVT_RPT_XXX */
|
|
uint8_t rpt_result;
|
|
/* reserve for future */
|
|
uint8_t reserve[7];
|
|
}proto_645_ext_bsrm_evt_rpt_result_dl_t;
|
|
|
|
/* power meter information which in bsrm, only for shandong and yns */
|
|
typedef struct _proto_645_ext_bsrm_pm_info {
|
|
/* address of power meter, little-endian */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* protocol type of power meter, see IOT_SG_STA_BSRM_PM_DATA_TYPE_XX */
|
|
uint8_t data_type;
|
|
}proto_645_ext_bsrm_pm_info_t;
|
|
|
|
/* result of bsrm power meters query only for shandong and yns */
|
|
typedef struct _proto_645_ext_bsrm_smc_result {
|
|
/* count of power meter */
|
|
uint8_t pm_cnt;
|
|
/* power meter info */
|
|
proto_645_ext_bsrm_pm_info_t pm[0];
|
|
}proto_645_ext_bsrm_smc_result_t;
|
|
|
|
/* baud word for nw 21meter */
|
|
typedef struct _proto_645_ext_baud_word {
|
|
/* module mac, little-endian */
|
|
uint8_t module_mac[IOT_MAC_ADDR_LEN];
|
|
/* baud bitmap, */
|
|
uint8_t reserve_1 : 1,
|
|
baud_600 : 1,
|
|
baud_1200 : 1,
|
|
baud_2400 : 1,
|
|
baud_4800 : 1,
|
|
baud_9600 : 1,
|
|
baud_19200 : 1,
|
|
reserve_2 : 1;
|
|
} proto_645_ext_baud_word_t;
|
|
|
|
/* write module dev id for nw 21meter */
|
|
typedef struct _proto_645_ext_module_dev_id_write {
|
|
/* password */
|
|
uint8_t password[PROTO_645_2007_PASSWORD_LEN];
|
|
/* operator code */
|
|
uint8_t operator[PROTO_645_2007_OPERATOR_LEN];
|
|
/* dev id, little-endian */
|
|
uint8_t data[PROTO_645_2007_EXT_CHIP_MMID_ID_LEN];
|
|
} proto_645_ext_module_dev_id_write_t;
|
|
|
|
/* factory test function code */
|
|
typedef struct _proto_645_ext_ft_mode_code {
|
|
/* factory test mode code */
|
|
uint8_t ft_mode;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_645_ext_ft_mode_code_t;
|
|
|
|
/* zero-crossing data for every phase */
|
|
typedef struct _proto_645_ext_ft_mode_zc_check_data {
|
|
/* is there a zero-crossing signal */
|
|
uint8_t exist;
|
|
/* zero crossing signal period, unit is 40ns */
|
|
uint32_t period;
|
|
} proto_645_ext_ft_mode_zc_check_data_t;
|
|
|
|
/* zero-crossing info */
|
|
typedef struct _proto_645_ext_ft_mode_zc_check_info {
|
|
/* collection method, see PROTO_645_EXT_ZC_CLCT_MODE_XXXX */
|
|
uint8_t clct_type;
|
|
/* phase of meter, see PROTO_645_EXT_ZC_METER_PHASE_XXXX */
|
|
uint8_t meter_type;
|
|
/* zero crossing information */
|
|
proto_645_ext_ft_mode_zc_check_data_t data[PROTO_645_EXT_ZC_PHASE_COUNT];
|
|
} proto_645_ext_ft_mode_zc_check_info_t;
|
|
|
|
/* version info for module */
|
|
typedef struct _proto_645_ext_ft_mode_sw_ver_resp {
|
|
/* day of version, BCD, eg. 27 */
|
|
uint8_t day;
|
|
/* mon of version, BCD, eg. 07 */
|
|
uint8_t mon;
|
|
/* year of version, BCD, eg. 23 */
|
|
uint8_t year;
|
|
/* version, BCD, little-endian, eg. 0102 -> 02 01 */
|
|
uint16_t ver;
|
|
} proto_645_ext_ft_mode_sw_ver_resp_t;
|
|
|
|
typedef struct _pt_basic_data {
|
|
/* the golden mac which used for the pt test */
|
|
uint8_t golden_mac[6];
|
|
/* year of production test date, bcd format */
|
|
uint8_t year;
|
|
/* month of production test date, bcd format */
|
|
uint8_t month;
|
|
/* day of production test date, bcd format */
|
|
uint8_t day;
|
|
/* hour of production test date, bcd format */
|
|
uint8_t hour;
|
|
/* minute of production test date, bcd format */
|
|
uint8_t min;
|
|
/* the golden's firmware version */
|
|
uint32_t golden_fw_ver;
|
|
/* the production test tool's version */
|
|
uint32_t pt_tool_ver;
|
|
/* the production test board's version */
|
|
uint32_t pt_board_ver;
|
|
} pt_basic_data_t;
|
|
|
|
/* response pt info payload */
|
|
typedef struct _proto_645_ext_read_pt_info_rsp {
|
|
/* the local pt ppm valid flag, 0-invalid, 1-valid */
|
|
uint8_t local_pt_ppm_valid : 1,
|
|
/* the local tool ppm valid flag, 0-invalid, 1-valid */
|
|
local_tool_ppm_valid : 1,
|
|
/* the local fix ppm valid flag, 0-invalid, 1-valid */
|
|
local_fix_ppm_valid : 1,
|
|
/* the reader's fix ppm valid flag, 0-invalid, 1-valid */
|
|
host_pt_ppm_valid : 1,
|
|
/* the reader's tool ppm valid flag, 0-invalid, 1-valid */
|
|
host_tool_ppm_valid : 1,
|
|
/* the reader's fix ppm valid flag, 0-invalid, 1-valid */
|
|
host_fix_ppm_valid : 1,
|
|
/* basic pt info valid flag, 0-invalid, 1-valid */
|
|
basic_data_valid : 1,
|
|
/* the dut firmware version valid flag, 0-invalid, 1-valid */
|
|
pt_dut_fw_valid : 1;
|
|
/* production test ppm value for target dev, stored in the oem field */
|
|
int8_t local_pt_ppm;
|
|
/* compensation ppm value for target dev, set by the tool */
|
|
int8_t local_tool_ppm;
|
|
/* fix ppm value for the target device to response the cmd */
|
|
int8_t local_fix_ppm;
|
|
/* production test ppm value for the reader, stored in the oem field */
|
|
int8_t host_pt_ppm;
|
|
/* compensation ppm value for the reader, set by the tool */
|
|
int8_t host_tool_ppm;
|
|
/* fix ppm value for the reader */
|
|
int8_t host_fix_ppm;
|
|
/* the version of the dut firmware which supported the production test */
|
|
uint32_t pt_dut_fw_ver;
|
|
/* the production test basic data */
|
|
pt_basic_data_t basic_data;
|
|
} proto_645_ext_read_pt_info_rsp_t;
|
|
|
|
#pragma pack(pop) /* restore the pack status */
|
|
|
|
/*
|
|
* @brief proto_645_vendor_build_tcz_ver_info() - build tcz version info.
|
|
* @param addr: address of meter.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_tcz_ver_info(uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_ver_info_base() - build soft version info.
|
|
* @param ver_info: pointer to proto_645_ext_read_ver_rsp_t.
|
|
*/
|
|
void proto_645_vendor_build_ver_info_base(
|
|
proto_645_ext_read_ver_rsp_t *ver_info);
|
|
|
|
/**
|
|
* @brief proto_645_handle_vendor_proto() - handle vendor 645 protocol.
|
|
* @param data: pointer to protocol data buffer.
|
|
* @param len: data length.
|
|
* @param snr: snr of current mpdu.
|
|
* @param rssi: rssi of current mpdu.
|
|
* @retval: 1 -- handled vendor 645 protocol.
|
|
* @retval: 0 -- no vendor 645 protocol.
|
|
*/
|
|
uint32_t proto_645_handle_vendor_proto(uint8_t *data, uint32_t len,
|
|
int8_t snr, int8_t rssi);
|
|
|
|
/* proto_645_vendor_build_id_info() - create a id information message for the
|
|
* 645 protocol
|
|
* @addr: address of meter.
|
|
* @info_type: ID information type, see PROTO_645_2007_EXT_XXX_ID.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_id_info(uint8_t *addr, uint8_t info_type);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_tsfm_launch_req() - create a tsfm
|
|
* recognition launch message for the transformer monitor device.
|
|
* @param addr: address of transformer monitor.
|
|
* @param tsfm_addr: transformer address, little endian.
|
|
* @param dur_output: duration of bit data output, uint is 1us.
|
|
* less than or equal to IOT_PLC_HW_TSFM_OUTPUT_MAX_TIME,
|
|
* greater than or equal to
|
|
* IOT_PLC_HW_TSFM_OUTPUT_MIN_TIME.
|
|
* @param ahead: ahead interval time of sending data relative to
|
|
* zero-crossing point,uint is 1us.
|
|
* less than or equal to IOT_PLC_HW_TSFM_MAX_AHEAD_TIME,
|
|
* greater than or equal to
|
|
* IOT_PLC_HW_TSFM_MIN_AHEAD_TIME.
|
|
* @param repeat_cnt: repeat count.
|
|
* @param send_interval: sending data interval, unit is 1s.
|
|
* @param sn: transformer sequence number.
|
|
* @param is_rising: 1 - rising edge zc send tsfm flag, 0 - not
|
|
* @retval: pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_tsfm_launch_req(uint8_t *addr,
|
|
uint8_t *tsfm_addr, uint16_t dur_output, uint16_t ahead,
|
|
uint8_t repeat_cnt, uint16_t send_interval, uint8_t sn, uint8_t is_rising);
|
|
|
|
/** handle tsfm send message.
|
|
* @param hdr_645: tsfm lanunch req 645 protocol header.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_handle_tsfm_send_req(proto_645_header_t *hdr_645);
|
|
|
|
/**
|
|
* @brief proto_645_handle_vendor_proto_cco() - handle vendor 645 protocol
|
|
* in cco.
|
|
* @param cco_addr: pointer to cco address, little endian.
|
|
* @param data: pointer to protocol data buffer.
|
|
* @param len: data length.
|
|
* @param snr: snr of current mpdu.
|
|
* @param rssi: rssi of current mpdu.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_handle_vendor_proto_cco(uint8_t *cco_addr,
|
|
uint8_t *data, uint32_t len, int8_t snr, int8_t rssi);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_basic_info() - create a sta basic information
|
|
* msg for the 645 protocol.
|
|
* @param addr: address of meter.
|
|
* @param di: rsp 645 packet di.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_basic_info(uint8_t *addr, uint32_t di);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_check_code() - create firmware check code
|
|
* msg for the 645 protocol.
|
|
* @param check_code: pointer to check code value.
|
|
* @param check_code_len: check code value len.
|
|
* @param addr: address of meter.
|
|
* @param di: rsp 645 packet di.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_check_code(uint8_t *check_code,
|
|
uint8_t check_code_len, uint8_t *addr, uint32_t di);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_br_correct_time_req() - create br correct
|
|
* time msg for the 645 protocol.
|
|
* @param addr: address of meter.
|
|
* @param tm: pointer time data of message.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_br_correct_time_req(uint8_t *addr,
|
|
iot_time_tm_t *tm);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_br_msg() - create br msg for the 645 protocol.
|
|
* @param addr: address of meter.
|
|
* @param data: pointer to br data.
|
|
* @param len: data_len.
|
|
* @param di: data identification.
|
|
* @param dir: direction, see PROTO_645_DIR_XXX.
|
|
* @param ack_v: flag of ack, see PROTO_645_ACK_XXX.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_br_msg(uint8_t *addr, uint8_t *data,
|
|
uint8_t len, uint32_t di, uint8_t dir, uint8_t ack);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_sta_nw_ext_uart_cmd_handle() - response extend uart cmd
|
|
* for nw factory test.
|
|
* @param header: req 645 protocol header.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_sta_nw_ext_uart_cmd_handle(
|
|
proto_645_header_t *header);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_set_id_info() - extend 645 set station id information
|
|
* @param req: set sta id information.
|
|
* @param force: whether to force write, 1: force write.
|
|
* 0: write when no id info.
|
|
* @retval: ERR_OK -- check success.
|
|
* @retval: otherwise -- check false, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_645_vendor_set_id_info(proto_645_ext_set_id_info_req_t *req,
|
|
uint8_t force);
|
|
|
|
/**
|
|
* @brief proto_645_vendor_build_mac_and_ver_info() - create dev mac addr and
|
|
* version infomation msg for the 645 protocol.
|
|
* @param addr: address of meter.
|
|
* @param fn: function code.
|
|
* @retval: rsp pkt packet -- successful.
|
|
* @retval: NULL -- failure.
|
|
*/
|
|
iot_pkt_t *proto_645_vendor_build_mac_and_ver_info(uint8_t *addr,
|
|
uint8_t fn);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PROTO_645_VENDOR_H */
|