3893 lines
138 KiB
C
3893 lines
138 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_69845_H
|
|
#define PROTO_69845_H
|
|
|
|
#include "os_types_api.h"
|
|
#include "iot_utils_api.h"
|
|
#include "iot_pkt_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* pack for the structures in the whole file */
|
|
#pragma pack(push) /* save the pack status */
|
|
#pragma pack(1) /* 1 byte align */
|
|
|
|
/* default baud rate for DL/T 698.45-201X */
|
|
#define PROTO_69845_DEFAULT_BAUD 9600
|
|
|
|
/* default predict 69845 apdu max len */
|
|
#define PROTO_69845_PREDICT_APDU_MAX_LEN (350)
|
|
|
|
#define PROTO_69845_LENGTH_SIZE (2)
|
|
#define PROTO_69845_CHECKSUM_LEN (2)
|
|
#define PROTO_69845_SA_MAX_LEN (16)
|
|
#define PROTO_69845_SA_LEN (6)
|
|
#define PROTO_69845_CA_LEN (1)
|
|
#define PROTO_69845_START_END_LEN (2)
|
|
#define PROTO_69845_START_LEN (1)
|
|
#define PROTO_69845_PREAMBLE_LEN (4)
|
|
#define PROTO_69845_DAR_LEN (1)
|
|
#define PROTO_69845_NO_TIME_TAG_LEN (1)
|
|
#define PROTO_69845_NO_FLW_DATA_LEN (1)
|
|
|
|
#define PROTO_69845_EVENT_DATA_LEN (18)
|
|
|
|
#define PROTO_69845_SECURITY_RN_LEN (16)
|
|
|
|
#define PROTO_69845_SECURITY_SEQUEN_LEN (4)
|
|
|
|
#define PROTO_69845_FW_EVT_WORD_LEN (4)
|
|
|
|
#define PROTO_69845_FW_EVT_WORD_CNT (PROTO_69845_FW_EVT_WORD_LEN * 8)
|
|
|
|
#define PROTO_69845_RS_WORDS_NUM (7)
|
|
|
|
/* define proto 69845 sn max number */
|
|
#define PROTO_69845_SN_MAX (63)
|
|
|
|
/* define security req data type */
|
|
#define PROTO_69845_SEC_DATA_TYPE_PLAINTEXT (0)
|
|
#define PROTO_69845_SEC_DATA_TYPE_CIPHERTEXT (1)
|
|
|
|
/* define security req data validation type */
|
|
#define PROTO_69845_SEC_REQ_VALI_TYPE_MAC (0)
|
|
#define PROTO_69845_SEC_REQ_VALI_TYPE_RN (1)
|
|
#define PROTO_69845_SEC_REQ_VALI_TYPE_MAC_RN (2)
|
|
|
|
/* define security resp data validation type */
|
|
#define PROTO_69845_SEC_RESP_VALI_TYPE_MAC (0)
|
|
#define PROTO_69845_SEC_RESP_VALI_TYPE_MAC_RN (1)
|
|
|
|
/* GET-Request and GET-Response data type length */
|
|
#define PROTO_69845_GET_R_TYPE_LEN (1)
|
|
|
|
/* Start of 698.45 protocol link layer frame */
|
|
#define PROTO_69845_START_BYTE (0x68)
|
|
|
|
/* End of 698.45 protocol link layer frame */
|
|
#define PROTO_69845_END_BYTE (0x16)
|
|
|
|
/* Function code of 698.45 protocol link layer frame */
|
|
#define PROTO_69845_FN_LINK_MANAGE (1)
|
|
#define PROTO_69845_FN_USER_DATA (3)
|
|
|
|
/* That app data of this frame is a whole APDU. */
|
|
#define PROTO_69845_APDU_WHOLE (0)
|
|
/* That app data of this frame is a part of APDU. */
|
|
#define PROTO_69845_APDU_PART (1)
|
|
|
|
/* Primary Request Message and Direction combination to represent meaning.
|
|
* PROTO_69845_D_P_CLIENT_RESPONSE :
|
|
* the response of the client to the server report.
|
|
* PROTO_69845_D_P_CLIENT_REQUEST :
|
|
* client initiated request.
|
|
* PROTO_69845_D_P_SERVER_REPORT:
|
|
* server initiated report.
|
|
* PROTO_69845_D_P_SERVER_RESPONSE:
|
|
* the response of the server to the client request.
|
|
*/
|
|
#define PROTO_69845_D_P_CLIENT_RESPONSE (0)
|
|
#define PROTO_69845_D_P_CLIENT_REQUEST (1)
|
|
#define PROTO_69845_D_P_SERVER_REPORT (2)
|
|
#define PROTO_69845_D_P_SERVER_RESPONSE (3)
|
|
|
|
/* type of the server address. */
|
|
#define PROTO_69845_SA_TYPE_SIG (0)
|
|
#define PROTO_69845_SA_TYPE_WILDCARD (1)
|
|
#define PROTO_69845_SA_TYPE_GROUP (2)
|
|
#define PROTO_69845_SA_TYPE_BROADCAST (3)
|
|
|
|
/* description parameter of the server address. */
|
|
#define PROTO_69845_SA_BROADCAST_ADD (0xaa)
|
|
#define PROTO_69845_SA_BIT_WILDCARD_ADD (0x0a)
|
|
#define PROTO_69845_SA_BIT_MAX_ADD (0x09)
|
|
#define PROTO_69845_SA_BIT_INVAILD_ADD (0x0f)
|
|
|
|
/* description parameter of the client address. */
|
|
#define PROTO_69845_CA_INVAILD_ADD (0x00)
|
|
|
|
/* description parameter of the logical address. */
|
|
#define PROTO_69845_EXT_LOGICAL_ADD_MIN (0x02)
|
|
#define PROTO_69845_EXT_LOGICAL_ADD_LEN (0x01)
|
|
|
|
/* Client Application Service, see standard DL/T 698.45 */
|
|
#define PROTO_69845_C_APP_LINK_RESP (0x01)
|
|
#define PROTO_69845_C_APP_CONNECT_REQ (0x02)
|
|
#define PROTO_69845_C_APP_RELEASE_REQ (0x03)
|
|
#define PROTO_69845_C_APP_GET_REQ (0x05)
|
|
#define PROTO_69845_C_APP_SET_REQ (0x06)
|
|
#define PROTO_69845_C_APP_ACTION_REQ (0x07)
|
|
#define PROTO_69845_C_APP_REPORT_RESP (0x08)
|
|
#define PROTO_69845_C_APP_PROXY_REQ (0x09)
|
|
#define PROTO_69845_C_APP_SECURITY_REQ (0x10)
|
|
|
|
/* Server Application Service, see standard DL/T 698.45 */
|
|
#define PROTO_69845_S_APP_LINK_REQ (0x81)
|
|
#define PROTO_69845_S_APP_CONNECT_RESP (0x82)
|
|
#define PROTO_69845_S_APP_RELEASE_RESP (0x83)
|
|
#define PROTO_69845_S_APP_RELEASE_NOTI (0x84)
|
|
#define PROTO_69845_S_APP_GET_RESP (0x85)
|
|
#define PROTO_69845_S_APP_SET_RESP (0x86)
|
|
#define PROTO_69845_S_APP_ACTION_RESP (0x87)
|
|
#define PROTO_69845_S_APP_REPORT_NOTI (0x88)
|
|
#define PROTO_69845_S_APP_PROXY_RESP (0x89)
|
|
#define PROTO_69845_S_APP_SECURITY_RESP (0x90)
|
|
|
|
/* GET-Request and GET-Response data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_GET_NORMAL (1)
|
|
#define PROTO_69845_APP_GET_NORMALLIST (2)
|
|
#define PROTO_69845_APP_GET_RECORD (3)
|
|
#define PROTO_69845_APP_GET_RECORDLIST (4)
|
|
#define PROTO_69845_APP_GET_NEXT (5)
|
|
/* Jiangsu provincial protocol expansion */
|
|
#define PROTO_69845_APP_GET_SIMPRECORD (23)
|
|
|
|
/* SET-Request and SET-Response data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_SET_NORMAL (1)
|
|
#define PROTO_69845_APP_SET_NORMALLIST (2)
|
|
#define PROTO_69845_APP_SET_AND_GET_NORMALLIST (3)
|
|
|
|
/* ACTION-Request and ACTION-Response data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_ACTION_NORMAL (1)
|
|
#define PROTO_69845_APP_ACTION_NORMALLIST (2)
|
|
#define PROTO_69845_APP_ACTION_AND_GET_NORMALLIST (3)
|
|
|
|
/* report-request and report-response data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_REPRORT_NORMALLIST (1)
|
|
#define PROTO_69845_APP_REPRORT_RECORDLIST (2)
|
|
#define PROTO_69845_APP_REPRORT_TRANS (3)
|
|
/* Jiangsu provincial protocol expansion */
|
|
#define PROTO_69845_APP_REPRORT_SIMPRECORD (6)
|
|
|
|
/* Client proxy_request, see standard DL/T 698.45 */
|
|
#define PROTO_69845_PROXY_GET_REQUESTLIST (0x01)
|
|
#define PROTO_69845_PROXY_GET_REQUESTRECORD (0x02)
|
|
#define PROTO_69845_PROXY_SET_REQUESTLIST (0x03)
|
|
#define PROTO_69845_PROXY_SET_GET_REQUESTLIST (0x04)
|
|
#define PROTO_69845_PROXY_ACTION_REQUESTLIST (0x05)
|
|
#define PROTO_69845_PROXY_ACTION_GET_REQUESTLIST (0x06)
|
|
#define PROTO_69845_PROXY_TRANS_COMMAND_REQUEST (0x07)
|
|
|
|
/* PIID priority data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_PIID_PRIORITY_GENERAL (0)
|
|
#define PROTO_69845_APP_PIID_PRIORITY_HIGH (1)
|
|
|
|
/* get result data type definition, see standard DL/T 698.45 */
|
|
#define PROTO_69845_APP_GET_RESULT_DAR (0)
|
|
#define PROTO_69845_APP_GET_RESULT_DATA (1)
|
|
|
|
/* report result data type definition, see standard DL/T 698.45 */
|
|
#define PROTO_69845_APP_RPT_RESULT_DAR (0)
|
|
#define PROTO_69845_APP_RPT_RESULT_DATA (1)
|
|
|
|
/* optional data type definition, see standard DL/T 698.45 */
|
|
#define PROTO_69845_APP_OPTIONAL_NO_DATA (0)
|
|
#define PROTO_69845_APP_OPTIONAL_DATA (1)
|
|
|
|
/* data type definition, see standard DL/T 698.45 */
|
|
#define PROTO_69845_APP_DATA_NULL (0)
|
|
#define PROTO_69845_APP_DATA_ARRAY (1)
|
|
#define PROTO_69845_APP_DATA_STRUCTURE (2)
|
|
#define PROTO_69845_APP_DATA_BOOL (3)
|
|
#define PROTO_69845_APP_DATA_BIT_STRING (4)
|
|
#define PROTO_69845_APP_DATA_DOUBLE_LONG (5)
|
|
#define PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED (6)
|
|
#define PROTO_69845_APP_DATA_OCTET_STRING (9)
|
|
#define PROTO_69845_APP_DATA_VISIBLE_STRING (10)
|
|
#define PROTO_69845_APP_DATA_UTF8_SRTING (12)
|
|
#define PROTO_69845_APP_DATA_INTEGER (15)
|
|
#define PROTO_69845_APP_DATA_LONG (16)
|
|
#define PROTO_69845_APP_DATA_UNSIGNED (17)
|
|
#define PROTO_69845_APP_DATA_LONG_UNSIGNED (18)
|
|
#define PROTO_69845_APP_DATA_LONG64 (20)
|
|
#define PROTO_69845_APP_DATA_LONG64_UNSIGNED (21)
|
|
#define PROTO_69845_APP_DATA_ENUM (22)
|
|
#define PROTO_69845_APP_DATA_FLOAT32 (23)
|
|
#define PROTO_69845_APP_DATA_FLOAT64 (24)
|
|
#define PROTO_69845_APP_DATA_DATE_TIME (25)
|
|
#define PROTO_69845_APP_DATA_DATE (26)
|
|
#define PROTO_69845_APP_DATA_TIME (27)
|
|
#define PROTO_69845_APP_DATA_TIME_S (28)
|
|
#define PROTO_69845_APP_DATA_OI (80)
|
|
#define PROTO_69845_APP_DATA_OAD (81)
|
|
#define PROTO_69845_APP_DATA_ROAD (82)
|
|
#define PROTO_69845_APP_DATA_OMD (83)
|
|
#define PROTO_69845_APP_DATA_TI (84)
|
|
#define PROTO_69845_APP_DATA_TSA (85)
|
|
#define PROTO_69845_APP_DATA_MAC (86)
|
|
#define PROTO_69845_APP_DATA_RN (87)
|
|
#define PROTO_69845_APP_DATA_REGION (88)
|
|
#define PROTO_69845_APP_DATA_SCALER_UNIT (89)
|
|
#define PROTO_69845_APP_DATA_RSD (90)
|
|
#define PROTO_69845_APP_DATA_CSD (91)
|
|
#define PROTO_69845_APP_DATA_MS (92)
|
|
#define PROTO_69845_APP_DATA_SID (93)
|
|
#define PROTO_69845_APP_DATA_SID_MAC (94)
|
|
#define PROTO_69845_APP_DATA_COMDCB (95)
|
|
#define PROTO_69845_APP_DATA_RCSD (96)
|
|
|
|
/* dar type definition, see standard DL/T 698.45 */
|
|
#define PROTO_69845_APP_DAR_SUCCESS (0)
|
|
#define PROTO_69845_APP_DAR_HW_FAILURE (1)
|
|
#define PROTO_69845_APP_DAR_TEMP_FAILURE (2)
|
|
#define PROTO_69845_APP_DAR_REJECT_W_R (3)
|
|
#define PROTO_69845_APP_DAR_OI_UNDEFINED (4)
|
|
#define PROTO_69845_APP_DAR_OI_CLASS_ERR (5)
|
|
#define PROTO_69845_APP_DAR_OI_NO_EXIST (6)
|
|
#define PROTO_69845_APP_DAR_TYPE_MISMATCH (7)
|
|
#define PROTO_69845_APP_DAR_OVERFLOW (8)
|
|
#define PROTO_69845_APP_DAR_DATA_BLOCK_DAMAGE (9)
|
|
#define PROTO_69845_APP_DAR_FRAMING_CANCEL (10)
|
|
#define PROTO_69845_APP_DAR_NO_FRAMING_STATE (11)
|
|
#define PROTO_69845_APP_DAR_BLOCK_W_CANCEL (12)
|
|
#define PROTO_69845_APP_DAR_NO_BLACK_W_STATE (13)
|
|
#define PROTO_69845_APP_DAR_BLOCK_SEQ_INVALID (14)
|
|
#define PROTO_69845_APP_DAR_PASSWORD_ERR (15)
|
|
#define PROTO_69845_APP_DAR_BAUD_NOT_CHANGE (16)
|
|
#define PROTO_69845_APP_DAR_Y_ZONE_NUM_OVER (17)
|
|
#define PROTO_69845_APP_DAR_D_SLOT_NUM_OVER (18)
|
|
#define PROTO_69845_APP_DAR_RATE_NUM_OVER (19)
|
|
#define PROTO_69845_APP_DAR_SEC_MISMATCH (20)
|
|
#define PROTO_69845_APP_DAR_REPEAT_RECHARGE (21)
|
|
#define PROTO_69845_APP_DAR_ESAM_VERIFY_FAIL (22)
|
|
#define PROTO_69845_APP_DAR_SEC_FAIL (23)
|
|
#define PROTO_69845_APP_DAR_CUSTOMERID_MISMATCH (24)
|
|
#define PROTO_69845_APP_DAR_RECHARGE_CNT_ERR (25)
|
|
#define PROTO_69845_APP_DAR_POWER_PURCHASE_OVER (26)
|
|
#define PROTO_69845_APP_DAR_ADDR_ERR (27)
|
|
#define PROTO_69845_APP_DAR_SYM_DEC_ERR (28)
|
|
#define PROTO_69845_APP_DAR_ASY_DEC_ERR (29)
|
|
#define PROTO_69845_APP_DAR_SIGNATURE_ERR (30)
|
|
#define PROTO_69845_APP_DAR_METER_SUSPEND (31)
|
|
#define PROTO_69845_APP_DAR_TS_INVALID (32)
|
|
#define PROTO_69845_APP_DAR_REQ_TIMEOUT (33)
|
|
#define PROTO_69845_APP_DAR_ESAM_P1P2_ERR (34)
|
|
#define PROTO_69845_APP_DAR_ESAM_LC_ERR (35)
|
|
#define PROTO_69845_APP_DAR_RESULT_LAST (200)
|
|
#define PROTO_69845_APP_DAR_OTHER (255)
|
|
|
|
/* Object identifies the data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_OI_EPT_COMP (0x0000)
|
|
#define PROTO_69845_APP_OI_EPT_POS (0x0010)
|
|
#define PROTO_69845_APP_OI_EPT_NEG (0x0020)
|
|
#define PROTO_69845_APP_OI_EQT_POS (0x0030)
|
|
#define PROTO_69845_APP_OI_EQT_NEG (0x0040)
|
|
#define PROTO_69845_APP_OI_EQT_QRT1 (0x0050)
|
|
#define PROTO_69845_APP_OI_EQT_QRT2 (0x0060)
|
|
#define PROTO_69845_APP_OI_EQT_QRT3 (0x0070)
|
|
#define PROTO_69845_APP_OI_EQT_QRT4 (0x0080)
|
|
#define PROTO_69845_APP_OI_EPT_POS_DEMAND (0x1010)
|
|
#define PROTO_69845_APP_OI_EPT_NEG_DEMAND (0x1020)
|
|
#define PROTO_69845_APP_OI_VOLTAGE (0x2000)
|
|
#define PROTO_69845_APP_OI_CURRENT (0x2001)
|
|
#define PROTO_69845_APP_OI_P (0x2004)
|
|
#define PROTO_69845_APP_OI_Q (0x2005)
|
|
#define PROTO_69845_APP_OI_PF (0x200A)
|
|
#define PROTO_69845_APP_OI_FREQ (0x200F)
|
|
#define PROTO_69845_APP_OI_RUN_WORD (0x2014)
|
|
#define PROTO_69845_APP_OI_FLW_EVT_WORD (0x2015)
|
|
#define PROTO_69845_APP_OI_EPT_DEMAND (0x2017)
|
|
#define PROTO_69845_APP_OI_EQT_DEMAND (0x2018)
|
|
#define PROTO_69845_APP_OI_EVENT_START_TM (0x201E)
|
|
#define PROTO_69845_APP_OI_EVENT_END_TM (0x2020)
|
|
#define PROTO_69845_APP_OI_EVENT_REC_SEQ (0x2022)
|
|
#define PROTO_69845_APP_OI_EVENT_OCCUR_SOURCE (0x2024)
|
|
#define PROTO_69845_APP_OI_COVER_OPEN_N (0x301B)
|
|
#define PROTO_69845_APP_OI_DEV_FAULT_REC (0x310A)
|
|
#define PROTO_69845_APP_OI_EVENT_RPT_STA (0x3300)
|
|
#define PROTO_69845_APP_OI_NEW_EVT_LIST (0x3320)
|
|
#define PROTO_69845_APP_OI_TIME (0x4000)
|
|
#define PROTO_69845_APP_OI_ADDR (0x4001)
|
|
#define PROTO_69845_APP_OI_METER_ID (0x4002)
|
|
|
|
/* extend object identifies the data type definition,
|
|
* see standard DL/T 698.45 extend for measurement switch
|
|
*/
|
|
#define PROTO_69845_APP_OI_EXT_BR2_LAUNCH (0x4208)
|
|
#define PROTO_69845_APP_OI_EXT_BR2_INFO (0x4209)
|
|
|
|
#define PROTO_69845_APP_OI_ELE_ID (0x4300)
|
|
#define PROTO_69845_APP_OI_GET_VERSION (0x4400)
|
|
|
|
/* extend object identifies the data type definition,
|
|
* see standard DL/T 698.45 zhejiang
|
|
*/
|
|
#define PROTO_69845_APP_OI_BR2_LAUNCH_RECORD (0x4E01)
|
|
/* extend object identifies the data type definition,
|
|
* see standard DL/T 698.45 zhejiang
|
|
*/
|
|
#define PROTO_69845_APP_OI_BR2_LAUNCH (0x4E06)
|
|
#define PROTO_69845_APP_OI_BR2_INFO (0x4E07)
|
|
#define PROTO_69845_APP_OI_MIN_FROZEN (0x5002)
|
|
#define PROTO_69845_APP_OI_DAY_FROZEN (0x5004)
|
|
#define PROTO_69845_APP_OI_MON_FROZEN (0x5006)
|
|
#define PROTO_69845_APP_OI_TASK_CFG_LIST (0x6012)
|
|
#define PROTO_69845_APP_OI_TASK_CFG_UNIT (0x6013)
|
|
#define PROTO_69845_APP_OI_CLCT_LIST (0x6014)
|
|
#define PROTO_69845_APP_OI_CLCT_UNIT (0x6015)
|
|
#define PROTO_69845_APP_OI_CLCT_STATE_LIST (0x6032)
|
|
#define PROTO_69845_APP_OI_CLCT_STATE_UNIT (0x6033)
|
|
#define PROTO_69845_APP_OI_CLCT_MONITOR_LIST (0x6034)
|
|
#define PROTO_69845_APP_OI_CLCT_MONITOR_UNIT (0x6035)
|
|
#define PROTO_69845_APP_OI_CLCT_SAVE_TIME (0x6042)
|
|
#define PROTO_69845_APP_OI_FILETRANS_BLOCK (0xF001)
|
|
#define PROTO_69845_APP_OI_PLC_WIRELESS_INTERFACE (0xF209)
|
|
|
|
/* oad value data type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_OAD_EPT_COMP (0x00000200u)
|
|
#define PROTO_69845_APP_OAD_EPT_COMP_SUM (0x00000201u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS (0x00100200u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS_SIG (0x00100201u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS_A_SIG (0x00110201u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS_B_SIG (0x00120201u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS_C_SIG (0x00130201u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG (0x00200200u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG_SIG (0x00200201u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG_A_SIG (0x00210201u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG_B_SIG (0x00220201u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG_C_SIG (0x00230201u)
|
|
#define PROTO_69845_APP_OAD_EQT_POS (0x00300200u)
|
|
#define PROTO_69845_APP_OAD_EQT_POS_SUM (0x00300201u)
|
|
#define PROTO_69845_APP_OAD_EQT_NEG (0x00400200u)
|
|
#define PROTO_69845_APP_OAD_EQT_NEG_SUM (0x00400201u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT1 (0x00500200u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT1_SUM (0x00500201u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT2 (0x00600200u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT2_SUM (0x00600201u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT3 (0x00700200u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT3_SUM (0x00700201u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT4 (0x00800200u)
|
|
#define PROTO_69845_APP_OAD_EQT_QRT4_SUM (0x00800201u)
|
|
#define PROTO_69845_APP_OAD_EPT_POS_DEMAND (0x10100200u)
|
|
#define PROTO_69845_APP_OAD_EPT_NEG_DEMAND (0x10200200u)
|
|
#define PROTO_69845_APP_OAD_EQT_POS_DEMAND (0x10300200u)
|
|
#define PROTO_69845_APP_OAD_EQT_NEG_DEMAND (0x10400200u)
|
|
#define PROTO_69845_APP_OAD_VOLTAGE (0x20000200u)
|
|
#define PROTO_69845_APP_OAD_VOLTAGE_A (0x20000201u)
|
|
#define PROTO_69845_APP_OAD_CURRENT (0x20010200u)
|
|
#define PROTO_69845_APP_OAD_CURRENT_A (0x20010201u)
|
|
#define PROTO_69845_APP_OAD_GND_CURRENT (0x20010400u)
|
|
#define PROTO_69845_APP_OAD_P (0x20040200u)
|
|
#define PROTO_69845_APP_OAD_P_T (0x20040201u)
|
|
#define PROTO_69845_APP_OAD_P_A (0x20040202u)
|
|
#define PROTO_69845_APP_OAD_Q (0x20050200u)
|
|
#define PROTO_69845_APP_OAD_Q_T (0x20050201u)
|
|
#define PROTO_69845_APP_OAD_Q_A (0x20050202u)
|
|
#define PROTO_69845_APP_OAD_PF (0x200A0200u)
|
|
#define PROTO_69845_APP_OAD_PF_T (0x200A0201u)
|
|
#define PROTO_69845_APP_OAD_PF_A (0x200A0202u)
|
|
#define PROTO_69845_APP_OAD_RUN_WORD (0x20140200u)
|
|
#define PROTO_69845_APP_OAD_EPT_DEMAND (0x20170200u)
|
|
#define PROTO_69845_APP_OAD_EQT_DEMAND (0x20180200u)
|
|
#define PROTO_69845_APP_OAD_FROZEN_T (0x20210200u)
|
|
/* only for hlj protocol */
|
|
#define PROTO_69845_APP_OAD_CURRENT_OVER_HLJ (0x30050700u)
|
|
#define PROTO_69845_APP_OAD_COVER_OPEN_N (0x301B0700u)
|
|
#define PROTO_69845_APP_OAD_TIME (0x40000200u)
|
|
#define PROTO_69845_APP_OAD_VERSION (0x43000300u)
|
|
#define PROTO_69845_APP_OAD_MINF (0x50020200u)
|
|
#define PROTO_69845_APP_OAD_HF (0x50030200u)
|
|
#define PROTO_69845_APP_OAD_DF (0x50040200u)
|
|
#define PROTO_69845_APP_OAD_SDF (0x50050200u)
|
|
#define PROTO_69845_APP_OAD_MF (0x50060200u)
|
|
#define PROTO_69845_APP_OAD_YF (0x50070200u)
|
|
#define PROTO_69845_APP_OAD_TTSF (0x50080200u)
|
|
#define PROTO_69845_APP_OAD_DTSF (0x50090200u)
|
|
#define PROTO_69845_APP_OAD_PSF (0x500A0200u)
|
|
#define PROTO_69845_APP_OAD_LSF (0x500B0200u)
|
|
#define PROTO_69845_APP_OAD_LSSF (0x50110200u)
|
|
#define PROTO_69845_APP_OAD_REPORT (0x60120300u)
|
|
#define PROTO_69845_APP_OAD_TRANSFILE_INFO (0xF0010300u)
|
|
#define PROTO_69845_APP_OAD_TRANSFILE_STATUS (0xF0010400u)
|
|
#define PROTO_69845_APP_OAD_TRANSFILE_DATA (0xF0010800u)
|
|
#define PROTO_69845_APP_OAD_TRANSFILE_EXE (0xF0010d00u)
|
|
#define PROTO_69845_APP_OAD_TRANSFILE_START (0xF0010e00u)
|
|
#define PROTO_69845_APP_OAD_PORT_RS485I (0xF2010201u)
|
|
#define PROTO_69845_APP_OAD_PORT_RS485II (0xF2010202u)
|
|
#define PROTO_69845_APP_OAD_INVALID (0xFFFFFFFFu)
|
|
|
|
/* event occur source type definition,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
#define PROTO_69845_APP_EVT_SOC_485_FALT (3)
|
|
|
|
/* extend object identifies the data type definition,
|
|
* see standard DL/T 698.45 jiangsu
|
|
*/
|
|
#define PROTO_69845_APP_OI_COLLECTOR (0x6043)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_TASK_CFG_LIST */
|
|
#define PROTO_OI_TASK_CFG_LIST_ATT_CFG_LIST (2)
|
|
#define PROTO_OI_TASK_CFG_LIST_ATT_RECORD_LIST (3)
|
|
/* define method id of oi PROTO_69845_APP_OI_TASK_CFG_LIST */
|
|
#define PROTO_OI_TASK_CFG_LIST_MET_ADD (127)
|
|
#define PROTO_OI_TASK_CFG_LIST_MET_DELETE (128)
|
|
#define PROTO_OI_TASK_CFG_LIST_MET_CLEAR (129)
|
|
#define PROTO_OI_TASK_CFG_LIST_MET_UPDATE1 (130)
|
|
#define PROTO_OI_TASK_CFG_LIST_MET_UPDATE2 (131)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_TAST_CFG_UNIT */
|
|
#define PROTO_OI_TASK_CFG_UNIT_ATT_CFG_UNIT (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_DEV_FAULT_REC */
|
|
#define PROTO_OI_DEV_FAULT_REC_ATT_EVT_REC_TAB (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_MIN_FROZEN */
|
|
#define PROTO_OI_DEV_MIN_FROZEN_ATT_FROZEN_TAB (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_LIST */
|
|
#define PROTO_OI_CLCT_LIST_ATT_ClCT_LIST (2)
|
|
#define PROTO_OI_CLCT_LIST_ATT_ClCT_LIST_CNT (3)
|
|
#define PROTO_OI_CLCT_LIST_ATT_ClCT_LIST_MAX_CNT (4)
|
|
/* define method id of oi PROTO_69845_APP_OI_CLCT_LIST */
|
|
#define PROTO_OI_CLCT_LIST_MET_ADD (127)
|
|
#define PROTO_OI_CLCT_LIST_MET_DELETE (128)
|
|
#define PROTO_OI_CLCT_LIST_MET_CLEAR (129)
|
|
#define PROTO_OI_CLCT_LIST_MET_SET_CSD (130)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_UNIT */
|
|
#define PROTO_OI_CLCT_UNIT_ATT_CFG_UNIT (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_STATE_LIST */
|
|
#define PROTO_OI_CLCT_STATE_LIST_ATT_ClCT_LIST (2)
|
|
#define PROTO_OI_CLCT_STATE_LIST_ATT_ClCT_LIST_CNT (3)
|
|
#define PROTO_OI_CLCT_STATE_LIST_ATT_ClCT_LIST_MAX_CNT (4)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_STATE_UNIT */
|
|
#define PROTO_OI_CLCT_STATE_UNIT_ATT_CFG_UNIT (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_MONITOR_LIST */
|
|
#define PROTO_OI_CLCT_MONITOR_LIST_ATT_ClCT_LIST (2)
|
|
#define PROTO_OI_CLCT_MONITOR_LIST_ATT_ClCT_LIST_CNT (3)
|
|
#define PROTO_OI_CLCT_MONITOR_LIST_ATT_ClCT_LIST_MAX_CNT (4)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_CLCT_MONITOR_UNIT */
|
|
#define PROTO_OI_CLCT_MONITOR_UNIT_ATT_CFG_UNIT (2)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_COLLECTOR */
|
|
#define PROTO_OI_COLLECTOR_ATT_MIN_DATA_RPT_CNT (16)
|
|
#define PROTO_OI_COLLECTOR_ATT_CURVE_DATA_RPT_CNT (17)
|
|
#define PROTO_OI_COLLECTOR_ATT_METER_CNT (18)
|
|
#define PROTO_OI_COLLECTOR_ATT_METER_LIST (19)
|
|
#define PROTO_OI_COLLECTOR_ATT_MIN_DATA_MAX_CNT (20)
|
|
#define PROTO_OI_COLLECTOR_ATT_CURVE_DATA_MAX_CNT (21)
|
|
#define PROTO_OI_COLLECTOR_ATT_RPT_DATA (127)
|
|
|
|
/* define method id of oi PROTO_69845_APP_OI_BR2_LAUNCH */
|
|
#define PROTO_OI_BR2_LAUNCH_METHOD_LAUNCH (127)
|
|
#define PROTO_OI_BR2_LAUNCH_METHOD_TIME_LAUNCH (128)
|
|
|
|
/* define method id of oi PROTO_69845_APP_OI_BR2_INFO */
|
|
#define PROTO_OI_BR2_REC_METHOD_CLEAR (129)
|
|
|
|
/* define attribute id of oi PROTO_69845_APP_OI_BR2_LAUNCH_RECORD */
|
|
#define PROTO_OI_BR2_LAUNCH_RECORD_ATT_RECORD (6)
|
|
|
|
/* define oi PROTO_69845_APP_DATA_TI interval uint type */
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_SEC (0)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_MIN (1)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_HOUR (2)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_DAY (3)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_MON (4)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_TYPE_YEAR (5)
|
|
|
|
/* define oi PROTO_69845_APP_DATA_TI interval uint */
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_SEC (1)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_MIN (60)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_HOUR (60 * 60)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_DAY (60 * 60 * 24)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_MON (60 * 60 * 24 * 31)
|
|
#define PROTO_OI_TI_INTERVAL_UNIT_YEAR (60 * 60 * 24 * 365)
|
|
|
|
/* define oi PROTO_69845_APP_DATA_MS type */
|
|
#define PROTO_OI_MS_TYPE_NO_PM (0)
|
|
#define PROTO_OI_MS_TYPE_ALL_PM (1)
|
|
#define PROTO_OI_MS_TYPE_GROUP_PM_TYPE (2)
|
|
#define PROTO_OI_MS_TYPE_GROUP_PM_ADDR (3)
|
|
#define PROTO_OI_MS_TYPE_GROUP_PM_NUM (4)
|
|
#define PROTO_OI_MS_TYPE_PM_TYPE_INTERVAL (5)
|
|
#define PROTO_OI_MS_TYPE_PM_ADDR_INTERVAL (6)
|
|
#define PROTO_OI_MS_TYPE_PM_NUM_INTERVAL (7)
|
|
|
|
/* define oi PROTO_69845_APP_DATA_RSD type */
|
|
#define PROTO_OI_RSD_TYPE_NO (0)
|
|
#define PROTO_OI_RSD_TYPE_1 (1)
|
|
#define PROTO_OI_RSD_TYPE_2 (2)
|
|
#define PROTO_OI_RSD_TYPE_3 (3)
|
|
#define PROTO_OI_RSD_TYPE_4 (4)
|
|
#define PROTO_OI_RSD_TYPE_5 (5)
|
|
#define PROTO_OI_RSD_TYPE_6 (6)
|
|
#define PROTO_OI_RSD_TYPE_7 (7)
|
|
#define PROTO_OI_RSD_TYPE_8 (8)
|
|
#define PROTO_OI_RSD_TYPE_9 (9)
|
|
#define PROTO_OI_RSD_TYPE_10 (10)
|
|
|
|
/* define oi PROTO_OI_RSD_TYPE_2 data cnt */
|
|
#define PROTO_OI_RSD_TYPE_2_DATA_CNT (3)
|
|
|
|
/* define oi PROTO_69845_APP_DATA_CSD type */
|
|
#define PROTO_OI_CSD_TYPE_OAD (0)
|
|
#define PROTO_OI_CSD_TYPE_ROAD (1)
|
|
|
|
/* define transfile data method id */
|
|
#define PROTO_OMD_TRANSFILE_DATA_METHOD_ID (8)
|
|
/* define exe transfile method id */
|
|
#define PROTO_OMD_TRANSFILE_INFO_EXE_METHOD_ID (13)
|
|
/* define start transfile method id */
|
|
#define PROTO_OMD_TRANSFILE_INFO_START_METHOD_ID (14)
|
|
/* define correct time method id */
|
|
#define PROTO_OMD_CORRECT_TIME_METHOD_ID (127)
|
|
|
|
/* proto 698.45 data structure lenght type */
|
|
#define PROTO_69845_DATA_LEN_TYPE_NORMAL (0)
|
|
#define PROTO_69845_DATA_LEN_TYPE_MULTI_BTYE (1)
|
|
#define PROTO_69845_DATA_LEN_TYPE_ELEMENT (2)
|
|
#define PROTO_69845_DATA_LEN_TYPE_DIV8 (3)
|
|
#define PROTO_69845_DATA_LEN_TYPE_ROAD (4)
|
|
#define PROTO_69845_DATA_LEN_TYPE_TSA (5)
|
|
#define PROTO_69845_DATA_LEN_TYPE_RSD (6)
|
|
#define PROTO_69845_DATA_LEN_TYPE_CSD (7)
|
|
#define PROTO_69845_DATA_LEN_TYPE_MS (8)
|
|
#define PROTO_69845_DATA_LEN_TYPE_RCSD (9)
|
|
#define PROTO_69845_DATA_LEN_TYPE_UNKNOW (10)
|
|
|
|
/* preamble char definition */
|
|
#define PROTO_69845_PREAMBLE_CHAR 0xFE
|
|
|
|
/* define logical_addr for jiangsu */
|
|
#define PROTO_69845_JS_LOGICAL_ADDR (1)
|
|
/* define logical_addr for zhejiang */
|
|
#define PROTO_69845_ZJ_LOGICAL_ADDR (0x63)
|
|
|
|
/* define task plan type in PROTO_69845_APP_OI_TASK_CFG_UNIT data structure */
|
|
#define PROTO_69845_DATA_TASK_PLAN_TYPE_NORMAL_CLCT (1)
|
|
#define PROTO_69845_DATA_TASK_PLAN_TYPE_EVT_CLCT (2)
|
|
#define PROTO_69845_DATA_TASK_PLAN_TYPE_TRANS (3)
|
|
#define PROTO_69845_DATA_TASK_PLAN_TYPE_RPT (4)
|
|
#define PROTO_69845_DATA_TASK_PLAN_TYPE_SCRIPT (5)
|
|
|
|
/* define task state in PROTO_69845_APP_OI_TASK_CFG_UNIT data structure */
|
|
#define PROTO_69845_DATA_TASK_STATE_NORMAL (1)
|
|
#define PROTO_69845_DATA_TASK_STATE_STOP (2)
|
|
|
|
/* define runtime range type in
|
|
* PROTO_69845_APP_OI_TASK_CFG_UNIT data structure
|
|
*/
|
|
/* front close and back open */
|
|
#define PROTO_69845_DATA_RUNTIME_RANGE_TYPE_FCBO (0)
|
|
/* front open and back close */
|
|
#define PROTO_69845_DATA_RUNTIME_RANGE_TYPE_FOBC (1)
|
|
/* front close and back close */
|
|
#define PROTO_69845_DATA_RUNTIME_RANGE_TYPE_FCBC (2)
|
|
/* front open and back open */
|
|
#define PROTO_69845_DATA_RUNTIME_RANGE_TYPE_FOBO (3)
|
|
|
|
/* define clct type in PROTO_69845_APP_OI_CLCT_UNIT data structure */
|
|
#define PROTO_69845_DATA_CLCT_UNIT_TYPE_CURR (0)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_TYPE_LASTN (1)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_TYPE_FROZEN (2)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_TYPE_INTERVAL (3)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_TYPE_RETRY (4)
|
|
|
|
/* define clct storage timescale selection */
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE0 (0)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE1 (1)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE2 (2)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE3 (3)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE4 (4)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE5 (5)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE6 (6)
|
|
#define PROTO_69845_DATA_CLCT_UNIT_STS_TYPE7 (7)
|
|
|
|
/* define double long data length */
|
|
#define PROTO_69845_METER_DATA_DOUBLE_LONG_LEN (4)
|
|
#define PROTO_69845_METER_DATA_LONG_LEN (2)
|
|
|
|
/* define report max sn */
|
|
#define PROTO_69845_RPT_MAX_SN (63)
|
|
|
|
/* define max number of power data */
|
|
#define PROTO_69845_POWER_MAX_ELE_NUM (4)
|
|
/* define max number of energy element data */
|
|
#define PROTO_69845_ENERGY_MAX_ELE_NUM (5)
|
|
/* define max number of demand element data */
|
|
#define PROTO_69845_DEMAND_MAX_ELE_NUM (1)
|
|
/* define max number of split phase element data */
|
|
#define PROTO_69845_SPLIT_PHASE_MAX_ELE_NUM (3)
|
|
/* define max number of run state word data */
|
|
#define PROTO_69845_RS_WORD_MAX_ELE_NUM (7)
|
|
|
|
/* define data collection default id num */
|
|
#define PROTO_69845_DC_3P_1M_CUR_DEF_ID_NUM (1)
|
|
#define PROTO_69845_DC_3P_DF_DEF_ID_NUM (2)
|
|
#define PROTO_69845_DC_3P_MF_DEF_ID_NUM (3)
|
|
#define PROTO_69845_DC_3P_15M_CUR_DEF_ID_NUM (4)
|
|
#define PROTO_69845_DC_1M_CUR_DEF_ID_NUM (5)
|
|
#define PROTO_69845_DC_DF_DEF_ID_NUM (6)
|
|
#define PROTO_69845_DC_MF_DEF_ID_NUM (7)
|
|
#define PROTO_69845_DC_15M_CUR_DEF_ID_NUM (8)
|
|
#define PROTO_69845_DC_3P_DC_DEF_ID_NUM (9)
|
|
#define PROTO_69845_DC_DC_DEF_ID_NUM (10)
|
|
|
|
/* define meter prepayment type */
|
|
#define PROTO_69845_METER_NO_PREPAY (0)
|
|
#define PROTO_69845_METER_ELECTRIC_PREPAY (1)
|
|
#define PROTO_69845_METER_ELECTRICITY_PREPAY (2)
|
|
|
|
/* parity configuration */
|
|
#define PROTO_69845_PARITY_NONE (0)
|
|
#define PROTO_69845_PARITY_ODD (1)
|
|
#define PROTO_69845_PARITY_EVEN (2)
|
|
|
|
/** length of data. see PROTO_69845_DLEN_X_BITS */
|
|
#define PROTO_69845_DLEN_5_BITS (5)
|
|
#define PROTO_69845_DLEN_6_BITS (6)
|
|
#define PROTO_69845_DLEN_7_BITS (7)
|
|
#define PROTO_69845_DLEN_8_BITS (8)
|
|
|
|
/** stop bit. see PROTO_69845_STOP_XX_BITS */
|
|
#define PROTO_69845_STOP_1_BITS (1)
|
|
#define PROTO_69845_STOP_2_BITS (2)
|
|
|
|
/** running status word 1 - 7 unit length */
|
|
#define PROTO_69845_RS_WORD_UNIT_LEN (2)
|
|
|
|
/* server get response next data type */
|
|
#define PROTO_69845_GET_RESP_NEXT_ERR (0)
|
|
#define PROTO_69845_GET_RESP_NEXT_NORMAL (1)
|
|
#define PROTO_69845_GET_RESP_NEXT_RECORD_NORMAL (2)
|
|
|
|
/* define get response version unit data cnt */
|
|
#define PROTO_69845_GET_VERSION_CNT (6)
|
|
|
|
/* action request common length */
|
|
#define PROTO_69845_ACTION_REQUEST_COMMON_LEN (128)
|
|
|
|
/* PROTO_69845_APP_DATA_TIME_S data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_time_s {
|
|
uint16_t year;
|
|
uint8_t month;
|
|
uint8_t day;
|
|
uint8_t hour;
|
|
uint8_t minute;
|
|
uint8_t second;
|
|
} proto_69845_app_data_time_s_t;
|
|
|
|
/* PROTO_69845_APP_DATA comdcb data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_comdcb {
|
|
/* transmit use buad, 300bit/s(0), 600bit/s(1), 1200bit/s(2), 2400bit/s(3)
|
|
* 4800bit/s(4), 7200bit/s(5), 9600bit/s(6), 19200bit/s(7), 38400bit/s(8),
|
|
* 57600bit/s(9), 115200bit/s(10), self_adaption(255).
|
|
* see standard DL/T 698.45
|
|
*/
|
|
uint8_t buad;
|
|
/* parity. see PROTO_69845_PARITY_XXX */
|
|
uint8_t parity;
|
|
/* length of data. see PROTO_69845_DLEN_X_BITS */
|
|
uint8_t data_bit;
|
|
/* stop bit. see PROTO_69845_STOP_XX_BITS */
|
|
uint8_t stop;
|
|
/* stands flow mode, 0: no flow, 1: hardware flow, 2: software. */
|
|
uint8_t flow_mode;
|
|
} proto_69845_app_data_comdcb_t;
|
|
|
|
/* PROTO_69845_APP_DATA_TI data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_ti {
|
|
/* interval time unit, see PROTO_OI_TI_INTERVAL_UNIT_TYPE_XXX */
|
|
uint8_t uint;
|
|
/* interval value */
|
|
uint16_t value;
|
|
} proto_69845_app_data_ti_t;
|
|
|
|
/* Priority and Invoke ID data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_piid {
|
|
/* sn of request APDU */
|
|
uint8_t sn :6,
|
|
reserved :1,
|
|
/* priority of APDU, see PROTO_69845_APP_PIID_PRIORITY_XXX */
|
|
priority :1;
|
|
} proto_69845_app_piid_t;
|
|
|
|
/* Priority and Invoke ID with ACD data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_piid_acd {
|
|
/* sn of response APDU */
|
|
uint8_t sn :6,
|
|
/* ask call demand */
|
|
acd :1,
|
|
/* priority of APDU, see PROTO_69845_APP_PIID_PRIORITY_XXX */
|
|
priority :1;
|
|
} proto_69845_app_piid_acd_t;
|
|
|
|
/* PROTO_69845_APP_DATA_OAD data structure,
|
|
* use to describe object Attribute.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_oad {
|
|
/* Object identifies */
|
|
uint16_t oi;
|
|
/* attribute identifies */
|
|
uint8_t attribute_id :5,
|
|
/* attribute character */
|
|
attribute_char :3;
|
|
/* element index of object attribute */
|
|
uint8_t element_index;
|
|
} proto_69845_app_oad_t;
|
|
|
|
/* PROTO_69845_APP_DATA_OMD data structure,
|
|
* use to describe object method.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_omd {
|
|
/* Object identifies */
|
|
uint16_t oi;
|
|
/* method identifies */
|
|
uint8_t method_id;
|
|
/* operation mode, value defaults to 1 */
|
|
uint8_t operation_mode;
|
|
} proto_69845_app_omd_t;
|
|
|
|
/* PROTO_69845_APP_DATA_ROAD data structure,
|
|
* used to describe one or more associated
|
|
* object properties in a recordable objec.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_road {
|
|
/* record object */
|
|
proto_69845_app_oad_t rec_oad;
|
|
/* associated object cnt */
|
|
uint8_t cnt;
|
|
/* associated object */
|
|
proto_69845_app_oad_t ass_oad[0];
|
|
} proto_69845_app_road_t;
|
|
|
|
/* PROTO_69845_APP_DATA_CSD data structure,
|
|
* used to describe the column association
|
|
* object properties of records in a record type object.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_csd {
|
|
/* csd type, see PROTO_OI_CSD_TYPE_XXX
|
|
* 0 mean csd_data is PROTO_69845_APP_DATA_OAD
|
|
* 1 mean csd_data is PROTO_69845_APP_DATA_ROAD
|
|
*/
|
|
uint8_t type;
|
|
/* data */
|
|
uint8_t csd_data[0];
|
|
} proto_69845_app_data_csd_t;
|
|
|
|
/* PROTO_69845_APP_DATA_MS data structure,
|
|
* used to describe a meter set.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_ms_group_addr {
|
|
/* address cnt */
|
|
uint8_t cnt;
|
|
/* tsa data */
|
|
uint8_t tsa_data[0];
|
|
} proto_69845_app_data_ms_group_addr_t;
|
|
|
|
/* PROTO_69845_APP_DATA_MS data structure,
|
|
* used to describe a meter set.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_ms {
|
|
/* ms type, see PROTO_OI_MS_TYPE_XXX */
|
|
uint8_t type;
|
|
/* ms data.
|
|
* if type is PROTO_OI_MS_TYPE_NO_PM or
|
|
* PROTO_OI_MS_TYPE_NO_PM, ms_data is invalid
|
|
*/
|
|
uint8_t ms_data[0];
|
|
} proto_69845_app_data_ms_t;
|
|
|
|
|
|
/* PROTO_69845_APP_DATA_RSD data structure,
|
|
* used to describe the range of selected record objects.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd {
|
|
/* rsd type, see PROTO_OI_RSD_TYPE_XXX */
|
|
uint8_t type;
|
|
/* data */
|
|
uint8_t rsd_data[0];
|
|
} proto_69845_app_data_rsd_t;
|
|
|
|
/* PROTO_OI_RSD_TYPE_2 data structure,
|
|
* see standard DL/T 698.45
|
|
* selector2::=SEQUENCE
|
|
* {
|
|
* object property descriptor OAD,
|
|
* start value Data,
|
|
* end value Data,
|
|
* data interval Data
|
|
* }
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd_type2 {
|
|
/* oad */
|
|
proto_69845_app_oad_t oad;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_data_rsd_type2_t;
|
|
|
|
/* PROTO_69845_APP_DATA proxytranscommandrequest data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct proto_69845_app_data_proxy_tans_req {
|
|
/* piid */
|
|
proto_69845_app_piid_t piid;
|
|
/* oad */
|
|
proto_69845_app_oad_t oad;
|
|
/* PROTO_69845_APP_DATA comdcb data structure */
|
|
proto_69845_app_data_comdcb_t comdcb;
|
|
/* timeout waiting for message, uint is 1s */
|
|
uint16_t timeout1;
|
|
/* timeout per byte interval, uint is 1ms */
|
|
uint16_t timeout2;
|
|
/* data len */
|
|
uint8_t data_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_data_proxy_tans_req_t;
|
|
|
|
/* PROTO_69845_APP_DATA proxy trans command response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_proxy_tans_resp {
|
|
/* piid */
|
|
proto_69845_app_piid_t piid;
|
|
/* oad */
|
|
proto_69845_app_oad_t oad;
|
|
/* data type, see PROTO_69845_APP_DATA_XXX */
|
|
uint8_t data_type;
|
|
/* data len */
|
|
uint8_t data_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_data_proxy_tans_resp_t;
|
|
|
|
/* PROTO_69845_APP_DATA proxy data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct proto_69845_app_data_proxy_req {
|
|
/* proxy_type, see PROTO_69845_C_PROXY_XXX */
|
|
uint8_t proxy_type;
|
|
/* data */
|
|
uint8_t data[0];
|
|
}proto_69845_app_data_proxy_req_t;
|
|
|
|
/* PROTO_OI_RSD_TYPE_6/7/8 data structure,
|
|
* see standard DL/T 698.45
|
|
* selector6/7/8::=SEQUENCE
|
|
* {
|
|
* data_time_s,
|
|
* data_time_s,
|
|
* TI,
|
|
* MS
|
|
* }
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd_type678 {
|
|
/* start time */
|
|
proto_69845_app_data_time_s_t start_time;
|
|
/* end time */
|
|
proto_69845_app_data_time_s_t end_time;
|
|
/* time interval */
|
|
proto_69845_app_data_ti_t ti;
|
|
/* meter set */
|
|
proto_69845_app_data_ms_t meter_set;
|
|
} proto_69845_app_data_rsd_type678_t;
|
|
|
|
/* PROTO_OI_RSD_TYPE_9 data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd_type9 {
|
|
/* times */
|
|
uint8_t times;
|
|
} proto_69845_app_data_rsd_type9_t;
|
|
|
|
/* PROTO_OI_RSD_TYPE_10 data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd_type10 {
|
|
/* record number */
|
|
uint8_t record_num;
|
|
/* meter set */
|
|
proto_69845_app_data_ms_t meter_set;
|
|
} proto_69845_app_data_rsd_type10_t;
|
|
|
|
/* PROTO_69845_APP_DATA_RCSD data structure,
|
|
* used to describe object properties associated with recordable objects.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_rcsd {
|
|
/* csd cnt */
|
|
uint8_t cnt;
|
|
/* csd list, csd see proto_69845_app_data_csd_t */
|
|
uint8_t csd_list[0];
|
|
} proto_69845_app_data_rcsd_t;
|
|
|
|
/* PROTO_OI_RSD_TYPE_2 data structure,
|
|
* see standard DL/T 698.45
|
|
* selector2::=SEQUENCE
|
|
* {
|
|
* start type
|
|
* start value Data,
|
|
* end type
|
|
* end value Data,
|
|
* ti type
|
|
* data interval Data
|
|
* }
|
|
*/
|
|
typedef struct _proto_69845_app_data_rsd_type2_data {
|
|
/* start time type */
|
|
uint8_t start_time_type;
|
|
/* start time */
|
|
proto_69845_app_data_time_s_t start_time;
|
|
/* end time type */
|
|
uint8_t end_time_type;
|
|
/* end time */
|
|
proto_69845_app_data_time_s_t end_time;
|
|
/* ti type */
|
|
uint8_t ti_type;
|
|
/* time interval */
|
|
proto_69845_app_data_ti_t ti;
|
|
/* RCSD data structure */
|
|
proto_69845_app_data_rcsd_t rcsd;
|
|
} proto_69845_app_data_rsd_type2_data_t;
|
|
|
|
/* PROTO_69845_APP_DATA_TSA data sequence structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_tsa_seq {
|
|
/* tsa cnt */
|
|
uint8_t cnt;
|
|
/* tsa list */
|
|
uint8_t tsa_list[0];
|
|
} proto_69845_app_data_tsa_seq_t;
|
|
|
|
/* PROTO_OI_MS_TYPE_GROUP_PM_TYPE data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_ms_type {
|
|
/* type cnt */
|
|
uint8_t cnt;
|
|
/* type list */
|
|
uint8_t type_list[0];
|
|
} proto_69845_app_data_ms_type_t;
|
|
|
|
/* normal event unit data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_norm_evt_unit {
|
|
/* data type, it's always PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED */
|
|
uint8_t data0_type;
|
|
/* it's always 1 */
|
|
uint32_t evt_seq;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data1_type;
|
|
/* start time */
|
|
proto_69845_app_data_time_s_t evt_start_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data2_type;
|
|
/* end time */
|
|
proto_69845_app_data_time_s_t evt_end_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data3_type;
|
|
/* it's always PROTO_69845_APP_EVT_SOC_485_FALT */
|
|
uint8_t evt_soc;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t data4_type;
|
|
/* it's always 1 */
|
|
uint8_t channel_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data5_type;
|
|
/* it's always 2 */
|
|
uint8_t member_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_OAD */
|
|
uint8_t data6_type;
|
|
/* channel oad */
|
|
proto_69845_app_oad_t channel_oad;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data7_type;
|
|
/* flag to mark if the meter power off has been reported */
|
|
uint8_t pf_rpt :1,
|
|
/* flag to mark if the meter received ack after power off reported */
|
|
pf_rpt_ok :1,
|
|
/* flag to mark if the meter power on has been reported */
|
|
po_rpt :1,
|
|
/* flag to mark if the meter received ack after power on reported */
|
|
po_rpt_ok :1,
|
|
/* reserved for further use */
|
|
rsvd :4;
|
|
} proto_69845_app_norm_evt_unit_t;
|
|
|
|
/* abnormal event unit data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_abnorm_evt_unit {
|
|
/* it's always 0 */
|
|
uint8_t evt_seq;
|
|
/* it's always 0 */
|
|
uint8_t evt_start_time;
|
|
/* it's always 0 */
|
|
uint8_t evt_end_time;
|
|
/* it's always 0 */
|
|
uint8_t evt_soc;
|
|
/* it's always 0 */
|
|
uint8_t evt_rpt_sta;
|
|
} proto_69845_app_abnorm_evt_unit_t;
|
|
|
|
/* event unit data structure. this event has occured, and not recovered
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_unrecover_evt_unit {
|
|
/* data type, it's always PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED */
|
|
uint8_t data0_type;
|
|
/* it's always 1 */
|
|
uint32_t evt_seq;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data1_type;
|
|
/* start time */
|
|
proto_69845_app_data_time_s_t evt_start_time;
|
|
/* data type, it's always 0 */
|
|
uint8_t data2_type;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data3_type;
|
|
/* it's always PROTO_69845_APP_EVT_SOC_485_FALT */
|
|
uint8_t evt_soc;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t data4_type;
|
|
/* it's always 1 */
|
|
uint8_t channel_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data5_type;
|
|
/* it's always 2 */
|
|
uint8_t member_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_OAD */
|
|
uint8_t data6_type;
|
|
/* channel oad */
|
|
proto_69845_app_oad_t channel_oad;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data7_type;
|
|
/* flag to mark if the meter power off has been reported */
|
|
uint8_t pf_rpt :1,
|
|
/* flag to mark if the meter received ack after power off reported */
|
|
pf_rpt_ok :1,
|
|
/* flag to mark if the meter power on has been reported */
|
|
po_rpt :1,
|
|
/* flag to mark if the meter received ack after power on reported */
|
|
po_rpt_ok :1,
|
|
/* reserved for further use */
|
|
rsvd :4;
|
|
} proto_69845_app_unrecover_evt_unit_t;
|
|
|
|
/* runtime range unit data structure in
|
|
* proto_69845_app_data_task_cfg_unit_t structure.
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_runtime_range_unit {
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* element cnt in structure,
|
|
* it's always 4.
|
|
*/
|
|
uint8_t cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data1_type;
|
|
/* start hour time */
|
|
uint8_t start_hour;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data2_type;
|
|
/* start minute time*/
|
|
uint8_t start_min;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data3_type;
|
|
/* end hour time */
|
|
uint8_t end_hour;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data4_type;
|
|
/* end minute time */
|
|
uint8_t end_min;
|
|
} proto_69845_app_runtime_range_unit_t;
|
|
|
|
/* PROTO_69845_APP_OI_TASK_CFG_UNIT data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_task_cfg_unit {
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* element cnt in structure,
|
|
* it's always 12.
|
|
*/
|
|
uint8_t task_cfg_ele_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data1_type;
|
|
/* task id */
|
|
uint8_t task_id;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TI */
|
|
uint8_t data2_type;
|
|
/* task execution frequency */
|
|
proto_69845_app_data_ti_t freq_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data3_type;
|
|
/* task plan type, see PROTO_69845_DATA_TASK_PLAN_TYPE_XXX */
|
|
uint8_t plan_type;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data4_type;
|
|
/* task plan num */
|
|
uint8_t plan_num;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data5_type;
|
|
/* task start time */
|
|
proto_69845_app_data_time_s_t start_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data6_type;
|
|
/* task end time */
|
|
proto_69845_app_data_time_s_t end_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TI */
|
|
uint8_t data7_type;
|
|
/* task time-delay */
|
|
proto_69845_app_data_ti_t delay_time;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data8_type;
|
|
/* operation priority */
|
|
uint8_t priority;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data9_type;
|
|
/* task state, see PROTO_69845_DATA_TASK_STATE_XXX */
|
|
uint8_t state;
|
|
/* data type, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t data10_type;
|
|
/* script ID before task start */
|
|
uint16_t pre_script_id;
|
|
/* data type, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t data11_type;
|
|
/* script ID after task end */
|
|
uint16_t post_script_id;
|
|
/* task runtime description */
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data12_type;
|
|
/* element cnt in task runtime description structure,
|
|
* it's always 2.
|
|
*/
|
|
uint8_t runtime_desc_ele_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data12_1_type;
|
|
/* runtime range type, see PROTO_69845_DATA_RUNTIME_RANGE_TYPE_XXX */
|
|
uint8_t range_type;
|
|
/* runtime range table */
|
|
/* data type, it's always PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t data12_2_type;
|
|
/* cnt in task runtime range table */
|
|
uint8_t runtime_range_cnt;
|
|
proto_69845_app_runtime_range_unit_t runtime_range_table[0];
|
|
} proto_69845_app_data_task_cfg_unit_t;
|
|
|
|
/* PROTO_69845_APP_OI_CLCT_UNIT data structure
|
|
* ::= structure:
|
|
* {
|
|
* unsigned clct_id,
|
|
* long-unsigned clct_cnt,
|
|
* structure:
|
|
* {
|
|
* unsigned clct_type,
|
|
* data clct_type_desc,
|
|
* },
|
|
* array CSD clct_data_list,
|
|
* MS meter_list,
|
|
* enum clct_sts_type,
|
|
* }
|
|
*/
|
|
|
|
/* PROTO_69845_APP_OI_CLCT_UNIT data header structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_cfg_unit_hdr {
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* element cnt in structure,
|
|
* it's always 6.
|
|
*/
|
|
uint8_t clct_cfg_ele_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data1_type;
|
|
/* clct id */
|
|
uint8_t clct_id;
|
|
/* data type, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t data2_type;
|
|
/* acquisition and storage cnt */
|
|
uint16_t clct_cnt;
|
|
} proto_69845_app_data_clct_cfg_unit_hdr_t;
|
|
|
|
/* clct type description in proto_69845_app_data_clct_type_t data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_type_desc {
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* element cnt in structure,
|
|
* it's always 2.
|
|
*/
|
|
uint8_t ele_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TI */
|
|
uint8_t data1_type;
|
|
/* time scale interval */
|
|
proto_69845_app_data_ti_t ts_interval;
|
|
/* data type, see PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t data2_type;
|
|
/* supplementary recording cycle cnt */
|
|
uint16_t cycle_cnt;
|
|
} proto_69845_app_data_clct_type_desc_t;
|
|
|
|
/* clct type in PROTO_69845_APP_OI_CLCT_UNIT data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_type {
|
|
/* data type, it's always PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* element cnt in structure,
|
|
* it's always 2.
|
|
*/
|
|
uint8_t ele_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED */
|
|
uint8_t data1_type;
|
|
/* clct type, see PROTO_69845_DATA_CLCT_UNIT_TYPE_XXX */
|
|
uint8_t type;
|
|
/* data type, see PROTO_69845_APP_DATA_XXX */
|
|
uint8_t data2_type;
|
|
/* clct type desc data, base on data2_type */
|
|
uint8_t data[0];
|
|
} proto_69845_app_data_clct_type_t;
|
|
|
|
/* CSD unit in data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_csd {
|
|
/* data type, it's always PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t data0_type;
|
|
/* csd cnt, it's always 1 */
|
|
uint8_t csd_cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_CSD */
|
|
uint8_t data1_type;
|
|
/* csd type, see PROTO_OI_CSD_TYPE_XXX
|
|
* 0 mean csd_data is PROTO_69845_APP_DATA_OAD
|
|
* 1 mean csd_data is PROTO_69845_APP_DATA_ROAD
|
|
*/
|
|
uint8_t type;
|
|
/* data */
|
|
uint8_t csd_data[0];
|
|
} proto_69845_app_data_clct_csd_t;
|
|
|
|
/* MS in PROTO_69845_APP_OI_CLCT_UNIT data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_ms {
|
|
/* data type, it's always PROTO_69845_APP_DATA_MS */
|
|
uint8_t data_type;
|
|
/* ms type, see PROTO_OI_MS_TYPE_XXX */
|
|
uint8_t type;
|
|
/* ms data.
|
|
* if type is PROTO_OI_MS_TYPE_NO_PM or
|
|
* PROTO_OI_MS_TYPE_ALL_PM, ms_data is invalid
|
|
*/
|
|
uint8_t ms_data[0];
|
|
} proto_69845_app_data_clct_ms_t;
|
|
|
|
/* PROTO_69845_APP_OI_CLCT_UNIT data header structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_clct_cfg_unit_tail {
|
|
/* data type, it's always PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data_type;
|
|
/* storage timescale type, see PROTO_69845_DATA_CLCT_UNIT_STS_XXX */
|
|
uint8_t clct_sts_type;
|
|
} proto_69845_app_data_clct_cfg_unit_tail_t;
|
|
|
|
/* notification and response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_noti_resp {
|
|
/* notification or response data type,
|
|
* see PROTO_69845_C_APP_XXX or PROTO_69845_S_APP_XXX
|
|
*/
|
|
uint8_t type;
|
|
/* notification or response data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_noti_resp_t;
|
|
|
|
/* server report notify data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_noti {
|
|
/* report notify data type, see PROTO_69845_APP_REPRORT_XX*/
|
|
uint8_t data_type;
|
|
/* report notify data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_noti_t;
|
|
|
|
/* report normal list data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_nor_list {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* attribute count */
|
|
uint8_t att_cnt;
|
|
/* attribute data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_nor_list_t;
|
|
|
|
/* report record list data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_record_list {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* attribute count */
|
|
uint8_t att_cnt;
|
|
/* attribute data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_record_list_t;
|
|
|
|
/* report result record data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_result_record {
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* record column selection descriptor, include csd list,
|
|
* followed proto_69845_app_rpt_noti_result_t in the behind
|
|
*/
|
|
proto_69845_app_data_rcsd_t rcsd;
|
|
} proto_69845_app_rpt_result_record_t;
|
|
|
|
/* report notify result data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_noti_result {
|
|
/* result type, see PROTO_69845_APP_RPT_RESULT_XX */
|
|
uint8_t type;
|
|
/* result data*/
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_noti_result_t;
|
|
|
|
/* report notify result data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_array_result {
|
|
/* result array len */
|
|
uint8_t array_len;
|
|
/* result data*/
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_array_result_t;
|
|
|
|
/* report record row data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_record_row {
|
|
/* record number */
|
|
uint8_t record_num;
|
|
/* record row data*/
|
|
uint8_t data[0];
|
|
} proto_69845_app_rpt_record_row_t;
|
|
|
|
/* element data structure in data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_ele_data {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX */
|
|
uint8_t data_type;
|
|
/* the number of this type of data in the data domain */
|
|
uint8_t num_of_data;
|
|
/* This type of data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_ele_data_t;
|
|
|
|
/* data structure in apdu,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX */
|
|
uint8_t data_type;
|
|
/* This type of data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_data_t;
|
|
|
|
/* get result data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_result {
|
|
/* type of result, see PROTO_69845_APP_GET_RESULT_XXX */
|
|
uint8_t result_type;
|
|
/* the data of the result */
|
|
uint8_t result[0];
|
|
} proto_69845_app_get_result_t;
|
|
|
|
/* A Result Normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_result_normal {
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* get a result normal data */
|
|
proto_69845_app_get_result_t get_result;
|
|
} proto_69845_app_result_normal_t;
|
|
|
|
/* Client Get Request Normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req_normal {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
} proto_69845_app_get_req_normal_t;
|
|
|
|
/* Client Get Request Normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req_normal_list {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* oad cnt */
|
|
uint8_t oad_cnt;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad[0];
|
|
} proto_69845_app_get_req_normal_list_t;
|
|
|
|
/* Client Get Request record data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req_record {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* rsd and rcsd */
|
|
uint8_t rsd_and_rcsd[0];
|
|
} proto_69845_app_get_req_record_t;
|
|
|
|
/* Client Get Request Next data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req_next{
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* last sequence number */
|
|
uint16_t last_seq;
|
|
} proto_69845_app_get_req_next_t;
|
|
|
|
/* Client Get Request simplify record data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_simp_record_resp {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* rsd and road */
|
|
uint8_t rsd_and_road[0];
|
|
} proto_69845_app_get_simp_record_resp_t;
|
|
|
|
/* Client Get Request record data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_record_resp {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* record column selection descriptor */
|
|
uint8_t rcsd[0];
|
|
} proto_69845_app_get_record_resp_t;
|
|
|
|
/* Server Get Response Normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_resp_normal {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* type of result, see PROTO_69845_APP_GET_RESULT_XXX */
|
|
uint8_t result_type;
|
|
/* the data of the result */
|
|
uint8_t result[0];
|
|
} proto_69845_app_get_resp_normal_t;
|
|
|
|
/* Server Get Response Next data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_resp_next {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* end flag, 1 is end */
|
|
uint8_t end_flag;
|
|
/* sequence number */
|
|
uint16_t seq;
|
|
/* data type, see PROTO_69845_GET_RESP_NEXT_XXX */
|
|
uint8_t data_type;
|
|
/* the number of this type of data in the data domain */
|
|
uint8_t num_of_data;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_get_resp_next_t;
|
|
|
|
/* Server Get Response Next fail data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_resp_next_fail {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* end flag, 1 is end */
|
|
uint8_t end_flag;
|
|
/* sequence number */
|
|
uint16_t seq;
|
|
/* data type is PROTO_69845_GET_RESP_NEXT_ERR */
|
|
uint8_t data_type;
|
|
/* err code */
|
|
uint8_t err_code;
|
|
} proto_69845_app_get_resp_next_fail_t;
|
|
|
|
typedef struct _proto_69845_app_oad_resp_hdr {
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* type of result, see PROTO_69845_APP_GET_RESULT_XXX */
|
|
uint8_t result_type;
|
|
/* the data of the result */
|
|
uint8_t result[0];
|
|
} proto_69845_app_oad_resp_hdr_t;
|
|
|
|
/* Server Get Response Normal list data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_resp_normal_list {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* oad cnt */
|
|
uint8_t oad_cnt;
|
|
/* oad data */
|
|
uint8_t oad_data[0];
|
|
} proto_69845_app_get_resp_normal_list_t;
|
|
|
|
/* Client Get Request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req {
|
|
/* get request data type, see PROTO_69845_APP_GET_XXX*/
|
|
uint8_t data_type;
|
|
/* get requests data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_get_req_t;
|
|
|
|
/* Server Get Response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_resp {
|
|
/* get response data type, see PROTO_69845_APP_GET_XXX*/
|
|
uint8_t data_type;
|
|
/* get response data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_get_resp_t;
|
|
|
|
/* Client Set Request Normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_set_req_normal {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* data */
|
|
proto_69845_app_data_t data;
|
|
} proto_69845_app_set_req_normal_t;
|
|
|
|
typedef struct _proto_69845_app_oad_with_data {
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* data */
|
|
proto_69845_app_data_t data;
|
|
} proto_69845_app_oad_with_data_t;
|
|
|
|
typedef struct _proto_69845_app_set_req_normal_list {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* oad cnt */
|
|
uint8_t oad_cnt;
|
|
/* object attribute descriptor with data,
|
|
* see proto_69845_app_oad_with_data_t
|
|
*/
|
|
uint8_t oad_and_dar_list[0];
|
|
} proto_69845_app_set_req_normal_list_t;
|
|
|
|
typedef struct _proto_69845_app_oad_with_dar {
|
|
/* object method descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
/* see PROTO_69845_APP_DAR_XXX */
|
|
uint8_t dar;
|
|
} proto_69845_app_oad_with_dar_t;
|
|
|
|
/* Server Set response normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_set_resp_normal {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object method descriptor with data */
|
|
proto_69845_app_oad_with_dar_t result;
|
|
} proto_69845_app_set_resp_normal_t;
|
|
|
|
typedef struct _proto_69845_app_set_resp_normal_list {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* oad cnt */
|
|
uint8_t oad_cnt;
|
|
/* object method descriptor with data */
|
|
proto_69845_app_oad_with_dar_t result[0];
|
|
} proto_69845_app_set_resp_normal_list_t;
|
|
|
|
/* Client Set Request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_set_req {
|
|
/* set request data type, see PROTO_69845_APP_SET_XXX*/
|
|
uint8_t data_type;
|
|
/* set requests data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_set_req_t;
|
|
|
|
/* Server Set Response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_set_resp {
|
|
/* set response data type, see PROTO_69845_APP_SET_XXX*/
|
|
uint8_t data_type;
|
|
/* set response data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_set_resp_t;
|
|
|
|
/* Client action Request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_req {
|
|
/* action request data type, see PROTO_69845_APP_ACTION_XXX*/
|
|
uint8_t data_type;
|
|
/* action requests data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_action_req_t;
|
|
|
|
/* Client action request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_req_single {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* Object method descriptor data */
|
|
proto_69845_app_omd_t omd;
|
|
/* data */
|
|
proto_69845_app_data_t data;
|
|
} proto_69845_app_action_req_single_t;
|
|
|
|
typedef struct _proto_69845_app_omd_with_data {
|
|
/* object method descriptor data */
|
|
proto_69845_app_omd_t omd;
|
|
/* data */
|
|
proto_69845_app_data_t data;
|
|
} proto_69845_app_omd_with_data_t;
|
|
|
|
/* Client action request normal list data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_req_list {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* omd cnt */
|
|
uint8_t omd_cnt;
|
|
/* object method descriptor with data,
|
|
* see proto_69845_app_omd_with_data_t
|
|
*/
|
|
uint8_t omd_and_data_list[0];
|
|
} proto_69845_app_action_req_list_t;
|
|
|
|
/* Server action response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_resp {
|
|
/* action response data type, see PROTO_69845_APP_ACTION_XXX*/
|
|
uint8_t data_type;
|
|
/* action response data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_action_resp_t;
|
|
|
|
typedef struct _proto_69845_app_omd_with_dar {
|
|
/* object method descriptor data */
|
|
proto_69845_app_omd_t omd;
|
|
/* see PROTO_69845_APP_DAR_XXX */
|
|
uint8_t dar;
|
|
/* see PROTO_69845_APP_OPTIONAL_XXX */
|
|
uint8_t optional;
|
|
/* optional is PROTO_69845_APP_OPTIONAL_NO_DATA: no data.
|
|
* optional is PROTO_69845_APP_OPTIONAL_DATA: the data structure is
|
|
* proto_69845_app_data_t.
|
|
*/
|
|
uint8_t data[0];
|
|
} proto_69845_app_omd_with_dar_t;
|
|
|
|
/* Server action response normal data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_resp_normal {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object method descriptor with data */
|
|
proto_69845_app_omd_with_dar_t result;
|
|
} proto_69845_app_action_resp_normal_t;
|
|
|
|
/* Server action response normal list data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_action_resp_normal_list {
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* omd cnt */
|
|
uint8_t omd_cnt;
|
|
/* object method descriptor with data,
|
|
* see proto_69845_app_omd_with_dar_t
|
|
*/
|
|
uint8_t omd_and_dar_list[0];
|
|
} proto_69845_app_action_resp_normal_list_t;
|
|
|
|
/* Client report response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_report_resp {
|
|
/* action request data type, see PROTO_69845_APP_REPRORT_XXX*/
|
|
uint8_t data_type;
|
|
/* action requests data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_report_resp_t;
|
|
|
|
/* Client report response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_report_req {
|
|
/* action request data type, see PROTO_69845_APP_REPRORT_XXX*/
|
|
uint8_t data_type;
|
|
/* action requests data information */
|
|
uint8_t data[0];
|
|
} proto_69845_app_report_req_t;
|
|
|
|
/* ReportNotificationSimplifyRecord::= SEQUENCE:
|
|
* {
|
|
* PIID-ACD,
|
|
* OAD,
|
|
* RSD,
|
|
* ROAD,
|
|
* record data CHOICE
|
|
* {
|
|
* [0] DAR
|
|
* [1] A-SimplifyRecord
|
|
* }
|
|
* }
|
|
*/
|
|
/* simplify record report data structure,
|
|
* see standard DL/T 698.45, for jangsu
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_simp_rec_req_hdr {
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* oad */
|
|
proto_69845_app_oad_t oad;
|
|
/* rsd, road, record */
|
|
uint8_t rsd_road_record[0];
|
|
} proto_69845_app_rpt_simp_rec_req_hdr_t;
|
|
|
|
/* Request and Response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_req_resp {
|
|
/* request or response data type,
|
|
* see PROTO_69845_C_APP_XXX or PROTO_69845_S_APP_XXX
|
|
*/
|
|
uint8_t type;
|
|
/* request or response data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_req_resp_t;
|
|
|
|
/* application layer payload data unit */
|
|
typedef struct _proto_69845_apdu {
|
|
/* apdu type, see PROTO_69845_C_APP_XXX or PROTO_69845_S_APP_XXX */
|
|
uint8_t type;
|
|
/* apdu payload */
|
|
uint8_t data[0];
|
|
} proto_69845_apdu_t;
|
|
|
|
/* apdt get reso,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_apdu_get_rsp {
|
|
/* get response type, see PROTO_69845_APP_GET_XXX. */
|
|
uint8_t type;
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* request or response data */
|
|
uint8_t data[0];
|
|
} proto_69845_apdu_get_rsp_t;
|
|
|
|
/* Get Request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_req_info {
|
|
/* get data type, see PROTO_69845_GET_XXX */
|
|
uint8_t type;
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
} proto_69845_app_get_req_info_t;
|
|
|
|
/* Get normal list request data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_get_list_req_info {
|
|
/* get data type, see PROTO_69845_APP_GET_NORMALLIST */
|
|
uint8_t type;
|
|
/* oad cnt */
|
|
uint8_t oad_cnt;
|
|
/* priority and invoke id data */
|
|
proto_69845_app_piid_t piid;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad[0];
|
|
} proto_69845_app_get_list_req_info_t;
|
|
|
|
/* PROTO_69845_APP_LEN_DESCRIPT data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_len_descript {
|
|
/* len byte number */
|
|
uint8_t byte_num: 7,
|
|
/* multibyte flag */
|
|
mub_flag: 1;
|
|
} proto_69845_app_len_descript_t;
|
|
|
|
/* security request and response data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_sec_req_resp_info {
|
|
/* security data type, see PROTO_69845_SEC_DATA_TYPE_XXX */
|
|
uint8_t type;
|
|
/* data length */
|
|
uint8_t len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_sec_req_resp_info_t;
|
|
|
|
/* security req and resp data validation structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_sec_req_resp_vali_info {
|
|
/* security validation type,
|
|
* req see PROTO_69845_SEC_REQ_VALI_TYPE_XXX.
|
|
* resp see PROTO_69845_SEC_RESP_VALI_TYPE_XXX.
|
|
*/
|
|
uint8_t type;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_sec_req_resp_vali_info_t;
|
|
|
|
/* security validation random number structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_sec_rn_info {
|
|
/* rn length */
|
|
uint8_t len;
|
|
/* rn */
|
|
uint8_t data[0];
|
|
} proto_69845_app_sec_rn_info_t;
|
|
|
|
/* security validation optional data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_sec_optinon_info {
|
|
/* security validation type,
|
|
* req see PROTO_69845_SEC_REQ_VALI_TYPE_XXX.
|
|
* resp see PROTO_69845_SEC_RESP_VALI_TYPE_XXX.
|
|
*/
|
|
uint8_t type;
|
|
/* choice */
|
|
uint8_t choice;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_app_sec_optinon_info_t;
|
|
|
|
/* security validation mac data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_sec_mac_info {
|
|
/* mac length */
|
|
uint8_t len;
|
|
/* mac */
|
|
uint8_t data[0];
|
|
} proto_69845_app_sec_mac_info_t;
|
|
|
|
typedef struct _proto_69845_ctrl {
|
|
/* function code. see PROTO_69845_FN_XXX */
|
|
uint8_t fn :3,
|
|
/* flag of scrambling code identification
|
|
* if flag_scramble is 1, it mean that the link user data is scrambled.
|
|
* if flag_scramble is 0, it mean that the link user data isn't scrambled.
|
|
* scrambling code is 0x33.
|
|
*/
|
|
flag_scramble :1,
|
|
/* reserve */
|
|
reserve :1,
|
|
/* flag to mark if the data is a fragment of the APDU,
|
|
* see PROTO_69845_APDU_XXX.
|
|
*/
|
|
fragment :1,
|
|
/* prm : flag of primary request message.
|
|
* dir : flag of direction.
|
|
* The two flags unite to represent meaning, as follow:
|
|
* dir prm
|
|
* 0 0 the response of the client to the server report
|
|
* 0 1 client initiated request
|
|
* 1 0 server initiated report
|
|
* 1 1 the response of the server to the client request
|
|
* see PROTO_69845_D_P_XXX.
|
|
*/
|
|
dir_prm :2;
|
|
} proto_69845_ctrl_t;
|
|
|
|
typedef struct _proto_69845_addr_flag {
|
|
/* length of the server address.
|
|
* the length include 1 byte client address
|
|
* and (sa_len - 1) byte server address.
|
|
*/
|
|
uint8_t sa_len :4,
|
|
/* logical address */
|
|
logical_addr :1,
|
|
/* flag of extended logical address */
|
|
flg_ext :1,
|
|
/* type of the server address, see PROTO_69845_SA_TYPE_XXX. */
|
|
sa_type :2;
|
|
} proto_69845_addr_flag_t;
|
|
|
|
/* PROTO_69845_APP_DATA_TSA data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_data_tsa {
|
|
/* include flag len and address len */
|
|
uint8_t len;
|
|
/* flag of address field */
|
|
proto_69845_addr_flag_t flag;
|
|
/* server address and client address */
|
|
uint8_t sa_and_ca[0];
|
|
} proto_69845_app_data_tsa_t;
|
|
|
|
typedef struct _proto_69845_addr {
|
|
/* flag of address field */
|
|
proto_69845_addr_flag_t flag;
|
|
/* server address and client address */
|
|
uint8_t sa_and_ca[0];
|
|
} proto_69845_addr_t;
|
|
|
|
/* frame head info of 698.45 protocol link layer frame */
|
|
typedef struct proto_69845_frame_head_info {
|
|
/* start char, see PROTO_69845_START_BYTE */
|
|
uint8_t start_char;
|
|
/* frame data length */
|
|
uint16_t len;
|
|
/* control code */
|
|
proto_69845_ctrl_t ctrl;
|
|
/* address field */
|
|
proto_69845_addr_t addr;
|
|
} proto_69845_frame_head_info_t;
|
|
|
|
/* frame tail info of 698.45 protocol link layer frame */
|
|
typedef struct _proto_69845_tailer {
|
|
/* check sum */
|
|
uint8_t fcs[PROTO_69845_CHECKSUM_LEN];
|
|
/* end char. see 645_END_CHAR */
|
|
uint8_t end_char;
|
|
} proto_69845_tailer_t;
|
|
|
|
/* structure of 698.45 link layer frame
|
|
-------------
|
|
|----68H----| start of frame, 0x68
|
|
|----Len----| 2 byte. length of frame except start of frame and end of frame
|
|
|----Ctrl---| 1 byte of control
|
|
|----Addr---| address field. length is variable
|
|
|----HCS----| 2 byte of frame header check
|
|
|----Data---| APDU. length is variable
|
|
|----FCS----| 2 byte of frame
|
|
|----16H----| end of frame, 0x16
|
|
-------------
|
|
*/
|
|
|
|
typedef struct _proto_69845_rpt_meter_energy_data {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 5 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type0;
|
|
/* total energy value. big endian, uint is 0.01kWh.
|
|
* value is double long data or double long unsigned data
|
|
* base on type0.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type1;
|
|
/* the rate 1 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type1.
|
|
*/
|
|
uint8_t rate_1[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type2;
|
|
/* the rate 2 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type2.
|
|
*/
|
|
uint8_t rate_2[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type3;
|
|
/* the rate 3 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type3.
|
|
*/
|
|
uint8_t rate_3[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type4;
|
|
/* the rate 3 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type3.
|
|
*/
|
|
uint8_t rate_4[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_meter_energy_data_t;
|
|
|
|
typedef struct _proto_69845_rpt_meter_energy_data_simp {
|
|
/* total energy value. big endian, uint is 0.01kWh.
|
|
* value is double long data or double long unsigned data
|
|
* base on type0.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* the rate 1 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type1.
|
|
*/
|
|
uint8_t rate_1[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* the rate 2 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type2.
|
|
*/
|
|
uint8_t rate_2[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* the rate 3 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type3.
|
|
*/
|
|
uint8_t rate_3[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* the rate 3 energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data
|
|
* base on type3.
|
|
*/
|
|
uint8_t rate_4[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_meter_energy_data_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_meter_energy_sum_data {
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type;
|
|
/* total energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_meter_energy_sum_data_t;
|
|
|
|
typedef struct _proto_69845_rpt_meter_energy_sum_data_simp {
|
|
/* total energy value. big endian, uint is 0.01kWh
|
|
* value is double long data or double long unsigned data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_meter_energy_sum_data_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_demand_with_time {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t type;
|
|
/* cnt is 2 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG or
|
|
* PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED
|
|
*/
|
|
uint8_t type0;
|
|
/* max demand value. big endian, unit is 0.0001kW.
|
|
* value is double long data or double long unsigned data
|
|
* base on type0.
|
|
*/
|
|
uint8_t demand[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t type1;
|
|
/* occurrence time */
|
|
proto_69845_app_data_time_s_t time;
|
|
} proto_69845_rpt_demand_with_time_t;
|
|
|
|
typedef struct _proto_69845_rpt_v_3p {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 3 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t type0;
|
|
/* a phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t type1;
|
|
/* b phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t type2;
|
|
/* c phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_v_3p_t;
|
|
|
|
typedef struct _proto_69845_rpt_v_3p_simp {
|
|
/* a phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* b phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* c phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_v_3p_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_v_single {
|
|
/* type is PROTO_69845_APP_DATA_LONG_UNSIGNED */
|
|
uint8_t type;
|
|
/* a phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_v_single_t;
|
|
|
|
typedef struct _proto_69845_rpt_v_single_simp {
|
|
/* a phase voltage. big endian, unit is 0.1V.
|
|
* value is long unsigned data
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_v_single_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_i_3p {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 3 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type0;
|
|
/* a phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type1;
|
|
/* b phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type2;
|
|
/* c phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_i_3p_t;
|
|
|
|
typedef struct _proto_69845_rpt_i_3p_simp {
|
|
/* a phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* b phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* c phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_i_3p_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_i_single {
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type;
|
|
/* a phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_i_single_t;
|
|
|
|
typedef struct _proto_69845_rpt_i_single_simp {
|
|
/* a phase current. big endian, uint is 0.001A.
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_i_single_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_power_3p {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 4 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type0;
|
|
/* total power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type1;
|
|
/* a phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type2;
|
|
/* b phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type3;
|
|
/* c phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_power_3p_t;
|
|
|
|
typedef struct _proto_69845_rpt_power_3p_simp {
|
|
/* total power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* a phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* b phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* c phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_power_3p_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_power_single {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 2 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type0;
|
|
/* total power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG */
|
|
uint8_t type1;
|
|
/* a phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_power_single_t;
|
|
|
|
typedef struct _proto_69845_rpt_power_single_simp {
|
|
/* total power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* a phase power data. big endian, uint is 0.1W
|
|
* value is double long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
} proto_69845_rpt_power_single_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_pf_3p {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 4 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type0;
|
|
/* total power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type1;
|
|
/* a phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type2;
|
|
/* b phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type3;
|
|
/* c phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_pf_3p_t;
|
|
|
|
typedef struct _proto_69845_rpt_pf_3p_simp {
|
|
/* total power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* a phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* b phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t b[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* c phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t c[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_pf_3p_simp_t;
|
|
|
|
typedef struct _proto_69845_rpt_pf_single {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 2 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type0;
|
|
/* total power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type1;
|
|
/* a phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_pf_single_t;
|
|
|
|
typedef struct _proto_69845_rpt_pf_single_simp {
|
|
/* total power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t total[PROTO_69845_METER_DATA_LONG_LEN];
|
|
/* a phase power factor data. big endian, unit is 0.001.
|
|
* value is long data.
|
|
*/
|
|
uint8_t a[PROTO_69845_METER_DATA_LONG_LEN];
|
|
} proto_69845_rpt_pf_single_simp_t;
|
|
|
|
/* PROTO_69845_APP_DATA_TIME_S data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_rpt_data_time_s {
|
|
/* type is PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t type;
|
|
/* time */
|
|
uint16_t year;
|
|
uint8_t month;
|
|
uint8_t day;
|
|
uint8_t hour;
|
|
uint8_t minute;
|
|
uint8_t second;
|
|
} proto_69845_rpt_data_time_s_t;
|
|
|
|
/* PROTO_69845_APP_DATA_TIME_S simple data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_rpt_data_time_s_simp {
|
|
/* time */
|
|
uint16_t year;
|
|
uint8_t month;
|
|
uint8_t day;
|
|
uint8_t hour;
|
|
uint8_t minute;
|
|
uint8_t second;
|
|
} proto_69845_rpt_data_time_s_simp_t;
|
|
|
|
/* PROTO_69845_MAX_DEMAND_DATA_T data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_demand_with_time {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX
|
|
* it's always PROTO_69845_APP_DATA_STRUCTURE.
|
|
*/
|
|
uint8_t type;
|
|
/* element cnt in structure,
|
|
* it's always 2.
|
|
*/
|
|
uint8_t cnt;
|
|
/* demand data type, see PROTO_69845_APP_DATA_XXX
|
|
* it's always PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED.
|
|
*/
|
|
uint8_t demand_data_type;
|
|
/* demand data */
|
|
uint8_t demand[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* time tpye, see PROTO_69845_APP_DATA_XXX
|
|
* it's always PROTO_69845_APP_DATA_TIME_S.
|
|
*/
|
|
uint8_t time_type;
|
|
/* time */
|
|
proto_69845_app_data_time_s_t time;
|
|
} proto_69845_demand_with_time_t;
|
|
|
|
typedef struct _proto_69845_app_clct_state_tsa {
|
|
/* include flag len and address len */
|
|
uint8_t len;
|
|
/* flag of address field */
|
|
proto_69845_addr_flag_t flag;
|
|
/* server address and client address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
} proto_69845_app_clct_state_tsa_t;
|
|
|
|
/* PROTO_69845_APP_OI_CLCT_STATE_LIST data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_clct_state {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX
|
|
* it's always PROTO_69845_APP_DATA_STRUCTURE.
|
|
*/
|
|
uint8_t type;
|
|
/* element cnt in structure,
|
|
* it's always 8.
|
|
*/
|
|
uint8_t cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_TSA. */
|
|
uint8_t data0_type;
|
|
/* mac address */
|
|
proto_69845_app_clct_state_tsa_t mac_addr;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_UNSIGNED. */
|
|
uint8_t data1_type;
|
|
/* relay level */
|
|
uint8_t level;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_TSA. */
|
|
uint8_t data2_type;
|
|
/* relay address */
|
|
proto_69845_app_clct_state_tsa_t relay_addr;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_OAD. */
|
|
uint8_t data3_type;
|
|
/* port description */
|
|
proto_69845_app_oad_t oad;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_TIME_S. */
|
|
uint8_t data4_type;
|
|
/* port description */
|
|
proto_69845_app_data_time_s_t last_time;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_UNSIGNED. */
|
|
uint8_t data5_type;
|
|
/* collection failure times */
|
|
uint8_t fail_cnt;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_ENUM. */
|
|
uint8_t data6_type;
|
|
/* phase description, it's always 0.
|
|
* 0 means that phase is unknown.
|
|
*/
|
|
uint8_t phase_desc;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_ENUM. */
|
|
uint8_t data7_type;
|
|
/* abnormal description, it's always 0.
|
|
* 0 means that phase is normal.
|
|
*/
|
|
uint8_t abnormal_desc;
|
|
} proto_69845_clct_state_t;
|
|
|
|
/* PROTO_69845_APP_OI_CLCT_MONITOR_LIST data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_clct_monitor {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX
|
|
* it's always PROTO_69845_APP_DATA_STRUCTURE.
|
|
*/
|
|
uint8_t type;
|
|
/* element cnt in structure,
|
|
* it's always 8.
|
|
*/
|
|
uint8_t cnt;
|
|
/* data type, it's always PROTO_69845_APP_DATA_UNSIGNED. */
|
|
uint8_t data0_type;
|
|
/* task id */
|
|
uint8_t task_id;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_ENUM. */
|
|
uint8_t data1_type;
|
|
/* task run state, it's always 1.
|
|
* 1 mean that task is running.
|
|
*/
|
|
uint8_t task_state;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_TIME_S. */
|
|
uint8_t data2_type;
|
|
/* task start time */
|
|
proto_69845_app_data_time_s_t start_time;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_TIME_S. */
|
|
uint8_t data3_type;
|
|
/* task end time */
|
|
proto_69845_app_data_time_s_t end_time;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data4_type;
|
|
/* collect meter cnt */
|
|
uint16_t collect_meter_cnt;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data5_type;
|
|
/* collection success cnt */
|
|
uint16_t success_cnt;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data6_type;
|
|
/* send cnt */
|
|
uint16_t send_cnt;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data7_type;
|
|
/* receive cnt */
|
|
uint16_t rec_cnt;
|
|
} proto_69845_clct_monitor_t;
|
|
|
|
typedef struct _proto_698_flw_status {
|
|
/* reserve for future */
|
|
uint8_t reserve0_bit0 : 1,
|
|
/* flag of event that esam is error */
|
|
esam_error : 1,
|
|
/* reserve for future */
|
|
reserve0_bit2 : 1,
|
|
/* flag of event that battery of clock chip is low voltage. */
|
|
clock_battery_low : 1,
|
|
/* reserve for future */
|
|
reserve0_bit4 : 1,
|
|
/* flag of event that flash fault. */
|
|
flash_error : 1,
|
|
/* reserve for future */
|
|
reserve0_bit6_7 : 2;
|
|
/* flag of event that battery for meter reading in case of power
|
|
* failure is low voltage.
|
|
*/
|
|
uint8_t battery_low_for_pd : 1,
|
|
/* flag of overdraft status */
|
|
overdraft_status : 1,
|
|
/* reserve for future */
|
|
reserve1_bit2_5 : 4,
|
|
/* switch trip successful */
|
|
switch_trip : 1,
|
|
/* switch on successful */
|
|
switch_on : 1;
|
|
/* reserve for future */
|
|
uint8_t reserve2;
|
|
/* reserve for future */
|
|
uint8_t reserve3;
|
|
} proto_698_flw_status_t;
|
|
|
|
typedef struct _proto_69845_rs_word_1 {
|
|
/* reserve1 for future */
|
|
uint16_t reserve1 :1,
|
|
/* accumulation mode of demand */
|
|
demand_mode :1,
|
|
/* clock battery */
|
|
clock_battery :1,
|
|
/* power down meter reading battery */
|
|
pd_mr_battery :1,
|
|
/* active power direction */
|
|
act_power_dir :1,
|
|
/* reactive power direction */
|
|
react_power_dir :1,
|
|
/* reserve2 for future */
|
|
reserve2 :2,
|
|
/* control loop error */
|
|
ctrl_loop :1,
|
|
/* ESAM error */
|
|
esam :1,
|
|
/* reserve3 for future */
|
|
reserve3 :2,
|
|
/* internal program error */
|
|
inter_program :1,
|
|
/* memory failure or damage */
|
|
memory :1,
|
|
/* overdraft state */
|
|
overdraft :1,
|
|
/* clock failure */
|
|
clock_fail :1;
|
|
} proto_69845_rs_word_1_t;
|
|
|
|
typedef struct _proto_69845_rs_word_2 {
|
|
/* A active power direction */
|
|
uint16_t a_act_power_dir :1,
|
|
/* B active power direction */
|
|
b_act_power_dir :1,
|
|
/* C active power direction */
|
|
c_act_power_dir :1,
|
|
/* reserve for future */
|
|
reserve :1,
|
|
/* A reactive active power direction */
|
|
a_rea_power_dir :1,
|
|
/* B reactive active power direction */
|
|
b_rea_power_dir :1,
|
|
/* C reactive active power direction */
|
|
c_rea_power_dir :1,
|
|
/* reserve for future */
|
|
reserve1 :9;
|
|
} proto_69845_rs_word_2_t;
|
|
|
|
typedef struct _proto_69845_rs_word_3 {
|
|
/* reserve for future */
|
|
uint16_t reserve :1,
|
|
/* The power supply mode */
|
|
power_mode :2,
|
|
/* programming operation permit */
|
|
oper_pro :1,
|
|
/* relay status */
|
|
relay_state :1,
|
|
/* reserve for future */
|
|
reserve1 :1,
|
|
/* relay command */
|
|
relay_cmd :1,
|
|
/* pre-trip alarm */
|
|
trip_ararm :1,
|
|
/* meter prepayment type, see proto_69845_METER_XXX*/
|
|
perpay_type :2,
|
|
/* reserve for future */
|
|
reserve2 :2,
|
|
/* electrical state */
|
|
electrical_state :1,
|
|
/* status of identity authentication */
|
|
ide_aut_state :1,
|
|
/* local account opening status */
|
|
local_acc_ope_state :1,
|
|
/* remote account opening status */
|
|
remote_acc_ope_state :1;
|
|
} proto_69845_rs_word_3_t;
|
|
|
|
typedef struct _proto_69845_rs_word_456 {
|
|
/* loss voltage */
|
|
uint16_t v_loss1 :1,
|
|
/* loss voltage */
|
|
v_loss2 :1,
|
|
/* over voltage */
|
|
v_over :1,
|
|
/* no current */
|
|
a_loss :1,
|
|
/* auxiliary power loss */
|
|
a_over :1,
|
|
/* over load */
|
|
load_over :1,
|
|
/* power reverse */
|
|
power_reverse :1,
|
|
/* broken phase */
|
|
broken_phase :1,
|
|
/* total power factor over lower limit */
|
|
broken_current :1,
|
|
/* reserve for future */
|
|
reserve :7;
|
|
} proto_69845_rs_word_456_t;
|
|
|
|
typedef struct _proto_69845_rs_word_7 {
|
|
/* voltage reverse phase sequence */
|
|
uint16_t v_rps :1,
|
|
/* current reverse phase sequence */
|
|
a_rp_seq :1,
|
|
/* voltage unbalance */
|
|
v_unbalance :1,
|
|
/* current unbalance */
|
|
a_unbalance :1,
|
|
/* auxiliary power loss */
|
|
aux_power_loss :1,
|
|
/* power failure */
|
|
power_fail :1,
|
|
/* excess requirement */
|
|
req_excess :1,
|
|
/* total power factor over lower limit */
|
|
tpf_over_lower :1,
|
|
/* serious current imbalance */
|
|
a_ser_imbalance :1,
|
|
/* reserve for future */
|
|
reserve :7;
|
|
} proto_69845_rs_word_7_t;
|
|
|
|
/* The running status word for the electricity meter
|
|
* running status word 1 - 7 unit length see PROTO_69845_RS_WORD_UNIT_LEN
|
|
*/
|
|
typedef struct _proto_69845_rs_word {
|
|
/* The running status word 1 for the electricity meter */
|
|
proto_69845_rs_word_1_t rs_word_1;
|
|
/* The running status word 2 for the electricity meter */
|
|
proto_69845_rs_word_2_t rs_word_2;
|
|
/* The running status word 3 for the electricity meter */
|
|
proto_69845_rs_word_3_t rs_word_3;
|
|
/* The running status word 456 for the electricity meter */
|
|
proto_69845_rs_word_456_t rs_word_456[3];
|
|
/* The running status word 7 for the electricity meter */
|
|
proto_69845_rs_word_7_t rs_word_7;
|
|
} proto_69845_rs_word_t;
|
|
|
|
/* The report running status word for the electricity meter */
|
|
typedef struct _proto_69845_rpt_rs_word {
|
|
/* type is PROTO_69845_APP_DATA_ARRAY */
|
|
uint8_t type;
|
|
/* cnt is 7 */
|
|
uint8_t cnt;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type1;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type1;
|
|
/* The running status word 1 for the electricity meter */
|
|
proto_69845_rs_word_1_t rs_word_1;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type2;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type2;
|
|
/* The running status word 2 for the electricity meter */
|
|
proto_69845_rs_word_2_t rs_word_2;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type3;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type3;
|
|
/* The running status word 3 for the electricity meter */
|
|
proto_69845_rs_word_3_t rs_word_3;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type4;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type4;
|
|
/* The running status word 4 for the electricity meter */
|
|
proto_69845_rs_word_456_t rs_word_4;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type5;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type5;
|
|
/* The running status word 5 for the electricity meter */
|
|
proto_69845_rs_word_456_t rs_word_5;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type6;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type6;
|
|
/* The running status word 6 for the electricity meter */
|
|
proto_69845_rs_word_456_t rs_word_6;
|
|
/* data type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type7;
|
|
/* type is PROTO_69845_APP_DATA_LONG */
|
|
uint8_t type7;
|
|
/* The running status word 7 for the electricity meter */
|
|
proto_69845_rs_word_7_t rs_word_7;
|
|
} proto_69845_rpt_rs_word_t;
|
|
|
|
/* the br2 launch parameters structure */
|
|
typedef struct _proto_69845_br2_launch_para {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t type;
|
|
/* cnt is 6 */
|
|
uint8_t cnt;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data0_type;
|
|
/* characteristics data per bit duration time, unit: 1ms */
|
|
uint16_t chara_bit_dur;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data1_type;
|
|
/* modulate pulse signal high duration time, unit: 1us */
|
|
uint16_t pulse_high_dur;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_LONG_UNSIGNED. */
|
|
uint8_t data2_type;
|
|
/* modulate pulse signal low duration time, unit: 1us */
|
|
uint16_t pulse_low_dur;
|
|
/* data tpye, it's always PROTO_69845_APP_DATA_BIT_STRING. */
|
|
uint8_t data3_type;
|
|
/* task start time */
|
|
proto_69845_app_len_descript_t bit_len;
|
|
/* br2 code */
|
|
uint8_t code[0];
|
|
} proto_69845_br2_launch_para_t;
|
|
|
|
/* the br2 launch parameters structure */
|
|
typedef struct _proto_69845_br2_launch_time_para {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t type;
|
|
/* cnt is 2 */
|
|
uint8_t cnt;
|
|
/* the br2 launch parameters */
|
|
proto_69845_br2_launch_para_t launch_para;
|
|
/* the br2 launch time, data type is PROTO_69845_APP_DATA_TIME_S */
|
|
} proto_69845_br2_launch_time_para_t;
|
|
|
|
/* the br2 launch parameters structure */
|
|
typedef struct _proto_69845_br2_launch_record_uint {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t type;
|
|
/* cnt is 2 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data0_type;
|
|
/* start time */
|
|
proto_69845_app_data_time_s_t start;
|
|
/* type is PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data1_type;
|
|
/* switching frequency of characteristic signal */
|
|
proto_69845_app_data_time_s_t end;
|
|
} proto_69845_br2_launch_record_uint_t;
|
|
|
|
/* the br2 record identification code structure */
|
|
typedef struct _proto_69845_br2_code_id {
|
|
/* type is PROTO_69845_APP_DATA_BIT_STRING */
|
|
uint8_t data_type;
|
|
/* bit len */
|
|
uint8_t bit_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_br2_code_id_t;
|
|
|
|
/* the br2 record extend infomation structure */
|
|
typedef struct _proto_69845_br2_ext_info {
|
|
/* type is PROTO_69845_APP_DATA_OCTET_STRING */
|
|
uint8_t data_type;
|
|
/* byte len */
|
|
uint8_t byte_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_69845_br2_ext_info_t;
|
|
|
|
/* the br2 record info structure */
|
|
typedef struct _proto_69845_br2_record_info_uint {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* cnt is 7 */
|
|
uint8_t cnt;
|
|
/* type is PROTO_69845_APP_DATA_TIME_S */
|
|
uint8_t data1_type;
|
|
/* time of success */
|
|
proto_69845_app_data_time_s_t suc_time;
|
|
/* type is PROTO_69845_APP_DATA_ENUM */
|
|
uint8_t data2_type;
|
|
/* phase see, IOT_BSRM_BR2_PHASE_XXX */
|
|
uint8_t phase;
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED */
|
|
uint8_t data3_type;
|
|
/* signal intensity 1 */
|
|
uint8_t signal1_rssi[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED */
|
|
uint8_t data4_type;
|
|
/* signal intensity 2 */
|
|
uint8_t signal2_rssi[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* type is PROTO_69845_APP_DATA_DOUBLE_LONG_UNSIGNED */
|
|
uint8_t data5_type;
|
|
/* background noise */
|
|
uint8_t noise[PROTO_69845_METER_DATA_DOUBLE_LONG_LEN];
|
|
/* proto_69845_br2_code_id_t */
|
|
/* proto_69845_br2_ext_info_t */
|
|
} proto_69845_br2_record_info_uint_t;
|
|
|
|
typedef struct _proto_69845_visible_string_uint_hdr {
|
|
/* type is PROTO_69845_APP_DATA_VISIBLE_STRING */
|
|
uint8_t data_type;
|
|
/* string data length */
|
|
uint8_t len;
|
|
} proto_69845_visible_string_uint_hdr_t;
|
|
|
|
typedef struct _proto_69845_visible_string_uint {
|
|
proto_69845_visible_string_uint_hdr_t hdr;
|
|
/* string data */
|
|
uint8_t data[0];
|
|
} proto_69845_visible_string_uint_t;
|
|
|
|
typedef struct _proto_69845_octet_string_uint {
|
|
/* type is PROTO_69845_APP_DATA_VISIBLE_STRING */
|
|
uint8_t data_type;
|
|
/* string data length */
|
|
proto_69845_app_len_descript_t len_info;
|
|
/* len and data */
|
|
uint8_t len_and_data[0];
|
|
} proto_69845_octet_string_uint_t;
|
|
|
|
/* version info structure */
|
|
typedef struct _proto_69845_ver_info_uint {
|
|
/* type is PROTO_69845_APP_DATA_STRUCTURE */
|
|
uint8_t data0_type;
|
|
/* cnt is 6 */
|
|
uint8_t cnt;
|
|
/* visible string vendor id */
|
|
proto_69845_visible_string_uint_hdr_t data1;
|
|
/* vendor id */
|
|
uint8_t vendor_id[4];
|
|
/* visible string software version */
|
|
proto_69845_visible_string_uint_hdr_t data2;
|
|
/* software version */
|
|
uint8_t soft_ver[4];
|
|
/* visible string software version date */
|
|
proto_69845_visible_string_uint_hdr_t data3;
|
|
/* software version date */
|
|
uint8_t soft_date[6];
|
|
/* visible string hardware version */
|
|
proto_69845_visible_string_uint_hdr_t data4;
|
|
/* hardware version */
|
|
uint8_t hw_ver[4];
|
|
/* visible string hardware version date */
|
|
proto_69845_visible_string_uint_hdr_t data5;
|
|
/* hardware version date */
|
|
uint8_t hw_date[6];
|
|
/* visible string rsvd */
|
|
proto_69845_visible_string_uint_hdr_t data6;
|
|
/* rsvd msg */
|
|
uint8_t rsvd[8];
|
|
} proto_69845_ver_info_uint_t;
|
|
|
|
#pragma pack(pop) /* restore the pack status */
|
|
|
|
/* report notify information data structure,
|
|
* see standard DL/T 698.45
|
|
*/
|
|
typedef struct _proto_69845_app_rpt_noti_info {
|
|
/* report notify data type, see PROTO_69845_APP_REPRORT_XXX*/
|
|
uint8_t type;
|
|
/* priority and invoke id with acd data */
|
|
proto_69845_app_piid_acd_t piid_acd;
|
|
/* object attribute descriptor data */
|
|
proto_69845_app_oad_t oad;
|
|
} proto_69845_app_rpt_noti_info_t;
|
|
|
|
typedef struct _server_addr_info {
|
|
/* length of server address field */
|
|
uint8_t len;
|
|
/* type of server address field */
|
|
uint8_t type;
|
|
/* server address field */
|
|
uint8_t addr[PROTO_69845_SA_MAX_LEN];
|
|
/* logical address */
|
|
uint8_t logical_addr;
|
|
} server_addr_info_t;
|
|
|
|
typedef struct _addr_info {
|
|
/* server address info */
|
|
server_addr_info_t ser_info;
|
|
/* client address info */
|
|
uint8_t cli_addr;
|
|
} addr_info_t;
|
|
|
|
typedef struct _apdu_info {
|
|
/* cache pointer to APDU header */
|
|
uint8_t *ptr;
|
|
/* APDU length */
|
|
uint32_t len;
|
|
} apdu_info_t;
|
|
|
|
/* suspected event report status data structure */
|
|
typedef struct _rpt_status {
|
|
/* flag to mark if the meter power off has been reported */
|
|
uint8_t pf_rpt :1,
|
|
/* flag to mark if the meter received ack after power off reported */
|
|
pf_rpt_ok :1,
|
|
/* flag to mark if the meter power on has been reported */
|
|
po_rpt :1,
|
|
/* flag to mark if the meter received ack after power on reported */
|
|
po_rpt_ok :1,
|
|
/* reserve for future */
|
|
revd :4;
|
|
} rpt_status_t;
|
|
|
|
typedef struct _proto_69845_app_data_desc {
|
|
/* data type, see PROTO_69845_APP_DATA_XXX */
|
|
uint8_t type;
|
|
/* data lenght type, see PROTO_69845_DATA_LEN_TYPE_XXX */
|
|
uint8_t len_type;
|
|
/* length */
|
|
uint8_t len;
|
|
} proto_69845_app_data_desc_t;
|
|
|
|
typedef struct _proto_69845_action_list_unit_desc {
|
|
/* omd */
|
|
proto_69845_app_omd_t omd;
|
|
/* omd with data */
|
|
uint8_t *omd_data;
|
|
/* data length */
|
|
uint16_t len;
|
|
} proto_69845_action_list_unit_desc_t;
|
|
|
|
typedef struct _proto_69845_action_list_desc {
|
|
/* action request piid */
|
|
proto_69845_app_piid_t piid;
|
|
/* action request cnt */
|
|
uint8_t cnt;
|
|
/* action request list */
|
|
proto_69845_action_list_unit_desc_t list[0];
|
|
} proto_69845_action_list_desc_t;
|
|
|
|
typedef struct _proto_69845_get_normal_unit_desc {
|
|
/* oad */
|
|
proto_69845_app_oad_t oad;
|
|
} proto_69845_get_normal_unit_desc_t;
|
|
|
|
typedef struct _proto_69845_get_normal_list_desc {
|
|
/* get request piid */
|
|
proto_69845_app_piid_t piid;
|
|
/* get request cnt */
|
|
uint8_t cnt;
|
|
/* get request list */
|
|
proto_69845_get_normal_unit_desc_t list[0];
|
|
} proto_69845_get_normal_list_desc_t;
|
|
|
|
typedef struct _proto_69845_data_cache_desc {
|
|
/* pointer to the data */
|
|
uint8_t *data;
|
|
/* length of length */
|
|
uint32_t len;
|
|
} proto_69845_data_cache_desc_t;
|
|
|
|
/* preamble code */
|
|
extern const uint8_t proto_69845_preamble[PROTO_69845_PREAMBLE_LEN];
|
|
/* any mac address */
|
|
extern const server_addr_info_t proto_69845_any_server_addr;
|
|
|
|
/* The data field in response of event reporting status word
|
|
* according to DL/T645-2007 protocol frame.
|
|
*/
|
|
extern const uint8_t proto_69845_event_report_data[PROTO_69845_EVENT_DATA_LEN];
|
|
|
|
#define proto_69845_oi_to_byte(oi, ptr) iot_uint16_to_bytes(oi, ptr, 1)
|
|
|
|
#define proto_69845_byte_to_oi(ptr) iot_bytes_to_uint16(ptr, 1)
|
|
|
|
/**
|
|
* @brief check the pkt if security cmd.
|
|
* @param data: 645 pkt data.
|
|
* @param len: 645 pkt data length.
|
|
* @return: 0 - is not security cmd.
|
|
* @return: 1 - is security cmd.
|
|
*/
|
|
uint8_t proto_698_is_security_cmd(uint8_t *data, uint32_t len);
|
|
|
|
/**
|
|
* @brief check the pkt1 and pkt2 if interactive cmd.
|
|
* @param data1: 698 pkt1 data.
|
|
* @param len1: 698 pkt1 data length.
|
|
* @param data2: 698 pkt2 data.
|
|
* @param len2: 698 pkt2 data length.
|
|
* @return: 0 - is not interactive cmd.
|
|
* @return: 1 - is interactive cmd.
|
|
*/
|
|
uint8_t proto_698_interactive_cmd_check(uint8_t *data1, uint32_t len1,
|
|
uint8_t *data2, uint32_t len2);
|
|
|
|
/**
|
|
* @brief proto_645_di_to_698_oad - 645 di to 698 oad
|
|
* @param di: 645 proto di, see PROTO_645_2007_XXX.
|
|
* @retval 698 proto oad, see PROTO_69845_APP_OAD_XXX.
|
|
*/
|
|
uint32_t proto_645_di_to_698_oad(uint32_t di);
|
|
|
|
/**
|
|
* @brief: proto_698_oad_to_645_di - 698 di to 645 oad
|
|
* @param oad_698: 698 proto oad, see PROTO_69845_APP_OAD_XXX.
|
|
* @retval 645 proto di, see PROTO_645_2007_XXX.
|
|
*/
|
|
uint32_t proto_698_oad_to_645_di(uint32_t oad_698);
|
|
|
|
/**
|
|
* @brief proto_69845_sanity_check - check if a 698.45 packet is a valid.
|
|
* @param data: packet data
|
|
* @param len: length of the packet data
|
|
* @retval: NULL -- Incorrect protocol format.
|
|
* @retval: otherwise -- pointer to the 698.45 protocol header
|
|
*/
|
|
proto_69845_frame_head_info_t* proto_69845_sanity_check(uint8_t* data,
|
|
uint16_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_addr_info - get address info.
|
|
* @param head: pointer to head of 698.45 protocol
|
|
* @param addr_info: pointer to cache address info buffer
|
|
* @return length of address info in header.
|
|
*/
|
|
uint8_t proto_69845_get_addr_info(proto_69845_frame_head_info_t* head,
|
|
addr_info_t *addr_info);
|
|
|
|
/**
|
|
* @brief check if any server mac addr
|
|
* @param server_addr: server addr, len is IOT_MAC_ADDR_LEN
|
|
* @return 0 - is not any server addr, 1 - is any server addr
|
|
*/
|
|
uint32_t proto_69845_is_any_server_addr(uint8_t *server_addr);
|
|
|
|
/**
|
|
* @brief proto_69845_build_get_req_msg - create a get request message for the
|
|
* 698.45 protocol
|
|
* @param req_info: get request information
|
|
* @param server_info: server information
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_get_req_msg(
|
|
proto_69845_app_get_req_info_t* req_info,
|
|
const server_addr_info_t* server_info);
|
|
|
|
/**
|
|
* @brief proto_69845_build_action_req_single_msg - create action request single
|
|
* object for the 698.45 protocol
|
|
* @param req_info: action request single object info
|
|
* @app_data_len: action request single object app data length
|
|
* @param server_info: server information
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_action_req_single_msg(
|
|
const proto_69845_app_action_req_single_t *req_info, uint16_t app_data_len,
|
|
const server_addr_info_t* server_info);
|
|
|
|
/* @brief proto_69845_build_event_msg - create a DL/T 645-2007 event for the
|
|
* 698.45 protocol
|
|
* @param addr: address of meter, little edition.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_event_msg(uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_69845_build_get_req_msg - create a get normal list request
|
|
* message with rn for the 698.45 protocol.
|
|
* @param req_info: get request information
|
|
* @param server_info: server information
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_get_req_msg_with_rn(
|
|
proto_69845_app_get_list_req_info_t* req_info,
|
|
const server_addr_info_t* server_info);
|
|
/**
|
|
* @brief proto_69845_build_apdu_data_with_rn_msgs - create a apdu data with rn
|
|
* for the 698.45 protocol.
|
|
* @param apdu_data: apdu data.
|
|
* @param data_len: apdu data len.
|
|
* @param server_info: server information
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_apdu_data_with_rn_msg(uint8_t *apdu_data,
|
|
uint32_t data_len, const server_addr_info_t* server_info);
|
|
|
|
/**
|
|
* @brief proto_69845_build_apdu_data_msg - data with create a apdu
|
|
* for the 698.45 protocol.
|
|
* @param apdu_data: apdu data.
|
|
* @param data_len: apdu data len.
|
|
* @param addr_info: address information
|
|
* @param dir_and_prm: see PROTO_69845_D_P_XXX.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_apdu_data_msg(uint8_t *apdu_data,
|
|
uint32_t data_len, addr_info_t* addr_info, uint8_t dir_and_prm);
|
|
|
|
/**
|
|
* @brief proto_69845_build_apdu_data_with_security_resp_msg - data with create
|
|
* a apdu resp for the 698.45 protocol.
|
|
* @param apdu_data: apdu data.
|
|
* @param data_len: apdu data len.
|
|
* @param addr_info: address information
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_apdu_data_with_security_resp_msg(uint8_t *apdu_data,
|
|
uint32_t data_len, addr_info_t* addr_info);
|
|
|
|
/**
|
|
* @brief proto_69845_build_proxy_trans_data_msg - create a apdu data with
|
|
* resp for the 698.45 protocol.
|
|
* @param data: pointer to data to be transparently forwarded.
|
|
* @param data_len: data len to be transparently forwarded.
|
|
* @param buud: baud for transparent forwarding.
|
|
* @param port: port number of transparent forwarding RS485I and RS485II, see
|
|
* PROTO_PORT_RS485_X.
|
|
* @param parity: uart frame format - parity bit type, see
|
|
* PROTO_69845_PARITY_XXX.
|
|
* @param timeout: timeout for transparent forwarding to wait for response, uint
|
|
* is 1s.
|
|
* @param server_info: server information.
|
|
* @paran sn: message serial number.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_proxy_trans_data_msg(uint8_t *data,
|
|
uint32_t data_len, uint32_t baud, uint8_t port, uint8_t parity,
|
|
uint16_t timeout, const server_addr_info_t* server_info, uint8_t sn);
|
|
|
|
/**
|
|
* @brief proto_69845_build_comdcb_msg - create a apdu data with resp for the
|
|
* 698.45 protocol.
|
|
*
|
|
* @param baud: baud for transparent forwarding.
|
|
* @param server_info: server information.
|
|
* @param sn: message serial number.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_comdcb_msg(uint32_t baud,
|
|
const server_addr_info_t *server_info, uint8_t sn);
|
|
|
|
/**
|
|
* @brief proto_69845_build_get_version_msg_with_rn - create a apdu data with
|
|
* 698.45 protocol.
|
|
*
|
|
* @param server_info : server information.
|
|
* @param sn: message serial number.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_get_version_msg_with_rn(
|
|
const server_addr_info_t *server_info, uint8_t sn);
|
|
|
|
/**
|
|
* @brief create a report notification message of 698.45 protocol
|
|
* for suspect power on or power off
|
|
* @param noti_info: report notification information
|
|
* @param server_info: server information
|
|
* @param evt_start_tm: event start time
|
|
* @param evt_end_tm: event end time
|
|
* @param rpt_status: suspected event report status
|
|
* @retval: NULL - for failure case,
|
|
* pkt - the iot pkt buffer for 698.45 protocol
|
|
*/
|
|
iot_pkt_t *proto_69845_build_rpt_noti_sus_pof_msg(
|
|
proto_69845_app_rpt_noti_info_t* noti_info,
|
|
const server_addr_info_t* server_info,
|
|
proto_69845_app_data_time_s_t *evt_start_tm,
|
|
proto_69845_app_data_time_s_t *evt_end_tm, rpt_status_t *rpt_status);
|
|
|
|
/**
|
|
* @brief proto_69845_get_apdu - get apdu in a whole 698.45 message.
|
|
* @param hdr: pointer to the 698.45 protocol header
|
|
* @param len: length 698.45 message
|
|
* @param apdu: pointer to the cache apdu data
|
|
* @retval: ERR_OK -- get apdu.
|
|
* @retval: otherwise -- get apdu fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_apdu(proto_69845_frame_head_info_t *hdr,
|
|
uint32_t len, apdu_info_t *apdu);
|
|
|
|
/**
|
|
* @brief proto_69845_parse - get apdu in a whole 698.45 message.
|
|
* @param data: pointer to pointer the data buffer to be parsed. if the parsing
|
|
* is successful, it is used to return the APDU (without the
|
|
* security header and tail) pointer.
|
|
* @param len: pointer to len the data buffer to be parsed. f the parsing
|
|
* is successful, it is used to return the APDU (without the
|
|
* security header and tail) len.
|
|
* @param hdr: if the parsing is successful, it is used to return the frame
|
|
* header pointer of 69845
|
|
* @param apdu_desc: returns the original APDU information.
|
|
* @retval: ERR_OK -- pasre success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_parse(uint8_t **data, uint32_t *len,
|
|
proto_69845_frame_head_info_t **hdr, apdu_info_t *apdu_desc);
|
|
|
|
/**
|
|
* @brief proto_69845_proxy_trans_resp_parse - get proxy trans data in a whole
|
|
* 698.45 message.
|
|
* @param data: pointer to input data buffer.
|
|
* @param len: length data message.
|
|
* @param sn: return message seq number
|
|
* @retval: ERR_OK -- get trans data, data: pointer to the cache trans data,
|
|
* in_len: pointer to trans data length.
|
|
* @retval: otherwise -- get trans data fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_proxy_trans_resp_parse(uint8_t **data,
|
|
uint16_t *len, uint8_t *sn);
|
|
|
|
/**
|
|
* @brief proto_698_add33_handle() - add 33 for each of the specified memory
|
|
* @param ds: pointer to data buffer
|
|
* @param size: size of buffer
|
|
*/
|
|
void proto_69845_add33_handle(uint8_t *ds, uint32_t size);
|
|
|
|
/**
|
|
* @brief proto_645_sub33_handle() - sub 33 for each of the specified memory
|
|
* @param ds: pointer to data buffer
|
|
* @param size: size of buffer
|
|
*/
|
|
void proto_69845_sub33_handle(uint8_t *ds, uint32_t size);
|
|
|
|
/**
|
|
* @brief proto_69845_get_oad - get oad in get request.
|
|
* @param data: pointer to getting request.
|
|
* @param data_len: length of getting request.
|
|
* @param oad: pointer to the cache oad data
|
|
* @retval: ERR_OK -- get oad.
|
|
* @retval: otherwise -- get oad fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_oad(uint8_t *data,
|
|
uint32_t data_len, proto_69845_app_oad_t *oad);
|
|
|
|
/**
|
|
* @brief proto_69845_get_omd - get oad in action request.
|
|
* @param data: pointer to action request.
|
|
* @param data_len: length of action request.
|
|
* @param oad: pointer to the cache omd data
|
|
* @retval: ERR_OK -- get omd.
|
|
* @retval: otherwise -- get omd fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_omd(uint8_t *data,
|
|
uint32_t data_len, proto_69845_app_omd_t *omd);
|
|
|
|
/**
|
|
* @brief proto_69845_set_normal_ack - create a set ack response.
|
|
* @param addr_info: address info.
|
|
* @param piid_acd: piid_acd of set response.
|
|
* @param oad: oad of set response.
|
|
* @param dar: dar of set response, see PROTO_69845_APP_DAR_XXX.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_set_normal_ack(addr_info_t *addr_info,
|
|
proto_69845_app_piid_t *piid, proto_69845_app_oad_t *oad, uint8_t dar);
|
|
|
|
/**
|
|
* @brief proto_69845_action_single_ack - create a action ack response.
|
|
* @param addr_info: address info.
|
|
* @param piid_acd: piid_acd of action response.
|
|
* @param omd: omd of action response.
|
|
* @param dar: dar of action response, see PROTO_69845_APP_DAR_XXX.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_action_single_ack(addr_info_t *addr_info,
|
|
proto_69845_app_piid_t *piid, proto_69845_app_omd_t *omd,
|
|
uint8_t dar);
|
|
|
|
/**
|
|
* @brief proto_69845_build_corr_msg - create a action corr object.
|
|
* @param server_addr: address info, if set NULL, use broadcast address.
|
|
* @param tm: correct time.
|
|
* @param piid: piid of action response.
|
|
* @param with_rn: 0 - corr msg with no random numbers.
|
|
* 1 - corr msg with random numbers.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for 698.45 protocol.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_corr_msg(server_addr_info_t *server_addr,
|
|
iot_time_tm_t *tm, proto_69845_app_piid_t *piid, uint8_t with_rn);
|
|
|
|
/**
|
|
* @brief proto_69845_oad_cmp - check if the two oads match.
|
|
* @param oad_1: PROTO_69845_APP_DATA_OAD data structure.
|
|
* @param oad_2: PROTO_69845_APP_DATA_OAD data structure,
|
|
* @retval: 1 - oad match, 0 - oad not match.
|
|
*/
|
|
uint8_t proto_69845_oad_cmp(proto_69845_app_oad_t *oad_1,
|
|
proto_69845_app_oad_t *oad_2);
|
|
|
|
/**
|
|
* @brief proto_69845_get_data_len - get data length.
|
|
* @param data: pointer to data header.
|
|
* @param rec_data_len: length of receive data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- get omd.
|
|
* @retval: otherwise -- get omd fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_data_len(proto_69845_app_data_t *data,
|
|
uint32_t rec_data_len, uint32_t *data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_rsd_data_len - get rsd data length.
|
|
* @param data: pointer to data header.
|
|
* @param rec_data_len: length of receive data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- get omd.
|
|
* @retval: otherwise -- get omd fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_rsd_data_len(uint8_t *data,
|
|
uint32_t rec_data_len, uint32_t *data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_rcsd_data_len - get rcsd data length.
|
|
* @param data: pointer to data header.
|
|
* @param rec_data_len: length of receive data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- get omd.
|
|
* @retval: otherwise -- get omd fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_rcsd_data_len(uint8_t *data,
|
|
uint32_t rec_data_len, uint32_t *data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_csd_data_len - get csd data length.
|
|
* @param data: pointer to data header.
|
|
* @param rec_data_len: length of receive data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- get omd.
|
|
* @retval: otherwise -- get omd fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_csd_data_len(uint8_t *data,
|
|
uint32_t rec_data_len, uint32_t *data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_head_fill - fill frame head data of protocol message.
|
|
* @param head: pointer to header data filled.
|
|
* @param head_len: length of header data.
|
|
* @param total_len: length of message.
|
|
* @param addr_info: pointer to address info.
|
|
* @param fn: fn of message, see PROTO_69845_FN_XXX.
|
|
* @param fragment: flag to mark if the data is a fragment of the APDU.
|
|
* see PROTO_69845_APDU_XXX
|
|
* @param dir_prm: flag of primary request message and direction.
|
|
* see PROTO_69845_D_P_XXX
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_head_fill(
|
|
proto_69845_frame_head_info_t *head, uint16_t head_len,
|
|
uint16_t total_len, addr_info_t *addr_info, uint8_t fn,
|
|
uint8_t fragment, uint8_t dir_prm);
|
|
|
|
/**
|
|
* @brief proto_69845_tail_fill_without_ts_fl - fill frame tail data of protocol
|
|
* message.
|
|
* @param head: pointer to frame header .
|
|
* @param tail_data: pointer to tail data filled.
|
|
* @param len: length of tail data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_tail_fill(proto_69845_frame_head_info_t *head,
|
|
uint8_t *tail_data, uint16_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_tail_fill_without_ts_fl - fill frame tail data of protocol
|
|
* message without ts and flw_rpt.
|
|
* @param head: pointer to frame header .
|
|
* @param tail_data: pointer to tail data filled.
|
|
* @param len: length of tail data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_tail_fill_without_ts_fl(
|
|
proto_69845_frame_head_info_t *head,
|
|
uint8_t *tail_data, uint16_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_road_data_len - get road data length.
|
|
* @param data: pointer to data header.
|
|
* @param rec_data_len: length of receive data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- get road length.
|
|
* @retval: otherwise -- get fail, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_get_road_data_len(uint8_t *data,
|
|
uint32_t rec_data_len, uint32_t *data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_get_road_data_len - get road data length.
|
|
* @param data_type: type of data, see PROTO_69845_APP_DATA_XXX.
|
|
* @retval: length of type data.
|
|
*/
|
|
uint32_t proto_69845_get_normal_data_len(uint8_t data_type);
|
|
|
|
/**
|
|
* @brief proto_69845_dlong_unsign_data_to_meter_bcd_data - dlong unsigned data
|
|
* to meter bcd data.
|
|
* @param dlong_data: pointer to 69845 dlong data, big-endian, and length have
|
|
to PROTO_69845_METER_DATA_DOUBLE_LONG_LEN.
|
|
* @param dlong_data_len: pointer to 69845 dlong data length.
|
|
* @param meter_bcd_data: pointer to get meter bcd data, little-endian.
|
|
* @param bcd_len: length of bcd data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_dlong_unsign_data_to_meter_bcd_data(
|
|
uint8_t *dlong_data, uint8_t dlong_data_len, uint8_t *meter_bcd_data,
|
|
uint8_t bcd_len);
|
|
|
|
/**
|
|
* @brief proto_69845_long_unsign_to_meter_bcd_data - long unsigned data to
|
|
* meter bcd data.
|
|
* @param long_data: pointer to 69845 long data, big-endian, and length have to
|
|
PROTO_69845_METER_DATA_LONG_LEN.
|
|
* @param long_data_len pointer to 69845 long data length.
|
|
* @param meter_bcd_data: pointer to get meter bcd data, little-endian.
|
|
* @param bcd_len: length of bcd data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_long_unsign_to_meter_bcd_data(uint8_t *long_data,
|
|
uint8_t long_data_len, uint8_t *meter_bcd_data, uint8_t bcd_len);
|
|
|
|
/**
|
|
* @brief proto_69845_dlong_data_to_meter_bcd_data - dlong data
|
|
* to meter bcd data.
|
|
* @param dlong_data: pointer to 69845 dlong data, big-endian, and length have
|
|
to PROTO_69845_METER_DATA_DOUBLE_LONG_LEN.
|
|
* @param dlong_data_len: pointer to 69845 dlong data length.
|
|
* @param meter_bcd_data: pointer to get meter bcd data, little-endian.
|
|
* @param bcd_len: length of bcd data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_dlong_data_to_meter_bcd_data(
|
|
uint8_t *dlong_data, uint8_t dlong_data_len, uint8_t *meter_bcd_data,
|
|
uint8_t bcd_len);
|
|
|
|
/**
|
|
* @brief proto_69845_long_data_to_meter_bcd_data - long data to
|
|
* meter bcd data.
|
|
* @param long_data: pointer to 69845 long data, big-endian, and length have to
|
|
PROTO_69845_METER_DATA_LONG_LEN.
|
|
* @param long_data_len pointer to 69845 long data length.
|
|
* @param meter_bcd_data: pointer to get meter bcd data, little-endian.
|
|
* @param bcd_len: length of bcd data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_long_data_to_meter_bcd_data(uint8_t *long_data,
|
|
uint8_t long_data_len, uint8_t *meter_bcd_data, uint8_t bcd_len);
|
|
|
|
/**
|
|
* @brief proto_69845_pf_ele_data_handle - handle 69845 power factor data.
|
|
* @param meter_pf: pointer to need get meter power factor data.
|
|
* @param ele_data: pointer to 69845 power factor data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_pf_ele_data_handle(proto_645_07_pf_t *meter_pf,
|
|
proto_69845_app_ele_data_t *ele_data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_v_data_handle - handle 69845 voltage data.
|
|
* @param meter_v: pointer to need get meter voltage data.
|
|
* @param ele_data: pointer to 69845 voltage data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_v_data_handle(proto_645_v_t *meter_v,
|
|
proto_69845_app_ele_data_t *ele_data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_a_data_handle - handle 69845 current data.
|
|
* @param meter_a: pointer to need get meter current data.
|
|
* @param ele_data: pointer to 69845 current data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_a_data_handle(proto_645_07_a_t *meter_a,
|
|
proto_69845_app_ele_data_t *ele_data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_power_data_handle - handle 69845 meter power data.
|
|
* @param power: pointer to need get power data.
|
|
* @param data: point to pointer to data buffer.
|
|
* @param:len: pointer to len of the data buffer.
|
|
* @retval: ERR_OK -- success. otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_power_data_handle(int32_t power[], uint8_t **data,
|
|
uint32_t *len);
|
|
|
|
/**
|
|
* @brief proto_69845_gnd_a_data_handle - handle 69845 gnd current data.
|
|
* @param meter_gnd_a: pointer to need get meter gnd current BCD data,
|
|
* little-endian.
|
|
* @param gnd_a_len: get meter gnd current data length.
|
|
* @param data: pointer to proto_69845_app_data_t gnd current struct data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_gnd_a_data_handle(uint8_t *meter_gnd_a, uint8_t gnd_a_len,
|
|
uint8_t *data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_gnd_a_data_handle - handle 69845 gnd current data.
|
|
* @param meter_time: pointer to need get meter time.
|
|
* @param data: point to pointer to data buffer.
|
|
* @param:len: pointer to len of the data buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_time_data_handle(iot_time_tm_t *meter_time,
|
|
uint8_t **data, uint32_t *len);
|
|
|
|
/**
|
|
* @brief proto_69845_run_state_data_handle - handle 69845 meter run state data.
|
|
* @param word: pointer to need get meter run state.
|
|
* @param data: point to pointer to data buffer.
|
|
* @param:len: pointer to len of the data buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_run_state_data_handle(proto_69845_rs_word_t *rs_word,
|
|
uint8_t **data, uint32_t *len);
|
|
|
|
/**
|
|
* @brief proto_69845_evt_rec_cur_info_parse - parse 69845 event current
|
|
* information.
|
|
* @param occur_n: pointer to number of occurrences for return.
|
|
* @param acc_time: pointer to cumulative time for return.
|
|
* @param data: point to pointer to data buffer.
|
|
* @param:len: pointer to len of the data buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_evt_cur_info_parse(uint32_t *occur_n,
|
|
uint32_t *acc_time, uint8_t **data, uint32_t *len);
|
|
|
|
/**
|
|
* @brief proto_69845_check_frame_handler - check whether the frame
|
|
* is legitimate.
|
|
* @param buffer: the buffer containing data.
|
|
* @param buffer_len: len of the buffer.
|
|
* @param is_frame: false: the frame isn't legitimate.
|
|
* true: the frame is legitimate.
|
|
*/
|
|
void proto_69845_check_frame_handler(uint8_t* buffer, uint32_t buffer_len,
|
|
bool_t* is_frame);
|
|
|
|
/**
|
|
* @brief proto_69845_time_rsp_msg_handle - 69845 get time response msg handle.
|
|
* @param data: point to pointer to data buffer.
|
|
* @param:len: pointer to len of the data buffer.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: time -- meter response time.
|
|
*/
|
|
proto_69845_app_data_time_s_t *proto_69845_get_time_rsp_msg_handle(uint8_t *ds,
|
|
uint16_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_ti_data_to_sec - 69845 time interval to seconds time.
|
|
* @param ti: time interval.
|
|
* @retval: seconds time.
|
|
*/
|
|
uint64_t proto_69845_ti_data_to_sec(proto_69845_app_data_ti_t *ti);
|
|
|
|
/**
|
|
* @brief proto_69845_energy_data_handle() - parse of 69845 electric energy data.
|
|
* @param energy: place the buffer of the electric energy data.
|
|
* @param data: point to pointer to raw data buffer.
|
|
* @param:in_len: pointer to len of the raw data buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_energy_data_handle(uint32_t *energy,
|
|
uint8_t **data, uint32_t *in_len);
|
|
|
|
/**
|
|
* @brief proto_69845_energy_data_handle() - parse of 69845 electric energy sum
|
|
* data.
|
|
* @param energy_sum: place the buffer of the electric energy sum data.
|
|
* @param data: point to pointer to raw data buffer.
|
|
* @param:in_len: pointer to len of the raw data buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_energy_sum_data_handle(uint8_t *energy_sum,
|
|
uint8_t *data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_pf_data_handle() - parse of 69845 power factor data.
|
|
* @param pf: place the buffer of the power factor data.
|
|
* @param data: point to pointer to raw data buffer.
|
|
* @param:in_len: pointer to len of the draw ata buffer.
|
|
* @retval: ERR_OK -- success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_pf_data_handle(int16_t *pf,
|
|
uint8_t **data, uint32_t *in_len);
|
|
|
|
/**
|
|
* @brief proto_69845_a_data_handle - handle 69845 power data.
|
|
* @param meter_p: pointer to need get meter power data.
|
|
* @param ele_data: pointer to 69845 current data.
|
|
* @param data_len: pointer to the cache length of data.
|
|
* @retval: ERR_OK -- fill success.
|
|
* @retval: otherwise -- for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_p_data_handle(proto_645_07_p_t *meter_p,
|
|
proto_69845_app_ele_data_t *ele_data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_corr_msg_check() - 69845 protocol correct
|
|
* time format check.
|
|
* @param data: data.
|
|
* @param len: data len.
|
|
* @param addr: 69845 header server address, little-endian.
|
|
* @retval: ERR_OK -- check success.
|
|
* @retval: otherwise -- check false, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_corr_msg_check(uint8_t *data, uint32_t len, uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_69845_get_ser_addr() - get the pointer to address of the server
|
|
* in 69845 header.
|
|
* @param head: pointer to header data.
|
|
* @retval: server address: get server address.
|
|
* @retval: NULL -- for failure case.
|
|
*/
|
|
uint8_t *proto_69845_get_ser_addr(proto_69845_frame_head_info_t* head);
|
|
|
|
/**
|
|
* @brief proto_69845_apdu_sec_ciphertext_check() - apdu ciphertext check.
|
|
* @param apdu: pointer to apdu data.
|
|
* @param len: length of apdu data.
|
|
* @retval: ERR_OK -- check success.
|
|
* @retval: otherwise -- check false, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_69845_apdu_sec_ciphertext_check(uint8_t *apdu,
|
|
uint32_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_format_check_ext() - 698.45 protocol format check extended
|
|
* version, search the whole buffer to try to find one 698.45 format data.
|
|
* @param data: pointer to protocol data buffer
|
|
* @param len: data length
|
|
* @retval: NULL -- 698.45 format data not found.
|
|
* @retval: otherwise -- pointer to the 698.45 protocol header
|
|
*/
|
|
proto_69845_frame_head_info_t *proto_69845_sanity_check_ext(uint8_t* data,
|
|
uint16_t len);
|
|
|
|
/**
|
|
* @brief proto_69845_build_rpt_noti_list_msg - create a normal list report
|
|
* message.
|
|
* @param result_list: pointer to normal list data.
|
|
* @param list_len: length of normal list data.
|
|
* @param list_cnt: normal cnt in result_list.
|
|
* @param server_addr: address info, if set NULL, use broadcast address.
|
|
* @param sn: sequence number of report message.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for report message.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_rpt_noti_list_msg(
|
|
uint8_t* result_list, uint16_t list_len, uint8_t list_cnt,
|
|
const server_addr_info_t* server_info, uint8_t sn);
|
|
|
|
/**
|
|
* @brief proto_69845_build_file_info_msg - create file info massage.
|
|
* @param file_size: file size.
|
|
* @param file_crc: file crc check.
|
|
* @param block_size: transfer block size.
|
|
* @param hw_ver: hardware version.
|
|
* @param sw_ver: software version.
|
|
* @param loader_id: downloader identity.
|
|
* @param server_addr: server address.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for message.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_file_info_msg(uint32_t file_size,
|
|
uint16_t file_crc, uint16_t block_size, uint32_t hw_ver, uint32_t sw_ver,
|
|
uint32_t loader_id, uint8_t *server_addr);
|
|
|
|
/**
|
|
* @brief proto_69845_handle_fileinfo_rsp - response file info.
|
|
* @param data: response data.
|
|
* @param data_len: response data length.
|
|
* @retval: ERR_OK - success, other - fail.
|
|
*/
|
|
uint32_t proto_69845_handle_file_info_rsp(uint8_t *data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_build_file_data_msg - create file data massage.
|
|
* @param data: transfer data.
|
|
* @param data_len: transfer block len.
|
|
* @param block_index: transfer block index.
|
|
* @param server_addr: server address.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for message.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_file_data_msg(uint8_t *data,
|
|
uint16_t data_len, uint16_t block_index, uint8_t *server_addr);
|
|
|
|
/**
|
|
* @brief proto_69845_handle_transfile_data_rsp - response file data.
|
|
* @param data: response data.
|
|
* @param data_len: response data length.
|
|
* @retval: ERR_OK - success, other - fail.
|
|
*/
|
|
uint32_t proto_69845_handle_file_data_rsp(uint8_t *data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief proto_69845_build_file_exe_msg - create file execute massage.
|
|
* @param time: execution time.
|
|
* @param server_addr: server address.
|
|
* @retval: NULL -- for failure case.
|
|
* @retval: pkt -- the iot pkt buffer for message.
|
|
*/
|
|
iot_pkt_t *proto_69845_build_file_exe_msg(iot_time_tm_t *time,
|
|
uint8_t *server_addr);
|
|
|
|
/**
|
|
* @brief proto_69845_handle_file_exe_rsp - response file exe.
|
|
* @param data: response data.
|
|
* @param data_len: response data length.
|
|
* @retval: ERR_OK - success, other - fail.
|
|
*/
|
|
uint32_t proto_69845_handle_file_exe_rsp(uint8_t *data, uint32_t data_len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PROTO_69845_H */
|