Files
kunlun/inc/host_interface/plc/iot_cli_ckb.h
2024-09-28 14:24:04 +08:00

130 lines
3.4 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_CLI_HOST_CKB_H
#define IOT_CLI_HOST_CKB_H
/* os shim includes */
#include "os_types.h"
#include "iot_utils_api.h"
#include "iot_config_api.h"
#include "iot_cli.h"
#ifdef __cplusplus
extern "C" {
#endif
#if IOT_CLI_CKB_ADDR_MAPPING
#define CMD_MAPPING_TABLE_CNT (2)
/* addr - req id mapping item */
typedef struct _cli_app_cmd_mapping_item
{
uint8_t is_used;
uint8_t mac[IOT_MAC_ADDR_LEN];
} cli_app_cmd_mapping_item;
#endif /* IOT_CLI_CKB_ADDR_MAPPING */
/**
* @brief is_local_mac - if addr of local device
* @param mac: mac addr
* @return 1 - local device
* @return 0 - for other case
*/
uint8_t is_local_mac(uint8_t* mac);
#if IOT_CLI_CKB_ADDR_MAPPING
/**
* @brief remove_addr_from_mapping_table - remove addr from mapping table
* @param mac: addr to remove
*/
void remove_addr_from_mapping_table(uint8_t* mac);
/**
* @brief add_addr_to_mapping_table - add addr in mapping table
* @param mac: addr to add
* @return 0 - for cco case
* @return otherwise - for chao kong bao case
*/
uint8_t add_addr_to_mapping_table(uint8_t* mac);
/**
* @brief get_first_ckb_addr_from_mapping_table - get ckb addr in mapping table
* @return NULL - for no chao kong bao case
* @return otherwise - for chao kong bao case
*/
uint8_t *get_first_ckb_addr_from_mapping_table();
/**
* @brief get_addr_from_mapping_table - get addr in mapping table by index
* @param mac: index to get addr
* @return NULL - for invalid index case
* @return otherwise - for normal case
*/
uint8_t *get_addr_from_mapping_table(uint8_t index);
/**
* @brief get_cmd_from_mapping_table - get item in mapping table by index
* @param mac: index to get item
* @return NULL - for invalid index case
* @return otherwise - for normal case
*/
cli_app_cmd_mapping_item* get_cmd_from_mapping_table(uint8_t index);
/**
* @brief iot_cli_addr_mapping_init - init add mapping table
*/
void iot_cli_addr_mapping_init();
/**
* @brief iot_cli_addr_mapping_deinit - deinit add mapping table
*/
void iot_cli_addr_mapping_deinit();
#else
uint8_t add_addr_to_mapping_table(uint8_t* mac);
#endif /* IOT_CLI_CKB_ADDR_MAPPING */
#if PLC_SUPPORT_CCO_ROLE
/**
* @brief iot_cli_ckb_init - init ckb module
*/
void iot_cli_ckb_init();
/**
* @brief iot_cli_ckb_deinit - deinit ckb module
*/
void iot_cli_ckb_deinit();
#endif /* PLC_SUPPORT_CCO_ROLE */
#if (IOT_STA_CONTROL_MODE == IOT_STA_CONTROL_TYPE_STA)
/**
* @brief iot_cli_host_set_sta_control_dev_type - set ckb dev type
*/
void iot_cli_host_set_ckb_dev_type();
#endif
#ifdef __cplusplus
}
#endif
#endif