659 lines
26 KiB
C
659 lines
26 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_NW_APP_CCO_H
|
|
#define IOT_NW_APP_CCO_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types_api.h"
|
|
|
|
/* smart grid internal header files */
|
|
#include "iot_sg_msg.h"
|
|
#include "proto_nw_app.h"
|
|
#include "iot_sg_fr.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if (PLC_SUPPORT_CCO_ROLE && IOT_NW_APP_ENABLE)
|
|
|
|
/**
|
|
* @brief iot_nw_cco_send_ctrl_proto - respond message to ctrl proto.
|
|
* @param pkt: iot_pkt_t containing the data that send to controller,
|
|
* the pkt will be free.
|
|
* @param proto_type: protocol type of the pkt, see IOT_SG_CCO_CTRL_PROTO_XXX.
|
|
*/
|
|
void iot_nw_cco_send_ctrl_proto(iot_pkt_t *pkt, uint8_t proto_type);
|
|
|
|
/**
|
|
* @brief iot_nw_cco_send_ctrl_proto_passthrough - respond message to ctrl proto
|
|
* @param pkt: iot_pkt_t containing the data that send to controller,
|
|
* the pkt will be free in function.
|
|
*/
|
|
void iot_nw_cco_send_ctrl_proto_passthrough(iot_pkt_t *pkt);
|
|
|
|
/**
|
|
* @brief iot_nw_send_ack_or_nack() - send confirm/reject data to plc.
|
|
* @param role: role of the device sending the command.
|
|
* @param see NW_APP_CONTROL_PRM_xxx.
|
|
* @param ack_nack: 0 - nack, 1 - ack.
|
|
* @param reason: reject reason, only ack_nack = 0 valid.
|
|
* @param sta_mac: destination address.
|
|
* @param sn: frame sequence number.
|
|
*/
|
|
void iot_nw_send_ack_or_nack(uint8_t role, uint8_t ack_nack, uint8_t reason,
|
|
uint8_t *sta_mac, uint16_t sn);
|
|
|
|
/**
|
|
* @brief iot_nw_send_trans_data() - send transparent transfer data to plc.
|
|
* @param meter_mac: the meter addr to receive transparent transfer data.
|
|
* @param sta_mac: station mac.
|
|
* @param data: transparent transfer data.
|
|
* @param len: transparent transfer data length.
|
|
* @param sn: frame sequence number.
|
|
* @param timeout_double: 1 - meter reading timeout need to double, 0 - not.
|
|
* @param task_id: task id.
|
|
* @param mr_cmd_tx_done_func: meter reading send done callback.
|
|
* @param mr_entry: meter reading entry.
|
|
*/
|
|
void iot_nw_send_trans_data(uint8_t *meter_mac, uint8_t *sta_mac,
|
|
uint8_t *data, uint16_t len, uint16_t sn, uint8_t timeout_double,
|
|
uint16_t task_id, iot_pkt_free_func_t mr_cmd_tx_done_func,
|
|
iot_buf_pool_entry_t *mr_entry);
|
|
|
|
/**
|
|
* @brief iot_nw_send_trans_module_data() - send transparent transfer data to plc.
|
|
* @param meter_mac: the meter addr to receive transparent transfer data.
|
|
* @param sta_mac: station mac.
|
|
* @param data: transparent transfer data.
|
|
* @param len: transparent transfer data length.
|
|
* @param sn: frame sequence number.
|
|
* @param task_id: task id.
|
|
* @param work_code: work code, see NW_APP_WORK_CODE_TRANS_XXX.
|
|
* @param rev_ntb: ntb when receive this command.
|
|
* @param mr_cmd_tx_done_func: meter reading send done callback.
|
|
* @param mr_entry: meter reading entry.
|
|
*/
|
|
void iot_nw_send_trans_module_data(uint8_t *meter_mac, uint8_t *sta_mac,
|
|
uint8_t *data, uint16_t len, uint16_t sn, uint16_t task_id,
|
|
uint8_t work_code, uint32_t rev_ntb,
|
|
iot_pkt_free_func_t mr_cmd_tx_done_func, iot_buf_pool_entry_t *mr_entry);
|
|
|
|
/**
|
|
* @brief iot_nw_send_query_sec_node_reg() - send query search meter result
|
|
* @param send_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XX.
|
|
* @param sta_mac: destination address.
|
|
* @param qr_sn: return sequence number of spg when send query cmd packet
|
|
* @return: ERR_OK for success case.
|
|
* @return: other value for failed case. See ERR_XXX.
|
|
*/
|
|
uint32_t iot_nw_send_query_sec_node_reg(uint8_t send_type, uint8_t *sta_mac,
|
|
uint32_t *qr_sn);
|
|
|
|
/**
|
|
* @brief iot_nw_send_cmd_dl_meter_list() - send download search meter list
|
|
* data to plc.
|
|
* @param meter_count: meter count in search meter list.
|
|
* @param meter_mac: meter mac list. the mac count equal meter_count.
|
|
* @param sta_mac: destination address.
|
|
*/
|
|
void iot_nw_send_cmd_dl_meter_list(uint8_t meter_count, uint8_t *meter_mac,
|
|
uint8_t *sta_mac);
|
|
|
|
/**
|
|
* @brief send download mapping list data to plc.
|
|
* @param mapping_cnt: mapping list count.
|
|
* @param mapping_list: mapping list array.
|
|
*/
|
|
void iot_nw_send_cmd_dl_map_list(uint8_t mapping_cnt,
|
|
iot_sg_meter_mapping_info_t *mapping_list);
|
|
|
|
/**
|
|
* @brief iot_nw_send_cmd_set_sec_node_evt() - send command about whether
|
|
* enable sec node event report to plc.
|
|
* @param evt_rpt_enable: 0 - forbid event report, 1 - permit event report.
|
|
* @param sta_mac: destination address.
|
|
* @param send_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
*/
|
|
void iot_nw_send_cmd_set_sec_node_evt(uint8_t evt_rpt_enable, uint8_t *sta_mac,
|
|
uint8_t send_type);
|
|
|
|
/**
|
|
* @brief iot_nw_send_cmd_reboot_sec_node() - send reboot sec node command to
|
|
* plc.
|
|
* @param delay: delay time, unit: seconds.
|
|
* @param sta_mac: destination address.
|
|
*/
|
|
void iot_nw_send_cmd_reboot_sec_node(uint8_t delay, uint8_t *sta_mac);
|
|
|
|
/**
|
|
* @brief iot_nw_send_cmd_comm_test() - send communicaton test data
|
|
* to plc.
|
|
* @param test_id: test id, see NW_APP_CMD_COMM_TEST_XXX.
|
|
* @param freq_band: test data.
|
|
* @param sta_mac: destination address.
|
|
*/
|
|
void iot_nw_send_cmd_comm_test(uint8_t test_id, uint8_t freq_band,
|
|
uint8_t *sta_mac);
|
|
|
|
/**
|
|
* @brief iot_nw_cco_handle_fwd_data() - handle forward data from sta.
|
|
* @param app_data: south power grid application level message data.
|
|
* @param len: length of the data packet.
|
|
* @param src_sta_mac: mac address of the source STA who sends the data.
|
|
* @param pkt: the iot_pkt containing nw data received from PLC. the
|
|
* ownership of the pkt will be transferred.
|
|
* @retval: ERR_OK for success case. other for failure case, see ERR_XXX.
|
|
*/
|
|
uint32_t iot_nw_cco_handle_fwd_data(nw_app_data_t *app_data,
|
|
uint32_t len, uint8_t *src_sta_mac, iot_pkt_t *pkt);
|
|
|
|
/**
|
|
* @brief iot_nw_cco_handle_evt_rpt() - handle event report from power meter.
|
|
* @param app_data: south power grid application level message data.
|
|
* @param len: length of the data packet.
|
|
* @param src_sta_mac: mac address of the source STA who sends the data.
|
|
* @param pkt: the iot_pkt containing nw data received from PLC. the
|
|
* ownership of the pkt will be transferred.
|
|
* @param is_bcast: 0 - unicast, others - bcast.
|
|
*/
|
|
void iot_nw_cco_handle_evt_rpt(nw_app_data_t *app_data,
|
|
uint32_t len, uint8_t *src_sta_mac, iot_pkt_t *pkt, uint8_t is_bcast);
|
|
|
|
/**
|
|
* @brief iot_spg_cco_msdu_recv - receive a msdu
|
|
* @param src_sta_mac: the msdu source address
|
|
* @param data: msdu payload
|
|
* @param msdu_len: msdu data len
|
|
* @param pkt: plc lib message data.
|
|
* include plc lib head, msdu head and msdu payload.
|
|
* @param is_bcast: 0 - unicast, others - bcast
|
|
* @retval: 0 - the pkt is not consumed.
|
|
* 1 - the pkt is consumed.
|
|
*/
|
|
uint32_t iot_nw_cco_msdu_recv(uint8_t *src_sta_mac, uint8_t *data,
|
|
uint32_t msdu_len, iot_pkt_t *pkt, uint8_t is_bcast);
|
|
|
|
/**
|
|
* @brief iot_nw_handle_node_score_query() - query node score info.
|
|
* @param sta_mac: sta mac addr, big-endian.
|
|
* @param pm_addr: power meter addr, little-endian.
|
|
*/
|
|
void iot_nw_handle_node_score_query(uint8_t *sta_mac, uint8_t *pm_addr);
|
|
|
|
/*
|
|
* @brief: send a start upgrading cmd to STA.
|
|
* @param file_type: upgrade file type see - NW_APP_FILE_ATTRIBUTE_XXX.
|
|
* @param dest_mac: mac address of the STA.
|
|
* @param file_crc: crc of the upgrading file.
|
|
* @param file_len: length of the upgrading file.
|
|
* @param block_cnt: upgrading total block count.
|
|
* @param upgrade_win: time for upgrading, unit is minute.
|
|
* @param file_id: file identity.
|
|
* @param msg_type: msg type.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
*/
|
|
void iot_nw_cco_send_start_cmd(uint8_t file_type, uint8_t *dest_mac,
|
|
uint32_t file_crc, uint32_t file_len, uint16_t block_cnt,
|
|
uint16_t upgrade_win, uint32_t file_id, uint8_t msg_type,
|
|
uint8_t retry_cnt);
|
|
|
|
/**
|
|
* @brief query sec node base info.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param element: query element data.
|
|
* @param element_cnt: query element count.
|
|
* @param sn: sequence number of the packet.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
* @param modified: flag to mark if the element is modified.
|
|
*/
|
|
void iot_nw_cco_qry_node_base_info(uint8_t *sta_mac, const uint8_t *element,
|
|
uint8_t element_cnt, uint16_t sn, uint8_t retry_cnt, uint8_t modified);
|
|
|
|
/**
|
|
* @brief - send query status message to query sta upgrading status.
|
|
* @param dest_mac: mac of STA to query upgrading status.
|
|
* @param cnt: count of block to query.
|
|
* @param start_index: start index of the block.
|
|
* @param file_id: file identity.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
*/
|
|
void iot_nw_cco_upgrade_query_status(uint8_t *dest_mac, uint16_t cnt,
|
|
uint16_t start_idx, uint32_t file_id, uint8_t retry_cnt);
|
|
|
|
/**
|
|
* @brief - send upgrading data block to a STA.
|
|
* @param file_id: file identity.
|
|
* @param dest_mac: mac address of the destination STA.
|
|
* @param block_cnt: total block count of upgrade file.
|
|
* @param block_index: index of the block.
|
|
* @param data: pointer to data buffer.
|
|
* @param data_len: length of this upgrading data block.
|
|
* @param msg_type: type of msg to be send.
|
|
* @param sta_fwd: shall STA forward this msg as local broadcast.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
* @param bcast_tx_done_func: upgrade bcast tx done callback.
|
|
* @param p_info: cco upgrade info
|
|
*/
|
|
void iot_nw_cco_upgrade_send_data(uint32_t file_id, uint8_t *dest_mac,
|
|
uint16_t block_cnt, uint32_t block_index, const uint8_t *data,
|
|
uint16_t data_len, uint8_t msg_type, uint8_t sta_fwd, uint8_t retry_cnt,
|
|
iot_pkt_free_func_t bcast_tx_done_func, iot_sg_cco_upgrade_t *p_info);
|
|
|
|
/**
|
|
* @brief - send stop upgrading command to a STA.
|
|
* @param file_id: file identity.
|
|
* @param dest_sta_mac: mac address of the destination STA.
|
|
* @param msg_type: type of msg to be send.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
*/
|
|
void iot_nw_cco_send_stop_upgrade_cmd(uint32_t file_id, uint8_t *dest_mac,
|
|
uint8_t msg_type, uint8_t retry_cnt);
|
|
|
|
/**
|
|
* @brief - send execute upgrading command to a STA.
|
|
* @param dest_mac: mac address of the destination STA.
|
|
* @param reset_timeout: time to delay before the STA reset.
|
|
* @param file_id: file identity.
|
|
* @param msg_type: type of msg to be send.
|
|
* @param retry_cnt: retry count in mac layer.
|
|
* @param bcast_tx_done_func: upgrade bcast tx done callback.
|
|
* @param p_info: cco upgrade info
|
|
|
|
*/
|
|
void iot_nw_cco_upgrade_send_exe_cmd(uint8_t *dest_mac, uint16_t reset_timeout,
|
|
uint32_t file_id, uint8_t msg_type, uint8_t retry_cnt,
|
|
iot_pkt_free_func_t bcast_tx_done_func, iot_sg_cco_upgrade_t *p_info);
|
|
|
|
/**
|
|
* @brief collection task correct sta time.
|
|
* @param second: correct time, BCD type.
|
|
* @param minute: correct time, BCD type.
|
|
* @param hour: correct time, BCD type.
|
|
* @param day: correct time, BCD type.
|
|
* @param month: correct time, BCD type.
|
|
* @param year: correct time, BCD type.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_correct_time(uint8_t second, uint8_t minute,
|
|
uint8_t hour, uint8_t day, uint8_t month, uint8_t year, uint16_t seq);
|
|
|
|
/**
|
|
* @brief collection task init.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_init(uint8_t *sta_mac, uint16_t seq);
|
|
|
|
/**
|
|
* @brief collection task addition.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param pm_addr: mac address of the power meter, little-endian.
|
|
* @param tm: time struct.
|
|
* @param clct_task_data: collection task info data.
|
|
* @param len: data len.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_add(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
iot_sg_cco_time_t *tm, iot_sg_collect_task_t *clct_task_data, uint8_t len,
|
|
uint16_t seq);
|
|
|
|
/**
|
|
* @brief collection task delete.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param pm_addr: mac address of the power meter, little-endian.
|
|
* @param id: collection task id.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_del(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
uint8_t id, uint16_t seq);
|
|
|
|
/**
|
|
* @brief query collection task id.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param pm_addr: mac address of the power meter, little-endian.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_id_query(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
uint16_t seq);
|
|
|
|
/**
|
|
* @brief query collection task info.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param pm_addr: mac address of the power meter, little-endian.
|
|
* @param id: collection task id.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_info_query(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
uint8_t id, uint16_t seq);
|
|
|
|
/**
|
|
* @brief query collection task data.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param pm_addr: mac address of the power meter, little-endian.
|
|
* @param id: collection task id.
|
|
* @param start_time: start time, min - 6bit, hour - 5bit, day - 5bit
|
|
* @param cnt: timing count.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_clct_task_data_query(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
uint8_t id, nw_app_clct_task_data_time_t start_time, uint8_t cnt,
|
|
uint16_t seq);
|
|
|
|
/**
|
|
* @brief query node chip id info.
|
|
* @param send_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_query_chip_id_info(uint8_t send_type, uint8_t *sta_mac,
|
|
uint16_t seq);
|
|
|
|
/**
|
|
* @brief query node network info.
|
|
* @param send_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
*/
|
|
void iot_nw_cco_handle_query_net_info(uint8_t send_type, uint8_t *sta_mac,
|
|
uint16_t seq);
|
|
|
|
/**
|
|
* @brief start collect transformer ntb.
|
|
* @param seq: sequence number.
|
|
* @param start_ntb: collection start ntb.
|
|
* @param collect_cnt: collection count.
|
|
* @param collect_seq: collection sequence, the value range is 1-255.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_collect_ntb(uint16_t seq,
|
|
uint32_t start_ntb, uint8_t collect_cnt, uint8_t collect_seq);
|
|
|
|
/**
|
|
* @brief collect sec node transformer feature information.
|
|
* @param msg_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param phase: collect phase, see NW_APP_DATA_PHASE_XXX.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_feature_collect(uint8_t msg_type,
|
|
uint8_t *sta_addr, uint16_t seq, uint8_t phase);
|
|
|
|
/**
|
|
* @brief broadcast cco's transformer ntb.
|
|
* @param seq: packet sequence number.
|
|
* @param clct_cnt: collection count, include two edge data.
|
|
* @param clct_type: edge type, see IOT_PLC_ZC_CT_XXX_EDGE.
|
|
* @param collect_seq: collect sequence number.
|
|
* @param data: transformer feature data.
|
|
* @param data_len: data length.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_bcast_ntb(uint16_t seq, uint8_t clct_cnt,
|
|
uint8_t clct_type, uint8_t collect_seq, iot_plc_zc_data_t *data,
|
|
uint16_t data_len);
|
|
|
|
/**
|
|
* @brief query node transformer detect result.
|
|
* @param msg_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param phase: collect phase, see NW_APP_DATA_PHASE_XXX.
|
|
* @param collect_type:transformer feature collection type,
|
|
* see NW_APP_TSFM_COLLECT_XXX
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_query_result(uint8_t msg_type,
|
|
uint8_t *sta_addr, uint16_t seq, uint8_t phase, uint8_t collect_type);
|
|
|
|
/**
|
|
* @brief guangdong start collect transformer ntb.
|
|
* @param seq: sequence number.
|
|
* @param start_ntb: collection start ntb.
|
|
* @param collect_cnt: collection count.
|
|
* @param collect_seq: collection sequence, the value range is 1-255.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_collect_ntb_gd(uint16_t seq,
|
|
uint32_t start_ntb, uint8_t collect_cnt, uint8_t collect_seq);
|
|
|
|
/**
|
|
* @brief guangdong collect sec node transformer feature information.
|
|
* @param msg_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param phase: collect phase, see NW_APP_DATA_PHASE_XXX.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_feature_collect_gd(uint8_t msg_type,
|
|
uint8_t *sta_addr, uint16_t seq, uint8_t phase);
|
|
|
|
/**
|
|
* @brief guangdong broadcast cco's transformer ntb.
|
|
* @param seq: packet sequence number.
|
|
* @param clct_cnt: collection count, include two edge data.
|
|
* @param clct_type: edge type, see IOT_PLC_ZC_CT_XXX_EDGE.
|
|
* @param collect_seq: collect sequence number.
|
|
* @param data: transformer feature data.
|
|
* @param data_len: data length.
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_bcast_ntb_gd(uint16_t seq, uint8_t clct_cnt,
|
|
uint8_t clct_type, uint8_t collect_seq, iot_plc_zc_data_t *data,
|
|
uint16_t data_len);
|
|
|
|
/**
|
|
* @brief guangdong query node transformer detect result.
|
|
* @param msg_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param phase: collect phase, see NW_APP_DATA_PHASE_XXX.
|
|
* @param collect_type:transformer feature collection type,
|
|
* see NW_APP_TSFM_COLLECT_XXX
|
|
*/
|
|
void iot_nw_handle_tsfm_detect_query_result_gd(uint8_t msg_type,
|
|
uint8_t *sta_addr, uint16_t seq, uint8_t phase, uint8_t collect_type);
|
|
|
|
/**
|
|
* @brief query transformer phase feature info.
|
|
* @param seq: sequence number.
|
|
* @param clct_cnt: collection count.
|
|
* @param clct_seq: collection sequence, the value range is 0-255.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
*/
|
|
void iot_nw_query_sec_node_phase_feature(uint16_t seq, uint8_t clct_cnt,
|
|
uint8_t clct_seq, uint8_t *sta_addr);
|
|
|
|
/**
|
|
* @brief query node run state info.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param data: query info count.
|
|
* @param len: query data len.
|
|
* @param meter_mac: meter mac address, little-endian.
|
|
*/
|
|
void iot_nw_cco_query_run_state_info(uint8_t *sta_mac, uint16_t seq,
|
|
uint8_t *data, uint16_t len, uint8_t *meter_mac);
|
|
|
|
/**
|
|
* @brief query sec node channel info.
|
|
* @param sta_mac: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param query_channel: query channel task info data.
|
|
*/
|
|
void iot_nw_cco_query_node_channel_info(uint8_t *sta_mac, uint16_t seq,
|
|
iot_sg_cco_query_channel_info_t *query_channel);
|
|
|
|
|
|
/**
|
|
* @brief get cco base info.
|
|
* @param info_id: info id for base info.
|
|
* @param info_cnt: info cnt for base info.
|
|
* @return: pkt pointer, cco base info data.
|
|
*/
|
|
iot_pkt_t *iot_nw_cco_get_cco_base_info(uint8_t *info_id, uint8_t info_cnt);
|
|
|
|
/**
|
|
* @brief get node base info length.
|
|
* @param info_id: info id for base info.
|
|
* @param info_cnt: info cnt for base info.
|
|
* @return: node base info data length.
|
|
*/
|
|
uint16_t iot_nw_cco_sec_node_info_size_ul(uint8_t *info_id, uint8_t info_cnt);
|
|
|
|
/**
|
|
* @brief convert framework elements id to spg app elements id.
|
|
* @param info_id, see NW_APP_CMD_SEC_NODE_INFO_XXX.
|
|
* @return: elements, see IOT_SG_ELEMENT_XXX.
|
|
*/
|
|
uint8_t iot_nw_cco_info_id_to_elements(uint8_t info_id);
|
|
|
|
/**
|
|
* @brief set sec node edge computing info.
|
|
* @param sta_addr: mac address of the station, big-endian.
|
|
* @param seq: sequence number.
|
|
* @param send_type: indicate if the msg is bcast or unicast,
|
|
* see IOT_PLC_MSG_TYPE_XXX.
|
|
* @param task_id: current configure edge computing task id.
|
|
* @param edge_pib: edge computing configure info.
|
|
*/
|
|
void iot_nw_cco_handle_set_edge_computing(uint8_t *sta_addr, uint16_t seq,
|
|
uint8_t send_type, uint8_t task_id, iot_sg_edge_computing_pib_t *edge_pib);
|
|
|
|
#else
|
|
|
|
void iot_nw_cco_handle_clct_task_add(uint8_t *sta_mac, uint8_t *pm_addr,
|
|
iot_sg_cco_time_t *tm, iot_sg_collect_task_t *clct_task_data, uint8_t len,
|
|
uint16_t seq);
|
|
|
|
void iot_nw_cco_send_stop_upgrade_cmd(uint32_t file_id, uint8_t *dest_mac,
|
|
uint8_t msg_type, uint8_t retry_cnt);
|
|
|
|
#define iot_nw_cco_send_ctrl_proto(pkt, proto_type)
|
|
|
|
#define iot_nw_cco_send_ctrl_proto_passthrough(pkt)
|
|
|
|
#define iot_nw_send_ack_or_nack(role, ack_nack, reason, sta_mac, sn)
|
|
|
|
#define iot_nw_send_query_sec_node_reg(send_type, sta_mac, qr_sn) (ERR_NOSUPP)
|
|
|
|
#define iot_nw_send_trans_data(meter_mac, sta_mac, data, len, sn, \
|
|
timeout_double, task_id, mr_cmd_tx_done_func, mr_entry)
|
|
|
|
#define iot_nw_send_trans_module_data(meter_mac, sta_mac, data, len, sn, \
|
|
task_id, work_code, rev_ntb, mr_cmd_tx_done_func, mr_entry)
|
|
|
|
#define iot_nw_send_cmd_dl_meter_list(meter_count, meter_mac, sta_mac)
|
|
|
|
#define iot_nw_send_cmd_dl_map_list(mapping_cnt, mapping_list)
|
|
|
|
#define iot_nw_send_cmd_set_sec_node_evt(evt_rpt_enable, sta_mac, send_type)
|
|
|
|
#define iot_nw_send_cmd_reboot_sec_node(delay, sta_mac)
|
|
|
|
#define iot_nw_send_cmd_comm_test(test_id, freq_band, sta_mac)
|
|
|
|
#define iot_nw_cco_handle_fwd_data(app_data, len, src_sta_mac, pkt) (0)
|
|
|
|
#define iot_nw_cco_handle_evt_rpt(app_data, len, src_sta_mac, pkt, is_bcast)
|
|
|
|
#define iot_nw_cco_msdu_recv(src_sta_mac, data, msdu_len, pkt, is_bcast) (0)
|
|
|
|
#define iot_nw_handle_node_score_query(sta_mac, pm_addr)
|
|
|
|
#define iot_nw_cco_send_start_cmd(file_type, dest_mac, file_crc, file_len, \
|
|
block_cnt, upgrade_win, file_id, msg_type, retry_cnt)
|
|
|
|
#define iot_nw_cco_qry_node_base_info(sta_mac, element, element_cnt, sn, \
|
|
retry_cnt, modified);
|
|
|
|
#define iot_nw_cco_upgrade_query_status(dest_mac, cnt, start_idx, \
|
|
file_id, retry_cnt)
|
|
|
|
#define iot_nw_cco_upgrade_send_data(file_id, dest_mac, block_cnt, lock_index, \
|
|
data, data_len, msg_type, sta_fwd, retry_cnt, bcast_tx_done_func, p_info)
|
|
|
|
#define iot_nw_cco_upgrade_send_exe_cmd(dest_mac, reset_timeout, file_id, \
|
|
msg_type, retry_cnt, bcast_tx_done_func, p_info)
|
|
|
|
#define iot_nw_cco_handle_clct_task_correct_time(second, minute, hour, day, \
|
|
month, year, seq)
|
|
|
|
#define iot_nw_cco_handle_clct_task_init(sta_mac, seq)
|
|
|
|
#define iot_nw_cco_handle_clct_task_del(sta_mac, pm_addr, id, seq)
|
|
|
|
#define iot_nw_cco_handle_clct_task_id_query(sta_mac, pm_addr, seq)
|
|
|
|
#define iot_nw_cco_handle_clct_task_info_query(sta_mac, pm_addr, id, seq);
|
|
|
|
#define iot_nw_cco_handle_clct_task_data_query(sta_mac, pm_addr, id, \
|
|
start_time, cnt, seq);
|
|
|
|
#define iot_nw_cco_handle_query_chip_id_info(send_type, sta_mac, seq)
|
|
|
|
#define iot_nw_cco_handle_query_net_info(send_type, sta_mac, seq)
|
|
|
|
#define iot_nw_handle_tsfm_detect_collect_ntb(seq, start_ntb, \
|
|
collect_cnt, collect_seq)
|
|
|
|
#define iot_nw_handle_tsfm_detect_feature_collect(msg_type, sta_addr, seq, \
|
|
phase)
|
|
|
|
#define iot_nw_handle_tsfm_detect_bcast_ntb(seq, clct_cnt, clct_type, \
|
|
collect_seq, data, data_len)
|
|
|
|
#define iot_nw_handle_tsfm_detect_query_result(msg_type, sta_addr, seq, \
|
|
phase, collect_type)
|
|
|
|
#define iot_nw_handle_tsfm_detect_collect_ntb_gd(seq, start_ntb, \
|
|
collect_cnt, collect_seq)
|
|
|
|
#define iot_nw_handle_tsfm_detect_feature_collect_gd(msg_type, sta_addr, seq, \
|
|
phase)
|
|
|
|
#define iot_nw_handle_tsfm_detect_bcast_ntb_gd(seq, clct_cnt, clct_type, \
|
|
collect_seq, data, data_len)
|
|
|
|
#define iot_nw_handle_tsfm_detect_query_result_gd(msg_type, sta_addr, seq, \
|
|
phase, collect_type)
|
|
|
|
#define iot_nw_query_sec_node_phase_feature(seq, clct_cnt, clct_seq, sta_addr)
|
|
|
|
#define iot_nw_cco_query_run_state_info(sta_mac, seq, data, len, meter_mac)
|
|
|
|
#define iot_nw_cco_query_node_channel_info(sta_mac, seq, query_channel)
|
|
|
|
#define iot_nw_cco_get_cco_base_info(info_id, info_cnt) (NULL)
|
|
|
|
#define iot_nw_cco_sec_node_info_size_ul(info_id, info_cnt) (0)
|
|
|
|
#define iot_nw_cco_info_id_to_elements(info_id) (IOT_SG_ELEMENT_STA_INVALID)
|
|
|
|
#define iot_nw_cco_handle_set_edge_computing(sta_addr, seq, send_type, \
|
|
task_id, edge_pib)
|
|
|
|
#endif /* PLC_SUPPORT_CCO_ROLE && IOT_NW_APP_ENABLE */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* IOT_NW_APP_CCO_H */
|