1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: HiLink SDK提供的demo示例代码(此文件为DEMO,需集成方适配修改) 15 */ 16 #include <stdio.h> 17 #include <stddef.h> 18 #include "hilink.h" 19 #include "hilink_device.h" 20 #include "cmsis_os2.h" 21 #include "hilink_socket_adapter.h" 22 GetAcV2Func(unsigned char * acKey,unsigned int acLen)23static int GetAcV2Func(unsigned char *acKey, unsigned int acLen) 24 { 25 /* key文件在开发者平台获取 */ 26 return -1; 27 } 28 hilink_wifi_main(void)29int hilink_wifi_main(void) 30 { 31 /* 注册ACKey函数 */ 32 HILINK_RegisterGetAcV2Func(GetAcV2Func); 33 34 /* 设置配网方式 */ 35 HILINK_SetNetConfigMode(HILINK_NETCONFIG_WIFI); 36 37 #ifdef CONFIG_SUPPORT_HILINK_INDIE_UPGRADE 38 if (HILINK_RegisterErrnoCallback(get_os_errno) != 0) { 39 printf("reg errno cb err\r\n"); 40 } 41 #endif 42 43 /* 修改任务属性 */ 44 HILINK_SdkAttr *sdkAttr = HILINK_GetSdkAttr(); 45 if (sdkAttr == NULL) { 46 printf("sdkAttr is null"); 47 } 48 sdkAttr->monitorTaskStackSize = 0x600; 49 HILINK_SetSdkAttr(*sdkAttr); 50 51 /* 启动Hilink SDK */ 52 if (HILINK_Main() != 0) { 53 printf("HILINK_Main start error"); 54 } 55 56 return 0; 57 } 58