2686 lines
106 KiB
C
Executable File
2686 lines
106 KiB
C
Executable File
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef PROTO_645_H
|
|
#define PROTO_645_H
|
|
|
|
#include "os_types_api.h"
|
|
#include "iot_utils_api.h"
|
|
#include "iot_pkt_api.h"
|
|
#include "iot_rtc_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 */
|
|
|
|
/* unknown protocol ID */
|
|
#define PROTO_UNKNOWN_ID 0
|
|
/* ID for DL/T 645-1997 */
|
|
#define PROTO_645_1997_ID 1
|
|
/* ID for DL/T 645-2007 */
|
|
#define PROTO_645_2007_ID 2
|
|
|
|
/* defines bit num per byte in transmission */
|
|
#define PROTO_645_BIT_N_PER_BYTE 11
|
|
|
|
/* frame start char definition */
|
|
#define PROTO_645_START_CHAR 0x68
|
|
|
|
/* frame end char definition */
|
|
#define PROTO_645_END_CHAR 0x16
|
|
|
|
/* preamble char definition */
|
|
#define PROTO_645_PREAMBLE_CHAR 0xFE
|
|
|
|
/* define data block separate characters */
|
|
#define PROTO_645_DB_SEPARATE_CHAR 0xAA
|
|
|
|
/* preamble code length */
|
|
#define PROTO_645_PREAMBLE_LEN 4
|
|
|
|
/* define data block separate characters */
|
|
#define PROTO_645_EVT_SEPARATE_LEN (2)
|
|
|
|
/* data identification length for DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_LEN (2)
|
|
|
|
/* data identification length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_LEN (4)
|
|
|
|
/* data passward length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_PASSWORD_LEN (4)
|
|
|
|
/* data operator code length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_OPERATOR_LEN (4)
|
|
|
|
/* data recording interval time code length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_RED_INTER_TM_LEN (2)
|
|
|
|
/* data recording 645 protocol header length */
|
|
#define PROTO_645_HEADER_LEN (10)
|
|
|
|
/* data recording 645 protocol end length */
|
|
#define PROTO_645_END_LEN (2)
|
|
|
|
/* define the maximum payload len of 645 protocol, excluding head and end */
|
|
#define PROTO_645_MAX_DATA_LEN (255)
|
|
|
|
/* define the maximum payload len of 645 protocol, including head and end */
|
|
#define PROTO_645_MAX_PKT_LEN PROTO_645_MAX_DATA_LEN + \
|
|
PROTO_645_HEADER_LEN + PROTO_645_END_LEN
|
|
|
|
/* read data max length */
|
|
#define PROTO_645_READ_DATA_MAX_LEN 200
|
|
|
|
/* write data max length */
|
|
#define PROTO_645_WRITE_DATA_MAX_LEN 50
|
|
|
|
/* meter read frame length for DL/T 645-1997 */
|
|
#define PROTO_645_1997_READ_DATA_PKT_LEN 14
|
|
|
|
/* default baud rate for DL/T 645-1997 */
|
|
#define PROTO_645_1997_DEFAULT_BAUD 1200
|
|
|
|
/* default baud rate for DL/T 645-2007 */
|
|
#define PROTO_645_2007_DEFAULT_BAUD 2400
|
|
|
|
/* meter address read frame length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_READ_ADDR_PKT_LEN 12
|
|
|
|
/* meter address read frame length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_READ_DATA_PKT_LEN 16
|
|
|
|
/* meter nack frame length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_NACK_PKT_LEN 13
|
|
|
|
/* meter ack frame length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_ACK_PKT_LEN 12
|
|
|
|
/* correct time frame length for DL/T 645 */
|
|
#define PROTO_645_CORRECT_DATA_PKT_LEN 18
|
|
|
|
/* frozen frame length */
|
|
#define PROTO_645_2007_FROZEN_DATA_PKT_LEN 16
|
|
|
|
/* meter protocol version number len */
|
|
#define PROTO_645_2007_VER_NUM_LEN 16
|
|
|
|
/* meter manufacturing date len */
|
|
#define PROTO_645_2007_MFG_DATE_LEN 10
|
|
|
|
/* meter event cnt data length */
|
|
#define PROTO_645_2007_DI_CNT_DATE_LEN 3
|
|
|
|
/* DI: read meter running status word 1, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_RUN_STA_WORD_1 (0x04000501u)
|
|
/* DI: read meter running status word 7, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_RUN_STA_WORD_7 (0x04000507u)
|
|
/* DI: Event status word, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_EVENT_STA_WORD (0x04001501u)
|
|
/* DI: total positive active power, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_FOR_WATTH_T (0x00010000u)
|
|
/* DI: read meter addr, for see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_R_ADDR (0x04000401u)
|
|
/* DI: devive asset management code */
|
|
#define PROTO_645_2007_DI_AMC (0x04000403u)
|
|
/* DI: read meter manufacturing date, for see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_R_MFG (0x0400040Cu)
|
|
/* DI read meter protocol version number, for see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_R_PROTO_VER (0x0400040Du)
|
|
/* DI: reset active report status word, see standard
|
|
* extended DL/T 645-2007
|
|
*/
|
|
#define PROTO_645_2007_DI_RESET_EVENT_RPT (0x04001503u)
|
|
/* DI: read meter time, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_TIME (0x0400010cu)
|
|
/* DI: read meter time, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_TIME_YMD (0x04000101u)
|
|
/* DI: read meter time, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_TIME_HMS (0x04000102u)
|
|
/* DI: read/write demand period, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_DEMAND_PERIOD (0x04000103u)
|
|
/* DI: read/write demand slide interval, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_DEMAND_SLIDE_INTERVAL (0x04000104u)
|
|
/* DI: meter baud word, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_BAUD_WORD (0x04000705u)
|
|
|
|
/* DI: read load recording interval time, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_LOAD_INTER_TIME (0x04000A02u)
|
|
|
|
/* DI: first settlement day setting, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_MSD_1 (0x04000B01u)
|
|
|
|
/* DI: second settlement day setting, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_MSD_2 (0x04000B02u)
|
|
|
|
/* DI: third settlement day setting, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_MSD_3 (0x04000B03u)
|
|
|
|
/* DI: module dev id, see standard extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_DEV_ID (0x0400140Du)
|
|
|
|
/* DI: the day freeze data, see standard extended DL/T 645-2007.
|
|
* the last 1st day freeze data DI is PROTO_645_2007_DI_DF + 1.
|
|
* ......
|
|
* the last Nst day freeze data DI is PROTO_645_2007_DI_DF + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_DF (0x0506FF00u)
|
|
|
|
/* DI: the hour freeze data, see standard extended DL/T 645-2007
|
|
* the last 1st hour freeze data DI is PROTO_645_2007_DI_HF + 1.
|
|
* ......
|
|
* the last Nst hour freeze data DI is PROTO_645_2007_DI_HF + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_HF (0x0504FF00u)
|
|
|
|
/* DI: the voltage data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_V_A (0x02010100u)
|
|
#define PROTO_645_2007_DI_V_B (0x02010200u)
|
|
#define PROTO_645_2007_DI_V_C (0x02010300u)
|
|
#define PROTO_645_2007_DI_V_ALL (0x0201FF00u)
|
|
/* DI: the current data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_I_A (0x02020100u)
|
|
#define PROTO_645_2007_DI_I_B (0x02020200u)
|
|
#define PROTO_645_2007_DI_I_C (0x02020300u)
|
|
#define PROTO_645_2007_DI_I_N (0x02800001u)
|
|
#define PROTO_645_2007_DI_I_ALL (0x0202FF00u)
|
|
/* DI: the active power data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_P_T (0x02030000u)
|
|
#define PROTO_645_2007_DI_P_A (0x02030100u)
|
|
#define PROTO_645_2007_DI_P_B (0x02030200u)
|
|
#define PROTO_645_2007_DI_P_C (0x02030300u)
|
|
#define PROTO_645_2007_DI_P_ALL (0x0203FF00u)
|
|
/* DI: the reactive power data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_Q_T (0x02040000u)
|
|
#define PROTO_645_2007_DI_Q_A (0x02040100u)
|
|
#define PROTO_645_2007_DI_Q_B (0x02040200u)
|
|
#define PROTO_645_2007_DI_Q_C (0x02040300u)
|
|
#define PROTO_645_2007_DI_Q_ALL (0x0204FF00u)
|
|
/* DI: the apparent power, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_S_T (0x02050000u)
|
|
#define PROTO_645_2007_DI_S_A (0x02050100u)
|
|
#define PROTO_645_2007_DI_S_B (0x02050200u)
|
|
#define PROTO_645_2007_DI_S_C (0x02050300u)
|
|
#define PROTO_645_2007_DI_S_ALL (0x0205FF00u)
|
|
/* DI: the power factor data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_PF_T (0x02060000u)
|
|
#define PROTO_645_2007_DI_PF_A (0x02060100u)
|
|
#define PROTO_645_2007_DI_PF_B (0x02060200u)
|
|
#define PROTO_645_2007_DI_PF_C (0x02060300u)
|
|
#define PROTO_645_2007_DI_PF_ALL (0x0206FF00u)
|
|
/* DI: the phase angle data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_PA_A (0x02070100u)
|
|
#define PROTO_645_2007_DI_PA_B (0x02070200u)
|
|
#define PROTO_645_2007_DI_PA_C (0x02070300u)
|
|
#define PROTO_645_2007_DI_PA_ALL (0x0207FF00u)
|
|
/* DI: the voltage waveform distortion data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_VW_A (0x02080100u)
|
|
#define PROTO_645_2007_DI_VW_B (0x02080200u)
|
|
#define PROTO_645_2007_DI_VW_C (0x02080300u)
|
|
#define PROTO_645_2007_DI_VW_ALL (0x0208FF00u)
|
|
/* DI: the current waveform distortion data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_IW_A (0x02090100u)
|
|
#define PROTO_645_2007_DI_IW_B (0x02090200u)
|
|
#define PROTO_645_2007_DI_IW_C (0x02090300u)
|
|
#define PROTO_645_2007_DI_IW_ALL (0x0209FF00u)
|
|
/* DI: the A phase voltage harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_VHC_A + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_VHC_A + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_VHC_A (0x020A0100u)
|
|
/* DI: the B phase voltage harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_VHC_B + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_VHC_B + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_VHC_B (0x020A0200u)
|
|
/* DI: the C phase voltage harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_VHC_C + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_VHC_C + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_VHC_C (0x020A0300u)
|
|
/* DI: the A phase current harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_IHC_A + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_IHC_A + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_IHC_A (0x020B0100u)
|
|
/* DI: the B phase current harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_IHC_B + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_IHC_B + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_IHC_B (0x020B0200u)
|
|
/* DI: the C phase current harmonic content distortion data,
|
|
* see standard DL/T 645-2007.
|
|
* the 1st harmonic content data DI is PROTO_645_2007_DI_IHC_C + 1.
|
|
* ......
|
|
* the Nst harmonic content data DI is PROTO_645_2007_DI_IHC_C + N.
|
|
*/
|
|
#define PROTO_645_2007_DI_IHC_C (0x020B0300u)
|
|
/* DI: the frequency data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_FREQ (0x02800002u)
|
|
/* DI: the 1 min average power */
|
|
#define PROTO_645_2007_DI_1MIN_AVG_P (0x02800003u)
|
|
/* DI: the demand data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_EPT_DEMAND (0x02800004u)
|
|
#define PROTO_645_2007_DI_EQT_DEMAND (0x02800005u)
|
|
#define PROTO_645_2007_DI_AT_DEMAND (0x02800006u)
|
|
/* DI: the temperature data, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_TEMP (0x02800007u)
|
|
/* DI: the interior clock battery voltage */
|
|
#define PROTO_645_2007_CLOCK_BATTERY_V (0x02800008u)
|
|
/* DI: the external meter read battery voltage */
|
|
#define PROTO_645_2007_MR_BATTERY_V (0x02800009u)
|
|
/* DI: the interior battery work time */
|
|
#define PROTO_645_2007_INTER_BATTERY_TIME (0x0280000au)
|
|
|
|
/* DI: definition for three-phase electric energy */
|
|
#define PROTO_645_2007_DI_EPT_COMP_SUM (0x00000000u)
|
|
#define PROTO_645_2007_DI_EPT_COMP_RATE1 (0x00000100u)
|
|
#define PROTO_645_2007_DI_EPT_COMP_RATE2 (0x00000200u)
|
|
#define PROTO_645_2007_DI_EPT_COMP_RATE3 (0x00000300u)
|
|
#define PROTO_645_2007_DI_EPT_COMP_RATE4 (0x00000400u)
|
|
#define PROTO_645_2007_DI_EPT_COMP_ALL (0x0000ff00u)
|
|
#define PROTO_645_2007_DI_EPT_POS_SUM (0x00010000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_SUM_LAST1 (0x00010001u)
|
|
#define PROTO_645_2007_DI_EPT_POS_RATE1 (0x00010100u)
|
|
#define PROTO_645_2007_DI_EPT_POS_RATE2 (0x00010200u)
|
|
#define PROTO_645_2007_DI_EPT_POS_RATE3 (0x00010300u)
|
|
#define PROTO_645_2007_DI_EPT_POS_RATE4 (0x00010400u)
|
|
#define PROTO_645_2007_DI_EPT_POS_ALL (0x0001ff00u)
|
|
#define PROTO_645_2007_DI_EPT_POS_ALL_LAST1 (0x0001ff01u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_SUM (0x00020000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_RATE1 (0x00020100u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_RATE2 (0x00020200u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_RATE3 (0x00020300u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_RATE4 (0x00020400u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_ALL (0x0002ff00u)
|
|
#define PROTO_645_2007_DI_EQT_POS_SUM (0x00030000u)
|
|
#define PROTO_645_2007_DI_EQT_POS_RATE1 (0x00030100u)
|
|
#define PROTO_645_2007_DI_EQT_POS_RATE2 (0x00030200u)
|
|
#define PROTO_645_2007_DI_EQT_POS_RATE3 (0x00030300u)
|
|
#define PROTO_645_2007_DI_EQT_POS_RATE4 (0x00030400u)
|
|
#define PROTO_645_2007_DI_EQT_POS_ALL (0x0003ff00u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_SUM (0x00040000u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_RATE1 (0x00040100u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_RATE2 (0x00040200u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_RATE3 (0x00040300u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_RATE4 (0x00040400u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_ALL (0x0004ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_SUM (0x00050000u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_RATE1 (0x00050100u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_RATE2 (0x00050200u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_RATE3 (0x00050300u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_RATE4 (0x00050400u)
|
|
#define PROTO_645_2007_DI_EQT_QRT1_ALL (0x0005ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_SUM (0x00060000u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_RATE1 (0x00060100u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_RATE2 (0x00060200u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_RATE3 (0x00060300u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_RATE4 (0x00060400u)
|
|
#define PROTO_645_2007_DI_EQT_QRT2_ALL (0x0006ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_SUM (0x00070000u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_RATE1 (0x00070100u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_RATE2 (0x00070200u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_RATE3 (0x00070300u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_RATE4 (0x00070400u)
|
|
#define PROTO_645_2007_DI_EQT_QRT3_ALL (0x0007ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_SUM (0x00080000u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_RATE1 (0x00080100u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_RATE2 (0x00080200u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_RATE3 (0x00080300u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_RATE4 (0x00080400u)
|
|
#define PROTO_645_2007_DI_EQT_QRT4_ALL (0x0008ff00u)
|
|
#define PROTO_645_2007_DI_EST_POS_SUM (0x00090000u)
|
|
#define PROTO_645_2007_DI_EST_POS_RATE1 (0x00090100u)
|
|
#define PROTO_645_2007_DI_EST_POS_RATE2 (0x00090200u)
|
|
#define PROTO_645_2007_DI_EST_POS_RATE3 (0x00090300u)
|
|
#define PROTO_645_2007_DI_EST_POS_RATE4 (0x00090400u)
|
|
#define PROTO_645_2007_DI_EST_POS_ALL (0x0009ff00u)
|
|
#define PROTO_645_2007_DI_EST_NEG_SUM (0x000a0000u)
|
|
#define PROTO_645_2007_DI_EST_NEG_RATE1 (0x000a0100u)
|
|
#define PROTO_645_2007_DI_EST_NEG_RATE2 (0x000a0200u)
|
|
#define PROTO_645_2007_DI_EST_NEG_RATE3 (0x000a0300u)
|
|
#define PROTO_645_2007_DI_EST_NEG_RATE4 (0x000a0400u)
|
|
#define PROTO_645_2007_DI_EST_NEG_ALL (0x000aff00u)
|
|
#define PROTO_645_2007_DI_EPT_POS_A (0x00150000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_A (0x00160000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_B (0x00290000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_B (0x002a0000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_C (0x003d0000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_C (0x003e0000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND (0x01010000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND_RATE1 (0x01010100u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND_RATE2 (0x01010200u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND_RATE3 (0x01010300u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND_RATE4 (0x01010400u)
|
|
#define PROTO_645_2007_DI_EPT_POS_DEMAND_ALL (0x0101ff00u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND (0x01020000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND_RATE1 (0x01020100u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND_RATE2 (0x01020200u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND_RATE3 (0x01020300u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND_RATE4 (0x01020400u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_DEMAND_ALL (0x0102ff00u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND (0x01030000u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND_RATE1 (0x01030100u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND_RATE2 (0x01030200u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND_RATE3 (0x01030300u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND_RATE4 (0x01030400u)
|
|
#define PROTO_645_2007_DI_EQT_POS_DEMAND_ALL (0x0103ff00u)
|
|
#define PROTO_645_2007_DI_COM_RE1_DEM_TIME_ALL (0x0103ff00u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND (0x01040000u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND_RATE1 (0x01040100u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND_RATE2 (0x01040200u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND_RATE3 (0x01040300u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND_RATE4 (0x01040400u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_DEMAND_ALL (0x0104ff00u)
|
|
#define PROTO_645_2007_DI_COM_RE2_DEM_TIME_ALL (0x0104ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND (0x01050000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND_RATE1 (0x01050100u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND_RATE2 (0x01050200u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND_RATE3 (0x01050300u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND_RATE4 (0x01050400u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_DEMAND_ALL (0x0105ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND (0x01060000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND_RATE1 (0x01060100u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND_RATE2 (0x01060200u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND_RATE3 (0x01060300u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND_RATE4 (0x01060400u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_DEMAND_ALL (0x0106ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND (0x01070000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND_RATE1 (0x01070100u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND_RATE2 (0x01070200u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND_RATE3 (0x01070300u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND_RATE4 (0x01070400u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_DEMAND_ALL (0x0107ff00u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND (0x01080000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND_RATE1 (0x01080100u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND_RATE2 (0x01080200u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND_RATE3 (0x01080300u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND_RATE4 (0x01080400u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_DEMAND_ALL (0x0108ff00u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND (0x01090000u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND_RATE1 (0x01090100u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND_RATE2 (0x01090200u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND_RATE3 (0x01090300u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND_RATE4 (0x01090400u)
|
|
#define PROTO_645_2007_DI_EST_POS_DEMAND_ALL (0x0109ff00u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND (0x010A0000u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND_RATE1 (0x010A0100u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND_RATE2 (0x010A0200u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND_RATE3 (0x010A0300u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND_RATE4 (0x010A0400u)
|
|
#define PROTO_645_2007_DI_EST_NEG_DEMAND_ALL (0x010AFF00u)
|
|
#define PROTO_645_2007_DI_EPT_POS_A_DEMAND (0x01150000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_A_DEMAND (0x01160000u)
|
|
#define PROTO_645_2007_DI_EQT_POS_A_DEMAND (0x01170000u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_A_DEMAND (0x01180000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_A_DEMAND (0x01190000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_A_DEMAND (0x011A0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_A_DEMAND (0x011B0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_A_DEMAND (0x011C0000u)
|
|
#define PROTO_645_2007_DI_EST_POS_A_DEMAND (0x011D0000u)
|
|
#define PROTO_645_2007_DI_EST_NEG_A_DEMAND (0x011E0000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_B_DEMAND (0x01290000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_B_DEMAND (0x012A0000u)
|
|
#define PROTO_645_2007_DI_EQT_POS_B_DEMAND (0x012B0000u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_B_DEMAND (0x012C0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_B_DEMAND (0x012D0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_B_DEMAND (0x012E0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_B_DEMAND (0x012F0000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_B_DEMAND (0x01300000u)
|
|
#define PROTO_645_2007_DI_EST_POS_B_DEMAND (0x01310000u)
|
|
#define PROTO_645_2007_DI_EST_NEG_B_DEMAND (0x01320000u)
|
|
#define PROTO_645_2007_DI_EPT_POS_C_DEMAND (0x013D0000u)
|
|
#define PROTO_645_2007_DI_EPT_NEG_C_DEMAND (0x013E0000u)
|
|
#define PROTO_645_2007_DI_EQT_POS_C_DEMAND (0x013F0000u)
|
|
#define PROTO_645_2007_DI_EQT_NEG_C_DEMAND (0x01400000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD1_C_DEMAND (0x01410000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD2_C_DEMAND (0x01420000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD3_C_DEMAND (0x01430000u)
|
|
#define PROTO_645_2007_DI_EQT_QUAD4_C_DEMAND (0x01440000u)
|
|
#define PROTO_645_2007_DI_EST_POS_C_DEMAND (0x01450000u)
|
|
#define PROTO_645_2007_DI_EST_NEG_C_DEMAND (0x01460000u)
|
|
|
|
/* DI definition for single-phase electric energy */
|
|
#define PROTO_645_2007_EPA_POS (0x00150000u)
|
|
#define PROTO_645_2007_EPA_NEG (0x00160000u)
|
|
#define PROTO_645_2007_EQA_POS (0x00170000u)
|
|
#define PROTO_645_2007_EQA_NEG (0x00180000u)
|
|
#define PROTO_645_2007_EQA_QRT1 (0x00190000u)
|
|
#define PROTO_645_2007_EQA_QRT2 (0x001A0000u)
|
|
#define PROTO_645_2007_EQA_QRT3 (0x001B0000u)
|
|
#define PROTO_645_2007_EQA_QRT4 (0x001C0000u)
|
|
#define PROTO_645_2007_ESA_POS (0x001D0000u)
|
|
#define PROTO_645_2007_ESA_NEG (0x001E0000u)
|
|
#define PROTO_645_2007_EPB_POS (0x00290000u)
|
|
#define PROTO_645_2007_EPB_NEG (0x002A0000u)
|
|
#define PROTO_645_2007_EQB_POS (0x002B0000u)
|
|
#define PROTO_645_2007_EQB_NEG (0x002C0000u)
|
|
#define PROTO_645_2007_EQB_QRT1 (0x002D0000u)
|
|
#define PROTO_645_2007_EQB_QRT2 (0x002E0000u)
|
|
#define PROTO_645_2007_EQB_QRT3 (0x002F0000u)
|
|
#define PROTO_645_2007_EQB_QRT4 (0x00300000u)
|
|
#define PROTO_645_2007_ESB_POS (0x00310000u)
|
|
#define PROTO_645_2007_ESB_NEG (0x00320000u)
|
|
#define PROTO_645_2007_EPC_POS (0x003D0000u)
|
|
#define PROTO_645_2007_EPC_NEG (0x003E0000u)
|
|
#define PROTO_645_2007_EQC_POS (0x003F0000u)
|
|
#define PROTO_645_2007_EQC_NEG (0x00400000u)
|
|
#define PROTO_645_2007_EQC_QRT1 (0x00410000u)
|
|
#define PROTO_645_2007_EQC_QRT2 (0x00420000u)
|
|
#define PROTO_645_2007_EQC_QRT3 (0x00430000u)
|
|
#define PROTO_645_2007_EQC_QRT4 (0x00440000u)
|
|
#define PROTO_645_2007_ESC_POS (0x00450000u)
|
|
#define PROTO_645_2007_ESC_NEG (0x00460000u)
|
|
|
|
/* read current and 12 settlement date energy data blocks of an item */
|
|
#define PROTO_645_2007_DI_UNI_ENERGY_RECORD_ALL (0x000000FFu)
|
|
|
|
/* read current and 12 settlement date demand data blocks of an item */
|
|
#define PROTO_645_2007_DI_UNI_DEMAND_RECORD_ALL (0x010000FFu)
|
|
|
|
/* write identify cert */
|
|
#define PROTO_645_2007_DI_WIC (0x070000FFu)
|
|
/* DI: the current combined reactive energy data 1,
|
|
* see standard DL/T 645-2007.
|
|
*/
|
|
#define PROTO_645_2007_DI_CRE1 (0x0003FF00u)
|
|
/* DI: the current combined reactive energy data 2,
|
|
* see standard DL/T 645-2007
|
|
*/
|
|
#define PROTO_645_2007_DI_CRE2 (0x0004FF00u)
|
|
|
|
/* DI: number of missing voltage record */
|
|
#define PROTO_645_2007_DI_MISS_V_NUM (0x03010000u)
|
|
/* DI: number of voltage reverse phase sequence */
|
|
#define PROTO_645_2007_DI_V_RPS_NUM (0x03070000u)
|
|
/* DI: number of loss current */
|
|
#define PROTO_645_2007_DI_MISS_I_NUM (0x030B0000u)
|
|
/* DI: number of phase disconnection */
|
|
#define PROTO_645_2007_DI_PHASE_DISC_NUM (0x03040000u)
|
|
|
|
/* DI: power down record */
|
|
#define PROTO_645_2007_DI_PD_TOTAL_NUM (0x03110000u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST1 (0x03110001u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST2 (0x03110002u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST3 (0x03110003u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST4 (0x03110004u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST5 (0x03110005u)
|
|
#define PROTO_645_2007_DI_PD_RECORD_LAST6 (0x03110006u)
|
|
/* DI: programming record */
|
|
#define PROTO_645_2007_DI_PROGRAM_R (0x03300001u)
|
|
|
|
/* DI: number of meter clean */
|
|
#define PROTO_645_2007_DI_PM_CLEAE_N (0x03300100u)
|
|
|
|
/* DI: total modification times of monthly settlement date */
|
|
#define PROTO_645_2007_DI_MSD_MODIFY_COUNT (0x03300C00u)
|
|
|
|
/* DI: monthly settlement date modification record */
|
|
#define PROTO_645_2007_DI_MSD_MODIFY_REC_BASE (0x03300C01u)
|
|
|
|
/* DI: number of Opening covers */
|
|
#define PROTO_645_2007_DI_COVER_OPEN_N (0x03300D00u)
|
|
#define PROTO_645_2007_DI_COVER_OPEN_R (0x03300D01u)
|
|
/* DI: number of opening button box covers */
|
|
#define PROTO_645_2007_DI_BUTTON_OPEN_N (0x03300E00u)
|
|
/* DI: correcting time record */
|
|
#define PROTO_645_2007_DI_CORR_TIME_NUM (0x03300400u)
|
|
|
|
/* DI: the rating current */
|
|
#define PROTO_645_2007_DI_RATING_CURRENT (0x04000405u)
|
|
/* rating current ascii length */
|
|
#define PROTO_645_2007_RATING_CUR_LEN (6)
|
|
|
|
/* DI: running status word */
|
|
#define PROTO_645_2007_RUN_STATE_WORD_1 (0x04000501u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_2 (0x04000502u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_3 (0x04000503u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_4 (0x04000504u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_5 (0x04000505u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_6 (0x04000506u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_7 (0x04000507u)
|
|
#define PROTO_645_2007_RUN_STATE_WORD_ALL (0x040005FFu)
|
|
|
|
/* DI: time delta report, see standard extended DL/T 645-2007.
|
|
* for hlj protocol
|
|
*/
|
|
#define PROTO_645_2007_DI_DELTA_RPT (0x04001599u)
|
|
|
|
/* definition of under voltage event threshold, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_THR_UV_VOLTAGE (0x04090201u)
|
|
#define PROTO_645_2007_DI_THR_UV_TIME (0x04090202u)
|
|
|
|
/* definition of over voltage event threshold, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_THR_OV_VOLTAGE (0x04090301u)
|
|
#define PROTO_645_2007_DI_THR_OV_TIME (0x04090302u)
|
|
|
|
/* definition of phase failure event threshold, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_THR_PF_VOLTAGE (0x04090401u)
|
|
#define PROTO_645_2007_DI_THR_PF_CURRENT (0x04090402u)
|
|
#define PROTO_645_2007_DI_THR_PF_TIME (0x04090403u)
|
|
|
|
/* definition of voltage unbalance event threshold,
|
|
* see standard DL/T 645-2007
|
|
*/
|
|
#define PROTO_645_2007_DI_THR_UBV_RATE (0x04090501u)
|
|
#define PROTO_645_2007_DI_THR_UBV_TIME (0x04090502u)
|
|
|
|
/* definition of over current event threshold, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_THR_OI_CURRENT (0x04090801u)
|
|
#define PROTO_645_2007_DI_THR_OI_TIME (0x04090802u)
|
|
|
|
/* definition of real time frozen data items, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_RT_YMDHMS_BASE 0x05010000
|
|
#define PROTO_645_2007_DI_RT_EP_POS_BASE 0x05010100
|
|
#define PROTO_645_2007_DI_RT_EP_NEG_BASE 0x05010200
|
|
#define PROTO_645_2007_DI_RT_EQ_POS_BASE 0x05010300
|
|
#define PROTO_645_2007_DI_RT_EQ_NEG_BASE 0x05010400
|
|
#define PROTO_645_2007_DI_RT_VARIABLE_BASE 0x05011000
|
|
|
|
#define PROTO_645_2007_DI_RT_YMDHMS_LAST1 0x05010001
|
|
#define PROTO_645_2007_DI_RT_EP_POS_LAST1 0x05010101
|
|
#define PROTO_645_2007_DI_RT_EP_NEG_LAST1 0x05010201
|
|
#define PROTO_645_2007_DI_RT_VARIABLE_LAST1 0x05011001
|
|
|
|
/* definition of hourly frozen data items, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_HF_YMDHMS_BASE 0x05040000
|
|
#define PROTO_645_2007_DI_HF_EP_POS_BASE 0x05040100
|
|
#define PROTO_645_2007_DI_HF_EP_NEG_BASE 0x05040200
|
|
#define PROTO_645_2007_DI_HF_ALL_BASE 0x0504FF00
|
|
|
|
/* definition of daily frozen data items, see standard DL/T 645-2007 */
|
|
#define PROTO_645_2007_DI_DF_YMDHMS_BASE 0x05060000
|
|
#define PROTO_645_2007_DI_DF_YMDHMS_LAST1 0x05060001
|
|
#define PROTO_645_2007_DI_DF_EP_POS_BASE 0x05060100
|
|
#define PROTO_645_2007_DI_DF_EP_POS_LAST1 0x05060101
|
|
#define PROTO_645_2007_DI_DF_EP_NEG_BASE 0x05060200
|
|
#define PROTO_645_2007_DI_DF_EP_NEG_LAST1 0x05060201
|
|
#define PROTO_645_2007_DI_DF_EQ_POS_BASE 0x05060300
|
|
#define PROTO_645_2007_DI_DF_EQ_POS_LAST1 0x05060301
|
|
#define PROTO_645_2007_DI_DF_EQ_NEG_BASE 0x05060400
|
|
#define PROTO_645_2007_DI_DF_EQ_NEG_LAST1 0x05060401
|
|
#define PROTO_645_2007_DI_DF_RE_1ST_POWER_LAST1 0x05060501
|
|
#define PROTO_645_2007_DI_DF_RE_2ST_POWER_LAST1 0x05060601
|
|
#define PROTO_645_2007_DI_DF_RE_3ST_POWER_LAST1 0x05060701
|
|
#define PROTO_645_2007_DI_DF_RE_4ST_POWER_LAST1 0x05060801
|
|
#define PROTO_645_2007_DI_DF_POS_ACT_DEM_TIME_LAST1 0x05060901
|
|
#define PROTO_645_2007_DI_DF_NEG_ACT_DEM_TIME_LAST1 0x05060A01
|
|
#define PROTO_645_2007_DI_DF_VARIABLE_LAST1 0x05061001
|
|
|
|
/* define load curve di*/
|
|
|
|
/* DI for read curve records at specified times */
|
|
#define PROTO_645_2007_DI_CR_ALL_BY_TIME 0x06000001
|
|
|
|
#define PROTO_645_2007_DI_CR_V_A 0x06100101/* A-phase voltage curve */
|
|
#define PROTO_645_2007_DI_CR_V_B 0x06100102/* B-phase voltage curve */
|
|
#define PROTO_645_2007_DI_CR_V_C 0x06100103/* B-phase voltage curve */
|
|
#define PROTO_645_2007_DI_CR_V_ALL 0x061001ff/* voltage curve block */
|
|
#define PROTO_645_2007_DI_CR_I_A 0x06100201/* A-phase current curve */
|
|
#define PROTO_645_2007_DI_CR_I_B 0x06100202/* B-phase current curve */
|
|
#define PROTO_645_2007_DI_CR_I_C 0x06100203/* C-phase current curve */
|
|
#define PROTO_645_2007_DI_CR_I_ALL 0x061002ff/* current curve bloc */
|
|
#define PROTO_645_2007_DI_CR_P_T 0x06100300/* T-phase act power curve */
|
|
#define PROTO_645_2007_DI_CR_P_A 0x06100301/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_CR_P_B 0x06100302/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_CR_P_C 0x06100303/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_CR_P_ALL 0x061003ff/* act power curve block */
|
|
#define PROTO_645_2007_DI_CR_Q_T 0x06100400/* T-phase reac power curve */
|
|
#define PROTO_645_2007_DI_CR_Q_A 0x06100401/* A-phase reac power curve */
|
|
#define PROTO_645_2007_DI_CR_Q_B 0x06100402/* B-phase reac power curve */
|
|
#define PROTO_645_2007_DI_CR_Q_C 0x06100403/* C-phase reac power curve */
|
|
#define PROTO_645_2007_DI_CR_Q_ALL 0x061004ff/* reac power curve block */
|
|
#define PROTO_645_2007_DI_CR_PF_T 0x06100500/* T-phase power curve */
|
|
#define PROTO_645_2007_DI_CR_PF_A 0x06100501/* A-phase power factor curve */
|
|
#define PROTO_645_2007_DI_CR_PF_B 0x06100502/* B-phase power factor curve */
|
|
#define PROTO_645_2007_DI_CR_PF_C 0x06100503/* C-phase power factor curve */
|
|
#define PROTO_645_2007_DI_CR_PF_ALL 0x061005ff/* power factor curve block */
|
|
#define PROTO_645_2007_DI_CR_EP_POS 0x06100601/* pos ep curve block */
|
|
#define PROTO_645_2007_DI_CR_EP_NEG 0x06100602/* neg ep curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_POS 0x06100603/* pos eq curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_NEG 0x06100604/* neg eq curve block */
|
|
#define PROTO_645_2007_DI_CR_EPEQ_ALL 0x061006ff/* all ep/eq curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_QRT1 0x06100701/* eq quad1 curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_QRT2 0x06100702/* eq quad2 curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_QRT3 0x06100703/* eq quad3 curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_QRT4 0x06100704/* eq quad4 curve block */
|
|
#define PROTO_645_2007_DI_CR_EQ_QRT_ALL 0x061007ff/* eq all quad curve block */
|
|
|
|
/* define nw load curve di */
|
|
#define PROTO_645_2007_DI_NW_CR_V_A 0x06120101/* A-phase voltage curve */
|
|
#define PROTO_645_2007_DI_NW_CR_V_B 0x06120102/* B-phase voltage curve */
|
|
#define PROTO_645_2007_DI_NW_CR_V_C 0x06120103/* B-phase voltage curve */
|
|
#define PROTO_645_2007_DI_NW_CR_V_ALL 0x061201ff/* voltage curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_I_A 0x06120201/* A-phase current curve */
|
|
#define PROTO_645_2007_DI_NW_CR_I_B 0x06120202/* B-phase current curve */
|
|
#define PROTO_645_2007_DI_NW_CR_I_C 0x06120203/* C-phase current curve */
|
|
#define PROTO_645_2007_DI_NW_CR_I_ALL 0x061202ff/* current curve bloc */
|
|
#define PROTO_645_2007_DI_NW_CR_P_T 0x06120300/* T-phase act power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_P_A 0x06120301/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_P_B 0x06120302/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_P_C 0x06120303/* A-phase act power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_P_ALL 0x061203ff/* act power curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_Q_T 0x06120400/* T-phase reac power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_Q_A 0x06120401/* A-phase reac power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_Q_B 0x06120402/* B-phase reac power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_Q_C 0x06120403/* C-phase reac power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_Q_ALL 0x061204ff/* reac power curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_PF_T 0x06120500/* T-phase power curve */
|
|
#define PROTO_645_2007_DI_NW_CR_PF_A 0x06120501/* A-phase power factor curve */
|
|
#define PROTO_645_2007_DI_NW_CR_PF_B 0x06120502/* B-phase power factor curve */
|
|
#define PROTO_645_2007_DI_NW_CR_PF_C 0x06120503/* C-phase power factor curve */
|
|
#define PROTO_645_2007_DI_NW_CR_PF_ALL 0x061205ff/* power factor curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EP_POS 0x06120601/* pos ep curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EP_NEG 0x06120602/* neg ep curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_POS 0x06120603/* pos eq curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_NEG 0x06120604/* neg eq curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EPEQ_ALL 0x061206ff/* all ep/eq curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_QRT1 0x06120701/* eq quad1 curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_QRT2 0x06120702/* eq quad2 curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_QRT3 0x06120703/* eq quad3 curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_QRT4 0x06120704/* eq quad4 curve block */
|
|
/* eq all quad curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQ_QRT_ALL 0x061207ff
|
|
/* ept demand curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EPT_DEMAND 0x06120801
|
|
/* eqt demand curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_EQT_DEMAND 0x06120802
|
|
/* all ept/eqt demand curve block */
|
|
#define PROTO_645_2007_DI_NW_CR_DEMAND_ALL 0x061208ff
|
|
/* GND current curve */
|
|
#define PROTO_645_2007_DI_NW_CR_I_N 0x06120900
|
|
/* data identification for nw multi di read */
|
|
#define PROTO_645_2007_DI_NW_MULTI_READ 0xEEEEEE00
|
|
|
|
/* data identification for start score */
|
|
#define PROTO_645_2007_DI_START_SCORE (0x07070707u)
|
|
|
|
/* Number of phase A overcurrent */
|
|
#define PROTO_645_2007_DI_OVER_CUR_A_N (0x19010001u)
|
|
/* Number of phase B overcurrent */
|
|
#define PROTO_645_2007_DI_OVER_CUR_B_N (0x19020001u)
|
|
/* Number of phase C overcurrent */
|
|
#define PROTO_645_2007_DI_OVER_CUR_C_N (0x19030001u)
|
|
|
|
/* data identification for switch band */
|
|
#define PROTO_645_2007_DI_BAND_SWITCH (0x7EFF1300u)
|
|
/* data identification for 698 event report, only for hlj dev test cco mode */
|
|
#define PROTO_645_2007_DI_TRIG_698_EVT_RPT (0x7EFF2000u)
|
|
|
|
/* set follow address, only for shandong repeater */
|
|
#define PROTO_645_2007_DI_FOLLOW_ADDR_SET (0xA0B0C0D0u)
|
|
#define PROTO_645_2007_DI_FOLLOW_ADDR_QUERY (0xA0B0C0D1u)
|
|
|
|
/* DI: AI management unit operation command, see standard extended
|
|
* DL/T 645-2007. only for XIAN AI management unit
|
|
*/
|
|
#define PROTO_645_2007_DI_AI_TOPO_START (0xE1100001u)
|
|
#define PROTO_645_2007_DI_AI_TOPO_QUERY (0xE1100004u)
|
|
#define PROTO_645_2007_DI_AI_LL_START (0xE1100101u)
|
|
#define PROTO_645_2007_DI_AI_LL_QUERY (0xE1100104u)
|
|
|
|
/* defines payload data length corresponding to the DI, for
|
|
* standard DL/T 645-2007.
|
|
*/
|
|
#define PROTO_645_2007_DI_FOR_WATTH_T_LEN (4u)
|
|
#define PROTO_645_2007_DI_R_ADDR_LEN (6u)
|
|
#define PROTO_645_2007_DI_EVENT_STA_WORD_LEN (10u)
|
|
|
|
/* DI: definition for three-phase electric energy, see standard DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_EPT_POS_SUM (0x9010u)
|
|
#define PROTO_645_1997_DI_EPT_POS_RATE1 (0x9011u)
|
|
#define PROTO_645_1997_DI_EPT_POS_RATE2 (0x9012u)
|
|
#define PROTO_645_1997_DI_EPT_POS_RATE3 (0x9013u)
|
|
#define PROTO_645_1997_DI_EPT_POS_RATE4 (0x9014u)
|
|
#define PROTO_645_1997_DI_EPT_POS_ALL (0x901fu)
|
|
#define PROTO_645_1997_DI_EPT_NEG_SUM (0x9020u)
|
|
#define PROTO_645_1997_DI_EPT_NEG_RATE1 (0x9021u)
|
|
#define PROTO_645_1997_DI_EPT_NEG_RATE2 (0x9022u)
|
|
#define PROTO_645_1997_DI_EPT_NEG_RATE3 (0x9023u)
|
|
#define PROTO_645_1997_DI_EPT_NEG_RATE4 (0x9024u)
|
|
#define PROTO_645_1997_DI_EPT_NEG_ALL (0x902fu)
|
|
#define PROTO_645_1997_DI_EQT_POS_SUM (0x9110u)
|
|
#define PROTO_645_1997_DI_EQT_POS_RATE1 (0x9111u)
|
|
#define PROTO_645_1997_DI_EQT_POS_RATE2 (0x9112u)
|
|
#define PROTO_645_1997_DI_EQT_POS_RATE3 (0x9113u)
|
|
#define PROTO_645_1997_DI_EQT_POS_RATE4 (0x9114u)
|
|
#define PROTO_645_1997_DI_EQT_POS_ALL (0x911fu)
|
|
#define PROTO_645_1997_DI_EQT_NEG_SUM (0x9120u)
|
|
#define PROTO_645_1997_DI_EQT_NEG_RATE1 (0x9121u)
|
|
#define PROTO_645_1997_DI_EQT_NEG_RATE2 (0x9122u)
|
|
#define PROTO_645_1997_DI_EQT_NEG_RATE3 (0x9123u)
|
|
#define PROTO_645_1997_DI_EQT_NEG_RATE4 (0x9124u)
|
|
#define PROTO_645_1997_DI_EQT_NEG_ALL (0x912fu)
|
|
#define PROTO_645_1997_DI_EQT_QRT1_SUM (0x9130u)
|
|
#define PROTO_645_1997_DI_EQT_QRT1_ALL (0x913fu)
|
|
#define PROTO_645_1997_DI_EQT_QRT2_SUM (0x9150u)
|
|
#define PROTO_645_1997_DI_EQT_QRT2_ALL (0x915fu)
|
|
#define PROTO_645_1997_DI_EQT_QRT3_SUM (0x9160u)
|
|
#define PROTO_645_1997_DI_EQT_QRT3_ALL (0x916fu)
|
|
#define PROTO_645_1997_DI_EQT_QRT4_SUM (0x9140u)
|
|
#define PROTO_645_1997_DI_EQT_QRT4_ALL (0x914fu)
|
|
/* DI: read meter addr, for see standard DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_R_ADDR (0xC032u)
|
|
/* DI: read meter time (year, month, data),
|
|
* see standard extended DL/T 645-1997
|
|
*/
|
|
#define PROTO_645_1997_DI_TIME_YMD (0xc010u)
|
|
/* DI: read meter time (hour, minute, second),
|
|
* see standard extended DL/T 645-1997
|
|
*/
|
|
#define PROTO_645_1997_DI_TIME_HMS (0xc011u)
|
|
/* DI: the voltage data, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_V_A (0xb611u)
|
|
#define PROTO_645_1997_DI_V_B (0xb612u)
|
|
#define PROTO_645_1997_DI_V_C (0xb613u)
|
|
#define PROTO_645_1997_DI_V_ALL (0xb61fu)
|
|
/* DI: the current data, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_I_A (0xb621u)
|
|
#define PROTO_645_1997_DI_I_B (0xb622u)
|
|
#define PROTO_645_1997_DI_I_C (0xb623u)
|
|
#define PROTO_645_1997_DI_I_ALL (0xb62fu)
|
|
/* DI: the active power data, see standard DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_P_T (0xb630u)
|
|
#define PROTO_645_1997_DI_P_A (0xb631u)
|
|
#define PROTO_645_1997_DI_P_B (0xb632u)
|
|
#define PROTO_645_1997_DI_P_C (0xb633u)
|
|
#define PROTO_645_1997_DI_P_ALL (0xb63fu)
|
|
/* DI: the reactive power data, see standard DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_Q_T (0xb640u)
|
|
#define PROTO_645_1997_DI_Q_A (0xb641u)
|
|
#define PROTO_645_1997_DI_Q_B (0xb642u)
|
|
#define PROTO_645_1997_DI_Q_C (0xb643u)
|
|
#define PROTO_645_1997_DI_Q_ALL (0xb64fu)
|
|
/* DI: the power factor data, see standard DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_PF_T (0xb650u)
|
|
#define PROTO_645_1997_DI_PF_A (0xb651u)
|
|
#define PROTO_645_1997_DI_PF_B (0xb652u)
|
|
#define PROTO_645_1997_DI_PF_C (0xb653u)
|
|
#define PROTO_645_1997_DI_PF_ALL (0xb65fu)
|
|
|
|
/* DI: the power factor data, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_PF_ALL (0xb65fu)
|
|
/* DI: the frequency data, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_FREQ (0xb664u)
|
|
|
|
/* DI: running state data1, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_RS1 (0xc020u)
|
|
/* DI: running state data2, see standard extended DL/T 645-1997 */
|
|
#define PROTO_645_1997_DI_RS2 (0xc021u)
|
|
|
|
/* defines payload data length corresponding to the DI, for
|
|
* standard DL/T 645-1997.
|
|
*/
|
|
#define PROTO_645_1997_DI_EPT_POS_SUM_LEN (4u)
|
|
#define PROTO_645_1997_DI_R_ADDR_LEN (6u)
|
|
|
|
/* Invalid di */
|
|
#define PROTO_645_INVALID_DI (0xffffffffu)
|
|
|
|
/* the maximum legal address value defined in the 645 protocol, decimal */
|
|
#define PRORO_645_ADDR_DEC_MAX (99)
|
|
|
|
/* the byte of any mac address value defined in the 645 protocol */
|
|
#define PRORO_645_ANY_ADDR_BYTE (0xaa)
|
|
|
|
/* Message direction: slave->master */
|
|
#define PROTO_645_DIR_SLAVE 1
|
|
|
|
/* Message direction: master->slave */
|
|
#define PROTO_645_DIR_MASTER 0
|
|
|
|
/* Ack flag: means abnormal ack */
|
|
#define PROTO_645_ACK_ABNORMAL 1
|
|
|
|
/* Ack flag: means normal ack */
|
|
#define PROTO_645_ACK_NORMAL 0
|
|
|
|
/* Follow data flag: means following data available */
|
|
#define PROTO_645_FOLLOW_AVAILABLE 1
|
|
|
|
/* Follow data flag: means no following data */
|
|
#define PROTO_645_FOLLOW_INVALID 0
|
|
|
|
/* control function code definition for DL/T 645-2007 */
|
|
#define PROTO_645_2007_FN_SECURITY_CERTIFICATE 0x03
|
|
/* only for hunan dev test */
|
|
#define PROTO_645_2007_FN_QUERY_TOPO 0x04
|
|
#define PROTO_645_2007_FN_CORRECT_TIME 0x08
|
|
#define PROTO_645_2007_FN_EVT_RPT 0x09
|
|
#define PROTO_645_2007_FN_READ_DATA 0x11
|
|
#define PROTO_645_2007_FN_READ_DATA_C 0x12
|
|
#define PROTO_645_2007_FN_READ_ADDR 0x13
|
|
#define PROTO_645_2007_FN_WRITE_DATA 0x14
|
|
#define PROTO_645_2007_FN_WRITE_ADDR 0x15
|
|
#define PROTO_645_2007_FN_FROZE 0x16
|
|
#define PROTO_645_2007_FN_CHG_RATE 0x17
|
|
#define PROTO_645_2007_FN_CHG_PASSWORD 0x18
|
|
#define PROTO_645_2007_FN_MAX_REQ_RESET 0x19
|
|
#define PROTO_645_2007_FN_PM_RESET 0x1A
|
|
#define PROTO_645_2007_FN_EVENT_RESET 0x1B
|
|
#define PROTO_645_2007_FN_COST_CON 0x1C
|
|
#define PROTO_645_2007_FN_BAND_SWITCH 0x1E
|
|
/* only for hlj dev test cco mode */
|
|
#define PROTO_645_2007_FN_698_EVT_RPT 0x1E
|
|
#define PROTO_645_2007_FN_CLOCK_SKEW 0x1F
|
|
|
|
/* only for bsrm */
|
|
#define PROTO_645_2007_FN_BSRM_EVT_RPT 0x1E
|
|
/* only for dingxin bsrm set address*/
|
|
#define PROTO_645_2007_FN_BSRM_DX_WRITE_ADDR 0x1E
|
|
|
|
/* control function code for AI management unit operation command,
|
|
* see standard extended DL/T 645-2007. only for XIAN AI management unit
|
|
*/
|
|
#define PROTO_645_2007_FN_AI_XIAN 0x1F
|
|
|
|
#define PROTO_645_2007_FN_MAX_REQ_RESET_ACK 0x99
|
|
#define PROTO_645_2007_FN_MAX_REQ_RESET_NACK 0xD9
|
|
|
|
/* control function code definition for DL/T 645-1997 */
|
|
#define PROTO_645_1997_FN_READ_DATA 0x01
|
|
#define PROTO_645_1997_FN_READ_DATA_C 0x02
|
|
#define PROTO_645_1997_FN_REPEAT_READ_DATA 0x03
|
|
#define PROTO_645_1997_FN_WRITE_DATA 0x04
|
|
#define PROTO_645_1997_FN_CORRECT_TIME 0x08
|
|
#define PROTO_645_1997_FN_WRITE_ADDR 0x0A
|
|
#define PROTO_645_1997_FN_CHG_RATE 0x0C
|
|
#define PROTO_645_1997_FN_CHG_PASSWORD 0x0F
|
|
#define PROTO_645_1997_FN_MAX_REQ_RESET 0x10
|
|
|
|
/* event report status length in Extended DL/T 645-2007 */
|
|
#define PROTO_645_2007_EVENT_STATUS_LEN (12)
|
|
|
|
/* password and operator code length for DL/T 645-2007 */
|
|
#define PROTO_645_2007_P_C_LEN (8)
|
|
|
|
/* type of error for DL/T 645-2007 */
|
|
#define PROTO_645_2007_ERR_OK 0
|
|
#define PROTO_645_2007_ERR_OTHER 0x01
|
|
#define PROTO_645_2007_ERR_NO_REQ_DATA 0X02
|
|
#define PROTO_645_2007_ERR_GO_OUT_FWD 0XFF
|
|
|
|
/* data unit identification, default is 0x82.*/
|
|
#define PROTO_645_2007_BSRM_DX_SET_ADDR_IDENT (0x82)
|
|
|
|
/* 645 datagram length define of TSFM second node event report */
|
|
/* hunan, sichuan, shanghai, ningxia, liaoning, hubei, jiangxi, henan */
|
|
#define PROTO_645_TSFM_LEN (19)
|
|
|
|
/* define 645-07 impedance anomaly time data length */
|
|
#define PROTO_645_07_IA_TIME_LEN (6)
|
|
|
|
/* define 645-07 impedance anomaly resistance data length */
|
|
#define PROTO_645_07_IA_RES_LEN (3)
|
|
|
|
/* define 645 work time data len */
|
|
#define PROTO_645_INTER_BATTERY_TIME_LEN (4)
|
|
|
|
/* define 645 temperature data length */
|
|
#define PROTO_645_TEMPERATURE_LEN (2)
|
|
|
|
/* define 645 harmonic content data length */
|
|
#define PROTO_645_HARMONIC_CONT_LEN (2)
|
|
|
|
/* define 645 waveform distortion data length */
|
|
#define PROTO_645_WAVEFORM_DIS_LEN (2)
|
|
|
|
/* define 645 phase angle data length */
|
|
#define PROTO_645_PHASE_ANGLE_LEN (2)
|
|
|
|
/* define 645 voltage data length */
|
|
#define PROTO_645_V_LEN (2)
|
|
|
|
/* define 645-07 current data length */
|
|
#define PROTO_645_07_A_LEN (3)
|
|
|
|
/* define 645-07 power data length */
|
|
#define PROTO_645_07_P_LEN (3)
|
|
|
|
/* define 645-07 power factor data length */
|
|
#define PROTO_645_07_PF_LEN (2)
|
|
|
|
/* define 645-07 freq data length */
|
|
#define PROTO_645_07_FREQ_LEN (2)
|
|
|
|
/* define 4-digit BCD code length */
|
|
#define PROTO_645_DIGIT4_BCD_LEN (2)
|
|
|
|
/* define 2-digit BCD code length */
|
|
#define PROTO_645_DIGIT2_BCD_LEN (1)
|
|
|
|
/* define 645-07 temperature data length */
|
|
#define PROTO_645_07_TEMP_LEN (2)
|
|
|
|
/* define 645-07 energy data length */
|
|
#define PROTO_645_07_ENERGY_DATA_LEN (4)
|
|
|
|
/* define 645-07 current power demand with time length */
|
|
#define PROTO_645_07_CURR_PD_LEN (8)
|
|
|
|
/* define 645-07 the max status workds index */
|
|
#define PROTO_645_07_MAX_STATUS_WORDS_INDEX (7)
|
|
|
|
/* define 645-07 current data length */
|
|
#define PROTO_645_97_A_LEN (2)
|
|
|
|
/* define 645-97 reactive power data length */
|
|
#define PROTO_645_97_RP_LEN (2)
|
|
|
|
/* define 645 frequency data length */
|
|
#define PROTO_645_FREQ_LEN (2)
|
|
#define PROTO_645_YYMMDDHHMM_LEN (5)
|
|
/* define protocol 645 number(NNNNNN) length */
|
|
#define PROTO_645_NUM_LEN (3)
|
|
|
|
/* define protocol 645 qeidian data length */
|
|
#define PROTO_645_YYMMDDHHMMSS_LEN (6)
|
|
|
|
/* define protocol 645 current threshold for over current data length */
|
|
#define PROTO_645_THR_OI_A_LEN (2)
|
|
|
|
/* define protocol 645-2007 rate threshold data length for
|
|
* voltage/current unbalance data.
|
|
*/
|
|
#define PROTO_645_07_THR_UNBAL_RATE_LEN (2)
|
|
|
|
/* define 645 harmonic content block unit count */
|
|
#define PROTO_645_HC_BLOCK_UNIT_CNT (21)
|
|
|
|
/* define the maximum size of single point curve record transmission */
|
|
#define PROTO_645_07_CURVE_REC_MAX_SIZE 103
|
|
|
|
/* define 645 read load record curve data length */
|
|
#define PROTO_645_READ_LR_CURVE_DATA_LEN (10)
|
|
|
|
/* define the max count of voltage load record point */
|
|
#define PROTO_645_07_V_LR_POINT_MAX_CNT (123)
|
|
|
|
/* define switch band response data len */
|
|
#define PROTO_645_07_BADN_SWITCH_DATA_LEN 8
|
|
|
|
/* asset management code len */
|
|
#define PROTO_645_2007_AMC_LEN 32
|
|
|
|
/* define 645 curve data freezing density */
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_NO (0)
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_15MIN (1)
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_30MIN (2)
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_60MIN (3)
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_5MIN (254)
|
|
#define PROTO_645_CURVE_FREEZ_DENSITY_1MIN (255)
|
|
|
|
/* define 645 program record data id code count */
|
|
#define PROTO_645_PROGRAM_ID_CODE_CNT (10)
|
|
|
|
/* define 645 open coves record total electric energy count */
|
|
#define PROTO_645_OC_RECORD_ENERGY_CNT (12)
|
|
|
|
/* define 645 clock skew mode meter time above cctt time */
|
|
#define PROTO_645_CS_MODE_METER_ABOVE_CCTT (1)
|
|
/* define 645 clock skew mode meter time below cctt time */
|
|
#define PROTO_645_CS_MODE_METER_BELOW_CCTT (2)
|
|
|
|
/* define 645 clock skew mode meter time below cctt time. for hlj protocol */
|
|
#define PROTO_645_CS_MODE_METER_BELOW_CCTT_HLJ (0)
|
|
/* define 645 clock skew mode meter time above cctt time. for hlj protocol */
|
|
#define PROTO_645_CS_MODE_METER_ABOVE_CCTT_HLJ (1)
|
|
|
|
/* days of monthly settlement date, see PROTO645_2007 */
|
|
#define PROTO_645_MSD_NUM (3)
|
|
|
|
#define proto_645_2007_di_to_byte(di,ptr) \
|
|
do { \
|
|
((uint8_t *)(ptr))[3] = (uint8_t)((di) >> 24); \
|
|
((uint8_t *)(ptr))[2] = (uint8_t)((di) >> 16); \
|
|
((uint8_t *)(ptr))[1] = (uint8_t)((di) >> 8); \
|
|
((uint8_t *)(ptr))[0] = (uint8_t)((di) & 0xff); \
|
|
} while(0)
|
|
|
|
#define proto_645_1997_di_to_byte(di,ptr) \
|
|
do { \
|
|
((uint8_t *)(ptr))[1] = (uint8_t)((di) >> 8); \
|
|
((uint8_t *)(ptr))[0] = (uint8_t)((di) & 0xff); \
|
|
} while(0)
|
|
|
|
typedef struct _proto_645_ctrl {
|
|
/* function code. see PROTO645_2007(1997)_FN_XXX */
|
|
uint8_t fn :5,
|
|
/* 0 means no following data. 1 means following data available.
|
|
* see PROTO_645_FOLLOW_XXX
|
|
*/
|
|
follow :1,
|
|
/* 0 means normal ack. 1 means abnormal ack.
|
|
* see PROTO_645_ACK_XXX
|
|
*/
|
|
ack :1,
|
|
/* direction. 1 means from primary to secondary. 0 means from secondary
|
|
* to primary,see PROTO_645_DIR_XXX
|
|
*/
|
|
dir :1;
|
|
} proto_645_ctrl_t;
|
|
|
|
typedef struct _proto_645_header {
|
|
/* start char, see 645_START_CHAR */
|
|
uint8_t start_char_1;
|
|
/* target mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
/* start char, see 645_START_CHAR */
|
|
uint8_t start_char_2;
|
|
/* control code */
|
|
proto_645_ctrl_t control;
|
|
/* data length */
|
|
uint8_t len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_645_header_t;
|
|
|
|
typedef struct _proto_645_write_data_dest {
|
|
/* di, see DL/T 645-2007 */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* password */
|
|
uint8_t password[PROTO_645_2007_PASSWORD_LEN];
|
|
/* operator code */
|
|
uint8_t operator[PROTO_645_2007_OPERATOR_LEN];
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_645_write_data_dest_t;
|
|
|
|
/* frozen cmd layout */
|
|
typedef struct proto_645_07_frozen_cmd {
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t day;
|
|
uint8_t mon;
|
|
} proto_645_07_frozen_cmd_t;
|
|
|
|
typedef struct _proto_645_tailer {
|
|
/* check sum */
|
|
uint8_t cs;
|
|
/* end char. see 645_END_CHAR */
|
|
uint8_t end_char;
|
|
} proto_645_tailer_t;
|
|
|
|
typedef struct _proto_645_time_ymd {
|
|
uint8_t week;
|
|
uint8_t day;
|
|
uint8_t month;
|
|
uint8_t year;
|
|
} proto_645_time_ymd_t;
|
|
|
|
typedef struct _proto_645_time_hms {
|
|
uint8_t second;
|
|
uint8_t minute;
|
|
uint8_t hour;
|
|
} proto_645_time_hms_t;
|
|
|
|
typedef struct _proto_645_07_time {
|
|
uint8_t second;
|
|
uint8_t minute;
|
|
uint8_t hour;
|
|
uint8_t week;
|
|
uint8_t day;
|
|
uint8_t month;
|
|
uint8_t year;
|
|
} proto_645_07_time_t;
|
|
|
|
typedef struct _proto_645_corr_time {
|
|
uint8_t second;
|
|
uint8_t minute;
|
|
uint8_t hour;
|
|
uint8_t day;
|
|
uint8_t month;
|
|
uint8_t year;
|
|
} proto_645_corr_time_t;
|
|
|
|
/* please refer to Dingxin communication topology identification
|
|
* core board (TY) communication protocol v2 0 section 3.3.2 .
|
|
*/
|
|
typedef struct _proto_645_07_dingxin_address {
|
|
/* data unit identification, default is 0x82,
|
|
* refer PROTO_645_2007_BSRM_DX_SET_ADDR_IDENT.
|
|
*/
|
|
uint8_t ident;
|
|
/* mac address */
|
|
uint8_t addr[IOT_MAC_ADDR_LEN];
|
|
} proto_645_07_dingxin_address_t;
|
|
|
|
typedef struct _proto_645_07_frozen_time {
|
|
uint8_t minute;
|
|
uint8_t hour;
|
|
uint8_t day;
|
|
uint8_t month;
|
|
uint8_t year;
|
|
} proto_645_07_frozen_time_t;
|
|
|
|
typedef struct _proto_645_07_energy_data {
|
|
/* use 4 bytes of BCD code to represent total energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t total[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* use 4 bytes of BCD code to represent the rate 1 energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t rate_1[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* use 4 bytes of BCD code to represent the rate 2 energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t rate_2[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* use 4 bytes of BCD code to represent the rate 3 energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t rate_3[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* use 4 bytes of BCD code to represent the rate 4 energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t rate_4[PROTO_645_07_ENERGY_DATA_LEN];
|
|
} proto_645_07_energy_data_t;
|
|
|
|
typedef struct _proto_645_07_hf_energy {
|
|
/* use 4 bytes of BCD code to represent the energy value. for example,
|
|
* 123456.78KWh uses 4 bytes of BCD code to represent the following
|
|
* 0x12, 0x34, 0x56, 0x78.
|
|
*/
|
|
uint8_t energy[PROTO_645_07_ENERGY_DATA_LEN];
|
|
} proto_645_07_hf_energy_t;
|
|
|
|
typedef struct _proto_645_07_ia {
|
|
/* time of impedance anomaly */
|
|
uint8_t time[PROTO_645_07_IA_TIME_LEN];
|
|
/* phase of impedance anomaly */
|
|
uint8_t phase;
|
|
/* resistance of impedance anomaly.use 3 bytes of BCD code to
|
|
* represent the resistance. for example, 123.456Ohm uses 3 bytes
|
|
* of BCD code to represent the following 0x12, 0x34, 0x56. */
|
|
uint8_t resistance[PROTO_645_07_IA_RES_LEN];
|
|
} proto_645_07_ia_t;
|
|
|
|
typedef struct _proto_645_07_evt_status {
|
|
/* reserve for future */
|
|
uint8_t reserve0_bit0_2 : 3,
|
|
/* flag of event that battery of clock chip is low voltage. */
|
|
clock_battery_low : 1,
|
|
/* reserve for future */
|
|
reserve0_bit4_7 : 4;
|
|
/* flag of event that battery for meter reading in case of power
|
|
* failure is low voltage.
|
|
*/
|
|
uint8_t battery_low_for_pd : 1,
|
|
/* reserve for future */
|
|
reserve1_bit1 : 1,
|
|
/* flag of uncap event */
|
|
uncap : 1,
|
|
/* flag of open button cover event */
|
|
open_button_cover : 1,
|
|
/* reserve for future */
|
|
reserve1_bit4_7 : 2,
|
|
/* switch trip successful */
|
|
switch_trip : 1,
|
|
/* switch on successful */
|
|
switch_on : 1;
|
|
/* flag of a phase miss voltage event */
|
|
uint8_t a_phase_miss_v : 1,
|
|
/* reserve for future */
|
|
reserve2_bit1_2 : 2,
|
|
/* flag of a phase loss of current event */
|
|
a_phase_miss_i : 1,
|
|
/* flag of A phase overcurrent event */
|
|
a_phase_overcurrent: 1,
|
|
/* reserve for future */
|
|
reserve2_bit5_6 : 2,
|
|
/* flag of a phase disconnection event */
|
|
a_phase_diss : 1;
|
|
/* reserve for future */
|
|
uint8_t reserve3;
|
|
/* flag of b phase miss voltage event */
|
|
uint8_t b_phase_miss_v : 1,
|
|
/* reserve for future */
|
|
reserve4_bit1_2 : 2,
|
|
/* flag of b phase loss of current event */
|
|
b_phase_miss_i : 1,
|
|
/* flag of b phase overcurrent event */
|
|
b_phase_overcurrent: 1,
|
|
/* reserve for future */
|
|
reserve4_bit5_6 : 2,
|
|
/* flag of b phase disconnection event */
|
|
b_phase_diss : 1;
|
|
/* reserve for future */
|
|
uint8_t reserve5;
|
|
/* flag of c phase miss voltage event */
|
|
uint8_t c_phase_miss_v : 1,
|
|
/* reserve for future */
|
|
reserve6_bit1_2 : 2,
|
|
/* flag of c phase loss of current event */
|
|
c_phase_miss_i : 1,
|
|
/* flag of c phase overcurrent event */
|
|
c_phase_overcurrent: 1,
|
|
/* reserve for future */
|
|
reserve6_bit5_6 : 2,
|
|
/* flag of c phase disconnection event */
|
|
c_phase_diss : 1;
|
|
/* reserve for future */
|
|
uint8_t reserve7;
|
|
/* flag of voltage reverse phase sequence event */
|
|
uint8_t v_rps : 1,
|
|
/* reserve for future */
|
|
reserve8_bit1_4 : 4,
|
|
/* flag of meter power off event */
|
|
power_off : 1,
|
|
/* reserve for future */
|
|
reserve8_bit6_7 : 2;
|
|
/* reserve for future */
|
|
uint8_t reserve9;
|
|
/* reserve for future */
|
|
uint8_t reserve10_bit0 : 1,
|
|
/* flag of meter data clear event */
|
|
meter_clear : 1,
|
|
/* reserve for future */
|
|
reserve10_bit2_3 : 2,
|
|
/* flag of meter correct time event */
|
|
corr_time : 1,
|
|
/* reserve for future */
|
|
reserve10_bit5_7 : 3;
|
|
/* reserve for future */
|
|
uint8_t reserve11;
|
|
} proto_645_07_evt_status_t;
|
|
|
|
/* voltage threshold parameters of under voltage event */
|
|
typedef struct _proto_645_uv_voltage_thr {
|
|
/* voltage threshold for under voltage event, use 2 bytes of BCD code to
|
|
* represent the voltage. uint is 0.1V */
|
|
uint8_t v_thr[PROTO_645_V_LEN];
|
|
} proto_645_uv_voltage_thr_t;
|
|
|
|
/* voltage threshold parameters of over voltage event */
|
|
typedef struct _proto_645_ov_voltage_thr {
|
|
/* voltage threshold for over voltage event, use 2 bytes of BCD code to
|
|
* represent the voltage. uint is 0.1V */
|
|
uint8_t v_thr[PROTO_645_V_LEN];
|
|
} proto_645_ov_voltage_thr_t;
|
|
|
|
/* voltage threshold parameters of phase failure event */
|
|
typedef struct _proto_645_pf_voltage_thr {
|
|
/* voltage threshold for phase failure event, use 2 bytes of BCD code to
|
|
* represent the voltage. uint is 0.1V */
|
|
uint8_t v_thr[PROTO_645_V_LEN];
|
|
} proto_645_pf_voltage_thr_t;
|
|
|
|
/* current threshold parameters of phase failure event */
|
|
typedef struct _proto_645_pf_current_thr {
|
|
/* current threshold for phase failure event, use 3 bytes of BCD code to
|
|
* represent the current. uint is 0.0001A */
|
|
uint8_t i_thr[PROTO_645_07_A_LEN];
|
|
} proto_645_pf_current_thr_t;
|
|
|
|
/* current threshold parameters of over current event */
|
|
typedef struct _proto_645_oi_current_thr {
|
|
/* current threshold for over current event, use 2 bytes of BCD code to
|
|
* represent the current. uint is 0.1A */
|
|
uint8_t i_thr[PROTO_645_THR_OI_A_LEN];
|
|
} proto_645_oi_current_thr_t;
|
|
|
|
/* rate threshold parameters of voltage/current unbalance event */
|
|
typedef struct _proto_645_unbalance_thr {
|
|
/* rate threshold for voltage/current unbalance event, use 2 bytes of BCD
|
|
* code to represent the current. uint is 0.01%.
|
|
*/
|
|
uint8_t rate_thr[PROTO_645_07_THR_UNBAL_RATE_LEN];
|
|
} proto_645_unbal_rate_thr_t;
|
|
|
|
/* time threshold parameter structure for loss of voltage, under voltage,
|
|
* over voltage, phase failure, unbalance of voltage, unbalance of current,
|
|
* loss of current, over current, current failure, power reverse, overload,
|
|
* demind over limit, total power factor ultra-lower limit or
|
|
* serious unbalance of current event determination delay time threshold,
|
|
* use 1 byte of BCD code to represent the time.
|
|
*/
|
|
typedef struct _proto_645_time_thr {
|
|
/* time threshold, uint is 1s */
|
|
uint8_t time_thr;
|
|
} proto_645_time_thr_t;
|
|
|
|
typedef struct _proto_645_v {
|
|
/* A phase voltage.use 2 bytes of BCD code to represent the voltage.
|
|
* for example, 220.0V uses 2 bytes of BCD code to represent
|
|
* the following 0x22, 0x00. */
|
|
uint8_t a[PROTO_645_V_LEN];
|
|
/* B phase voltage.use 2 bytes of BCD code to represent the voltage.
|
|
* for example, 220.0V uses 2 bytes of BCD code to represent
|
|
* the following 0x22, 0x00. */
|
|
uint8_t b[PROTO_645_V_LEN];
|
|
/* C phase voltage.use 2 bytes of BCD code to represent the voltage.
|
|
* for example, 220.0V uses 2 bytes of BCD code to represent
|
|
* the following 0x22, 0x00. */
|
|
uint8_t c[PROTO_645_V_LEN];
|
|
} proto_645_v_t;
|
|
|
|
typedef struct _proto_645_freq {
|
|
/* frequency. use 2 bytes of BCD code to represent the frequency.
|
|
* for example, 50.00Hz uses 2 bytes of BCD code to represent
|
|
* the following 0x50, 0x00. */
|
|
uint8_t bcd[PROTO_645_FREQ_LEN];
|
|
} proto_645_freq_t;
|
|
|
|
typedef struct _proto_645_07_a {
|
|
/* A phase current.use 3 bytes of BCD code to represent the current.
|
|
* for example, 123.456A uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56. */
|
|
uint8_t a[PROTO_645_07_A_LEN];
|
|
/* B phase current.use 3 bytes of BCD code to represent the current.
|
|
* for example, 123.456A uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56. */
|
|
uint8_t b[PROTO_645_07_A_LEN];
|
|
/* C phase current.use 3 bytes of BCD code to represent the current.
|
|
* for example, 123.456A uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56. */
|
|
uint8_t c[PROTO_645_07_A_LEN];
|
|
} proto_645_07_a_t;
|
|
|
|
typedef struct _proto_645_97_a {
|
|
/* A phase current.use 2 bytes of BCD code to represent the current.
|
|
* for example, 12.34A uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34. */
|
|
uint8_t a[PROTO_645_97_A_LEN];
|
|
/* B phase current.use 2 bytes of BCD code to represent the current.
|
|
* for example, 12.34A uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34. */
|
|
uint8_t b[PROTO_645_97_A_LEN];
|
|
/* C phase current.use 2 bytes of BCD code to represent the current.
|
|
* for example, 12.34A uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34. */
|
|
uint8_t c[PROTO_645_97_A_LEN];
|
|
} proto_645_97_a_t;
|
|
|
|
typedef struct _proto_645_07_p {
|
|
/* total power. use 3 bytes of BCD code to represent the active
|
|
* power. for example, 12.3456kW uses 3 bytes of BCD code to represent
|
|
* the following 0x12, 0x34, 0x56. */
|
|
uint8_t total[PROTO_645_07_P_LEN];
|
|
/* A phase power. use 3 bytes of BCD code to represent the
|
|
* active power. for example, 12.3456kW uses 3 bytes of BCD code to
|
|
* represent the following 0x12, 0x34, 0x56. */
|
|
uint8_t a[PROTO_645_07_P_LEN];
|
|
/* B phase power. use 3 bytes of BCD code to represent the
|
|
* active power. for example, 12.3456kW uses 3 bytes of BCD code to
|
|
* represent the following 0x12, 0x34, 0x56. */
|
|
uint8_t b[PROTO_645_07_P_LEN];
|
|
/* C phase power. use 3 bytes of BCD code to represent the
|
|
* active power. for example, 12.3456kW uses 3 bytes of BCD code to
|
|
* represent the following 0x12, 0x34, 0x56. */
|
|
uint8_t c[PROTO_645_07_P_LEN];
|
|
} proto_645_07_p_t;
|
|
|
|
typedef struct _proto_645_97_rp {
|
|
/* total power. use 2 bytes of BCD code to represent the reactive
|
|
* power. for example, 12.34kW uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34.
|
|
*/
|
|
uint8_t total[PROTO_645_97_RP_LEN];
|
|
/* A phase power. use 2 bytes of BCD code to represent the reactive
|
|
* power. for example, 12.34kW uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34.
|
|
*/
|
|
uint8_t a[PROTO_645_97_RP_LEN];
|
|
/* B phase power. use 2 bytes of BCD code to represent the reactive
|
|
* power. for example, 12.34kW uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34.
|
|
*/
|
|
uint8_t b[PROTO_645_97_RP_LEN];
|
|
/* C phase power. use 2 bytes of BCD code to represent the reactive
|
|
* power. for example, 12.34kW uses 2 bytes of BCD code to represent
|
|
* the following 0x12, 0x34.
|
|
*/
|
|
uint8_t c[PROTO_645_97_RP_LEN];
|
|
} proto_645_97_rp_t;
|
|
|
|
typedef struct _proto_645_07_pf {
|
|
/* total power factor.use 2 bytes of BCD code to represent the power
|
|
* factor. for example, 0.999 uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x99. */
|
|
uint8_t total[PROTO_645_07_PF_LEN];
|
|
/* A phase power factor.use 2 bytes of BCD code to represent the power
|
|
* factor. for example, 0.999 uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x99. */
|
|
uint8_t a[PROTO_645_07_PF_LEN];
|
|
/* B phase power factor.use 2 bytes of BCD code to represent the power
|
|
* factor. for example, 0.999 uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x99. */
|
|
uint8_t b[PROTO_645_07_PF_LEN];
|
|
/* C phase power factor.use 2 bytes of BCD code to represent the power
|
|
* factor. for example, 0.999 uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x99. */
|
|
uint8_t c[PROTO_645_07_PF_LEN];
|
|
} proto_645_07_pf_t;
|
|
|
|
typedef struct _proto_645_07_time_ymdhms {
|
|
/* second: BCD code */
|
|
uint8_t second;
|
|
/* minute: BCD code */
|
|
uint8_t minute;
|
|
/* hour: BCD code */
|
|
uint8_t hour;
|
|
/* day: BCD code */
|
|
uint8_t day;
|
|
/* month: BCD code */
|
|
uint8_t month;
|
|
/* year: BCD code */
|
|
uint8_t year;
|
|
} proto_645_07_time_ymdhms_t;
|
|
|
|
typedef struct _proto_645_07_program_record {
|
|
/* start time */
|
|
proto_645_07_time_ymdhms_t start_time;
|
|
/* operator code */
|
|
uint32_t operator_code;
|
|
/* data identification code */
|
|
uint32_t data_id_code[PROTO_645_PROGRAM_ID_CODE_CNT];
|
|
} proto_645_07_program_record_t;
|
|
|
|
/* freezing time of settlement date */
|
|
typedef struct _proto_645_07_msd_frozen_time {
|
|
/* hour */
|
|
uint8_t hour;
|
|
/* day */
|
|
uint8_t day;
|
|
} proto_645_07_msd_frozen_time_t;
|
|
|
|
typedef struct _proto_645_07_msd_modify_record {
|
|
/* modify time */
|
|
proto_645_07_time_ymdhms_t ymdhms;
|
|
/* operator code */
|
|
uint32_t operator_code;
|
|
/* settlement date information that already exists when setting a new
|
|
* settlement date.
|
|
*/
|
|
proto_645_07_msd_frozen_time_t msd[PROTO_645_MSD_NUM];
|
|
} proto_645_07_msd_modify_record_t;
|
|
|
|
typedef struct _proto_645_07_power_down_record {
|
|
/* start time */
|
|
proto_645_07_time_ymdhms_t start_time;
|
|
/* end time */
|
|
proto_645_07_time_ymdhms_t end_time;
|
|
} proto_645_07_power_down_record_t;
|
|
|
|
typedef struct _proto_645_07_open_covers_record {
|
|
/* start time */
|
|
proto_645_07_time_ymdhms_t start_time;
|
|
/* end time */
|
|
proto_645_07_time_ymdhms_t end_time;
|
|
/* unused total electric energy */
|
|
uint8_t total[PROTO_645_OC_RECORD_ENERGY_CNT][PROTO_645_07_ENERGY_DATA_LEN];
|
|
} proto_645_07_open_covers_record_t;
|
|
|
|
typedef struct _proto_645_07_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_645_07_rs_word_1_t;
|
|
|
|
typedef struct _proto_645_07_rs_word_2 {
|
|
/* a phase active power direction */
|
|
uint16_t a_ap_dir :1,
|
|
/* b phase active power direction */
|
|
b_ap_dir :1,
|
|
/* c phase active power direction */
|
|
c_ap_dir :1,
|
|
/* reserve for future */
|
|
reserve1 :1,
|
|
/* a phase reactive power direction */
|
|
a_rp_dir :1,
|
|
/* b phase reactive power direction */
|
|
b_rp_dir :1,
|
|
/* c phase reactive power direction */
|
|
c_rp_dir :1,
|
|
/* reserve for future */
|
|
reserve2 :9;
|
|
} proto_645_07_rs_word_2_t;
|
|
|
|
typedef struct _proto_645_07_rs_word_3 {
|
|
/* current running period */
|
|
uint16_t cur_run_period :1,
|
|
/* power supply mode */
|
|
power_sup_mode :2,
|
|
/* programming permission */
|
|
program_per :1,
|
|
/* relay state */
|
|
relay_state :1,
|
|
/* current running time zone */
|
|
cur_run_tz :1,
|
|
/* relay command state */
|
|
relay_com_state :1,
|
|
/* trip alarm state */
|
|
ta_state :1,
|
|
/* power meter type */
|
|
pm_type :2,
|
|
/* current running rate price */
|
|
cur_run_rp :1,
|
|
/* current ladder */
|
|
cur_ladder :1,
|
|
/* reserve for future */
|
|
reserve :4;
|
|
} proto_645_07_rs_word_3_t;
|
|
|
|
/* proto_645_07_rs_word_4_t represents A phase
|
|
* proto_645_07_rs_word_5_t represents B phase
|
|
* proto_645_07_rs_word_6_t represents C phase
|
|
*/
|
|
typedef struct _proto_645_07_rs_word_456 {
|
|
/* a phase miss voltage */
|
|
uint16_t miss_v :1,
|
|
/* a phase under voltage */
|
|
under_v :1,
|
|
/* a phase over voltage */
|
|
over_v :1,
|
|
/* a phase miss current */
|
|
miss_i :1,
|
|
/* a phase over current */
|
|
over_i :1,
|
|
/* a phase overload */
|
|
overload :1,
|
|
/* tide reverse */
|
|
tide_reverse :1,
|
|
/* a phase loss phase */
|
|
loss_phase :1,
|
|
/* a phase cutoff */
|
|
cutoff :1,
|
|
/* reserve for future */
|
|
reserve :7;
|
|
} proto_645_07_rs_word_456_t;
|
|
|
|
typedef struct _proto_645_07_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_645_07_rs_word_7_t;
|
|
|
|
/* power meter running state word */
|
|
typedef struct _proto_645_97_pm_rs_word {
|
|
/* meter read */
|
|
uint8_t meter_read :1,
|
|
/* accumulation mode of demand */
|
|
demand_mode :1,
|
|
/* clock battery */
|
|
clock_battery :1,
|
|
/* reserve1 for future */
|
|
reserve1 :1,
|
|
/* active electric energy direction */
|
|
act_neg_dir :1,
|
|
/* reactive electric energy direction */
|
|
react_neg_dir :1,
|
|
/* reserve2 for future */
|
|
reserve2 :2;
|
|
} proto_645_97_pm_rs_word_t;
|
|
|
|
/* power grid running state word */
|
|
typedef struct _proto_645_97_pg_rs_word {
|
|
/* a phase blackout */
|
|
uint8_t a_blackout :1,
|
|
/* b phase blackout */
|
|
b_blackout :1,
|
|
/* c phase blackout */
|
|
c_blackout :1,
|
|
/* reserve1 for future */
|
|
reserve1 :1,
|
|
/* a phase overvoltage */
|
|
a_overvoltage :1,
|
|
/* b phase overvoltage */
|
|
b_overvoltage :1,
|
|
/* c phase overvoltage */
|
|
c_overvoltage :1,
|
|
/* reserve1 for future */
|
|
reserve2 :1;
|
|
} proto_645_97_pg_rs_word_t;
|
|
|
|
/* curve Read Downlink Information descriptor */
|
|
typedef struct _proto_645_07_curve_dl {
|
|
/* curve point num to Read */
|
|
uint8_t n;
|
|
/* the specified time is seconds, minutes, hours, days and years. */
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t mday;
|
|
uint8_t mon;
|
|
uint8_t year;
|
|
} proto_645_07_curve_dl_t;
|
|
|
|
/* curve read uplink Information descriptor */
|
|
typedef struct _proto_645_07_curve_ul {
|
|
/* the specified time is seconds, minutes, hours, days and years. */
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t mday;
|
|
uint8_t mon;
|
|
uint8_t year;
|
|
/* curve data */
|
|
uint8_t data[0];
|
|
} proto_645_07_curve_ul_t;
|
|
|
|
/* xian curve Read Downlink Information descriptor */
|
|
typedef struct _proto_645_07_curve_xian_dl {
|
|
/* the specified time is seconds, minutes, hours, days and years. */
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t mday;
|
|
uint8_t mon;
|
|
uint8_t year;
|
|
/* curve point num to Read */
|
|
uint8_t n;
|
|
} proto_645_07_curve_xian_dl_t;
|
|
|
|
/* xian curve read uplink Information descriptor */
|
|
typedef struct _proto_645_07_curve_xian_ul {
|
|
/* the specified time is seconds, minutes, hours, days and years. */
|
|
uint8_t min;
|
|
uint8_t hour;
|
|
uint8_t mday;
|
|
uint8_t mon;
|
|
uint8_t year;
|
|
/* density, uint is 1min */
|
|
uint8_t m;
|
|
/* curve point num to read */
|
|
uint8_t n;
|
|
/* curve data */
|
|
uint8_t data[0];
|
|
} proto_645_07_curve_xian_ul_t;
|
|
|
|
typedef struct _proto_645_07_frozen_mdhm {
|
|
/* minute: BCD code */
|
|
uint8_t minute;
|
|
/* hour: BCD code */
|
|
uint8_t hour;
|
|
/* day: BCD code */
|
|
uint8_t day;
|
|
/* month: BCD code */
|
|
uint8_t month;
|
|
} proto_645_07_frozen_mdhm_t;
|
|
|
|
typedef struct _proto_645_07_clock_skew {
|
|
/* skew mode, see PROTO_645_CS_MODE_METER_XXX_CCTT */
|
|
uint8_t mode;
|
|
/* skew time */
|
|
proto_645_07_time_ymdhms_t time;
|
|
} proto_645_07_clock_skew_t;
|
|
|
|
typedef struct _proto_645_07_err {
|
|
/* reserve for future */
|
|
uint8_t reserve1_bit0 : 1,
|
|
/* flag that error reason is no request data */
|
|
no_req_data : 1,
|
|
/* reserve for future */
|
|
reserve1_bit2_7 : 6;
|
|
} proto_645_07_err_t;
|
|
|
|
typedef struct _proto_645_07_evt_cnt_with_time {
|
|
/* evt cnt */
|
|
uint8_t evt_cnt[PROTO_645_2007_DI_CNT_DATE_LEN];
|
|
/* evt time */
|
|
uint8_t evt_time[PROTO_645_2007_DI_CNT_DATE_LEN];
|
|
} proto_645_07_evt_cnt_with_time_t;
|
|
|
|
typedef struct _proto_645_07_three_phase_evt_cnt {
|
|
/* a phase event data */
|
|
proto_645_07_evt_cnt_with_time_t a_phase;
|
|
/* b phase event data */
|
|
proto_645_07_evt_cnt_with_time_t b_phase;
|
|
/* c phase event data */
|
|
proto_645_07_evt_cnt_with_time_t c_phase;
|
|
} proto_645_07_three_phase_evt_cnt_t;
|
|
|
|
/* load record head layout */
|
|
typedef struct _proto_645_07_lr_block_hdr {
|
|
/* start code */
|
|
uint8_t start_char[2];
|
|
/* load record */
|
|
uint8_t len;
|
|
/* payload */
|
|
uint8_t data[0];
|
|
} proto_645_07_lr_block_hdr_t;
|
|
|
|
/* load curve time layout */
|
|
typedef struct _proto_645_07_lr_ts {
|
|
/* BCD format */
|
|
uint8_t min;
|
|
/* BCD format */
|
|
uint8_t hour;
|
|
/* BCD format */
|
|
uint8_t mday;
|
|
/* BCD format */
|
|
uint8_t mon;
|
|
/* BCD format */
|
|
uint8_t year;
|
|
} proto_645_07_lr_ts_t;
|
|
|
|
/* class 1 load curve layout */
|
|
typedef struct _proto_645_07_lr_type1 {
|
|
/* Voltage block, XXX.X V */
|
|
uint8_t v[3][PROTO_645_V_LEN];
|
|
/* current block, XXX.XXX A */
|
|
uint8_t i[3][PROTO_645_07_A_LEN];
|
|
/* freq, XX.XX HZ */
|
|
uint8_t freq[PROTO_645_FREQ_LEN];
|
|
} proto_645_07_lr_type1_t;
|
|
|
|
/* class 2 load curve layout */
|
|
typedef struct _proto_645_07_lr_type2 {
|
|
/* total active power, xx.xxxx kW */
|
|
uint8_t p_total[PROTO_645_07_P_LEN];
|
|
/* phase active power, xx.xxxx kW */
|
|
uint8_t p[3][PROTO_645_07_P_LEN];
|
|
/* total reactive power, xx.xxxx kvar */
|
|
uint8_t q_total[PROTO_645_07_P_LEN];
|
|
/* total reactive power, xx.xxxx kvar */
|
|
uint8_t q[3][PROTO_645_07_P_LEN];
|
|
} proto_645_07_lr_type2_t;
|
|
|
|
/* class 3 load curve layout */
|
|
typedef struct _proto_645_07_lr_type3 {
|
|
/* total power factor, x.xxx */
|
|
uint8_t pf_total[PROTO_645_07_PF_LEN];
|
|
/* phase power factor, x.xxx */
|
|
uint8_t pf[3][PROTO_645_07_PF_LEN];
|
|
} proto_645_07_lr_type3_t;
|
|
|
|
/* class 4 load curve layout */
|
|
typedef struct _proto_645_07_lr_type4 {
|
|
/* total electric energy of positive active power, xxxxxx.xx kWh */
|
|
uint8_t ept_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* total electric energy of reverse active power, xxxxxxxx.xx kWh */
|
|
uint8_t ept_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* total electric energy of positive reactive power, xxxxxx.xx kvarh */
|
|
uint8_t eqt_pos[PROTO_645_07_ENERGY_DATA_LEN];
|
|
/* total electric energy of reverse reactive power, xxxxxx.xx kvarh */
|
|
uint8_t eqt_neg[PROTO_645_07_ENERGY_DATA_LEN];
|
|
} proto_645_07_lr_type4_t;
|
|
|
|
/* phase angle */
|
|
typedef struct _proto_645_07_phase_angle {
|
|
/* A phase phase angle.use 2 bytes of BCD code to represent the phase angle.
|
|
* for example, 90.0° uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x00. */
|
|
uint8_t a[PROTO_645_PHASE_ANGLE_LEN];
|
|
/* b phase phase angle.use 2 bytes of BCD code to represent the phase angle.
|
|
* for example, 90.0° uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x00. */
|
|
uint8_t b[PROTO_645_PHASE_ANGLE_LEN];
|
|
/* c phase phase angle.use 2 bytes of BCD code to represent the phase angle.
|
|
* for example, 90.0° uses 2 bytes of BCD code to represent
|
|
* the following 0x09, 0x00. */
|
|
uint8_t c[PROTO_645_PHASE_ANGLE_LEN];
|
|
} proto_645_07_phase_angle_t;
|
|
|
|
/* waveform distortion */
|
|
typedef struct _proto_645_07_waveform_dis {
|
|
/* A phase waveform distortion.use 2 bytes of BCD code to represent the
|
|
* waveform distortion. for example, 10.00% uses 2 bytes of BCD code to
|
|
* represent the following 0x10, 0x00. */
|
|
uint8_t a[PROTO_645_WAVEFORM_DIS_LEN];
|
|
/* B phase waveform distortion.use 2 bytes of BCD code to represent the
|
|
* waveform distortion. for example, 10.00% uses 2 bytes of BCD code to
|
|
* represent the following 0x10, 0x00. */
|
|
uint8_t b[PROTO_645_WAVEFORM_DIS_LEN];
|
|
/* C phase waveform distortion.use 2 bytes of BCD code to represent the
|
|
* waveform distortion. for example, 10.00% uses 2 bytes of BCD code to
|
|
* represent the following 0x10, 0x00. */
|
|
uint8_t c[PROTO_645_WAVEFORM_DIS_LEN];
|
|
} proto_645_07_waveform_dis_t;
|
|
|
|
/* harmonic content unit */
|
|
typedef struct _proto_645_07_harmonic_cont_unit {
|
|
/* harmonic content. use 2 bytes of BCD code to represent the
|
|
* harmonic content. for example, 10.00% uses 2 bytes of BCD code to
|
|
* represent the following 0x10, 0x00. */
|
|
uint8_t cont[PROTO_645_HARMONIC_CONT_LEN];
|
|
} proto_645_07_harmonic_cont_unit_t;
|
|
|
|
/* harmonic content */
|
|
typedef struct _proto_645_07_harmonic_cont {
|
|
/* harmonic content block */
|
|
proto_645_07_harmonic_cont_unit_t hc[PROTO_645_HC_BLOCK_UNIT_CNT];
|
|
} proto_645_07_harmonic_cont_t;
|
|
|
|
/* report correct delta time layout, for hlj protocol */
|
|
typedef struct _proto_645_07_delta_rpt {
|
|
/* BCD format */
|
|
uint8_t hour_high;
|
|
/* BCD format */
|
|
uint8_t hour_low;
|
|
/* BCD format */
|
|
uint8_t min;
|
|
/* BCD format */
|
|
uint8_t sec;
|
|
/* time mode */
|
|
uint8_t mode;
|
|
} proto_645_07_delta_rpt_t;
|
|
|
|
/* rating current/base current */
|
|
typedef struct _proto_645_07_rating_current {
|
|
/* ASCII format */
|
|
uint8_t value[PROTO_645_2007_RATING_CUR_LEN];
|
|
} proto_645_07_rating_current_t;
|
|
|
|
typedef struct _proto_645_07_max_demand {
|
|
/* max demand value , BCD format, XX.XXXX */
|
|
uint8_t max_demand[PROTO_645_07_P_LEN];
|
|
/* time, YYMMDDhhmm */
|
|
uint8_t tm[PROTO_645_YYMMDDHHMM_LEN];
|
|
} proto_645_07_max_demand_t;
|
|
|
|
/* AI management unit operation command data structure, see standard extended
|
|
* DL/T 645-2007. only for XIAN AI management unit
|
|
*/
|
|
typedef struct _proto_645_07_ai_topo_start {
|
|
/* second of cco time, BCD format */
|
|
uint8_t sec;
|
|
/* minute of cco time, BCD format */
|
|
uint8_t min;
|
|
/* hour of cco time, BCD format */
|
|
uint8_t hour;
|
|
/* day of cco time, BCD format */
|
|
uint8_t day;
|
|
/* month of cco time, BCD format */
|
|
uint8_t mon;
|
|
/* year of cco time, BCD format */
|
|
uint8_t year;
|
|
/* flag of start current cycle */
|
|
uint8_t start_flag : 4,
|
|
/* cycle cnt */
|
|
cycle_cnt : 4;
|
|
/* interval, unit is 1s */
|
|
uint8_t interval;
|
|
/* flag of data */
|
|
/* flag of voltage */
|
|
uint8_t flag_v : 1,
|
|
/* flag of current */
|
|
flag_i : 1,
|
|
/* flag of power factor */
|
|
flag_pf : 1,
|
|
/* reserved for future */
|
|
rsvd0 : 5;
|
|
/* reserved for future */
|
|
uint8_t rsvd1;
|
|
/* reserved for future */
|
|
uint16_t rsvd2;
|
|
/* cco ntb */
|
|
uint32_t cco_ntb;
|
|
/* start ntb */
|
|
uint32_t start_ntb;
|
|
} proto_645_07_ai_topo_start_t;
|
|
|
|
typedef struct _proto_645_07_ai_topo_query_dl {
|
|
/* reserved for future */
|
|
uint8_t rsvd0;
|
|
/* query data point offset, BCD format, in the range of 0-60.
|
|
* The latest frozen data is read by default this time.
|
|
*/
|
|
uint8_t offset;
|
|
/* reserved for future */
|
|
uint32_t rsvd1;
|
|
/* query di */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* query cnt */
|
|
uint8_t cnt;
|
|
/* phase info */
|
|
uint8_t phase_info;
|
|
} proto_645_07_ai_topo_query_dl_t;
|
|
|
|
typedef struct _proto_645_07_ai_topo_query_ul {
|
|
/* second of start data, BCD format */
|
|
uint8_t sec;
|
|
/* minute of start data, BCD format */
|
|
uint8_t min;
|
|
/* hour of start data, BCD format */
|
|
uint8_t hour;
|
|
/* day of start data, BCD format */
|
|
uint8_t day;
|
|
/* month of start data, BCD format */
|
|
uint8_t mon;
|
|
/* year of start data, BCD format */
|
|
uint8_t year;
|
|
/* response di */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* response cnt */
|
|
uint8_t cnt;
|
|
/* phase info */
|
|
uint8_t phase_info;
|
|
/* topo running state, 1 mean running, 0 mean idle */
|
|
uint8_t state_topo : 1,
|
|
/* line lose running state, 1 mean running, 0 mean idle */
|
|
state_ll : 1,
|
|
/* reserved for future */
|
|
rsvd0 : 6;
|
|
/* reserved for future */
|
|
uint16_t rsvd1;
|
|
/* data length */
|
|
uint8_t data_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_645_07_ai_topo_query_ul_t;
|
|
|
|
typedef struct _proto_645_07_ai_ll_start {
|
|
/* second of cco time, BCD format */
|
|
uint8_t sec;
|
|
/* minute of cco time, BCD format */
|
|
uint8_t min;
|
|
/* hour of cco time, BCD format */
|
|
uint8_t hour;
|
|
/* day of cco time, BCD format */
|
|
uint8_t day;
|
|
/* month of cco time, BCD format */
|
|
uint8_t mon;
|
|
/* year of cco time, BCD format */
|
|
uint8_t year;
|
|
/* flag of start current cycle */
|
|
uint8_t start_flag : 4,
|
|
/* cycle cnt */
|
|
cycle_cnt : 4;
|
|
/* interval, unit is 1 minute */
|
|
uint8_t interval;
|
|
/* flag of data */
|
|
/* reserved for future */
|
|
uint8_t rsvd0;
|
|
/* flag of active power */
|
|
uint8_t flag_p : 1,
|
|
/* flag of current */
|
|
flag_i : 1,
|
|
/* flag of gnd current */
|
|
flag_gi : 1,
|
|
/* flag of voltage */
|
|
flag_v : 1,
|
|
/* flag of power factor */
|
|
flag_pf : 1,
|
|
/* flag of positive active electric energy */
|
|
flag_pos : 1,
|
|
/* flag of negative active electric energy */
|
|
flag_neg : 1,
|
|
/* flag of quadrant reactive energy */
|
|
flag_qtr : 1;
|
|
/* reserved for Reverse future */
|
|
uint16_t rsvd1;
|
|
/* cco ntb */
|
|
uint32_t cco_ntb;
|
|
/* start ntb */
|
|
uint32_t start_ntb;
|
|
} proto_645_07_ai_ll_start_t;
|
|
|
|
typedef struct _proto_645_07_ai_ll_query_dl {
|
|
/* reserved for future */
|
|
uint8_t rsvd0;
|
|
/* query data point offset, BCD format, in the range of 0-95. */
|
|
uint8_t offset;
|
|
/* reserved for future */
|
|
uint8_t rsvd1;
|
|
/* flag of day, 0 mean read frozen data of the previous day.
|
|
* 1 mean read frozen data of the current day
|
|
*/
|
|
uint8_t flag_curr;
|
|
/* reserved for future */
|
|
uint16_t rsvd2;
|
|
/* query di */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* query cnt */
|
|
uint8_t cnt;
|
|
/* phase info */
|
|
uint8_t phase_info;
|
|
} proto_645_07_ai_ll_query_dl_t;
|
|
|
|
typedef struct _proto_645_07_ai_ll_query_ul {
|
|
/* second of start data, BCD format */
|
|
uint8_t sec;
|
|
/* minute of start data, BCD format */
|
|
uint8_t min;
|
|
/* hour of start data, BCD format */
|
|
uint8_t hour;
|
|
/* day of start data, BCD format */
|
|
uint8_t day;
|
|
/* month of start data, BCD format */
|
|
uint8_t mon;
|
|
/* year of start data, BCD format */
|
|
uint8_t year;
|
|
/* response di */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* response cnt */
|
|
uint8_t cnt;
|
|
/* phase info */
|
|
uint8_t phase_info;
|
|
/* topo running state, 1 mean running, 0 mean idle */
|
|
uint8_t state_topo : 1,
|
|
/* line lose running state, 1 mean running, 0 mean idle */
|
|
state_ll : 1,
|
|
/* reserved for future */
|
|
rsvd0 : 6;
|
|
/* reserved for future */
|
|
uint16_t rsvd1;
|
|
/* data length */
|
|
uint8_t data_len;
|
|
/* data */
|
|
uint8_t data[0];
|
|
} proto_645_07_ai_ll_query_ul_t;
|
|
|
|
typedef struct _proto_645_07_nw_multi_di_read_rsp_unit{
|
|
/* current unit data len, di len + di data len */
|
|
uint8_t len;
|
|
/* di */
|
|
uint8_t di[PROTO_645_2007_DI_LEN];
|
|
/* di data */
|
|
uint8_t di_data[0];
|
|
} proto_645_07_nw_multi_di_read_rsp_unit_t;
|
|
|
|
|
|
#pragma pack(pop) /* restore the pack status */
|
|
|
|
/* broadcast mac address */
|
|
extern uint8_t proto_645_bcast_addr[IOT_MAC_ADDR_LEN];
|
|
|
|
/* the decimal version of the broadcast address */
|
|
extern uint8_t proto_645_bcast_dec_addr[IOT_MAC_ADDR_LEN];
|
|
|
|
/* any mac address */
|
|
extern uint8_t proto_645_any_addr[IOT_MAC_ADDR_LEN];
|
|
|
|
/* invaild mac address for collector i*/
|
|
extern uint8_t proto_645_invaild_addr[IOT_MAC_ADDR_LEN];
|
|
|
|
/* preamble code */
|
|
extern uint8_t proto_645_preamble[PROTO_645_PREAMBLE_LEN];
|
|
|
|
/* proto_645_calc_cs() - calculate checksum for 645 protocol
|
|
* @app_id: pointer tothe 645 protocol header
|
|
*
|
|
* return
|
|
* calculated checksum value
|
|
*/
|
|
uint8_t proto_645_calc_cs(proto_645_header_t *hdr);
|
|
|
|
/* proto_645_add33_handle() - add 33 for each of the specified memory
|
|
* @ds: pointer to data buffer
|
|
* @size: size of buffer
|
|
*
|
|
* return
|
|
* void
|
|
*/
|
|
void proto_645_add33_handle(uint8_t *ds, uint32_t size);
|
|
|
|
/* proto_645_sub33_handle() - sub 33 for each of the specified memory
|
|
* @ds: pointer to data buffer
|
|
* @size: size of buffer
|
|
* return
|
|
* void
|
|
*/
|
|
void proto_645_sub33_handle(uint8_t *ds, uint32_t size);
|
|
|
|
/**
|
|
* @brief proto_645_invert_handle() - data invert for each of the specified
|
|
* @brief memory
|
|
* @param ds: pointer to data buffer
|
|
* @param size: size of buffer
|
|
*/
|
|
void proto_645_invert_handle(uint8_t *ds, uint32_t size);
|
|
|
|
/**
|
|
* @brief proto_645_fill_frame() - fill data in 645 protocol frame. if the data
|
|
* @brief field exists in 645 protocol frame, it must
|
|
* @brief be used with the data identifier.
|
|
* @param frames_filled: pointer to the 645 protocol frame that needs
|
|
* @param to be filled.
|
|
* @param protocol_type: type of the 645 protocol frame.
|
|
* @param addr: destination address.
|
|
* @param dir: direction, see PROTO_645_DIR_XXX.
|
|
* @param ack: flag of ack, see PROTO_645_ACK_XXX.
|
|
* @param follow: flag of follow data, see PROTO_645_FOLLOW_XXX.
|
|
* @param fn: function code.
|
|
* @param di: data identification, if is PROTO_645_INVALID_DI, DI info field
|
|
* will not be filling.
|
|
* @param payload_len: length of payload, exclude DI.
|
|
* @param payload: pointer to payload.
|
|
* @retval: 0 -- fill 645 protocol frame failure
|
|
* @retval: otherwise -- length of data filled in 645 protocol frame
|
|
*/
|
|
uint32_t proto_645_fill_frame(uint8_t *frames_filled,
|
|
uint8_t protocol_type, uint8_t *addr, uint8_t dir, uint8_t ack,
|
|
uint8_t follow, uint8_t fn, uint32_t di, uint8_t payload_len,
|
|
uint8_t *payload);
|
|
|
|
/* proto_645_format_check() - 645 protocol format check
|
|
* @data: pointer to protocol data buffer
|
|
* @len: data length
|
|
* @dir: message direction--see PROTO_645_DIR_XXX
|
|
* return
|
|
* NULL -- Incorrect protocol format .
|
|
* otherwise --pointer to the 645 protocol header
|
|
*/
|
|
proto_645_header_t *proto_645_format_check(uint8_t *data,
|
|
uint32_t len, uint32_t dir);
|
|
|
|
/* proto_645_build_mr_msg() - create a meter reading message for the
|
|
* 645 protocol
|
|
* @p_id: style of protocol
|
|
* @addr: address of meter
|
|
* @di: data identification
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_build_mr_msg(uint8_t p_id,
|
|
uint8_t *addr, uint32_t di);
|
|
|
|
/* proto_645_2007_ra_msg() - Creates a read address message for the 645-2007
|
|
* protocol
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_ra_msg(void);
|
|
|
|
/**
|
|
* @brief proto_645_2007_build_nack_msg() - creates a nack message.
|
|
* @param err_code: err code, see PROTO_645_2007_ERR_XXX.
|
|
* @param addr: address.
|
|
* @param fn: function code.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_nack_msg(uint8_t err_code, uint8_t *addr,
|
|
uint8_t fn);
|
|
|
|
/**
|
|
* @brief proto_645_2007_build_ack_msg() - creates a ack message.
|
|
* @param addr: address.
|
|
* @param fn: function code.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_ack_msg(uint8_t *addr, uint8_t fn);
|
|
|
|
/**
|
|
* @brief proto_645_get_read_rsp_len() - gets the length of the full read
|
|
* response message for the 645 protocol.
|
|
* @param p_id: proto id. 1 - for 97, 2- for 07.
|
|
* @param di: defined DI in 645 protocol.
|
|
* @retval: len of full read response message. for unsupported DI,
|
|
* the maximum length is returned.
|
|
*/
|
|
uint32_t proto_645_get_read_rsp_len(uint8_t p_id, uint32_t di);
|
|
|
|
/**
|
|
* @brief: check if a mac is 645 broadcast mac
|
|
* @param dst: the mac address to be checked
|
|
* @return 1 is 645 broadcast mac
|
|
* @return 0 NOT a 645 broadcast mac
|
|
*/
|
|
uint8_t proto_645_is_bcast(uint8_t* dst);
|
|
|
|
/**
|
|
* @brief proto_645_pm_addr_valid() - check the validity of the meter address.
|
|
* @param addr: meter addr.
|
|
* @retval: 0 -- address is invalid.
|
|
* @retval: 1 -- address is valid.
|
|
*/
|
|
uint8_t proto_645_pm_addr_valid(uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_645_mac_addr_cmp() - mac address compare
|
|
* @param dst: pointer to first mac address to compare
|
|
* @param src: pointer to second mac address to compare
|
|
*
|
|
* @return 1 -- if mac address is the same
|
|
* @return 0 -- otherwise
|
|
*/
|
|
uint8_t proto_645_mac_addr_cmp(const uint8_t* dst, const uint8_t* src);
|
|
|
|
static inline uint32_t proto_645_2007_byte_to_di(uint8_t *ptr)
|
|
{
|
|
return ((((uint8_t *)(ptr))[3]<<24)
|
|
|(((uint8_t *)(ptr))[2]<<16)
|
|
|(((uint8_t *)(ptr))[1]<<8)
|
|
|((uint8_t *)(ptr))[0]);
|
|
}
|
|
|
|
static inline uint16_t proto_645_1997_byte_to_di(uint8_t *ptr)
|
|
{
|
|
return ((ptr[1]<<8)|ptr[0]);
|
|
}
|
|
|
|
static inline uint32_t proto_645_byte_to_di(uint8_t p_id, uint8_t *ptr)
|
|
{
|
|
IOT_ASSERT(p_id == PROTO_645_1997_ID
|
|
|| p_id == PROTO_645_2007_ID);
|
|
return (p_id == PROTO_645_1997_ID ? \
|
|
(uint32_t)proto_645_1997_byte_to_di(ptr) : \
|
|
proto_645_2007_byte_to_di(ptr));
|
|
}
|
|
|
|
/**
|
|
* @brief proto_645_header_init() - initializes the 645 protocol header.
|
|
* @param hdr: pointer to the 645 protocol header.
|
|
* @param addr: meter addr.
|
|
* @param dir: direction, see PROTO_645_DIR_XXX.
|
|
* @param ack_v: flag of ack, see PROTO_645_ACK_XXX.
|
|
* @param follow_v: flag of follow data, see PROTO_645_FOLLOW_XXX.
|
|
*/
|
|
void proto_645_header_init(proto_645_header_t *hdr,
|
|
uint8_t *addr, uint8_t fn, uint8_t dir, uint8_t ack_v, uint8_t follow_v);
|
|
|
|
/**
|
|
* @brief proto_645_tail_init() - initializes the 645 protocol tailer.
|
|
* @param hdr: pointer to the 645 protocol header.
|
|
*/
|
|
void proto_645_tail_init(proto_645_header_t *hdr);
|
|
|
|
/**
|
|
* @brief proto_645_type_identify() - identifying the type of 645 message, is 97
|
|
* or 07.
|
|
* @param hdr: pointer to the head of the 645 message.
|
|
* @retval: 0 - cannot identify.
|
|
* 1 - 1997.
|
|
* 2 - 2007.
|
|
*/
|
|
uint8_t proto_645_type_identify(proto_645_header_t *hdr);
|
|
|
|
/**
|
|
* @brief proto_645_07_event_validate() - check the event valiate in data field.
|
|
* @brief only used for DL/T 645-2007.
|
|
* @param data: pointer to event data field.
|
|
* @param len: length of event data field.
|
|
* @retval: 0 -- event is invalid.
|
|
* @retval: otherwise -- event is valid.
|
|
*/
|
|
uint32_t proto_645_07_event_validate(uint8_t *data, uint8_t len);
|
|
|
|
/**
|
|
* @brief proto_645_get_di_by_sub33() - get di by subtracting 0x33 in the 645
|
|
* protocol data field. This function can
|
|
* only be used when the data field has di.
|
|
* @param data: pointer to data field.
|
|
* @param len: length of data field.
|
|
* @param p_id: proto id. see PROTO_645_XXX_ID.
|
|
* @param di: pointer to di cache.
|
|
* @retval: ERR_OK -- get di successfully.
|
|
* @retval: ERR_FAIL -- get di fail.
|
|
*/
|
|
uint32_t proto_645_get_di_by_sub33(uint8_t *data, uint8_t len,
|
|
uint8_t p_id, uint32_t *di);
|
|
|
|
/**
|
|
* @brief proto_645_get_di() - get di by subtracting 0x33 in the 645
|
|
* protocol data field.
|
|
* @param data: pointer to data field.
|
|
* @param len: length of the data field.
|
|
* @param dir: message direction--see PROTO_645_DIR_XXX
|
|
* @param di: buffer to store the di after subtracting 0x33
|
|
* @param fn: buffer to store the fn
|
|
* @return: ERR_OK for successful #define, other for failed #define.
|
|
*/
|
|
uint32_t proto_645_get_di(uint8_t *data, uint32_t len, uint8_t dir,
|
|
uint32_t *di, uint8_t *fn);
|
|
|
|
/**
|
|
* @brief: check if response from PLC matches the corresponding command.
|
|
* @param data1: up(down) link data from PLC
|
|
* @param len1: length of data1
|
|
* @param data2: down(up) link data from PLC
|
|
* @param len2: length of data2
|
|
* @return: ERR_OK if di and fn are match, ERR_FAIL if not.
|
|
*/
|
|
uint32_t proto_645_check_di_fn_match(uint8_t *data1, uint32_t len1,
|
|
uint8_t *data2, uint32_t len2);
|
|
|
|
/**
|
|
* @brief proto_645_pkt_check_handle() - check 645 pkt frame.
|
|
* @param dir: point to the dir of the pkt frame.
|
|
* @param di: point to the di of the pkt frame.
|
|
* @retval: ERR_OK will response if pkt is 645 frame.
|
|
*/
|
|
uint8_t proto_645_pkt_check_handle(iot_pkt_t *pkt, uint8_t *dir,
|
|
uint32_t *di);
|
|
|
|
/* proto_645_build_corr_msg() - create a meter correct time message for the
|
|
* 645 protocol
|
|
* @addr: target address, if set NULL, use broadcast address. little endian
|
|
* @time: correct time
|
|
* return
|
|
* NULL -- for failure #define.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_build_corr_msg(uint8_t *addr, proto_645_corr_time_t *time);
|
|
|
|
/**
|
|
* @brief check the pkt if read data pkt.
|
|
* @param data: 645 pkt data.
|
|
* @param len: 645 pkt data length.
|
|
* @return: 0 - is not read data pkt.
|
|
* @return: 1 - is read data pkt.
|
|
*/
|
|
uint8_t proto_645_is_data_read(uint8_t *data, uint16_t len);
|
|
|
|
/**
|
|
* @brief check the pkt if password cmd.
|
|
* @param data: 645 pkt data.
|
|
* @param len: 645 pkt data length.
|
|
* @return: 0 - is not read data pkt.
|
|
* @return: 1 - is read data pkt.
|
|
*/
|
|
uint8_t proto_645_is_password_cmd(uint8_t *data, uint16_t len);
|
|
|
|
/* proto_645_format_check_ext() - 645 protocol format check extended version,
|
|
* search the whole buffer to try to
|
|
* find one 645 format data.
|
|
* @data: pointer to protocol data buffer
|
|
* @len: data length
|
|
* @dir: message direction--see PROTO_645_DIR_XXX
|
|
* return
|
|
* NULL -- 645 format data not found.
|
|
* otherwise -- pointer to the 645 protocol header
|
|
*/
|
|
proto_645_header_t *proto_645_format_check_ext(uint8_t *data,
|
|
uint32_t len, uint32_t dir);
|
|
|
|
/**
|
|
* @brief proto_645_unsig_to_bcd() - converts unsigned integers to BCD formats
|
|
* with specified n bytes.
|
|
* @param v: the value to be converted
|
|
* @param bcd_byte_n: specifies the number of bytes of BCD code after conversion
|
|
* @param bcd: converted data output buffer
|
|
* @retval: -- length of the converted BCD code, uint is byte
|
|
*/
|
|
uint8_t proto_645_unsig_to_bcd(uint32_t v, uint8_t bcd_byte_n,
|
|
uint8_t *bcd);
|
|
|
|
/**
|
|
* @brief proto_645_unsig_to_bcd() - converts signed integers to BCD formats
|
|
* with specified n bytes.
|
|
* @param v: the value to be converted
|
|
* @param bcd_byte_n: specifies the number of bytes of BCD code after conversion
|
|
* @param bcd: converted data output buffer
|
|
* @retval: - length of the converted BCD code, uint is byte
|
|
*/
|
|
uint8_t proto_645_sig_to_bcd(int32_t v, uint8_t bcd_byte_n,
|
|
uint8_t *bcd);
|
|
|
|
/**
|
|
* @brief proto_645_bcd_to_integer() -converting N-byte BCD code to integer data
|
|
* @param bcd: BCD code to be converted
|
|
* @param bcd_byte_n: the number of bytes of BCD code to be converted.
|
|
* @param is_signed: is it a signed BCD
|
|
* @retval: - converted integer values
|
|
*/
|
|
int32_t proto_645_bcd_to_integer(uint8_t *bcd, uint8_t bcd_byte_n,
|
|
uint8_t is_signed);
|
|
|
|
/**
|
|
* @brief proto_645_bcd_data_check() -check if bcd data is valid
|
|
* @param bcd: BCD code to be converted
|
|
* @param bcd_byte_n: the number of bytes of BCD code to be converted.
|
|
* @param is_signed: is it a signed BCD
|
|
* @retval: - converted integer values
|
|
*/
|
|
uint8_t proto_645_bcd_data_check(uint8_t *bcd, uint8_t bcd_byte_n,
|
|
uint8_t is_signed);
|
|
|
|
/**
|
|
* @brief proto_645_rtctime_to_YYMMDDhhmm() - converts rtc time to
|
|
* YYMMDDhhmm formats.
|
|
* @param tm: pintrer to rtc time.
|
|
* @param buf: converted data output buffer
|
|
* @retval: - length of the converted BCD code, uint is byte
|
|
*/
|
|
uint8_t proto_645_rtctime_to_YYMMDDhhmm(iot_time_tm_t *tm, uint8_t *buf);
|
|
|
|
/**
|
|
* @brief proto_645_rtctime_to_YYMMDDhhmmss() - converts rtc time to YYMMDDhhmmss
|
|
* formats.
|
|
* @param tm: pintrer to rtc time.
|
|
* @param buf: converted data output buffer
|
|
* @retval: - length of the converted BCD code, uint is byte
|
|
*/
|
|
uint8_t proto_645_rtctime_to_YYMMDDhhmmss(iot_time_tm_t *tm, uint8_t *buf);
|
|
|
|
/**
|
|
* @brief proto_645_07_get_curve_point_len() - get the data format length of
|
|
* load curve points
|
|
* @param di: DI corresponding to load curve.
|
|
* @retval: - data format length of load curve points
|
|
*/
|
|
uint8_t proto_645_07_get_curve_point_len(uint32_t di);
|
|
|
|
/* @brief proto_645_build_band_switch_rsp() - switch band response msg.
|
|
* @param addr: big end address.
|
|
* return rsp pkt packet, not NULL - successful, NULL - fail.
|
|
*/
|
|
iot_pkt_t *proto_645_build_band_switch_rsp(const uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_645_2007_build_frozen_msg() - create a meter frozen message
|
|
* for dl/t645 - 07 protocol
|
|
* @param addr: meter addr.
|
|
* @param time: frozen time.
|
|
* @retval: NULL -- for failure.
|
|
* @retval: pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_frozen_msg(uint8_t *addr,
|
|
proto_645_07_frozen_mdhm_t *time);
|
|
|
|
/* @brief proto_645_2007_build_mr_rsp() - build 645_07 response msg.
|
|
* @param addr: little end address.
|
|
* @param di: 645 proto response di, see PROTO_645_2007_XXX.
|
|
* @param payload: load data.
|
|
* @param len: load data len.
|
|
* @param head_reserved_len: head reserved len.
|
|
* @retval: NULL -- for failure.
|
|
* @retval: pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_mr_rsp(uint8_t *addr, uint32_t di,
|
|
uint8_t *payload, uint8_t len, uint8_t head_reserved_len);
|
|
|
|
|
|
/* @brief proto_645_1997_build_mr_rsp() - build 645_97 response msg.
|
|
* @param addr: little end address.
|
|
* @param di: 645 proto response di, see PROTO_645_1997_XXX.
|
|
* @param payload: load data.
|
|
* @param len: load data len.
|
|
* @param head_reserved_len: head reserved len.
|
|
* @retval: NULL -- for failure.
|
|
* @retval: pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_1997_build_mr_rsp(uint8_t *addr, uint32_t di,
|
|
uint8_t *payload, uint8_t len, uint8_t head_reserved_len);
|
|
|
|
/**
|
|
* @brief proto_645_2007_build_w_rsp() - build 645_07 write response msg.
|
|
* @param addr: little end address.
|
|
* @retval: NULL -- for failure.
|
|
* @retval: pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_2007_build_w_rsp(uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_645_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_645_check_frame_handler(uint8_t* buffer, uint32_t buffer_len,
|
|
bool_t* is_frame);
|
|
|
|
/**
|
|
* @brief proto_645_07_build_mr_lr_msg() - build a 645-07 protocol to read load
|
|
* record message.
|
|
* @param addr: specified address, little-endian.
|
|
* @param di: load record di, see PROTO_645_2007_DI_CR_XXX.
|
|
* @param n: specified number of points.
|
|
* @param start_tm: specified start time.
|
|
* @retval: NULL -- for failure.
|
|
* @retval: pkt -- returns the pkt containing the message.
|
|
*/
|
|
iot_pkt_t *proto_645_07_build_mr_lr_msg(uint8_t *addr,
|
|
uint32_t di, uint8_t n, iot_time_tm_t *start_tm);
|
|
|
|
/**
|
|
* @brief proto_645_i_97_to_07() - the i data of 645-97 protocol is converted into
|
|
* that of 645-07 protocol.
|
|
* @param i_97: the i data of 645-97 protocol, little-endian.
|
|
* @param i_07: the i data of 645-07 protocol, little-endian.
|
|
*/
|
|
void proto_645_i_97_to_07(uint8_t *i_97, uint8_t *i_07);
|
|
|
|
/**
|
|
* @brief proto_645_rp_97_to_07() - the reactive power data of 645-97 protocol
|
|
* is converted into that of 645-07 protocol.
|
|
* @param i_97: reactive power data of 645-97 protocol, little-endian.
|
|
* @param i_07: reactive power data of 645-07 protocol, little-endian.
|
|
*/
|
|
void proto_645_rp_97_to_07(uint8_t *rp_97, uint8_t *rp_07);
|
|
|
|
/* @brief proto_645_build_mr_msg_with_multi_di() - creating 645 protocol multi
|
|
* data item meter reading message.
|
|
* @param p_id: protocol id, see PROTO_645_XXXX_ID.
|
|
* @param addr: address of meter.
|
|
* @param di_buf: data item id buffer.
|
|
* @param cnt: the number of valid DI in di_buf.
|
|
* @param is_with_preamble: if set, each message created contains a preamble.
|
|
* otherwise, there is no preamble.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_build_mr_msg_with_multi_di(uint8_t p_id,
|
|
uint8_t *addr, uint32_t *di_buf, uint8_t cnt, uint8_t is_with_preamble);
|
|
|
|
/* @brief proto_645_07_build_mr_lr_msg_with_multi_di() - creating 645 protocol multi
|
|
* data item meter reading message - load record board.
|
|
* @param p_id: protocol id, see PROTO_645_XXXX_ID.
|
|
* @param addr: address of meter.
|
|
* @param di_buf: data item id buffer.
|
|
* @param cnt: the number of valid DI in di_buf.
|
|
* @param start_tm: specified start time for load record.
|
|
* @param n: specified number of points for load record.
|
|
* @param is_with_preamble: if set, each message created contains a preamble.
|
|
* otherwise, there is no preamble.
|
|
* return
|
|
* NULL -- for failure case.
|
|
* pkt -- the iot pkt buffer for 645 protocol.
|
|
*/
|
|
iot_pkt_t *proto_645_07_build_mr_lr_msg_with_multi_di(uint8_t *addr,
|
|
uint32_t *di_buf, uint8_t cnt, iot_time_tm_t *start_tm, uint8_t n,
|
|
uint8_t is_with_preamble);
|
|
|
|
/**
|
|
* @brief proto_645_corr_msg_check() - 645 protocol correct time format check.
|
|
* @param data: data.
|
|
* @param len: data len.
|
|
* @param addr: 645 header target mac address, little-endian.
|
|
* @retval: ERR_OK -- check success.
|
|
* @retval: otherwise -- check false, see ERR_XXX.
|
|
*/
|
|
uint32_t proto_645_corr_msg_check(uint8_t *data, uint32_t len, uint8_t *addr);
|
|
|
|
/**
|
|
* @brief proto_645_build_msg() - creating common 645 protocol message.
|
|
* @param addr: destination address, little endian.
|
|
* @param data: pointer to data.
|
|
* @param len: length of data.
|
|
* @param di: data identification, if is PROTO_645_INVALID_DI, DI info field
|
|
* will not be filling.
|
|
* @param dir: direction, see PROTO_645_DIR_XXX.
|
|
* @param ack: flag of ack, see PROTO_645_ACK_XXX.
|
|
* @param fn: function code.
|
|
* @param p_id: protocol id, see PROTO_645_XXXX_ID.
|
|
* @param follow: flag of follow data, see PROTO_645_FOLLOW_XXX.
|
|
* @retval: 0 -- fill 645 protocol frame failure
|
|
* @retval: otherwise -- length of data filled in 645 protocol frame
|
|
*/
|
|
iot_pkt_t *proto_645_build_msg(uint8_t *addr, uint8_t *data, uint8_t len,
|
|
uint32_t di, uint8_t dir, uint8_t ack, uint8_t fn, uint8_t p_id,
|
|
uint8_t follow);
|
|
|
|
/**
|
|
* @brief proto_645_ascii_to_uninteger() - 645 ascii translate to signed int.
|
|
* @param ascii: ascii data, little-endian.
|
|
* @param ascii_byte_n: ascii data len.
|
|
* @retval: signed int value.
|
|
*/
|
|
int32_t proto_645_ascii_to_integer(uint8_t *ascii, uint8_t ascii_byte_n);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PROTO_645_H */
|