Files
kunlun/export/inc/plc_lib/iot_plc_sta_api.h
2024-09-28 14:24:04 +08:00

169 lines
6.9 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_PLC_STA_API_H
#define IOT_PLC_STA_API_H
#include "os_types_api.h"
#include "iot_plc_api.h"
#include "iot_pkt_api.h"
#include "iot_plc_msg_sta_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief iot_plc_tsfm_state_lock() - lock the state of transformer detect.
*
* @param handle: plc application handler
*/
#define iot_plc_tsfm_state_lock(handle) \
iot_plc_tsfm_state_change(handle, IOT_PLC_API_REQ_ID_DEFAULT, \
IOT_PLC_TSFM_STATE_LOCK, NULL, 0, 0, NULL, NULL, 0)
/**
* @brief iot_plc_tsfm_state_unlock() - unlock the state of transformer detect.
*
* @param handle: plc application handler
* @param unlock_delay: unlock delay time, unit is 1min.
*/
#define iot_plc_tsfm_state_unlock(handle, unlock_delay) \
iot_plc_tsfm_state_change(handle, IOT_PLC_API_REQ_ID_DEFAULT, \
IOT_PLC_TSFM_STATE_UNLOCK, NULL, 0, 0, NULL, NULL, unlock_delay)
/**
* @brief iot_plc_tsfm_set_tsfm_addr() - set transformer address info.
*
* @param handle: plc application handler
* @param tsfm_addr: transformer mac address
*/
#define iot_plc_tsfm_set_tsfm_addr(handle, tsfm_addr) \
iot_plc_tsfm_state_change(handle, IOT_PLC_API_REQ_ID_DEFAULT, \
IOT_PLC_TSFM_STATE_INVALID, tsfm_addr, 0, 0, NULL, NULL, 0)
/**
* @brief iot_plc_tsfm_set_tsfm_lock_time() - set transformer lock time.
* @param handle: plc application handler
* @param net_lock_time: pointer to the net lock time.
* @param abn_lock_time: pointer to the lock time of abnormal leave net.
*/
#define iot_plc_tsfm_set_lock_time(handle, net_lock_time, abn_lock_time) \
iot_plc_tsfm_state_change(handle, IOT_PLC_API_REQ_ID_DEFAULT, \
IOT_PLC_TSFM_STATE_INVALID, NULL, 0, 0, net_lock_time, abn_lock_time, 0)
/**
* @brief iot_plc_set_discovery_mode() - enable/disable discovery mode. Note
* that this function is only available when local STA not joined to
* any network and in started status.
*
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back
* to app in the report. app can define the mean of
* each id itself.
* @param enable: 0 - disable, otherwise - enable
*/
void iot_plc_set_discovery_mode(iot_plc_app_h handle, uint8_t req_id,
uint8_t enable);
/**
* @brief query transformer area detection status of local device.
*
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back
* to app in the report. app can define the mean of
* each id itself.
*/
void iot_plc_query_tsfm_status(iot_plc_app_h handle, uint8_t req_id);
/**
* @brief iot_plc_ctrl_proto_connect() - connect the specified target device -
* STA or CCO, this connection behavior is defined in the controller
* protocol.
* @param handle: - plc application handler
* @param req_id: - request id, the request id will be transferred back
* to app in the report. app can define the mean of
* each id itself.
* @param addr: - target device address to be connected, the byte order is
* Big-Endian.
*/
void iot_plc_ctrl_proto_connect(iot_plc_app_h handle, uint8_t req_id,
uint8_t *addr);
/**
* @brief iot_plc_set_scan_band_bitmap() - plc set band bitmap.
*
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back to
* app in the report. app can define the mean of each id
* itself.
* @param band_bitmap: set scan band bitmap.
* e: band_bitmap = b0000 0000 0000 0100
* -> enable band PLC_LIB_FREQ_BAND_2
* @param size: size of scan bitmap,
* need equal to IOT_PLC_BAND_BITMAP_SIZE.
*/
void iot_plc_set_scan_band_bitmap(iot_plc_app_h handle, uint8_t req_id,
uint8_t *band_bitmap, uint32_t size);
/**
* @brief iot_plc_set_phase_mask() - plc set phase mask.
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back to
* app in the report. app can define the mean of each id
* itself.
* @param phase_mask: phase to be masked off so that CCO won't be able to get
* corresponding phase zero crossing info, bit 0~2
* corresponds to phase 1/2/3.
*/
void iot_plc_set_phase_mask(iot_plc_app_h handle, uint8_t req_id,
uint8_t phase_mask);
/**
* @brief iot_plc_set_pkt_capture() - set the tei bitmap to be captured
* to capture application layer frames. only supports capture
* the packets matching destination tei.
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back to
* app in the report. app can define the mean of each id
* itself.
* @param bm: tei bitmap. if a bit is set, it means that corresponding
* tei is valid. bit0 has no meaning, bit1 means tei 1,
* bit 2 means tei 2.
* @param bm_len: bitmap len
* @param enable: enable capture. 0 - disable, 1 - enable.
*/
void iot_plc_set_pkt_capture(iot_plc_app_h handle, uint8_t req_id,
uint8_t *bm, uint16_t bm_len, uint8_t enable);
/**
* @brief iot_plc_set_pm_addr() - set the address of power meter connected
* @param handle: plc application handler
* @param req_id: request id, the request id will be transferred back to
* app in the report. app can define the mean of each id
* itself.
* @param addr_array: mac address array of power meter connected, big-endian
* @param cnt: count of power meter connected, 0 means clear
* mac address of power meter connected
*/
void iot_plc_set_pm_addr(iot_plc_app_h handle, uint8_t req_id,
uint8_t *addr_array, uint8_t cnt);
#ifdef __cplusplus
}
#endif
#endif /* IOT_PLC_STA_API_H */