1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 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 OHOS_IDL_IWIFI_HOTSPOT_IFACE_H 17 #define OHOS_IDL_IWIFI_HOTSPOT_IFACE_H 18 19 #include <stdint.h> 20 #include "wifi_error_no.h" 21 #include "i_wifi_struct.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * @Description Sets the AP event callback function. 29 * 30 * @param callback 31 * @param id - ap id 32 */ 33 void SetWifiApEventCallback(IWifiApEventCallback callback, int id); 34 35 /** 36 * @Description Obtains the AP event callback structure. 37 * 38 * @return IWifiApEventCallback* 39 */ 40 IWifiApEventCallback *GetWifiApEventCallback(int id); 41 42 /** 43 * @Description Start Ap. 44 * 45 * @return WifiErrorNo 46 * @param id - ap id 47 */ 48 WifiErrorNo StartSoftAp(int id, const char *ifaceName); 49 50 /** 51 * @Description Close Ap. 52 * 53 * @return WifiErrorNo 54 * @param id - ap id 55 */ 56 WifiErrorNo StopSoftAp(int id); 57 58 /** 59 * @Description Setting the startup configuration items of the hostapd. 60 * 61 * @param config - HostapdConfig object's point. 62 * @param id - ap id 63 * @return WifiErrorNo 64 */ 65 WifiErrorNo SetHostapdConfig(HostapdConfig *config, int id); 66 67 /** 68 * @Description Obtains information about all connected STAs. 69 * 70 * @param infos 71 * @param size 72 * @param id - ap id 73 * @return WifiErrorNo 74 */ 75 WifiErrorNo GetStaInfos(char *infos, int32_t *size, int id); 76 77 /** 78 * @Description To set the blocklist filtering in AP mode to prohibit the MAC 79 * address connection. 80 * 81 * @param mac - Mac address. 82 * @param lenMac - Mac string length. 83 * @param id - ap id 84 * @return WifiErrorNo 85 */ 86 WifiErrorNo SetMacFilter(unsigned char *mac, int lenMac, int id); 87 88 /** 89 * @Description This command is used to set blocklist filtering in AP mode and delete 90 * a specified MAC address from the blocklist. 91 * 92 * @param mac - Mac address. 93 * @param lenMac - Mac string length. 94 * @param id - ap id 95 * @return WifiErrorNo 96 */ 97 WifiErrorNo DelMacFilter(unsigned char *mac, int lenMac, int id); 98 99 /** 100 * @Description Disconnect the STA with a specified MAC address. 101 * 102 * @param mac - Mac address. 103 * @param lenMac - Mac string length. 104 * @param id - ap id 105 * @return WifiErrorNo 106 */ 107 WifiErrorNo DisassociateSta(unsigned char *mac, int lenMac, int id); 108 109 /** 110 * @Description Obtains the hotspot frequency supported by a specified frequency band. 111 * 112 * @param band - Band type. 113 * @param frequencies - Numeric group pointer of the int type. 114 * @param size - Size of the memory to which the frequencies point and the 115 * number of obtained data. 116 * @param id - ap id 117 * @return WifiErrorNo 118 */ 119 WifiErrorNo GetValidFrequenciesForBand(int32_t band, int *frequencies, int32_t *size, int id); 120 121 /** 122 * @Description Setting the Wi-Fi Country Code. 123 * 124 * @param code 125 * @param id - ap id 126 * @return WifiErrorNo 127 */ 128 WifiErrorNo SetCountryCode(const char *code, int id); 129 130 /** 131 * @Description Disconnect the STA connection based on the MAC address. 132 * 133 * @param mac - MAC address of the STA to be disconnected. 134 * @param id - ap id 135 * @return WifiErrorNo 136 */ 137 WifiErrorNo DisconnectStaByMac(const char *mac); 138 139 /** 140 * @Description Information about the disconnected or connected STA. 141 * 142 * @param callback 143 * @param id - ap id 144 * @return WifiErrorNo 145 */ 146 WifiErrorNo RegisterAsscociatedEvent(IWifiApEventCallback callback, int id); 147 148 /** 149 * @Description Get supported power model list 150 * 151 * @param model - the model to be set 152 * @param id - ap id 153 * @return ErrCode - operation result 154 */ 155 WifiErrorNo WpaSetPowerModel(const int model, int id); 156 157 /** 158 * @Description Get power model 159 * 160 * @param model - current power model 161 * @param id - ap id 162 * @return ErrCode - operation result 163 */ 164 WifiErrorNo WpaGetPowerModel(int* model, int id); 165 #ifdef __cplusplus 166 } 167 #endif 168 #endif