302 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			302 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								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_SG_CTRL_API_H_
							 | 
						|||
| 
								 | 
							
								#define _IOT_SG_CTRL_API_H_
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#include "iot_io_api.h"
							 | 
						|||
| 
								 | 
							
								#include "iot_pkt_api.h"
							 | 
						|||
| 
								 | 
							
								#include "iot_frame_parse_api.h"
							 | 
						|||
| 
								 | 
							
								#include "iot_plc_msg_api.h"
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#define iot_sg_ctrl_printf iot_cus_printf
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* ctrl data frame receive parse timeout time, the unit is 10 ms */
							 | 
						|||
| 
								 | 
							
								#define CTRL_FRAME_PARSE_TIMEOUT                100
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* driver type */
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_DRV_ID_SG                      0
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_DRV_ID_SPG                     1
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_DRV_ID_MAX                     2
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* event type */
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_DEVICE_CONNECT_CONF      1
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_DEVICE_CONNECT_FAIL      2
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_DEVICE_CONNECTED         3
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_DEVICE_DISCONNECTED      4
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_METER_DATA               5
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_ID_INFO                  6
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_CCO_DATA_RPT             7
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_EVENT_PASSTHROUGH_RPT          8
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* define of role the control connected */
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_DEV_ROLE_CCO                 1
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_DEV_ROLE_STA                 2
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* define communication mode */
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_COMMUNICAT_RSVD              0
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_COMMUNICAT_PLC               3
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* ctrl command type */
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_CMD_TYPE_MR_CCO              0
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_CMD_TYPE_MR_STA              1
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_CMD_TYPE_QR_CHIP_ID_STA      2
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_CMD_TYPE_PASSTHROUGH         3
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* ctrl id type */
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_ID_INFO_TYPE_CHIP            1
							 | 
						|||
| 
								 | 
							
								#define PROTO_CTRL_ID_INFO_TYPE_MODULE          2
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#define IOT_SG_CTRL_LOG_BUF_LEN                 1024
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_CMD_SN_MAX                     0xFF
							 | 
						|||
| 
								 | 
							
								#define IOT_CTRL_PASSTHROUGH_SN                 (IOT_CTRL_CMD_SN_MAX + 1)
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#define IOT_SG_CTRL_DEFAULT_BAUD                9600
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* node info */
							 | 
						|||
| 
								 | 
							
								typedef struct _ctrl_node_info {
							 | 
						|||
| 
								 | 
							
								    /* newwork id */
							 | 
						|||
| 
								 | 
							
								    uint32_t    nid : 24,
							 | 
						|||
| 
								 | 
							
								    /* band id */
							 | 
						|||
| 
								 | 
							
								                band_id : 8;
							 | 
						|||
| 
								 | 
							
								    /* node mac address : small endian */
							 | 
						|||
| 
								 | 
							
								    uint8_t     addr[IOT_MAC_ADDR_LEN];
							 | 
						|||
| 
								 | 
							
								} ctrl_node_info_t;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						|||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								typedef struct _iot_sg_ctrl_id_info {
							 | 
						|||
| 
								 | 
							
								    /* device type, see IOT_PLC_DEV_TYPE_XXX */
							 | 
						|||
| 
								 | 
							
								    uint8_t     dev_type;
							 | 
						|||
| 
								 | 
							
								    /* id type: see PROTO_CTRL_ID_INFO_TYPE_XXX */
							 | 
						|||
| 
								 | 
							
								    uint8_t     id_type;
							 | 
						|||
| 
								 | 
							
								    /* id data length */
							 | 
						|||
| 
								 | 
							
								    uint8_t     id_len;
							 | 
						|||
| 
								 | 
							
								    /* power meter address, little - endian */
							 | 
						|||
| 
								 | 
							
								    uint8_t     addr[IOT_MAC_ADDR_LEN];
							 | 
						|||
| 
								 | 
							
								    /* id information, 12 bytes for module id, 24 bytes for chip id */
							 | 
						|||
| 
								 | 
							
								    uint8_t     info[24];
							 | 
						|||
| 
								 | 
							
								} iot_sg_ctrl_id_info_t;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#pragma pack(pop)   /* restore the pack status */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief    function callback to init driver.
							 | 
						|||
| 
								 | 
							
								 * @return:  0           - success.
							 | 
						|||
| 
								 | 
							
								 * @return:  otherwise   - error code.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef uint32_t(*iot_sg_ctrl_drv_init_func_t)();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* function callback to deinit driver */
							 | 
						|||
| 
								 | 
							
								typedef void(*iot_sg_ctrl_drv_deinit_func_t)();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief function callback for ckq to send event report data from power.
							 | 
						|||
| 
								 | 
							
								 * @param sn:            sequence number for a packet.
							 | 
						|||
| 
								 | 
							
								 * @param dev_addr:      device addr of event reporting
							 | 
						|||
| 
								 | 
							
								 * @param dev_type:      device type, see PROTO_CTRL_DEV_ROLE_XXX.
							 | 
						|||
| 
								 | 
							
								 * @param proto_type:    proto type of data.
							 | 
						|||
| 
								 | 
							
								 * @param evt_type:      event type, see IOT_CTRL_EVENT_XXX.
							 | 
						|||
| 
								 | 
							
								 * @param data:          event report data.
							 | 
						|||
| 
								 | 
							
								 * @param len:           length of the data.
							 | 
						|||
| 
								 | 
							
								 * @return:              ERR_OK: data ok.
							 | 
						|||
| 
								 | 
							
								 *                       other: data fail.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef uint32_t(*iot_sg_ctrl_drv_event_report_data_func_t)(uint8_t sn,
							 | 
						|||
| 
								 | 
							
								    uint8_t *dev_addr, uint8_t dev_type, uint32_t proto_type,
							 | 
						|||
| 
								 | 
							
								    uint8_t evt_type, uint8_t *data, uint16_t len);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief function to handle data from UART/Concentrator.
							 | 
						|||
| 
								 | 
							
								 * @param pkt:  iot_pkt containing data to be process.
							 | 
						|||
| 
								 | 
							
								 * @return:              ERR_OK: handle data ok.
							 | 
						|||
| 
								 | 
							
								 *                       other: handle data fail.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef uint32_t(*iot_sg_ctrl_drv_data_func_t)(iot_pkt_t *pkt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief check match data.
							 | 
						|||
| 
								 | 
							
								 * @param data:          source data.
							 | 
						|||
| 
								 | 
							
								 * @return:              ERR_OK: data is match
							 | 
						|||
| 
								 | 
							
								 *                       ERR_FAIL:data is  mismatch
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef uint32_t(*iot_sg_ctrl_drv_data_check)(iot_pkt_t *pkt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief function callback for ckq to send frequency band info to driver.
							 | 
						|||
| 
								 | 
							
								 * @param rpt:           the pointer of data to report.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef void (*iot_sg_ctrl_drv_freq_band_data_func_t)(
							 | 
						|||
| 
								 | 
							
								    iot_plc_freq_band_info_query_rpt_t* rpt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief function callback for ckq to send frequency band info to driver.
							 | 
						|||
| 
								 | 
							
								 * @param result:       the result of frequency band be set.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								typedef void (*iot_sg_ctrl_drv_freq_band_set_func_t)(uint8_t result);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						|||
| 
								 | 
							
								extern "C" {
							 | 
						|||
| 
								 | 
							
								#endif
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* cqk role driver descriptor */
							 | 
						|||
| 
								 | 
							
								typedef struct _iot_ctrl_drv {
							 | 
						|||
| 
								 | 
							
								    /* id of the driver. see IOT_CTRL_DRV_ID_XXX */
							 | 
						|||
| 
								 | 
							
								    uint16_t                                   drv_id;
							 | 
						|||
| 
								 | 
							
								    /* driver operation function callbacks */
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_init_func_t                init;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_deinit_func_t              deinit;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_event_report_data_func_t   event_report_handle;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_data_func_t                ctrl_drv_data_handle;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_data_check                 check_data_handle;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_freq_band_data_func_t      freq_band_report_cb;
							 | 
						|||
| 
								 | 
							
								    iot_sg_ctrl_drv_freq_band_set_func_t       freq_band_set_result_cb;
							 | 
						|||
| 
								 | 
							
								} iot_ctrl_drv_t;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						|||
| 
								 | 
							
								}
							 | 
						|||
| 
								 | 
							
								#endif
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_ctrl_uart_send() -send the buffer by uart, it is a asyn func.
							 | 
						|||
| 
								 | 
							
								 * @param pkt:                  the iot pkt buffer.
							 | 
						|||
| 
								 | 
							
								 * @return                      ERR_OK(0) -- success
							 | 
						|||
| 
								 | 
							
								 * @return                      otherwise -- error code.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_ctrl_uart_send(iot_pkt_t *pkt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_send_data() -ckq send the data by plc.
							 | 
						|||
| 
								 | 
							
								 * @param cmd_type:             command type, see PROTO_CTRL_CMD_TYPE_XXX.
							 | 
						|||
| 
								 | 
							
								 * @param app_sn:               data packet sequence number.
							 | 
						|||
| 
								 | 
							
								 * @param pkt:                  the iot pkt data, it's used retry, consumed.
							 | 
						|||
| 
								 | 
							
								 * @return                      ERR_OK(0) -- success
							 | 
						|||
| 
								 | 
							
								 * @return                      otherwise -- error code.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint32_t iot_sg_ctrl_send_data(uint8_t cmd_type, uint16_t app_sn,
							 | 
						|||
| 
								 | 
							
								    iot_pkt_t *pkt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_config_uart() - set the uart paramter.
							 | 
						|||
| 
								 | 
							
								 *                              will be empty when call this function
							 | 
						|||
| 
								 | 
							
								 * @param baud:                 baudrate
							 | 
						|||
| 
								 | 
							
								 * @param parity:               see IOT_UART_PARITY_XXX
							 | 
						|||
| 
								 | 
							
								 * @param data:                 data bits
							 | 
						|||
| 
								 | 
							
								 * @param stop:                 stop flag
							 | 
						|||
| 
								 | 
							
								 * @param fmt:                  a parse format
							 | 
						|||
| 
								 | 
							
								 * @return                      false -- for failure case
							 | 
						|||
| 
								 | 
							
								 * @return                      true  -- iot uart handle
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint32_t iot_sg_ctrl_config_uart(uint32_t baud, uint8_t parity,
							 | 
						|||
| 
								 | 
							
								    uint8_t data, uint8_t stop, iot_frame_fmt *fmt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_proto_connect() - .
							 | 
						|||
| 
								 | 
							
								 *                              connect node in ctrl protol
							 | 
						|||
| 
								 | 
							
								 * @param node_addr:            connect node address
							 | 
						|||
| 
								 | 
							
								 * @param app_sn:               sequence number
							 | 
						|||
| 
								 | 
							
								 * @return                      ERR_OK(0) -- success
							 | 
						|||
| 
								 | 
							
								 * @return                      otherwise -- error code.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint32_t iot_sg_ctrl_proto_connect(uint8_t *node_addr, uint8_t app_sn);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_reset_connet_status() - .
							 | 
						|||
| 
								 | 
							
								 *                              reset connect status
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_sg_ctrl_reset_connet_status();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_proto_connect_from_scan_node() - .
							 | 
						|||
| 
								 | 
							
								 *                              connect node in ctrl protol from scan node
							 | 
						|||
| 
								 | 
							
								 * @param node_addr:            connect node address - small Endian
							 | 
						|||
| 
								 | 
							
								 * @param app_sn:               sequence number
							 | 
						|||
| 
								 | 
							
								 * @return                      ERR_OK(0) -- success
							 | 
						|||
| 
								 | 
							
								 * @return                      otherwise -- error code.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint32_t iot_sg_ctrl_proto_connect_from_scan_node(uint8_t *node_addr,
							 | 
						|||
| 
								 | 
							
								    uint8_t app_sn);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief iot_sg_ctrl_read_meter() - ckq send read meter to sta.
							 | 
						|||
| 
								 | 
							
								 * @param data:                 read meter data
							 | 
						|||
| 
								 | 
							
								 * @param datalen:              data length
							 | 
						|||
| 
								 | 
							
								 * @param sn:                   sequence number
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_sg_ctrl_read_meter(uint8_t *data, uint16_t datalen, uint16_t sn);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   iot_sg_ctrl_get_vendor_id() - get fixed vendor id
							 | 
						|||
| 
								 | 
							
								 * @return: vendor id
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint16_t iot_sg_ctrl_get_vendor_id();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   iot_sg_ctrl_get_chip_code() - get fixed chip code
							 | 
						|||
| 
								 | 
							
								 * @return: chip code
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint16_t iot_sg_ctrl_get_chip_code();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief  iot_sg_ctrl_get_freq_band_msg() - query carrier comm param.
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_sg_ctrl_get_freq_band_msg();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief  iot_sg_ctrl_set_freq_band_msg() - set carrier comm param.
							 | 
						|||
| 
								 | 
							
								 * @param freq_band:            frequence band value see - PLC_LIB_FREQ_BAND_XXX
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_sg_ctrl_set_freq_band_msg(uint8_t freq_band);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   iot_sg_ctrl_get_scan_node_cnt() - get node total count in scan
							 | 
						|||
| 
								 | 
							
								 * @return: total node count
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint8_t iot_sg_ctrl_get_scan_node_cnt();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   iot_sg_ctrl_get_scan_node_info() - get node information
							 | 
						|||
| 
								 | 
							
								 * @param node_list:             output - node information ptr
							 | 
						|||
| 
								 | 
							
								 * @param start_index:           start index , begin is 1
							 | 
						|||
| 
								 | 
							
								 * @param cnt:                   get node count
							 | 
						|||
| 
								 | 
							
								 * @return: node count
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint8_t iot_sg_ctrl_get_scan_node_info(ctrl_node_info_t *node_list,
							 | 
						|||
| 
								 | 
							
								    uint8_t start_index, uint8_t cnt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   get connect device role
							 | 
						|||
| 
								 | 
							
								 * @return: role, see IOT_PLC_DEV_ROLE_XXX
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint8_t iot_sg_ctrl_get_connect_role();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/* iot_sg_ctrl_data_print - data printing method
							 | 
						|||
| 
								 | 
							
								 * @str:    a short string to be printed before data
							 | 
						|||
| 
								 | 
							
								 * @buf:    buffer contain data to be printed
							 | 
						|||
| 
								 | 
							
								 * @len:    length of data in the buffer
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								void iot_sg_ctrl_data_print(const char* str, uint8_t* buf, uint32_t len);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * @brief   get passthrough state for sta
							 | 
						|||
| 
								 | 
							
								 * @return: 0 - idle, could add passthrough task,
							 | 
						|||
| 
								 | 
							
								 *          1 - busy, could't add passthrough task
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								uint8_t iot_sg_ctrl_get_sta_passthrough_state();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#endif //_IOT_SG_CTRL_API_H_
							 |