58 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			58 lines
		
	
	
		
			1.8 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. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | 
 | ||
|  | /* common */ | ||
|  | #include "os_types.h"
 | ||
|  | #include "iot_io_api.h"
 | ||
|  | #include "iot_errno_api.h"
 | ||
|  | 
 | ||
|  | /* cli layer */ | ||
|  | #include "iot_cli_common.h"
 | ||
|  | #include "iot_cli_host_interface.h"
 | ||
|  | #include "iot_cli_plc_module.h"
 | ||
|  | #include "iot_cli_mac_test.h"
 | ||
|  | 
 | ||
|  | #if IOT_CLI_MAC_FUN_TEST_ENA
 | ||
|  | /* TODO: cli call mac api use ipc. */ | ||
|  | 
 | ||
|  | void cli_mac_fun_test(uint8_t *buffer, uint32_t bufferlen, uint8_t *src_mac) | ||
|  | { | ||
|  |     uint32_t ret; | ||
|  |     cli_mac_test_hdr_t *mac_test_hdr; | ||
|  | 
 | ||
|  |     if (!buffer || (bufferlen < sizeof(cli_mac_test_hdr_t))) { | ||
|  |         return; | ||
|  |     } | ||
|  | 
 | ||
|  |     mac_test_hdr = (cli_mac_test_hdr_t *)buffer; | ||
|  |     switch (mac_test_hdr->msg_id) { | ||
|  |     case CLI_MAC_FUN_DUMMY: /* TODO: need fix */ | ||
|  |         ret = ERR_OK; | ||
|  |         break; | ||
|  | 
 | ||
|  |     default: | ||
|  |         ret = ERR_INVAL; | ||
|  |         break; | ||
|  |     } | ||
|  | 
 | ||
|  |     iot_printf("mac_test:msgid=%d\n", mac_test_hdr->msg_id); | ||
|  | 
 | ||
|  |     //TODO: maybe need ack more info
 | ||
|  |     iot_cli_send_to_host(CLI_MSGID_MAC_FUN_TEST_RESULT, (uint8_t*)&ret, | ||
|  |         sizeof(uint32_t), src_mac); | ||
|  | 
 | ||
|  |     return; | ||
|  | } | ||
|  | #endif //IOT_CLI_MAC_FUN_TEST_ENA
 |