214 lines
		
	
	
		
			8.3 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			214 lines
		
	
	
		
			8.3 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_CCO_API_H
 | |
| #define IOT_PLC_CCO_API_H
 | |
| 
 | |
| /* os shim includes */
 | |
| #include "os_types_api.h"
 | |
| 
 | |
| /* common includes */
 | |
| #include "iot_plc_api.h"
 | |
| #include "iot_pkt_api.h"
 | |
| #include "iot_plc_msg_cco_api.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /** \defgroup PLCLIB_APIs PLCLIB APIs
 | |
|   * @brief WQ30x1 PLCLIB APIs
 | |
|   */
 | |
| 
 | |
| /** @addtogroup PLCLIB_APIs
 | |
|   * @{
 | |
|   */
 | |
| 
 | |
| /** \defgroup PLC_CCO_APIs PLC CCO APIs
 | |
|   * @brief CCO APIs
 | |
|   *
 | |
|   * APIs can be called only by CCO device
 | |
|   */
 | |
| 
 | |
| /** @addtogroup PLC_CCO_APIs
 | |
|   * @{
 | |
|   */
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_lid_alloc_req() - request to allocate bandwidth for the
 | |
|  *                          specified lid. the result will be notified through
 | |
|  * @param handle:           plc application handler
 | |
|  * @param lid:              the specified lid
 | |
|  */
 | |
| void iot_plc_lid_alloc_req(iot_plc_app_h handle, uint8_t lid);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_lid_rel_req() - request to release bandwidth for the
 | |
|  *                          specified lid.
 | |
|  * @param handle:           plc application handler
 | |
|  * @param lid:              the specified lid
 | |
|  */
 | |
| void iot_plc_lid_rel_req(iot_plc_app_h handle, uint8_t lid);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_query_nw_topo() - Query the plc network topologic. the result
 | |
|  *                       will be notified through iot_plc_recv_func_t callback.
 | |
|  * @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 req_data_ver:  request data type, see IOT_PLC_REQ_DATA_VER_XXX
 | |
|  * @param start_type:    start type, see IOT_PLC_QUERY_TOPO_START_AS_XXX
 | |
|  * @param start:         start tei of the query
 | |
|  * @param cnt:           requested number of valid entries
 | |
|  */
 | |
| void iot_plc_query_nw_topo(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t req_data_ver, uint8_t start_type, uint16_t start, uint16_t cnt);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_set_nid() - set nid of current network will be
 | |
|  *                          notified through iot_plc_recv_func_t callback.
 | |
|  * @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 new_ind:          new nid to be set to the network
 | |
|  */
 | |
| void iot_plc_set_nid(iot_plc_app_h handle, uint8_t req_id, uint32_t new_nid);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_set_beacon_data() - set beacon data. beacon data can be
 | |
|  *          broadcast to whole network in each beacon period.
 | |
|  * @param   handle: plc application handler
 | |
|  * @param   data:   data to be carried in each beacon
 | |
|  * @param   len:    length of the data. must be qeual ro less than
 | |
|  *                  IOT_PLC_BEACON_DATA_MAX
 | |
|  * @return  0 - requst sent to mac successfully
 | |
|  *          otherwise - error code. see ERR_XXX
 | |
|  */
 | |
| uint32_t iot_plc_set_beacon_data(iot_plc_app_h handle, uint8_t *data,
 | |
|     uint8_t len);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_query_node_info() - query nodes' info by mac
 | |
|  * @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   ver:       request data ver, see IOT_PLC_CCO_NODE_INFOR_REQ_VER_XXX.
 | |
|  * @param   sta_mac:   pointer to nodes' mac.
 | |
|  * @param   sta_cnt:   sta count.
 | |
|  */
 | |
| void iot_plc_query_node_info(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t ver, uint8_t *sta_mac, uint8_t sta_cnt);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_query_nw_info() - query local network information
 | |
|  * @param   handle:    plc application handler.
 | |
|  * @param   req_id:    request id.
 | |
|  */
 | |
| void iot_plc_query_nw_info(iot_plc_app_h handle, uint8_t req_id);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_query_wl_ext() - query whitelist extended information
 | |
|  * @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 start:            start index of whitelist entry
 | |
|  * @param cnt:              count of entries to retrieve
 | |
|  */
 | |
| void iot_plc_query_wl_ext(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint16_t start, uint16_t cnt);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_set_sta_phy_phase() - set STA physical phase info
 | |
|  * @param   handle:          plc application handler.
 | |
|  * @param   req_id:          request id.
 | |
|  * @param   mac:             sta mac address, big endian.
 | |
|  * @param   phase:           physical phase, bit0-2 means phaseA/B/C. set "1"
 | |
|  *                           to indicate which phase the device belongs to.
 | |
|  * @param   opposite_phase:  flag to mark if L/N reversed in Single-phase power
 | |
|  *                           meter or phase sequence reversed in Three-phase
 | |
|  *                           power meter.
 | |
|  */
 | |
| void iot_plc_set_sta_phy_phase(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t mac[], uint8_t phase, uint8_t opposite_phase);
 | |
| /**
 | |
|  * @brief   iot_plc_set_phy_phase_ident() - set physical phase identification
 | |
|  *                           info
 | |
|  * @param   handle:          plc application handler.
 | |
|  * @param   req_id:          request id.
 | |
|  * @param   enable:          flag to mark if enable physical phase
 | |
|  *                           identification, 0 - disable, 1 - enable
 | |
|  */
 | |
| void iot_plc_set_phy_phase_ident(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t enable);
 | |
| /**
 | |
|  * @brief   iot_plc_set_app_load() - set application layer data traffic load
 | |
|  * @param   handle:          plc application handler.
 | |
|  * @param   req_id:          request id.
 | |
|  * @param   load:            application layer data traffic load level,
 | |
|  *                           see IOT_PLC_APP_LOAD_XXX.
 | |
|  */
 | |
| void iot_plc_set_app_load(iot_plc_app_h handle, uint8_t req_id, uint8_t load);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_set_repeater_addr_range() - set repeater addr range.
 | |
|  *                           if the value is valid the repeater in the range
 | |
|  *                           are allowed to join network.
 | |
|  *                           if the value is invalid then all repeater are
 | |
|  *                           allowed to join network.
 | |
|  *                           00:00:00:00:00:00 and FF:FF:FF:FF:FF:FF are
 | |
|  *                           invalid data.
 | |
|  * @param   handle:          plc application handler.
 | |
|  * @param   req_id:          request id.
 | |
|  * @param   start_addr:      start address, big endian.
 | |
|  * @param   end_addr:        end address, big endian.
 | |
|  */
 | |
| void iot_plc_set_repeater_addr_range(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t *start_addr, uint8_t *end_addr);
 | |
| 
 | |
| /**
 | |
|  * @brief   iot_plc_set_app_sniffer_cmd() - set app sniffer function.
 | |
|  * @param   handle:          plc application handler.
 | |
|  * @param   req_id:          request id.
 | |
|  * @param   cmd:             0 - disabled, other - enable
 | |
|  */
 | |
| void iot_plc_set_app_sniffer_cmd(iot_plc_app_h handle, uint8_t req_id,
 | |
|     uint8_t cmd);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_plc_set_nw_nego() - set neighbour network negotiation enable.
 | |
|  *
 | |
|  * @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:       flag to mark if enable neighbour network negotiation,
 | |
|  *                      0 - disable, 1 - enable
 | |
|  */
 | |
| void iot_plc_set_nw_nego(iot_plc_app_h handle, uint8_t req_id, uint8_t enable);
 | |
| 
 | |
| /**
 | |
|   * @}
 | |
|   */
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif /* IOT_PLC_CCO_API_H */
 |