88 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			3.0 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_BRM_BRK_H_
 | 
						|
#define _IOT_BRM_BRK_H_
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_init() - init breaker device.
 | 
						|
 * @retval ERR_OK - for success case, othersie - error code.
 | 
						|
 */
 | 
						|
uint32_t iot_brm_brk_init();
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_mr_data() - send mr data to breaker.
 | 
						|
 * @param pkt: pointer to send data.
 | 
						|
 * @param recv_from: pkt from device, see - iot_brm_data_owner_t.
 | 
						|
 * @retval ERR_OK - for success case, pkt is consumed.
 | 
						|
 *         othersie - error code. pkt is not consumed.
 | 
						|
 */
 | 
						|
uint32_t iot_brm_brk_mr_data(iot_pkt_t *pkt, iot_brm_data_owner_t recv_from);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_switch_event_handle() - handle switch event msg.
 | 
						|
 * @param msgid: event msg, see - IOT_BRM_BRK_REQ_XXX.
 | 
						|
 */
 | 
						|
void iot_brm_brk_switch_event_handle(uint32_t msgid);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_fwd_boardcast_data() - fwd boardcast data to breaker.
 | 
						|
 * @param data: boardcast data ptr.
 | 
						|
 * @param len: boardcast data length.
 | 
						|
 * @param recv_from: pkt from device, see - iot_brm_data_owner_t.
 | 
						|
 */
 | 
						|
void iot_brm_brk_fwd_boardcast_data(uint8_t *data, uint16_t len,
 | 
						|
    iot_brm_data_owner_t recv_from);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_handle_rsp_data() - breaker handle response data.
 | 
						|
 * @param brk_pkt: pointer to breaker rsp data.
 | 
						|
 */
 | 
						|
void iot_brm_brk_handle_rsp_data(iot_pkt_t *brk_pkt);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_proto_645_r_data_hander() - handle breaker read di.
 | 
						|
 * @param di: breaker di.
 | 
						|
 * @param out_buf: read di out buffer ptr.
 | 
						|
 * @param len_out: read di length.
 | 
						|
 * @retval breaker di handle result, see - PROTO_645_2007_XXX.
 | 
						|
 */
 | 
						|
uint8_t iot_brm_brk_proto_645_r_data_hander(uint32_t di, uint8_t *out_buf,
 | 
						|
    uint8_t *len_out);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_correct_time() - breaker fwd correct time to switch.
 | 
						|
 * @retval ERR_OK - for success load correct tm.
 | 
						|
 *         othersie - error.
 | 
						|
 */
 | 
						|
uint32_t iot_brm_brk_correct_time(proto_645_corr_time_t *correct_tm);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_timeout_handle() - breaker timeout handle.
 | 
						|
 */
 | 
						|
void iot_brm_brk_timeout_handle();
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_timeout() - breaker periodic handleing function.
 | 
						|
 */
 | 
						|
void iot_brm_brk_timeout();
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_brm_brk_deinit() - deinit breaker device.
 | 
						|
 */
 | 
						|
void iot_brm_brk_deinit();
 | 
						|
 | 
						|
#endif /* _IOT_BRM_BRK_H_ */
 |