87 lines
2.8 KiB
C
87 lines
2.8 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_APP_META_HANDLE_H_
|
||
|
#define _IOT_APP_META_HANDLE_H_
|
||
|
|
||
|
/***************************************************/
|
||
|
|
||
|
/* pack for the structures in the whole file */
|
||
|
#pragma pack(push) // save the pack status
|
||
|
#pragma pack(1) // 1 byte align
|
||
|
|
||
|
/***************meta cmd struct****************/
|
||
|
|
||
|
/***************meta type network struct*******/
|
||
|
|
||
|
/***************meta type app struct*******/
|
||
|
|
||
|
/***************meta type peripheral struct*******/
|
||
|
|
||
|
/***************meta type upgrade struct*******/
|
||
|
|
||
|
/***************************************************/
|
||
|
|
||
|
typedef struct _meta_cmd_t
|
||
|
{
|
||
|
/* ID group max 1023 */
|
||
|
uint32_t id_group : 10,
|
||
|
/* ID max 1023 */
|
||
|
id : 10,
|
||
|
/* the length of tlv data, max 125 */
|
||
|
datalen : 7,
|
||
|
/* query or responce */
|
||
|
op : 1,
|
||
|
/* reserve */
|
||
|
res : 4;
|
||
|
/* tlv data */
|
||
|
uint8_t data[0];
|
||
|
} meta_cmd_t;
|
||
|
|
||
|
#define MIN_META_CMD_LEN (sizeof(meta_cmd_t))
|
||
|
|
||
|
#pragma pack(pop) /* restore the pack status */
|
||
|
|
||
|
/**
|
||
|
* @brief iot_meta_cmd_handle() - receive side unpack and handle the meta cmd
|
||
|
* @param data:point to the meta position
|
||
|
* @param data_len:the meta cmd length
|
||
|
*/
|
||
|
void iot_meta_cmd_handle(uint8_t *data, uint16_t data_len);
|
||
|
|
||
|
/**
|
||
|
* @brief meta_make_query_cmd() - pack query cmd to buffer,called by api
|
||
|
* @param id_group:id group
|
||
|
* @param id:point to the cmd id
|
||
|
* @return: ERR_OK, or error reason
|
||
|
*/
|
||
|
uint8_t meta_make_query_cmd(uint16_t id_group, uint16_t id);
|
||
|
|
||
|
/**
|
||
|
* @brief meta_rcd_app_msdu_info() - record app msdu info
|
||
|
* @param msdu: msdu info
|
||
|
* @param conn_type: msdu type
|
||
|
* @return: recd index
|
||
|
*/
|
||
|
uint8_t meta_rcd_app_msdu_info(iot_plc_msdu_recv_t *msdu, uint8_t conn_type);
|
||
|
|
||
|
/**
|
||
|
* @brief iot_meta_info_init() - init msdu info
|
||
|
* @param app_id: different app id
|
||
|
* @param module_id: app module index
|
||
|
*/
|
||
|
void iot_meta_info_init(uint8_t app_id, uint16_t module_id);
|
||
|
|
||
|
#endif /* _IOT_APP_META_HANDLE_H_ */
|