77 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			77 lines
		
	
	
		
			2.3 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. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | #include "iot_board_api.h"
 | ||
|  | #include "iot_io.h"
 | ||
|  | 
 | ||
|  | #include "iot_cli_host_interface.h"
 | ||
|  | 
 | ||
|  | extern iot_cli_t cli; | ||
|  | 
 | ||
|  | uint8_t iot_cli_module_handle_msg( | ||
|  |     cli_moduleid_t moduleid, cli_msgid_t msgid, iot_cli_msg_t *msg) | ||
|  | { | ||
|  |     (void)moduleid; | ||
|  |     (void)msgid; | ||
|  |     (void)msg; | ||
|  |     return 0; | ||
|  | } | ||
|  | 
 | ||
|  | uint8_t iot_cli_module_handle_task_msg(iot_cli_msg_t *cli_msg, uint16_t id) | ||
|  | { | ||
|  |     (void)cli_msg; | ||
|  |     (void)id; | ||
|  |     return 0; | ||
|  | } | ||
|  | 
 | ||
|  | uint8_t iot_cli_module_cancel_task_msg( | ||
|  |     iot_cli_msg_t *cli_msg, uint16_t id) | ||
|  | { | ||
|  |     (void)cli_msg; | ||
|  |     (void)id; | ||
|  |     return 0; | ||
|  | } | ||
|  | 
 | ||
|  | void iot_cli_module_init_uart(commnucator_t * com, uint8_t interface_type) | ||
|  | { | ||
|  |     (void)interface_type; | ||
|  |     if (com && (com->is_initiated == 0)) { | ||
|  |         com->type = interface_type; | ||
|  |         os_mem_set(&(com->uart_frame), 0, sizeof(iot_frame_fmt)); | ||
|  |         com->uart_frame.preamble_codelen = 2; | ||
|  |         os_mem_cpy(com->uart_frame.preamble_code, "##", 2); | ||
|  |         com->uart_frame.backcode_len = 2; | ||
|  |         os_mem_cpy(com->uart_frame.backcode, "@@", 2); | ||
|  |         com->uart_frame.datalen_offset = 20; | ||
|  |         com->uart_frame.datalen_size = 4; | ||
|  |         com->uart_frame.backcode_offset = 0; | ||
|  |         com->uart_frame.frame_timeout = 200; | ||
|  | 
 | ||
|  |         com->com_num = iot_board_get_uart(UART_CLI_PORT); | ||
|  | 
 | ||
|  |         iot_printf("bt cli create uart port %lu\n", com->com_num); | ||
|  | 
 | ||
|  |         commnunicator_init(com, &cli, CALLER_PLC_CLI); | ||
|  |         cli.commu.is_initiated = 1; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | uint8_t iot_cli_proto_module_init() | ||
|  | { | ||
|  |     return 0; | ||
|  | } | ||
|  | 
 | ||
|  | void iot_cli_proto_module_deinit() | ||
|  | { | ||
|  | } |