364 lines
10 KiB
C
364 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_CLI_SG_H
|
|
#define IOT_CLI_SG_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
|
|
#include "iot_cli_sg_api.h"
|
|
#include "iot_config.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#pragma pack(push) /* save the pack status */
|
|
#pragma pack(1) /* 1 byte align */
|
|
|
|
#define CLI_SG_MSG_SHORT_BUF_SIZE 64
|
|
|
|
#if IOT_CLI_SG_INTERFACE_ENABLE
|
|
|
|
/**
|
|
* @brief iot_sg_cli_send_cmd() - cli sned msg to sg.
|
|
* @param req_id: request id.
|
|
* @param msg_id: massage id.
|
|
* @param data: cli data for download.
|
|
* @param data_len: cli data length.
|
|
*/
|
|
void iot_sg_cli_send_cmd(uint8_t req_id, uint8_t msg_id,
|
|
uint8_t *data, uint32_t data_len);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_prep_msg() - wrap a message to iot_pkt_t.
|
|
* @param pkt: data pointer.
|
|
* @param msg_id: massage id.
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_cli_sg_prep_msg(iot_pkt_t *pkt, uint8_t msg_id, uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_handle_msg() - message handle, receive task message for
|
|
* smart grid request.
|
|
* @param pkt: sec node start index.
|
|
*/
|
|
void iot_cli_sg_handle_msg(iot_pkt_t *pkt);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_set_mac() - set mac.
|
|
* @param req_id: request id.
|
|
* @param data: data pointer.
|
|
*/
|
|
void iot_cli_sg_set_mac(uint8_t req_id, iot_cli_sg_set_mac_dl_t *data);
|
|
|
|
#if (PLC_SUPPORT_CCO_ROLE)
|
|
|
|
/**
|
|
* @brief iot_cli_sg_get_meter_data() -get meter data
|
|
* @param req_id: request id.
|
|
* @param data: data pointer.
|
|
* @param datalen: length of the data.
|
|
*/
|
|
void iot_cli_sg_get_meter_data(uint8_t req_id, uint8_t *data,
|
|
uint32_t datalen);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_get_meter_rt_data() -get meter data in route meter reading
|
|
* @param req_id: request id.
|
|
* @param data: data pointer.
|
|
* @param datalen: length of the data.
|
|
*/
|
|
void iot_cli_sg_get_meter_rt_data(uint8_t req_id, uint8_t *data,
|
|
uint32_t datalen);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_get_report_ack() - response report ack from cli
|
|
* @param req_id: request id.
|
|
* @param data: data pointer.
|
|
* @param datalen: length of the data.
|
|
*/
|
|
void iot_cli_sg_get_report_ack(uint8_t req_id, uint8_t *data,
|
|
uint32_t datalen);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_handle_user_data() - handle user data
|
|
* @param req_id: request id.
|
|
* @param src_mac: source mac.
|
|
* @param data: data pointer.
|
|
* @param datalen: length of the data.
|
|
*/
|
|
void iot_cli_sg_handle_user_data(uint8_t req_id, uint8_t* src_mac,
|
|
uint8_t *data, uint32_t datalen);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_start_get_meter_list() - start sec node register.
|
|
* @param req_id: request id.
|
|
* @param duration: sec node register period, unit is 1 min.
|
|
*/
|
|
void iot_cli_sg_start_get_meter_list(uint8_t req_id, uint16_t duration);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_stop_get_meter_list() - stop sec node register.
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_sg_cli_stop_get_meter_list(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_get_meter_list() - query meter list.
|
|
* @param req_id: request id.
|
|
* @param start_index: sec node start index.
|
|
* @param count: the count of need to query sec node.
|
|
*/
|
|
void iot_sg_cli_get_meter_list(uint8_t req_id, uint16_t start_index,
|
|
uint8_t count);
|
|
|
|
/**
|
|
* @brief cli_upgrade_dst_status_sg_query() - sg upgrade status of the coo.
|
|
* @param req_id: request id.
|
|
*/
|
|
void cli_upgrade_dst_status_sg_query(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief cli_upgrade_dst_status_sg_list() - sg upgrade status of the sta.
|
|
* @param start_index: start id of the sta.
|
|
* @param dst_num: count of query sta
|
|
* @param req_id: request id.
|
|
*/
|
|
void cli_upgrade_dst_status_sg_list(uint16_t start_index,
|
|
uint8_t dst_num, uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_set_tsfm_detect_state() - set transformer detect state
|
|
* @param req_id: request id.
|
|
* @param data: state info
|
|
*/
|
|
void iot_sg_cli_set_tsfm_detect_state(uint8_t req_id,
|
|
iot_cli_sg_set_tsfm_detect_state_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_query_tsfm_detect_state() - query transformer detect state
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_sg_cli_query_tsfm_detect_state(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_set_con_mr_param() - set concurrence meter reading param
|
|
* @param req_id: request id.
|
|
* @param data: concurrence meter reading parameter
|
|
*/
|
|
void iot_sg_cli_set_con_mr_param(uint8_t req_id,
|
|
iot_cli_sg_con_mr_param_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_query_con_mr_param() - query concurrence meter reading
|
|
* param
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_sg_cli_query_con_mr_param(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_plc_mgr_state_change() - notify plc mgr state change to sg
|
|
* @param req_id: request id.
|
|
* @param data: plc mgr alive or not
|
|
*/
|
|
void iot_sg_cli_plc_mgr_state_change(uint8_t req_id,
|
|
iot_cli_sg_plc_mgr_state_change_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_bd_start() - start or stop branch detect
|
|
* @param req_id: request id.
|
|
* @param data: value
|
|
*/
|
|
void iot_sg_cli_bd_start(uint8_t req_id, iot_cli_sg_bd_start_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_bd_query_state() - query branch detect status
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_sg_cli_bd_query_state(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_bd_query_ret() - query branch detect result
|
|
* @param req_id: request id.
|
|
* @param data: query condition
|
|
*/
|
|
void iot_sg_cli_bd_query_ret(uint8_t req_id, iot_cli_sg_bd_query_ret_t *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_handle_msg() - message handle, receive task message for
|
|
* smart grid request.
|
|
* @param pkt: sec node start index.
|
|
*/
|
|
void iot_cli_sg_handle_msg(iot_pkt_t *pkt);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_set_event_rpt_enabled() - enabled event report
|
|
* @param req_id: request id.
|
|
* @param data: enabled flag
|
|
*/
|
|
void iot_cli_sg_set_event_rpt_enabled(uint8_t req_id,
|
|
iot_cli_sg_set_event_enabled_t *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_set_cctt_data_enabled() - enabled cctt data
|
|
* @param req_id: request id.
|
|
* @param data: enabled flag
|
|
*/
|
|
void iot_cli_sg_set_cctt_data_enabled(uint8_t req_id,
|
|
iot_cli_sg_set_cctt_data_enabled_t *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_set_esp() - set cco esp
|
|
* @param req_id: request id.
|
|
* @param data: esp info.
|
|
*/
|
|
void iot_cli_sg_set_esp(uint8_t req_id, iot_cli_sg_set_esp_t *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_query_esp() - query cco esp
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_cli_sg_query_esp(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_query_node_info() - query node information
|
|
* @param req_id: request id.
|
|
* @param data: query parameter
|
|
*/
|
|
void iot_cli_sg_query_node_info(uint8_t req_id,
|
|
iot_cli_sg_qr_node_info_dl_t *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_send_broadcast_data() - send broadcast data
|
|
* @param req_id: request id.
|
|
* @param data: broadcast data
|
|
*/
|
|
void iot_cli_sg_send_broadcast_data(uint8_t req_id,
|
|
iot_cli_sg_send_broadcast_data_dl *data);
|
|
|
|
/**
|
|
* @brief iot_cli_sg_trans_local_proto_data() - trans locak proto data
|
|
* @param req_id: request id.
|
|
* @param data: cmd data
|
|
*/
|
|
void iot_cli_sg_trans_local_proto_data(uint8_t req_id,
|
|
iot_cli_sg_trans_local_proto_data_dl_t *data);
|
|
|
|
#endif /* PLC_SUPPORT_CCO_ROLE */
|
|
|
|
#if IOT_CLI_SUPPORT_WL_CMD
|
|
|
|
/**
|
|
* @brief iot_sg_cli_query_wl_state() - query whitelist state
|
|
* @param req_id: request id.
|
|
*/
|
|
void iot_sg_cli_query_wl_state(uint8_t req_id);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_query_wl() - query whitelist
|
|
* @param req_id: request id.
|
|
* @param data: query param
|
|
*/
|
|
void iot_sg_cli_query_wl(uint8_t req_id, iot_cli_sg_query_wl_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_add_wl() - add whitelist
|
|
* @param req_id: request id.
|
|
* @param data: node info
|
|
*/
|
|
void iot_sg_cli_add_wl(uint8_t req_id, iot_cli_sg_add_wl_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_rm_wl() - remove whitelist
|
|
* @param req_id: request id.
|
|
* @param data: node info
|
|
*/
|
|
void iot_sg_cli_rm_wl(uint8_t req_id, iot_cli_sg_rm_wl_t *data);
|
|
|
|
/**
|
|
* @brief iot_sg_cli_set_wl_state() - set whitelist state
|
|
* @param req_id: request id.
|
|
* @param data: state info
|
|
*/
|
|
void iot_sg_cli_set_wl_state(uint8_t req_id, iot_cli_sg_set_wl_state_t *data);
|
|
|
|
#endif /* IOT_CLI_SUPPORT_WL_CMD */
|
|
|
|
#else /* IOT_CLI_SG_INTERFACE_ENABLE */
|
|
|
|
#define iot_sg_cli_send_cmd(req_id, msg_id, data, data_len)
|
|
|
|
#define iot_cli_sg_prep_msg(pkt, msg_id, req_id)
|
|
|
|
#define iot_cli_sg_start_get_meter_list(req_id, duration)
|
|
|
|
#define iot_sg_cli_stop_get_meter_list(req_id)
|
|
|
|
#define iot_sg_cli_get_meter_list(req_id, start_index, count)
|
|
|
|
#define iot_sg_cli_query_wl_state(req_id)
|
|
|
|
#define iot_sg_cli_query_wl(req_id, data)
|
|
|
|
#define iot_sg_cli_add_wl(req_id, data)
|
|
|
|
#define iot_sg_cli_rm_wl(req_id, data)
|
|
|
|
#define iot_sg_cli_set_wl_state(req_id, data)
|
|
|
|
#define iot_sg_cli_set_tsfm_detect_state(req_id, data)
|
|
|
|
#define iot_sg_cli_query_tsfm_detect_state(req_id)
|
|
|
|
#define iot_sg_cli_set_con_mr_param(req_id, data)
|
|
|
|
#define iot_sg_cli_query_con_mr_param(req_id)
|
|
|
|
#define iot_cli_sg_handle_msg(pkt) (pkt = pkt)
|
|
|
|
#define iot_cli_sg_set_event_rpt_enabled(req_id, data)
|
|
|
|
#define iot_cli_sg_set_cctt_data_enabled(req_id, data)
|
|
|
|
#define iot_sg_cli_bd_start(req_id, data)
|
|
|
|
#define iot_sg_cli_bd_query_state(req_id)
|
|
|
|
#define iot_sg_cli_bd_query_ret(req_id, data)
|
|
|
|
#define iot_cli_sg_set_esp(req_id, data)
|
|
|
|
#define iot_cli_sg_query_esp(req_id)
|
|
|
|
#define iot_cli_sg_query_node_info(req_id, data)
|
|
|
|
#define iot_cli_sg_send_broadcast_data(req_id, data)
|
|
|
|
#define iot_cli_sg_set_mac(req_id, data)
|
|
|
|
#define iot_cli_sg_trans_local_proto_data(req_id, data)
|
|
#endif
|
|
|
|
#pragma pack(pop) /* restore the pack status */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* IOT_CLI_SG_H */
|