122 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			122 lines
		
	
	
		
			3.9 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_PLC_MODULE_H
 | ||
|  | #define IOT_CLI_PLC_MODULE_H
 | ||
|  | 
 | ||
|  | /* os shim includes */ | ||
|  | #include "os_types.h"
 | ||
|  | #include "os_task.h"
 | ||
|  | #include "os_event.h"
 | ||
|  | #include "os_timer_api.h"
 | ||
|  | 
 | ||
|  | #include "iot_task.h"
 | ||
|  | #include "iot_utils.h"
 | ||
|  | #include "iot_queue.h"
 | ||
|  | #include "iot_ipc_api.h"
 | ||
|  | 
 | ||
|  | #include "iot_plc_cco_api.h"
 | ||
|  | #include "iot_plc_sta_api.h"
 | ||
|  | #include "iot_plc_lib.h"
 | ||
|  | 
 | ||
|  | #include "iot_cli.h"
 | ||
|  | #include "iot_cli_sg_api.h"
 | ||
|  | #include "iot_cli_ckb.h"
 | ||
|  | #include "iot_cli_sg.h"
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #pragma pack(push)  /* save the pack status */
 | ||
|  | #pragma pack(1)     /* 1 byte align */
 | ||
|  | 
 | ||
|  | typedef struct _iot_plc_host_config_t { | ||
|  |     /** a flag indicating if app registered successfully */ | ||
|  |     uint8_t                app_registered; | ||
|  |     /* handle of this app */ | ||
|  |     iot_plc_app_h          app_handle; | ||
|  |     /* event indicate if there are message in the queue to be handled */ | ||
|  |     os_event_h             ready_event; | ||
|  |     /* tei of local device */ | ||
|  |     uint16_t               dev_tei; | ||
|  |     /* role of local device */ | ||
|  |     uint8_t                dev_role; | ||
|  |     /* type of local device. see IOT_PLC_DEV_TYPE_XXX */ | ||
|  |     uint8_t                dev_type; | ||
|  |     /* mac address of local device */ | ||
|  |     uint8_t                mac_addr[IOT_MAC_ADDR_LEN]; | ||
|  |     /* mac address of CCo */ | ||
|  |     uint8_t                cco_mac[IOT_MAC_ADDR_LEN]; | ||
|  |     /* topo count in one packet for plc manager */ | ||
|  |     uint16_t               topo_count_in_packet; | ||
|  |     /* ckb auto query start index */ | ||
|  |     uint16_t               topo_query_start_index; | ||
|  |     /* if continually query topo */ | ||
|  |     uint8_t                continue_query  : 1, | ||
|  |     /* ckb query miss topo data */ | ||
|  |                            query_miss_topo : 1, | ||
|  |     /* topo version, see IOT_PLC_CCO_TOPO_REQ_DATA_VER_XXX */ | ||
|  |                            topo_ver        : 4, | ||
|  |     /* reserved for further use */ | ||
|  |                            rsvd            : 2; | ||
|  |     /* network sn */ | ||
|  |     uint8_t                network_sn; | ||
|  |     /* switch part */ | ||
|  |     uint8_t                switch_flag; | ||
|  |     /* ipc handler */ | ||
|  |     iot_ipc_h              ipc_h; | ||
|  | 
 | ||
|  | #if IOT_TPUT_APP_ENABLE
 | ||
|  |     iot_cli_tput_interface_t *cli_tput_interface; | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #if IOT_CLI_SG_INTERFACE_ENABLE
 | ||
|  |     /* cli host app config */ | ||
|  |     iot_cli_sg_interface_t *cli_sg_interface; | ||
|  | #endif /* IOT_CLI_SG_INTERFACE_ENABLE */
 | ||
|  | 
 | ||
|  | #if IOT_CLI_CKB_ADDR_MAPPING
 | ||
|  |     cli_app_cmd_mapping_item* cmd_mapping_table; | ||
|  |     os_mutex_h             m_mapping_table_lock; | ||
|  | #endif /* IOT_CLI_CKB_ADDR_MAPPING */
 | ||
|  | 
 | ||
|  | #if PLC_SUPPORT_CCO_ROLE
 | ||
|  | 
 | ||
|  |     /* req id for cli search meter result*/ | ||
|  |     uint8_t                cli_request_id; | ||
|  |     /* network protocol see - IOT_SG_APP_PROTO_XX */ | ||
|  |     uint8_t                proto : 2, | ||
|  |         reserved : 6; | ||
|  |     /* network formation done */ | ||
|  |     uint8_t                nw_fmt_done; | ||
|  |     /* route learning done */ | ||
|  |     uint8_t                route_learn_done; | ||
|  |     uint8_t                cli_upgrade_enabled; | ||
|  |     /* cmd src mac addr */ | ||
|  |     uint8_t                cmd_src_addr[IOT_MAC_ADDR_LEN]; | ||
|  |     /* nid */ | ||
|  |     uint32_t               nid; | ||
|  |     /* rpt topo data timer */ | ||
|  |     timer_id_t             topo_data_timer; | ||
|  | #endif
 | ||
|  | } iot_plc_host_config_t; | ||
|  | 
 | ||
|  | #pragma pack(pop)   /* restore the pack status */
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif
 |