489 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			489 lines
		
	
	
		
			19 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 IOT_BRM_PROTO_645_EXT_H
 | 
						|
#define IOT_BRM_PROTO_645_EXT_H
 | 
						|
 | 
						|
#include "os_types_api.h"
 | 
						|
#include "iot_utils_api.h"
 | 
						|
#include "iot_pkt_api.h"
 | 
						|
#include "proto_645.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
#define BRM_PROTO_645_EXT_DEBUG            1
 | 
						|
 | 
						|
/* pack for the structures in the whole file */
 | 
						|
#pragma pack(push)  /* save the pack status */
 | 
						|
#pragma pack(1)     /* 1 byte align */
 | 
						|
 | 
						|
/* Invalid di */
 | 
						|
#define PROTO_645_EXT_INVALID_DI                (0xffffffffu)
 | 
						|
 | 
						|
/* extended data item of extended 645-2007 frame */
 | 
						|
/* read value of current and paramter of power threshold */
 | 
						|
#define PROTO_645_EXT_CURRENT_AND_POWER_THR_DI    (0x04400050u)
 | 
						|
/* read counter of event in someday */
 | 
						|
#define PROTO_645_EXT_EVT_COUNTER_DI              (0x04400055u)
 | 
						|
/* read record of event in someday */
 | 
						|
#define PROTO_645_EXT_EVT_RECORD_DI               (0x04400056u)
 | 
						|
/* read diagram of load */
 | 
						|
#define PROTO_645_EXT_LOAD_DIAGRAM_DI             (0x04400057u)
 | 
						|
/* read real time data */
 | 
						|
#define PROTO_645_EXT_REAL_TIME_DATA_DI           (0x04400058u)
 | 
						|
/* read VMS-3006-WS-N01 external device humidity and temperature */
 | 
						|
#define PROTO_645_EXT_READ_04400059_DI            (0x04400059u)
 | 
						|
/* collecting galactic thermostat humidity and temperature */
 | 
						|
#define PROTO_645_EXT_READ_0440005A_DI            (0x0440005Au)
 | 
						|
/* read counts of event indication */
 | 
						|
#define PROTO_645_EXT_EVT_IND_CNT_DI              (0x03830000u)
 | 
						|
/* read event indication */
 | 
						|
#define PROTO_645_EXT_REQ_EVT_IND_DI              (0x03830001u)
 | 
						|
 | 
						|
/* write value of meter bottom */
 | 
						|
#define PROTO_645_EXT_METER_BOTTOM_VALUE_DI       (0x0440002Eu)
 | 
						|
 | 
						|
#define proto_645_2007_ext_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)
 | 
						|
 | 
						|
typedef enum _proto_645_ext_event_e {
 | 
						|
    /* Event type, used to report the event. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_POWER_ON   = 0x0,/* Device power on. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_WORK_START = 0x1,/* Device start working. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_WORK_STOP  = 0x2,/* Device stop working. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_POWER_OFF  = 0x3,/* Device power off. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_TRAP_START = 0x4,/* Device work in trap. */
 | 
						|
    PROTO_645_EXT_EVENT_DEV_TRAP_STOP  = 0x5,/* Device restore from trap. */
 | 
						|
 | 
						|
    PROTO_645_EXT_EVENT_INVALID
 | 
						|
} proto_645_ext_event_e;
 | 
						|
 | 
						|
typedef struct _proto_645_ext_corr_time_t {
 | 
						|
    uint8_t second;
 | 
						|
    uint8_t minute;
 | 
						|
    uint8_t hour;
 | 
						|
    uint8_t day;
 | 
						|
    uint8_t month;
 | 
						|
    uint8_t year;
 | 
						|
} proto_645_ext_corr_time_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_time_t {
 | 
						|
    uint8_t second;
 | 
						|
    uint8_t minute;
 | 
						|
    uint8_t hour;
 | 
						|
    uint8_t week;
 | 
						|
    uint8_t day;
 | 
						|
    uint8_t month;
 | 
						|
    uint8_t year;
 | 
						|
} proto_645_07_ext_time_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_v {
 | 
						|
    /* 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 tenth:4,      /* one-tenth unit. */
 | 
						|
            one:4;        /* ont unit. */
 | 
						|
    uint8_t ten:4,        /* ten unit. */
 | 
						|
            hundred:4;    /* hundred unit. */
 | 
						|
} proto_645_07_ext_v_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_thrphase_v_t {
 | 
						|
    /* Concentrators support three-phase voltages and recently
 | 
						|
     * use only a single term. */
 | 
						|
    proto_645_07_ext_v_t          A;
 | 
						|
    proto_645_07_ext_v_t          B;
 | 
						|
    proto_645_07_ext_v_t          C;
 | 
						|
} proto_645_07_ext_thrphase_v_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_a {
 | 
						|
    /* 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 thousandth:4,  /* one-thousandth unit. */
 | 
						|
            hundredth:4;   /* one-hundredth unit. */
 | 
						|
    uint8_t tenth:4,       /* ten unit. */
 | 
						|
            one:4;         /* one unit. */
 | 
						|
    uint8_t ten:4,         /* ten unit. */
 | 
						|
            hundred:3,     /* hundred unit. */
 | 
						|
            s:1;           /* sign bit, 1 for negative. */
 | 
						|
} proto_645_07_ext_a_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_thrphase_a_t {
 | 
						|
    /* Concentrators support three-phase currents and recently
 | 
						|
     * use only a single term. */
 | 
						|
    proto_645_07_ext_a_t          A;
 | 
						|
    proto_645_07_ext_a_t          B;
 | 
						|
    proto_645_07_ext_a_t          C;
 | 
						|
} proto_645_07_ext_thrphase_a_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_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 ten_thousandth:4,   /* ten_thousandth unit. */
 | 
						|
            thousandth:4;       /* one-hundredth unit. */
 | 
						|
    uint8_t hundredth:4,        /* one-hundredth unit. */
 | 
						|
            tenth:4;            /* one-tenth unit. */
 | 
						|
    uint8_t one:4,              /* one unit. */
 | 
						|
            ten:2,              /* ten unit. */
 | 
						|
            d:1,                /* carry bit, 1 for need multiply by 10. */
 | 
						|
            s:1;                /* sign bit, 1 for negative. */
 | 
						|
} proto_645_07_ext_p_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_thrphase_p_t {
 | 
						|
    /* Concentrators support three-phase power and recently
 | 
						|
     * use only a single term. */
 | 
						|
    proto_645_07_ext_p_t          total;
 | 
						|
    proto_645_07_ext_p_t          A;
 | 
						|
    proto_645_07_ext_p_t          B;
 | 
						|
    proto_645_07_ext_p_t          C;
 | 
						|
} proto_645_07_ext_thrphase_p_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_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 tenth:4,        /* one-tenth unit. */
 | 
						|
            one:4;          /* one unit. */
 | 
						|
    uint8_t ten:4,          /* ten unit. */
 | 
						|
            hundred:3,      /* hundred unit. */
 | 
						|
            s:1;            /* sign bit, 1 for negative. */
 | 
						|
} proto_645_07_ext_pf_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_thrphase_pf_t {
 | 
						|
    /* Concentrators support three-phase power factor and recently
 | 
						|
     * use only a single term. */
 | 
						|
    proto_645_07_ext_pf_t          total;
 | 
						|
    proto_645_07_ext_pf_t          A;
 | 
						|
    proto_645_07_ext_pf_t          B;
 | 
						|
    proto_645_07_ext_pf_t          C;
 | 
						|
} proto_645_07_ext_thrphase_pf_t;
 | 
						|
 | 
						|
typedef struct _proto_645_07_ext_w {
 | 
						|
    /* use 4 bytes of BCD code to represent bottom energy value. for example,
 | 
						|
     * 123456.78KWh uses 4 bytes of BCD code to represent the following
 | 
						|
     * 0x12, 0x34, 0x56, 0x78.
 | 
						|
     */
 | 
						|
    uint8_t hundredth:4,            /* one-hundredth unit. */
 | 
						|
            tenth:4;                /* one-tenth unit. */
 | 
						|
    uint8_t one:4,                  /* one unit. */
 | 
						|
            ten:4;                  /* ten unit. */
 | 
						|
    uint8_t hundred:4,              /* hundred unit. */
 | 
						|
            thousand:4;             /* thousand unit. */
 | 
						|
    uint8_t ten_thousand:4,         /* ten_thousand unit. */
 | 
						|
            hundred_thousand:4;     /* hundred_thousand unit. */
 | 
						|
} proto_645_07_ext_w_t;
 | 
						|
 | 
						|
/* Item of each power threshold item. */
 | 
						|
typedef struct _proto_645_ext_power_record_item_t {
 | 
						|
    proto_645_07_ext_thrphase_v_t  v;  /* Voltage, V. */
 | 
						|
    proto_645_07_ext_thrphase_a_t  i;  /* Electrical current, A. */
 | 
						|
    proto_645_07_ext_thrphase_p_t  p;  /* Power, KW. */
 | 
						|
    proto_645_07_ext_thrphase_pf_t pf; /* Power factor, %. */
 | 
						|
    proto_645_07_ext_w_t           w;  /* Work(meter bottom value), KWH. */
 | 
						|
} proto_645_ext_power_record_item_t;
 | 
						|
 | 
						|
/* Response read current and power limit parameters. */
 | 
						|
typedef struct _proto_645_ext_resp_threashold_t {
 | 
						|
    proto_645_07_ext_a_t        i_standby; /* Standby current threshold, A. */
 | 
						|
    proto_645_07_ext_a_t        i_work; /* Working current threshold, A. */
 | 
						|
    proto_645_07_ext_p_t        p_trap; /* Traped power threshold, KW. */
 | 
						|
} proto_645_ext_resp_threashold_t;
 | 
						|
 | 
						|
/* Response read event counter. */
 | 
						|
typedef struct _proto_645_ext_resp_event_counter_t {
 | 
						|
    proto_645_ext_corr_time_t start_time; /* The time of start querrying. */
 | 
						|
    uint16_t                  event_counter; /* Number of events queried. */
 | 
						|
} proto_645_ext_resp_event_counter_t;
 | 
						|
 | 
						|
/* Item of each reported event record. */
 | 
						|
typedef struct _proto_645_ext_event_record_item_t {
 | 
						|
    uint8_t                           type;   /* Event record type. */
 | 
						|
    proto_645_ext_corr_time_t         etime;  /* Event record timestamp. */
 | 
						|
    proto_645_ext_power_record_item_t event_record_item; /* event record item. */
 | 
						|
} proto_645_ext_event_record_item_t;
 | 
						|
 | 
						|
/* Item of each indication event count. */
 | 
						|
typedef struct _proto_645_ext_resp_ind_event_cnt_t {
 | 
						|
    uint16_t                          count; /* count of indication Event */
 | 
						|
    uint8_t                           resv;  /* reserved */
 | 
						|
} proto_645_ext_resp_ind_event_cnt_t;
 | 
						|
 | 
						|
/* Item of each indication event count. */
 | 
						|
typedef struct _proto_645_ext_resp_read_ind_event_t {
 | 
						|
    proto_645_ext_corr_time_t         etime;  /* Event record timestamp. */
 | 
						|
    proto_645_ext_power_record_item_t event_record_item; /* event record item. */
 | 
						|
    uint8_t                           type;   /* Event record type. */
 | 
						|
} proto_645_ext_resp_read_ind_event_t;
 | 
						|
 | 
						|
/* Event record command, used by query operation.
 | 
						|
 * Query event record of the day on timestamp.
 | 
						|
 */
 | 
						|
typedef struct _iot_brm_adp_cmd_event_record_query_t {
 | 
						|
    /* Timestamp for querying event record of a day. */
 | 
						|
    proto_645_ext_corr_time_t start_time;
 | 
						|
    /* Record start index. (0~511)*/
 | 
						|
    uint16_t                  start_idx;
 | 
						|
    /* The number of record to get(effective value: 1~5). */
 | 
						|
    uint16_t                  record_num;
 | 
						|
} iot_brm_adp_cmd_event_record_query_t;
 | 
						|
 | 
						|
/* Response read event record. */
 | 
						|
typedef struct _proto_645_ext_resp_event_record_t {
 | 
						|
    /* Start number of records.*/
 | 
						|
    uint16_t        record_start_index;
 | 
						|
    /* The number of records reported this time. */
 | 
						|
    uint16_t        record_num;
 | 
						|
    /* event record data. */
 | 
						|
    proto_645_ext_event_record_item_t record_data[0];
 | 
						|
} proto_645_ext_resp_event_record_t;
 | 
						|
 | 
						|
/* read record load diagram counter. */
 | 
						|
typedef struct _iot_brm_adp_cmd_load_record_query_t {
 | 
						|
    /* The time of start querrying. */
 | 
						|
    proto_645_ext_corr_time_t start_time;
 | 
						|
    /* Number of record. (1~5) */
 | 
						|
    uint16_t                  recode_counter;
 | 
						|
} iot_brm_adp_cmd_load_record_query_t;
 | 
						|
 | 
						|
/* Item of each reported load diagram. */
 | 
						|
typedef struct _proto_645_ext_load_diagram_item_t {
 | 
						|
    /* Event record timestamp. */
 | 
						|
    proto_645_ext_corr_time_t         etime;
 | 
						|
    /* Load diagram. */
 | 
						|
    proto_645_ext_power_record_item_t load_diagram_item;
 | 
						|
} proto_645_ext_load_diagram_item_t;
 | 
						|
 | 
						|
/* Response load diagram. */
 | 
						|
typedef struct _proto_645_ext_resp_load_diagram_t {
 | 
						|
    /* The number of records at 15-minute intervals
 | 
						|
     * starting from the starting time. */
 | 
						|
    uint16_t                          record_num;
 | 
						|
    /* data of records. */
 | 
						|
    proto_645_ext_load_diagram_item_t load_diagram[0];
 | 
						|
} proto_645_ext_resp_load_diagram_t;
 | 
						|
 | 
						|
/* Response realtime load diagram. */
 | 
						|
typedef struct _proto_645_ext_realtime_load_data_t {
 | 
						|
    /* the current time. */
 | 
						|
    proto_645_ext_corr_time_t         etime;
 | 
						|
    /* realtime load data. */
 | 
						|
    proto_645_ext_power_record_item_t realtime_load_data;
 | 
						|
} proto_645_ext_realtime_load_data_t;
 | 
						|
 | 
						|
/* Meter bottom value. */
 | 
						|
typedef struct _proto_645_ext_bottom_val_t
 | 
						|
{
 | 
						|
    /* Meter bottom value. */
 | 
						|
    proto_645_07_ext_w_t bottom_val;
 | 
						|
} proto_645_ext_bottom_val_t;
 | 
						|
 | 
						|
/* Response humidity and temperature for 0x04400059u. */
 | 
						|
typedef struct _proto_645_ext_resp_humi_temp_t {
 | 
						|
    /* read temperature. */
 | 
						|
    int16_t         temp;
 | 
						|
    /* read humidity.*/
 | 
						|
    uint16_t        humi;
 | 
						|
} proto_645_ext_resp_humi_temp_t;
 | 
						|
 | 
						|
/* Response collecting galactic thermostat data for 0x0440005Au. */
 | 
						|
typedef struct _proto_645_ext_resp_coll_thermo_t {
 | 
						|
    /* read temperature. */
 | 
						|
    int32_t         temp;
 | 
						|
    /* temperature setted. */
 | 
						|
    int32_t         temp_setted;
 | 
						|
    /* read humidity.*/
 | 
						|
    uint32_t        humi;
 | 
						|
    /* humidity setted.*/
 | 
						|
    uint32_t        humi_setted;
 | 
						|
    /* run time.*/
 | 
						|
    uint32_t        runs;
 | 
						|
    /* alarm state.*/
 | 
						|
    uint32_t        alarm_state;
 | 
						|
    /* run state.*/
 | 
						|
    uint16_t        run_state;
 | 
						|
    /* set temperature. */
 | 
						|
    int16_t         set_temp;
 | 
						|
    /* set humidity. */
 | 
						|
    uint16_t        set_humi;
 | 
						|
} proto_645_ext_resp_coll_thermo_t;
 | 
						|
 | 
						|
/* read humidity and temperature modbus command. */
 | 
						|
typedef struct _proto_modbus_read_humi_temp_t {
 | 
						|
    uint8_t         add;
 | 
						|
    uint8_t         fn;
 | 
						|
    uint16_t        start_add;
 | 
						|
    uint8_t         len_hi;
 | 
						|
    uint8_t         len_low;
 | 
						|
    uint16_t        crc16;
 | 
						|
} proto_modbus_read_humi_temp_t;
 | 
						|
 | 
						|
/* resp read humidity and temperature modbus command. */
 | 
						|
typedef struct _proto_modbus_resp_humi_temp_t {
 | 
						|
    uint8_t         add;
 | 
						|
    uint8_t         fn;
 | 
						|
    uint8_t         len;
 | 
						|
    uint16_t        humi;
 | 
						|
    int16_t         temp;
 | 
						|
    uint16_t        crc16;
 | 
						|
} proto_modbus_resp_humi_temp_t;
 | 
						|
 | 
						|
#pragma pack(pop)   /* restore the pack status */
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_read_threshold() - read current and power
 | 
						|
 *                                                    limit parameters.
 | 
						|
 * @param out_buf:   point to the resp payload frame.
 | 
						|
 * @param out_len:   the length of out_buf.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_read_threshold(uint8_t* out_buf,
 | 
						|
    uint8_t *out_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_read_event_counter() - request counter of
 | 
						|
 *                                                        event in someday.
 | 
						|
 * @param payload:      point to the request to adp.
 | 
						|
 * @param payload_len:  the length of payload.
 | 
						|
 * @param out_buf:      point to response buffer frame.
 | 
						|
 * @param out_len:      the length of out_buf.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_read_event_counter(uint8_t *payload,
 | 
						|
    uint8_t payload_len, uint8_t* out_buf, uint8_t *out_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_read_event_record() - request record of event
 | 
						|
 *                                                       in someday.
 | 
						|
 * @param payload:      point to the request to adp.
 | 
						|
 * @param payload_len:  the length of payload.
 | 
						|
 * @param out_buf:      point to response buffer frame.
 | 
						|
 * @param out_len:      the length of out_buf.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_read_event_record(uint8_t *payload,
 | 
						|
    uint8_t payload_len, uint8_t* out_buf, uint8_t *out_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_read_load_diagram() - request diagram of load.
 | 
						|
 * @param payload:      point to the request to adp.
 | 
						|
 * @param payload_len:  the length of payload.
 | 
						|
 * @param out_buf:      point to response buffer frame.
 | 
						|
 * @param out_len:      the length of out_buf.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_read_load_diagram(uint8_t *payload,
 | 
						|
    uint8_t payload_len, uint8_t* out_buf, uint8_t *out_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_read_realtime_load_data() - request
 | 
						|
 *                                                            real time data.
 | 
						|
 * @param out_buf:      point to response buffer frame.
 | 
						|
 * @param out_len:      the length of out_buf.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_read_realtime_load_data(uint8_t* out_buf,
 | 
						|
    uint8_t *out_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_write_threshold() - request write current
 | 
						|
 *                                                   and power limit parameters
 | 
						|
 * @param data:         point to the request to adp.
 | 
						|
 * @param data_len:     the length of data.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_write_threshold(uint8_t* data, uint8_t data_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief proto_handle_645_ext_req_write_bottom_value() - request write
 | 
						|
 *                                                        bottom value.
 | 
						|
 * @param data:         point to the request to adp.
 | 
						|
 * @param data_len:     the length of data.
 | 
						|
 */
 | 
						|
void proto_handle_645_ext_req_write_bottom_value(uint8_t* data,
 | 
						|
    uint8_t data_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_proto_645_w_ext_data_hander() - handler write command.
 | 
						|
 * @param in_data:      point to the request to adp.
 | 
						|
 * @param in_len:       the length of in_data.
 | 
						|
 * @param di:           the data item will be write.
 | 
						|
 * @param len:          will response data len.
 | 
						|
 * @retval: success handler will response PROTO_645_2007_ERR_OK
 | 
						|
 */
 | 
						|
uint8_t iot_brm_proto_645_w_ext_data_hander(uint8_t *in_data, uint8_t in_len,
 | 
						|
    uint32_t di, uint8_t *len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_proto_645_r_ext_data_hander() - handler read command.
 | 
						|
 * @param in_data:      point to the request to adp.
 | 
						|
 * @param in_len:       the length of in_data.
 | 
						|
 * @param out_buf:      point to response data.
 | 
						|
 * @param len:          will response data len.
 | 
						|
 * @retval: success handler will response PROTO_645_2007_ERR_OK
 | 
						|
 */
 | 
						|
uint8_t iot_brm_proto_645_r_ext_data_hander(uint8_t *in_data, uint8_t in_len,
 | 
						|
    uint8_t *out_buf, uint8_t *len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_adp_trans_evt_to_resp() - Convert recorded event data to
 | 
						|
 *                                          response data.
 | 
						|
 * @param event:         adp event recorded data.
 | 
						|
 * @param data :         the response data.
 | 
						|
 */
 | 
						|
void iot_brm_adp_trans_evt_to_resp(uint8_t *event, uint8_t *data);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_adp_load_resp_init() - init load recorded response data.
 | 
						|
 * @param data:          point to the response data.
 | 
						|
 * @param ts:            resp start ts.
 | 
						|
 * @param cnt:           response load count;
 | 
						|
 */
 | 
						|
void iot_brm_adp_load_resp_init(uint8_t *data, uint32_t ts, uint8_t cnt);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_adp_trans_load_to_resp() - Convert load recorded data to
 | 
						|
 *                                          response data.
 | 
						|
 * @param load:          adp load recorded data.
 | 
						|
 * @param data:          the response data.
 | 
						|
 */
 | 
						|
void iot_brm_adp_trans_load_to_resp(uint8_t *load, uint8_t *data);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_adp_read_ws_n01_humi_temp() - check the pkt is read
 | 
						|
 *                                              VMS-3006-WS-N01 humidity
 | 
						|
 *                                              and temperature.
 | 
						|
 * @param pkt:           point to the pkt data, if read di is 0x04400059u,
 | 
						|
 *                       fill read VMS-3006-WS-N01 humidity and temperature.
 | 
						|
 *                       rs485 modbus command.
 | 
						|
 * @retval  return ERR_OK if read di is 0x04400059u.
 | 
						|
 */
 | 
						|
uint8_t iot_brm_adp_read_ws_n01_humi_temp(iot_pkt_t *pkt);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_adp_resp_humi_temp() - response humidity and temperature.
 | 
						|
 * @param pkt:           point to the pkt data include humidity and temperature
 | 
						|
 *                       from rs485 modbus.
 | 
						|
 * @retval response ws_n01 humidity and temperature successful return ERR_OK.
 | 
						|
 */
 | 
						|
uint8_t iot_brm_adp_resp_ws_n01_humi_temp(iot_pkt_t* pkt);
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /* IOT_BRM_PROTO_645_EXT_H */
 |