93 lines
3.0 KiB
C
93 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 _APP_PROTO_DLT645_H_
|
|
#define _APP_PROTO_DLT645_H_
|
|
|
|
#include "app_types.h"
|
|
#include "app_common.h"
|
|
#include "proto_645.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef uint32_t (*proto_dlt645_proc_fn)(proto_645_header_t *frame,
|
|
uint8_t *out_buf, uint16_t *out_len);
|
|
|
|
typedef struct {
|
|
uint8_t fn;
|
|
uint32_t di;
|
|
proto_dlt645_proc_fn func;
|
|
} proto_dlt645_proc_func_pair;
|
|
|
|
/**
|
|
* @brief app_dlt645_init() - Initialize dlt645 resource.
|
|
*
|
|
* @param None.
|
|
*
|
|
* @return ERR_OK : initialize done;
|
|
* @return ERR_FAIL : initialize failed;
|
|
*/
|
|
uint32_t app_dlt645_init(void);
|
|
|
|
/**
|
|
* @brief app_dlt645_local_handle_list_register() - Register the local handle
|
|
* list of dlt645 frame for the specified task.
|
|
*
|
|
* @param [in] task : specified task, see app_task_e.
|
|
* @param [in] list_base : list base.
|
|
* @param [in] list_count : list count.
|
|
*
|
|
* @return ERR_OK : register done;
|
|
* @return ERR_FAIL : register failed;
|
|
*/
|
|
uint32_t app_dlt645_local_handle_list_register(app_task_e task,
|
|
proto_dlt645_proc_func_pair *list_base, uint16_t list_count);
|
|
|
|
/**
|
|
* @brief app_dlt645_uart_data_parse() - Parse data from uart. Forward the valid
|
|
* dlt645 frame to cus_task.
|
|
*
|
|
* @param [in] data : data to be parse.
|
|
* @param [in] data_length : data length.
|
|
*
|
|
* @return ERR_OK : data parse done;
|
|
* @return ERR_FAIL : error occurred, data is droped;
|
|
*/
|
|
uint32_t app_dlt645_uart_data_parse(uint8_t *data, uint16_t data_length);
|
|
|
|
/**
|
|
* @brief app_dlt645_local_handle() - Trying to handle the dlt645 frame by the
|
|
* specified task. If the frame matches in the registed handle list,
|
|
* it is handled locally, otherwise should be dispatched.
|
|
*
|
|
* @param [in] task : specified task, see app_task_e.
|
|
* @param [in] frame : dlt645 frame.
|
|
* @param [in] frame_len : dlt645 frame length.
|
|
* @param [out] pkt_ack : ack pkt with dlt645 frame.
|
|
*
|
|
* @return ERR_OK : frame is handled locally;
|
|
* @return ERR_FAIL : frame should be dispatched;
|
|
*/
|
|
uint32_t app_dlt645_local_handle(app_task_e task, proto_645_header_t *frame,
|
|
uint16_t frame_len, iot_pkt_t **pkt_ack);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _APP_PROTO_DLT645_H_ */
|