liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | /** |
| 2 | * @file ql_wifi.h |
| 3 | * @brief Quectel Openlinux WiFi public function declarations. |
| 4 | * |
| 5 | * @note |
| 6 | * |
| 7 | * @copyright Copyright (c) 2009-2017 @ Quectel Wireless Solutions Co., Ltd. |
| 8 | */ |
| 9 | /*================================================================ |
| 10 | Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. |
| 11 | Quectel Wireless Solution Proprietary and Confidential. |
| 12 | =================================================================*/ |
| 13 | |
| 14 | /*===================================================================== |
| 15 | |
| 16 | EDIT HISTORY FOR MODULE |
| 17 | |
| 18 | This section contains comments describing changes made to the module. |
| 19 | Notice that changes are listed in reverse chronological order. |
| 20 | |
| 21 | WHEN WHO WHAT, WHERE, WHY |
| 22 | ------------ ------- ---------------------------------------- |
| 23 | 11/20/2011 Paddy Initial creation. |
| 24 | |
| 25 | =======================================================================*/ |
| 26 | |
| 27 | #ifndef __QL_WIFI_H__ |
| 28 | #define __QL_WIFI_H__ |
| 29 | |
| 30 | #include <stdbool.h> |
| 31 | #include <netinet/in.h> |
| 32 | |
| 33 | #define QL_WIFI_AP_AUTH_OPEN "none" |
| 34 | #define QL_WIFI_AP_AUTH_WPA_PSK "psk" |
| 35 | #define QL_WIFI_AP_AUTH_WPA2_PSK "psk2" |
| 36 | #define QL_WIFI_AP_AUTH_WPA_WPA2_PSK "psk-mixed" |
| 37 | |
| 38 | #define QL_WIFI_AP_AUTH_WPA_PAIRWISE_TKIP "tkip" |
| 39 | #define QL_WIFI_AP_AUTH_WPA_PAIRWISE_AES "aes" |
| 40 | #define QL_WIFI_AP_AUTH_WPA_PAIRWISE_BOTH "tkip+aes" |
| 41 | |
| 42 | #define QL_WIFI_AP_BANDWIDTH_20MHZ "HT20" |
| 43 | #define QL_WIFI_AP_BANDWIDTH_40MHZ "HT40-" |
| 44 | #define QL_WIFI_AP_BANDWIDTH_80MHZ "HT40+" |
| 45 | |
| 46 | #define QL_WIFI_AP_MODE_80211B "11b" |
| 47 | #define QL_WIFI_AP_MODE_80211BG "11bg" |
| 48 | #define QL_WIFI_AP_MODE_80211BGN "11bgn" |
| 49 | |
| 50 | |
| 51 | typedef enum { |
| 52 | WIFI_WORK_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 53 | WIFI_WORK_MODE_AP_V01 = 0, |
| 54 | WIFI_WORK_MODE_STA_V01 = 1, |
| 55 | WIFI_WORK_MODE_AP_STA_V01 = 2, |
| 56 | WIFI_WORK_MODE_AP_AP_V01 = 3, |
| 57 | WIFI_WORK_MODE_MAX_V01 = 4, |
| 58 | WIFI_WORK_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 59 | }wifi_work_mode_e_v01; |
| 60 | |
| 61 | typedef enum { |
| 62 | WIFI_IEEE80211_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 63 | WIFI_MODE_11A_V01 = 0, |
| 64 | WIFI_MODE_11AN_V01 = 1, |
| 65 | WIFI_MODE_11B_V01 = 2, |
| 66 | WIFI_MODE_11BG_V01 = 3, |
| 67 | WIFI_MODE_11BGN_V01 = 4, |
| 68 | WIFI_MODE_11AC_V01 = 5, |
| 69 | WIFI_IEEE80211_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 70 | }wifi_ieee80211_mode_e_v01;; |
| 71 | |
| 72 | |
| 73 | |
| 74 | typedef enum { |
| 75 | WIFI_BANDWIDTH_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 76 | WIFI_BANDWIDTH_20MHZ_V01 = 0, |
| 77 | WIFI_BANDWIDTH_40MHZ_V01 = 1, |
| 78 | WIFI_BANDWIDTH_80MHZ_V01 = 2, |
| 79 | WIFI_BANDWIDTH_160MHZ_V01 = 3, |
| 80 | WIFI_BANDWIDTH_MAX_V01 = 4, |
| 81 | WIFI_BANDWIDTH_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 82 | }wifi_bandwidth_e_v01; |
| 83 | |
| 84 | typedef enum { |
| 85 | WIFI_AUTH_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 86 | WIFI_AUTH_OPEN_V01 = 0, |
| 87 | WIFI_AUTH_WEP_V01 = 1, |
| 88 | WIFI_AUTH_WPA_PSK_V01 = 2, |
| 89 | WIFI_AUTH_WPA2_PSK_V01 = 3, |
| 90 | WIFI_AUTH_WPA_WPA2_PSK_BOTH_V01 = 4, |
| 91 | WIFI_AUTH_WPA_V01 = 5, |
| 92 | WIFI_AUTH_WPA2_V01 = 6, |
| 93 | WIFI_AUTH_WPA_WPA2_BOTH_V01 = 7, |
| 94 | WIFI_AUTH_WPS_V01 = 8, |
| 95 | WIFI_AUTH_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 96 | }wifi_auth_e_v01; |
| 97 | /** |
| 98 | @} |
| 99 | */ |
| 100 | |
| 101 | /** @addtogroup ql_manager_access_msgr_wifi_qmi_enums |
| 102 | @{ |
| 103 | */ |
| 104 | typedef enum { |
| 105 | WIFI_WPA_PAIRWISE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 106 | WIFI_AUTH_WPA_PAIRWISE_TKIP_V01 = 0, |
| 107 | WIFI_AUTH_WPA_PAIRWISE_AES_V01 = 1, |
| 108 | WIFI_AUTH_WPA_PAIRWISE_BOTH_V01 = 2, |
| 109 | WIFI_WPA_PAIRWISE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 110 | }wifi_wpa_pairwise_e_v01; |
| 111 | |
| 112 | typedef enum { |
| 113 | QL_WIFI_EVENT_ENABLE_STATUS = 0, |
| 114 | QL_WIFI_EVENT_DISABLE_STATUS, |
| 115 | QL_WIFI_EVENT_AP_STATION, |
| 116 | QL_WIFI_EVENT_STA_STATUS, |
| 117 | QL_WIFI_EVENT_STA_SCAN_DONE, |
| 118 | } ql_wifi_event_type_e; |
| 119 | |
| 120 | typedef enum { |
| 121 | QL_WIFI_STATUS_ENABLE = 0, |
| 122 | QL_WIFI_STATUS_DISABLE, |
| 123 | QL_WIFI_STATUS_ERR_DRIVER, |
| 124 | QL_WIFI_STATUS_ERR_SOFTWARE, |
| 125 | } ql_wifi_status_e; |
| 126 | |
| 127 | typedef enum { |
| 128 | QL_WIFI_STATION_DISABLE = 0, /* WiFi station is not enable */ |
| 129 | QL_WIFI_STATION_CONNECTED, /* WiFi station is connected hotspot */ |
| 130 | QL_WIFI_STATION_DISCONNECTED /* WiFi station is disconnect hotspot */ |
| 131 | } ql_wifi_station_status_e; |
| 132 | |
| 133 | typedef struct { |
| 134 | ql_wifi_event_type_e id; |
| 135 | union { |
| 136 | /* the QL_WIFI_ENABLE_STATUS or QL_WIFI_DISABLE_STATUS event */ |
| 137 | ql_wifi_status_e status; |
| 138 | struct { |
| 139 | /* |
| 140 | * If connected is true, the station is connected wifi hotspot. |
| 141 | * If connected is false, the station is disconnected wifi hotspot. |
| 142 | */ |
| 143 | bool connected; |
| 144 | unsigned char mac[6]; |
| 145 | } ap_sta_info; |
| 146 | ql_wifi_station_status_e sta_status; |
| 147 | }; |
| 148 | } ql_wifi_event_s; |
| 149 | |
| 150 | typedef void (*wifi_event_handle)(ql_wifi_event_s *event, void *arg); |
| 151 | |
| 152 | typedef enum { |
| 153 | QL_WIFI_WORK_MODE_STA = 0, /* WiFi is in STA Mode */ |
| 154 | QL_WIFI_WORK_MODE_AP0, /* WiFi is in AP Mode */ |
| 155 | QL_WIFI_WORK_MODE_AP0_STA, /* WiFi is in AP/STA Mode */ |
| 156 | QL_WIFI_WORK_MODE_AP0_AP1 /* WiFi is in AP/AP Mode */ |
| 157 | } ql_wifi_work_mode_e; |
| 158 | |
| 159 | typedef enum { |
| 160 | QL_WIFI_AP_INDEX_AP0 = 0, /* Index 0 of AP/AP-STA/AP-AP Mode */ |
| 161 | QL_WIFI_AP_INDEX_AP1 /* Index 1 of AP/AP-STA/AP-AP Mode */ |
| 162 | } ql_wifi_ap_index_e; |
| 163 | |
| 164 | typedef enum { |
| 165 | QL_WIFI_MODE_80211B = 0, /* IEEE 802.11b (2.4 GHz) */ |
| 166 | QL_WIFI_MODE_80211BG, /* IEEE 802.11bg (2.4 GHz) */ |
| 167 | QL_WIFI_MODE_80211BGN, /* IEEE 802.11bgn (2.4 GHz) */ |
| 168 | QL_WIFI_MODE_80211A, /* IEEE 802.11a (5 GHz) */ |
| 169 | QL_WIFI_MODE_80211AN, /* IEEE 802.11an (5 GHz) */ |
| 170 | QL_WIFI_MODE_80211AC /* IEEE 802.11ac (5 GHz) */ |
| 171 | } ql_wifi_mode_type_e; |
| 172 | |
| 173 | typedef enum { |
| 174 | QL_WIFI_BANDWIDTH_HT20 = 0, |
| 175 | QL_WIFI_BANDWIDTH_HT40, |
| 176 | QL_WIFI_BANDWIDTH_HT80 |
| 177 | } ql_wifi_bandwidth_type_e; |
| 178 | |
| 179 | typedef enum { |
| 180 | QL_WIFI_SSID_HIDE_DISABLE = 0, |
| 181 | QL_WIFI_SSID_HIDE_ENABLE, |
| 182 | } ql_wifi_ssidhide_type_e; |
| 183 | |
| 184 | typedef enum { |
| 185 | QL_WIFI_AUTH_OPEN = 0, /* Open */ |
| 186 | QL_WIFI_AUTH_WPA_PSK, /* WPA Personal */ |
| 187 | QL_WIFI_AUTH_WPA2_PSK, /* WPA2 Personal */ |
| 188 | QL_WIFI_AUTH_WPA_WPA2_PSK_BOTH, /* WPA&WPA2 Personal */ |
| 189 | } ql_wifi_auth_e; |
| 190 | |
| 191 | typedef enum { |
| 192 | QL_WIFI_AUTH_WPA_PAIRWISE_AUTO = 0, /* contain TKIP and AES */ |
| 193 | QL_WIFI_AUTH_WPA_PAIRWISE_TKIP, |
| 194 | QL_WIFI_AUTH_WPA_PAIRWISE_AES |
| 195 | } ql_wifi_auth_wpa_psk_e; |
| 196 | |
| 197 | typedef struct { |
| 198 | int auth; |
| 199 | union { |
| 200 | struct { |
| 201 | int default_index; |
| 202 | char passwd[4][64]; |
| 203 | } wep; |
| 204 | |
| 205 | struct { |
| 206 | short pairwise; |
| 207 | char passwd[64]; |
| 208 | int group_rekey; |
| 209 | } wpa_psk; |
| 210 | }; |
| 211 | } ql_wifi_ap_auth_s; |
| 212 | |
| 213 | |
| 214 | typedef enum { |
| 215 | WIFI_IDX_AP_0 = 1, |
| 216 | WIFI_IDX_AP_1, |
| 217 | WIFI_IDX_STA_0 |
| 218 | } wifi_index_e; |
| 219 | |
| 220 | typedef enum { |
| 221 | WIFI_WORK_MODE_AP = 0, |
| 222 | WIFI_WORK_MODE_STA, |
| 223 | WIFI_WORK_MODE_AP_STA, |
| 224 | WIFI_WORK_MODE_AP_AP, |
| 225 | WIFI_WORK_MODE_MAX |
| 226 | } wifi_work_mode_e; |
| 227 | |
| 228 | typedef enum { |
| 229 | WIFI_START = 0, |
| 230 | WIFI_STOP, |
| 231 | WIFI_RESTART, |
| 232 | } wifi_active_e; |
| 233 | |
| 234 | typedef enum { |
| 235 | WIFI_MODE_11A = 0, |
| 236 | WIFI_MODE_11AN, |
| 237 | WIFI_MODE_11B, |
| 238 | WIFI_MODE_11BG, |
| 239 | WIFI_MODE_11BGN, |
| 240 | WIFI_MODE_11AC |
| 241 | } wifi_ieee80211_mode_e; |
| 242 | |
| 243 | typedef enum { |
| 244 | WIFI_BANDWIDTH_20MHZ = 0, |
| 245 | WIFI_BANDWIDTH_40MHZ, |
| 246 | WIFI_BANDWIDTH_80MHZ, |
| 247 | WIFI_BANDWIDTH_160MHZ, |
| 248 | WIFI_BANDWIDTH_MAX, |
| 249 | } wifi_bandwidth_e; |
| 250 | |
| 251 | typedef enum { |
| 252 | WIFI_AUTH_OPEN = 0, |
| 253 | WIFI_AUTH_WEP, |
| 254 | WIFI_AUTH_WPA_PSK, |
| 255 | WIFI_AUTH_WPA2_PSK, |
| 256 | WIFI_AUTH_WPA_WPA2_PSK_BOTH, |
| 257 | WIFI_AUTH_WPA, |
| 258 | WIFI_AUTH_WPA2, |
| 259 | WIFI_AUTH_WPA_WPA2_BOTH, |
| 260 | WIFI_AUTH_WPS |
| 261 | } wifi_auth_e; |
| 262 | |
| 263 | typedef enum { |
| 264 | WIFI_AUTH_WPA_PAIRWISE_TKIP = 0, |
| 265 | WIFI_AUTH_WPA_PAIRWISE_AES, |
| 266 | WIFI_AUTH_WPA_PAIRWISE_BOTH |
| 267 | } wifi_wpa_pairwise_e; |
| 268 | |
| 269 | typedef enum { |
| 270 | WIFI_SSID_HIDE_DISABLE = 0, |
| 271 | WIFI_SSID_HIDE_ENABLE |
| 272 | } wifi_ssid_hide_state_e; |
| 273 | |
| 274 | |
| 275 | struct _auth { |
| 276 | unsigned char auth; |
| 277 | struct { |
| 278 | unsigned char pairwise; |
| 279 | unsigned char group_rekey; |
| 280 | unsigned char passwd[64]; |
| 281 | } wpa_psk; |
| 282 | |
| 283 | }; |
| 284 | |
| 285 | |
| 286 | typedef enum { |
| 287 | WIFI_INDEX_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 288 | WIFI_IDX_AP_0_V01 = 1, |
| 289 | WIFI_IDX_AP_1_V01 = 2, |
| 290 | WIFI_IDX_STA_0_V01 = 3, |
| 291 | WIFI_INDEX_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 292 | }wifi_index_e_v01; |
| 293 | |
| 294 | typedef enum { |
| 295 | RTK_WIFI_IEEE80211_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/ |
| 296 | RTK_WIFI_WORKMODE_11B_V01 = 1, |
| 297 | RTK_WIFI_WORKMODE_11BG_V01 = 3, |
| 298 | RTK_WIFI_WORKMODE_11BGN_V01 = 11, |
| 299 | RTK_WIFI_IEEE80211_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/ |
| 300 | }rtk_wifi_ieee80211_mode_e_v01; |
| 301 | |
| 302 | typedef enum { |
| 303 | QL_WIFI_AUTH_OPEN_V01 = 0, /* Open */ |
| 304 | QL_WIFI_SHARED_KEY, /* Shared key */ |
| 305 | QL_WIFI_AUTO /* Auto */ |
| 306 | } ql_wifi_auth_type_e; |
| 307 | |
| 308 | typedef enum { |
| 309 | QL_WIFI_ENCRYPT_TKIP = 2, /* TKIP */ |
| 310 | QL_WIFI_ENCRYPT_AES = 8, /* AES */ |
| 311 | QL_WIFI_ENCRYPT_TKIP_AES_MIXED = 10 /* TKIP & AES MIXED */ |
| 312 | } ql_wifi_encrypt_mode_e; |
| 313 | |
| 314 | typedef enum { |
| 315 | QL_WIFI_PSK_DISABLE = 0, /* Encrypt disable */ |
| 316 | QL_WIFI_PSK_WPA, /* WPA */ |
| 317 | QL_WIFI_PSK_WPA2, /* WPA2 */ |
| 318 | QL_WIFI_PSK_WPA_WPA2, /* WPA-WPA2 */ |
| 319 | } ql_wifi_psk_enable_e; |
| 320 | |
| 321 | |
| 322 | |
| 323 | #define QL_WIFI_MAX_STA_NUM 16 |
| 324 | |
| 325 | struct ql_mgmt_client_wifi_work_mode { |
| 326 | /* |
| 327 | * WiFi work mode support AP, STA, AP+STA, AP-AP |
| 328 | */ |
| 329 | wifi_work_mode_e work_mode; |
| 330 | }; |
| 331 | |
| 332 | struct ql_mgmt_client_wifi_enable { |
| 333 | bool state; |
| 334 | }; |
| 335 | |
| 336 | struct ql_mgmt_client_wifi_country_code { |
| 337 | char country_code[2]; |
| 338 | }; |
| 339 | |
| 340 | struct ql_mgmt_client_wifi_mode { |
| 341 | wifi_index_e id; |
| 342 | wifi_ieee80211_mode_e mode; |
| 343 | }; |
| 344 | |
| 345 | struct ql_mgmt_client_wifi_channel { |
| 346 | wifi_index_e id; |
| 347 | int channel; |
| 348 | }; |
| 349 | |
| 350 | struct ql_mgmt_client_wifi_essid { |
| 351 | wifi_index_e id; |
| 352 | char ssid[32]; |
| 353 | }; |
| 354 | |
| 355 | struct ql_mgmt_client_wifi_ssid_hide { |
| 356 | wifi_index_e id; |
| 357 | wifi_ssid_hide_state_e state; |
| 358 | }; |
| 359 | |
| 360 | struct ql_mgmt_client_wifi_bandwidth { |
| 361 | wifi_index_e id; |
| 362 | wifi_bandwidth_e bandwidth; |
| 363 | }; |
| 364 | |
| 365 | struct ql_mgmt_client_wifi_max_sta { |
| 366 | wifi_index_e id; |
| 367 | int num; |
| 368 | }; |
| 369 | |
| 370 | |
| 371 | struct ql_mgmt_client_wifi_active { |
| 372 | wifi_index_e_v01 id; |
| 373 | unsigned char action_type; |
| 374 | }; |
| 375 | |
| 376 | struct ql_mgmt_client_wifi_auth { |
| 377 | wifi_index_e id; |
| 378 | wifi_auth_e auth; |
| 379 | union { |
| 380 | struct { |
| 381 | int default_index; |
| 382 | char password[4][64]; |
| 383 | } wep; |
| 384 | struct { |
| 385 | wifi_wpa_pairwise_e pairwise; |
| 386 | char password[64]; |
| 387 | int group_rekey; |
| 388 | } wpa_psk; |
| 389 | }; |
| 390 | }; |
| 391 | |
| 392 | struct ql_mgmt_client_wifi_rssi { |
| 393 | wifi_index_e id; |
| 394 | int rssi; |
| 395 | }; |
| 396 | |
| 397 | struct ql_mgmt_client_wifi_sta_info { |
| 398 | int count; |
| 399 | struct { |
| 400 | int ip; |
| 401 | char mac[6]; |
| 402 | char hostname[32]; |
| 403 | char ssid[32]; |
| 404 | int uptime; |
| 405 | long long tx_bytes; |
| 406 | long long rx_bytes; |
| 407 | } sta[QL_WIFI_MAX_STA_NUM]; |
| 408 | }; |
| 409 | typedef struct{ |
| 410 | struct ql_mgmt_client_wifi_enable enable; |
| 411 | |
| 412 | |
| 413 | }ql_mgmt_client_wifi_s_test; |
| 414 | |
| 415 | typedef struct { |
| 416 | union { |
| 417 | struct ql_mgmt_client_wifi_work_mode work_mode; |
| 418 | struct ql_mgmt_client_wifi_enable enable; |
| 419 | struct ql_mgmt_client_wifi_country_code country_code; |
| 420 | struct ql_mgmt_client_wifi_mode mode; |
| 421 | struct ql_mgmt_client_wifi_channel channel; |
| 422 | struct ql_mgmt_client_wifi_essid ssid; |
| 423 | struct ql_mgmt_client_wifi_ssid_hide ssid_hide; |
| 424 | struct ql_mgmt_client_wifi_bandwidth bandwidth; |
| 425 | struct ql_mgmt_client_wifi_max_sta max_sta; |
| 426 | struct ql_mgmt_client_wifi_active active; |
| 427 | struct ql_mgmt_client_wifi_auth auth; |
| 428 | struct ql_mgmt_client_wifi_rssi rssi; |
| 429 | struct ql_mgmt_client_wifi_sta_info sta_info; |
| 430 | }; |
| 431 | } ql_mgmt_client_wifi_s; |
| 432 | |
| 433 | |
| 434 | extern int ql_wifi_enable(void); |
| 435 | |
| 436 | /** |
| 437 | * Disables the WLAN. This function removes the kernel module for the Wi-Fi driver. |
| 438 | * |
| 439 | * @param None |
| 440 | * |
| 441 | * @return |
| 442 | * On success, 0 is returned. On error, -1 is returned. |
| 443 | * |
| 444 | */ |
| 445 | extern int ql_wifi_disable(void); |
| 446 | |
| 447 | /** |
| 448 | * Create thread to enables the WLAN. This function enables the WLAN based on the hostpad or wpa_supplicant |
| 449 | * configuration provided. This function inserts the WLAN kernel module and advertises the SSID. |
| 450 | * |
| 451 | * @param None |
| 452 | * |
| 453 | * @return |
| 454 | * On success, 0 is returned. On error, -1 is returned. |
| 455 | * |
| 456 | */ |
| 457 | |
| 458 | |
| 459 | extern int ql_wifi_status_get(ql_wifi_status_e *status); |
| 460 | |
| 461 | /** |
| 462 | * Set the WiFi configuration: WiFi work mode configuration. |
| 463 | * |
| 464 | * @param [in] WiFi work mode |
| 465 | * |
| 466 | * @return |
| 467 | * On success, 0 is returned. On error, -1 is returned. |
| 468 | * |
| 469 | * @dependencies |
| 470 | * ql_wifi_disable is must be disable |
| 471 | * |
| 472 | */ |
| 473 | |
| 474 | extern int ql_wifi_ap_ssid_set(ql_wifi_ap_index_e idx, char *ssid); |
| 475 | |
| 476 | /** |
| 477 | * Get the WiFi configuration: the hotspot ssid mode configuration. |
| 478 | * |
| 479 | * @param [in] Index of AP mode |
| 480 | * @param [out] the hotspot ssid name |
| 481 | * |
| 482 | * @return |
| 483 | * On success, 0 is returned. On error, -1 is returned. |
| 484 | * |
| 485 | */ |
| 486 | extern int ql_wifi_ap_ssid_get(ql_wifi_ap_index_e idx, char *ssid); |
| 487 | |
| 488 | /** |
| 489 | * Set the WiFi configuration: hidden hotspot configuration. |
| 490 | * |
| 491 | * @param [in] Index of AP mode |
| 492 | * @param [in] If set true, hidden hotspot |
| 493 | * If set false, open hotspot |
| 494 | * |
| 495 | * @return |
| 496 | * On success, 0 is returned. On error, -1 is returned. |
| 497 | * |
| 498 | */ |
| 499 | extern int ql_wifi_ap_ssid_hide_set(ql_wifi_ap_index_e idx, bool hide); |
| 500 | |
| 501 | /** |
| 502 | * Get the WiFi configuration: hidden hotspot configuration. |
| 503 | * |
| 504 | * @param [in] Index of AP mode |
| 505 | * @param [in] Get the hotspot hidden status |
| 506 | * |
| 507 | * @return |
| 508 | * On success, 0 is returned. On error, -1 is returned. |
| 509 | * |
| 510 | */ |
| 511 | extern int ql_wifi_ap_ssid_hide_get(ql_wifi_ap_index_e idx, bool *hide); |
| 512 | |
| 513 | /** |
| 514 | * Set the WiFi configuration: Operation mode configuration, such as 802.11a/b/n/ac. |
| 515 | * |
| 516 | * @param [in] Index of AP mode |
| 517 | * @param [in] Operation mode |
| 518 | * |
| 519 | * @return |
| 520 | * On success, 0 is returned. On error, -1 is returned. |
| 521 | * |
| 522 | */ |
| 523 | extern int ql_wifi_ap_mode_set(ql_wifi_ap_index_e idx, ql_wifi_mode_type_e mode); |
| 524 | |
| 525 | /** |
| 526 | * Get the WiFi configuration: Operation mode configuration, such as 802.11a/b/n/ac. |
| 527 | * |
| 528 | * @param [in] Index of AP mode |
| 529 | * @param [out] Operation mode |
| 530 | * |
| 531 | * @return |
| 532 | * On success, 0 is returned. On error, -1 is returned. |
| 533 | * |
| 534 | */ |
| 535 | extern int ql_wifi_ap_mode_get(ql_wifi_ap_index_e idx, ql_wifi_mode_type_e *mode); |
| 536 | |
| 537 | /** |
| 538 | * Set the WiFi configuration: HT or VHT capabilities (20MHz, 40MHz, 80MHz). |
| 539 | * |
| 540 | * @param [in] Index of AP mode |
| 541 | * @param [in] Bandwidth |
| 542 | * |
| 543 | * @return |
| 544 | * On success, 0 is returned. On error, -1 is returned. |
| 545 | * |
| 546 | * @dependencies |
| 547 | * The WiFi Operation mode must be set 802.11bgn/802.11an/802.11ac. |
| 548 | */ |
| 549 | extern int ql_wifi_ap_bandwidth_set(ql_wifi_ap_index_e idx, ql_wifi_bandwidth_type_e bandwidth); |
| 550 | |
| 551 | /** |
| 552 | * Get the WiFi configuration: HT or VHT capabilities (20MHz, 40MHz, 80MHz). |
| 553 | * |
| 554 | * @param [in] Index of AP mode |
| 555 | * @param [Out] Bandwidth |
| 556 | * |
| 557 | * @return |
| 558 | * On success, 0 is returned. On error, -1 is returned. |
| 559 | * |
| 560 | * @dependencies |
| 561 | * The WiFi Operation mode must be set 802.11bgn/802.11an/802.11ac. |
| 562 | */ |
| 563 | extern int ql_wifi_ap_bandwidth_get(ql_wifi_ap_index_e idx, ql_wifi_bandwidth_type_e *bandwidth); |
| 564 | |
| 565 | /** |
| 566 | * Set the WiFi configuration: channel number configuration. |
| 567 | * |
| 568 | * @param [in] Index of AP mode |
| 569 | * @param [in] Channel number |
| 570 | * |
| 571 | * @return |
| 572 | * On success, 0 is returned. On error, -1 is returned. |
| 573 | * |
| 574 | * @dependencies |
| 575 | * 1. if WiFi set 2.4GHz, the channel list: |
| 576 | * 0/1/2/3/4/5/6/7/8/9/10/11/12/13/14 |
| 577 | * 2. if WiFi set 5GHz, the channel list: |
| 578 | * 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/128/132/136/140/144/149/153/157/161/165/175/181 |
| 579 | */ |
| 580 | extern int ql_wifi_ap_channel_set(ql_wifi_ap_index_e idx, int channel); |
| 581 | |
| 582 | /** |
| 583 | * Get the WiFi configuration: channel number configuration. |
| 584 | * |
| 585 | * @param [in] Index of AP mode |
| 586 | * @param [out] Channel number |
| 587 | * |
| 588 | * @return |
| 589 | * On success, 0 is returned. On error, -1 is returned. |
| 590 | * |
| 591 | * @dependencies |
| 592 | * 1. if WiFi set 2.4GHz, the channel list: |
| 593 | * 0/1/2/3/4/5/6/7/8/9/10/11/12/13/14 |
| 594 | * 2. if WiFi set 5GHz, the channel list: |
| 595 | * 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/128/132/136/140/144/149/153/157/161/165/175/181 |
| 596 | */ |
| 597 | extern int ql_wifi_ap_channel_get(ql_wifi_ap_index_e idx, int *channel); |
| 598 | |
| 599 | /** |
| 600 | * Set the WiFi configuration: IEEE 802.11 specifies two authentication algorithms and WPA/IEEE 802.11i configuration. |
| 601 | * |
| 602 | * @param [in] Index of AP mode |
| 603 | * @param [in] authentication configuration |
| 604 | * |
| 605 | * @return |
| 606 | * On success, 0 is returned. On error, -1 is returned. |
| 607 | * |
| 608 | */ |
| 609 | extern int ql_wifi_ap_auth_set(ql_wifi_ap_index_e idx, ql_wifi_ap_auth_s *auth); |
| 610 | |
| 611 | /** |
| 612 | * Get the WiFi configuration: IEEE 802.11 specifies two authentication algorithms and WPA/IEEE 802.11i configuration. |
| 613 | * |
| 614 | * @param [in] Index of AP mode |
| 615 | * @param [out] authentication configuration |
| 616 | * |
| 617 | * @return |
| 618 | * On success, 0 is returned. On error, -1 is returned. |
| 619 | * |
| 620 | */ |
| 621 | extern int ql_wifi_ap_auth_get(ql_wifi_ap_index_e idx, ql_wifi_ap_auth_s *auth); |
| 622 | |
| 623 | /** |
| 624 | * Set the WiFi configuration: Maximum number of stations allowed in station table. |
| 625 | * |
| 626 | * @param [in] Index of AP mode |
| 627 | * @param [in] Maximum number of stations |
| 628 | * |
| 629 | * @return |
| 630 | * On success, 0 is returned. On error, -1 is returned. |
| 631 | * |
| 632 | */ |
| 633 | extern int ql_wifi_ap_max_sta_set(ql_wifi_ap_index_e idx, int max_sta_num); |
| 634 | |
| 635 | /** |
| 636 | * Get the WiFi configuration: Maximum number of stations allowed in station table. |
| 637 | * |
| 638 | * @param [in] Index of AP mode |
| 639 | * @param [out] Maximum number of stations |
| 640 | * |
| 641 | * @return |
| 642 | * On success, 0 is returned. On error, -1 is returned. |
| 643 | * |
| 644 | */ |
| 645 | extern int ql_wifi_ap_max_sta_get(ql_wifi_ap_index_e idx, int *max_sta_num); |
| 646 | |
| 647 | extern int ql_wifi_set_to_ap(ql_wifi_ap_index_e idx); |
| 648 | |
| 649 | extern int ql_wifi_set_to_sta(ql_wifi_ap_index_e idx); |
| 650 | |
| 651 | #endif /* end of __QL_WIFI_H__ */ |
| 652 | |