81 lines
2.7 KiB
C
81 lines
2.7 KiB
C
/****************************************************************************
|
|
|
|
Copyright(c) 2024 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_IEC_YJ_H
|
|
#define PROTO_IEC_YJ_H
|
|
|
|
#include "os_types_api.h"
|
|
#include "iot_utils_api.h"
|
|
#include "iot_pkt_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* define invalid multi-obis index for stop multi obis read */
|
|
#define PROTO_IEC_YJ_MULTI_OBIS_INDEX_INVALID (50)
|
|
|
|
/**
|
|
* @brief according to the DI group meter reading message pkt
|
|
*
|
|
* @param di di of dl/t 645-97
|
|
* @param *multi_obis_idx address for multi_obis_idx
|
|
* @return pkt or None
|
|
*/
|
|
iot_pkt_t *proto_iec_yj_build_iec_by_64597_di(
|
|
uint16_t di, uint8_t *multi_obis_idx);
|
|
|
|
/**
|
|
* @brief convert IEC response data frames to 64597 data domain data.
|
|
*
|
|
* @param di di value for meter read with 645-1997
|
|
* @param src iec complete meter reading response message
|
|
* @param dst memory address for storing 6451997 data
|
|
* @param len length of iec data
|
|
* @return data length for 64597
|
|
*/
|
|
uint8_t proto_iec_yj_iec_map_to_64597_data(
|
|
uint16_t di, uint8_t *src, uint8_t *dst, uint8_t len);
|
|
|
|
/**
|
|
* @brief convert IEC response data frames to 64597 data domain data
|
|
* for read block data with DL/T 645-1997.
|
|
*
|
|
* @param di di value for meter read with 645-1997
|
|
* @param src iec complete meter reading response message
|
|
* @param dst memory address for storing 6451997 data
|
|
* @param len length of iec data
|
|
* @param *multi_obis_idx address for multi_obis_idx
|
|
* @return data length for 64597
|
|
*/
|
|
uint8_t proto_iec_yj_iec_map_to_64597_data_multi_obis(
|
|
uint16_t di, uint8_t *src, uint8_t *dst, uint8_t len,
|
|
uint8_t *multi_obis_idx);
|
|
|
|
/**
|
|
* @brief calc xor crc value by yujian
|
|
*
|
|
* @param p address of data.
|
|
* @param len len of data
|
|
* @return crc value
|
|
*/
|
|
uint8_t proto_iec_calc_crc(uint8_t *p, uint8_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PROTO_IEC_YJ_H */
|