1 /* 2 * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved. 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 */ 15 16 #ifndef _LEGA_WIFI_API_AOS_H_ 17 #define _LEGA_WIFI_API_AOS_H_ 18 19 #include "lega_wlan_api.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 typedef enum { 26 WLAN_EVENT_SCAN_COMPLETED, 27 WLAN_EVENT_ASSOCIATED, 28 WLAN_EVENT_CONNECTED, 29 WLAN_EVENT_IP_GOT, 30 WLAN_EVENT_DISCONNECTED, 31 WLAN_EVENT_AP_UP, 32 WLAN_EVENT_AP_DOWN, 33 WLAN_EVENT_SCAN_FAILED, 34 WLAN_EVENT_CONNECT_FAILED, 35 WLAN_EVENT_AP_PEER_UP, 36 WLAN_EVENT_AP_PEER_DOWN, 37 WLAN_EVENT_MAX, 38 } lega_wlan_event_e; 39 40 /** 41 * @brief Input network precise paras in lega_wlan_start_adv function. 42 */ 43 typedef struct { 44 lega_wlan_ap_info_adv_t ap_info; /**< @ref apinfo_adv_t. */ 45 char key[64]; /**< Security key or PMK of the wlan. */ 46 int key_len; /**< The length of the key. */ 47 char local_ip_addr[16]; /**< Static IP configuration, Local IP address. */ 48 char net_mask[16]; /**< Static IP configuration, Netmask. */ 49 char gateway_ip_addr[16]; /**< Static IP configuration, Router IP address. */ 50 char dns_server_ip_addr[16]; /**< Static IP configuration, DNS server IP address. */ 51 char dhcp_mode; /**< DHCP mode, @ref DHCP_Disable, @ref DHCP_Client and @ref DHCP_Server. */ 52 char reserved[32]; 53 int wifi_retry_interval; /**< Retry interval if an error is occured when connecting an access point, 54 time unit is millisecond. */ 55 } lega_wlan_init_info_adv_st; 56 57 /** @brief used in station and softap mode, get mac address(in char mode) of WIFI device 58 * 59 * @param mac_addr : pointer to get the mac address 60 * 61 * @return 0 : on success. 62 * @return other : error occurred 63 */ 64 int lega_wlan_get_mac_address_inchar(char *puc_mac); 65 66 int lega_wlan_suspend_sta(void); 67 int lega_wlan_suspend_ap(void); 68 int lega_wlan_suspend(void); 69 void lega_wlan_register_mgmt_monitor_cb(monitor_cb_t fn); 70 71 /*Wifi event callback interface 72 * 73 * @return void 74 */ 75 extern void wifi_event_cb(lega_wlan_event_e evt, void *info); 76 #ifdef __cplusplus 77 } 78 #endif 79 80 #endif // _LEGA_WIFI_API_AOS_H_ 81 82