wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 1 | #include <stdint.h> |
| 2 | #include <stdio.h> |
| 3 | #include <string.h> |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 4 | #include "liblog/lynq_deflog.h" |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
| 10 | #include "sc_tel_types.h" |
| 11 | #include "sc_wifi.h" |
| 12 | #include "lynq-qser-wifi.h" |
| 13 | |
| 14 | /******************************************************************** |
| 15 | * @brief: qser_wifi_enable, Enable WiFi function |
| 16 | * @return : int, If equal to 0 succeeds, others fail |
| 17 | * @todo: NA |
| 18 | * @see: NA |
| 19 | * @warning: NA |
| 20 | *********************************************************************/ |
| 21 | int qser_wifi_enable(void) |
| 22 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 23 | int ret = -1; |
| 24 | ret = sc_wifi_init(); |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 25 | if (0 != ret) |
| 26 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 27 | LYERRLOG("[%s ] init : %d ret = %d\n", __func__,ret); |
| 28 | return ret; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 29 | } |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 30 | |
| 31 | ret = sc_wifi_enable(); |
| 32 | if (0 != ret) |
| 33 | { |
| 34 | LYERRLOG("[%s ] enable : %d ret = %d\n", __func__,ret); |
| 35 | return ret; |
| 36 | } |
| 37 | LYINFLOG("[%s ]\n", __func__); |
| 38 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /******************************************************************** |
| 42 | * @brief: qser_wifi_disable, Turn off WiFi |
| 43 | * @return : int, If equal to 0 succeeds, others fail |
| 44 | * @todo: NA |
| 45 | * @see: NA |
| 46 | * @warning: NA |
| 47 | *********************************************************************/ |
| 48 | int qser_wifi_disable(void) |
| 49 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 50 | int ret = -1; |
| 51 | ret = sc_wifi_disable(); |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 52 | if (0 != ret) |
| 53 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 54 | LYERRLOG("[%s ] disable : %d ret = %d\n", __func__,ret); |
| 55 | return ret; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 56 | } |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 57 | |
| 58 | ret = sc_wifi_uninit(); |
| 59 | if (0 != ret) |
| 60 | { |
| 61 | LYERRLOG("[%s ] uninit: %d ret = %d\n", __func__,ret); |
| 62 | return ret; |
| 63 | } |
| 64 | LYINFLOG("[%s ]\n", __func__); |
| 65 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | /******************************************************************** |
| 69 | * @brief: qser_wifi_ap_ssid_set, Set the name of the ssid of wlan0 or wlan1 |
| 70 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 71 | * @param ssid [IN]: const char *, Set the ssid name |
| 72 | * @return : int, If equal to 0 succeeds, others fail |
| 73 | * @todo: NA |
| 74 | * @see: NA |
| 75 | * @warning: NA |
| 76 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 77 | int qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 78 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 79 | int ret = -1; |
| 80 | if (ssid == NULL) |
| 81 | { |
| 82 | LYERRLOG("[%s ] Null pointer ssid = 0x%p \n", __func__, ssid); |
| 83 | return ret; |
| 84 | } |
| 85 | ret = sc_wifi_ap_ssid_set((sc_wifi_ap_index_e)idx, ssid); |
| 86 | if (0 != ret) |
| 87 | { |
| 88 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 89 | return ret; |
| 90 | } |
| 91 | LYINFLOG("[%s ] idx = %d ssid = %s \n", __func__, idx, ssid); |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | /******************************************************************** |
| 96 | * @brief: qser_wifi_ap_ssid_get, Get the name of the ssid of wlan0 or wlan1 |
| 97 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 98 | * @param ssid [OUT]: char *, Get the ssid name |
| 99 | * @return : int, If equal to 0 succeeds, others fail |
| 100 | * @todo: NA |
| 101 | * @see: NA |
| 102 | * @warning: NA |
| 103 | *********************************************************************/ |
| 104 | int qser_wifi_ap_ssid_get(lynq_wifi_ap_index_e idx, char *ssid) |
| 105 | { |
| 106 | int ret = -1; |
| 107 | sc_wifi_ap_param_t param = {0}; |
| 108 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 109 | if (0 != ret) |
| 110 | { |
| 111 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 112 | return ret; |
| 113 | } |
| 114 | LYINFLOG("[%s ] idx = %d ssid = %s \n", __func__, idx, param.ssid); |
| 115 | strncpy(ssid, param.ssid, sizeof(param.ssid) - 1); |
| 116 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | /******************************************************************** |
| 120 | * @brief: qser_wifi_ap_mode_set, Set the working protocol mode of wlan0 or wlan1 |
| 121 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 122 | * @param mode [IN]: lynq_wifi_mode_type_e, Set the working protocol mode |
| 123 | * @return : int, If equal to 0 succeeds, others fail |
| 124 | * @todo: NA |
| 125 | * @see: NA |
| 126 | * @warning: NA |
| 127 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 128 | int qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 129 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 130 | int ret = -1; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 131 | sc_wifi_ap_mode_type_e type; |
| 132 | switch(mode) |
| 133 | { |
| 134 | case LYNQ_WIFI_MODE_80211BGN: |
| 135 | type = SC_WIFI_AP_MODE_80211BGN; |
| 136 | break; |
| 137 | case LYNQ_WIFI_MODE_80211BGNAX_2G: |
| 138 | type = SC_WIFI_AP_MODE_80211BGNAX_2G; |
| 139 | break; |
| 140 | default: |
| 141 | type = SC_WIFI_AP_MODE_MIN; |
| 142 | break; |
| 143 | } |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 144 | ret = sc_wifi_ap_mode_set((sc_wifi_ap_index_e)idx, type); |
| 145 | if (0 != ret) |
| 146 | { |
| 147 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 148 | return ret; |
| 149 | } |
| 150 | LYINFLOG("[%s ] idx = %d mode = %d \n", __func__, idx, mode); |
| 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | /******************************************************************** |
| 155 | * @brief: qser_wifi_ap_mode_get, Get the working protocol mode of wlan0 or wlan1 |
| 156 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 157 | * @param mode [OUT]: lynq_wifi_mode_type_e *, Get the working protocol mode |
| 158 | * @return : int, If equal to 0 succeeds, others fail |
| 159 | * @todo: NA |
| 160 | * @see: NA |
| 161 | * @warning: NA |
| 162 | *********************************************************************/ |
| 163 | int qser_wifi_ap_mode_get(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e *mode) |
| 164 | { |
| 165 | int ret = -1; |
| 166 | sc_wifi_ap_param_t param = {0}; |
| 167 | if (mode == NULL) |
| 168 | { |
| 169 | LYERRLOG("[%s ] Null pointer mode = 0x%p \n", __func__, mode); |
| 170 | return ret; |
| 171 | } |
| 172 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 173 | if (0 != ret) |
| 174 | { |
| 175 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 176 | return ret; |
| 177 | } |
| 178 | LYINFLOG("[%s ] idx = %d mode = %d \n", __func__, idx, param.mode); |
| 179 | lynq_wifi_mode_type_e type; |
| 180 | switch(param.mode) |
| 181 | { |
| 182 | case SC_WIFI_AP_MODE_80211BGN: |
| 183 | type = LYNQ_WIFI_MODE_80211BGN; |
| 184 | break; |
| 185 | case SC_WIFI_AP_MODE_80211BGNAX_2G: |
| 186 | type = LYNQ_WIFI_MODE_80211BGNAX_2G; |
| 187 | break; |
| 188 | default: |
| 189 | type = LYNQ_WIFI_MODE_MIN; |
| 190 | break; |
| 191 | } |
| 192 | *mode = type; |
| 193 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | /******************************************************************** |
| 197 | * @brief: qser_wifi_ap_bandwidth_set, Set the bandwidth of wlan0 or wlan1 |
| 198 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 199 | * @param bandwidth [IN]: lynq_wifi_bandwidth_type_e, Set the bandwidth |
| 200 | * @return : int, If equal to 0 succeeds, others fail |
| 201 | * @todo: NA |
| 202 | * @see: NA |
| 203 | * @warning: NA |
| 204 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 205 | int qser_wifi_ap_bandwidth_set(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e bandwidth) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 206 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 207 | int ret = -1; |
| 208 | ret = sc_wifi_ap_bandwidth_set((sc_wifi_ap_index_e)idx, (sc_wifi_bandwidth_e)bandwidth); |
| 209 | if (0 != ret) |
| 210 | { |
| 211 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 212 | return ret; |
| 213 | } |
| 214 | LYINFLOG("[%s ] idx = %d bandwidth = %d \n", __func__, idx, bandwidth); |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | /******************************************************************** |
| 219 | * @brief: qser_wifi_ap_bandwidth_get, Get the bandwidth of wlan0 or wlan1 |
| 220 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 221 | * @param bandwidth [OUT]: lynq_wifi_bandwidth_type_e *, Get the bandwidth |
| 222 | * @return : int, If equal to 0 succeeds, others fail |
| 223 | * @todo: NA |
| 224 | * @see: NA |
| 225 | * @warning: NA |
| 226 | *********************************************************************/ |
| 227 | int qser_wifi_ap_bandwidth_get(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e *bandwidth) |
| 228 | { |
| 229 | int ret = -1; |
| 230 | sc_wifi_ap_param_t param = {0}; |
| 231 | if (bandwidth == NULL) |
| 232 | { |
| 233 | LYERRLOG("[%s ] Null pointer bandwidth = 0x%p \n", __func__, bandwidth); |
| 234 | return ret; |
| 235 | } |
| 236 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 237 | if (0 != ret) |
| 238 | { |
| 239 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 240 | return ret; |
| 241 | } |
| 242 | LYINFLOG("[%s ] idx = %d bandwidth = %d \n", __func__, idx, param.bandwidth); |
| 243 | *bandwidth = (lynq_wifi_bandwidth_type_e)param.bandwidth; |
| 244 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | /******************************************************************** |
| 248 | * @brief: qser_wifi_ap_channel_set, Set the channel for wlan0 or wlan1 |
| 249 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 250 | * @param country_code [IN]: const char *, Set country code |
| 251 | * @param channel [IN]: int, Set the channel |
| 252 | * @return : int, If equal to 0 succeeds, others fail |
| 253 | * @todo: NA |
| 254 | * @see: NA |
| 255 | * @warning: NA |
| 256 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 257 | int qser_wifi_ap_channel_set(lynq_wifi_ap_index_e idx, const char *country_code, int channel) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 258 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 259 | int ret = -1; |
| 260 | if (country_code == NULL) |
| 261 | { |
| 262 | LYERRLOG("[%s ] Null pointer country_code = 0x%p \n", __func__, country_code); |
| 263 | return ret; |
| 264 | } |
| 265 | ret = sc_wifi_ap_cc_ch_set((sc_wifi_ap_index_e)idx, country_code, channel); |
| 266 | if (0 != ret) |
| 267 | { |
| 268 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 269 | return ret; |
| 270 | } |
| 271 | LYINFLOG("[%s ] idx = %d country_code = %s channel = %d\n", __func__, idx, country_code, channel); |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | /******************************************************************** |
| 276 | * @brief: qser_wifi_ap_channel_get, Get the channel for wlan0 or wlan1 |
| 277 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 278 | * @param country_code [OUT]: char *, Get country code |
| 279 | * @param channel [OUT]: int *, Get the channel |
| 280 | * @return : int, If equal to 0 succeeds, others fail |
| 281 | * @todo: NA |
| 282 | * @see: NA |
| 283 | * @warning: NA |
| 284 | *********************************************************************/ |
| 285 | int qser_wifi_ap_channel_get(lynq_wifi_ap_index_e idx, char *country_code, int *channel) |
| 286 | { |
| 287 | int ret = -1; |
| 288 | sc_wifi_ap_param_t param = {0}; |
| 289 | if (country_code == NULL || channel == NULL) |
| 290 | { |
| 291 | LYERRLOG("[%s ] Null pointer country_code = 0x%p channel = 0x%p\n", __func__, country_code, channel); |
| 292 | return ret; |
| 293 | } |
| 294 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 295 | if (0 != ret) |
| 296 | { |
| 297 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 298 | return ret; |
| 299 | } |
| 300 | LYINFLOG("[%s ] idx = %d country_code = %s channel = %d\n", __func__, idx, param.countrycode, param.channel); |
| 301 | strncpy(country_code, param.countrycode, sizeof(param.countrycode) - 1); |
| 302 | *channel = param.channel; |
| 303 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | /******************************************************************** |
| 307 | * @brief: qser_wifi_ap_auth_set, Set the security authentication mode and password of wlan0 or wlan1 |
| 308 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 309 | * @param auth_mode [IN]: lynq_wifi_auth_e, Set the security authentication mode |
| 310 | * @param auth_passwd [IN]: const char *, Set password |
| 311 | * @return : int, If equal to 0 succeeds, others fail |
| 312 | * @todo: NA |
| 313 | * @see: NA |
| 314 | * @warning: NA |
| 315 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 316 | int qser_wifi_ap_auth_set(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e auth_mode, const char *auth_passwd) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 317 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 318 | int ret = -1; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 319 | sc_wifi_auth_e type; |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 320 | if (auth_passwd == NULL) |
| 321 | { |
| 322 | LYERRLOG("[%s ] Null pointer auth_passwd = 0x%p\n", __func__, auth_passwd); |
| 323 | return ret; |
| 324 | } |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 325 | switch (auth_mode) |
| 326 | { |
| 327 | case LYNQ_WIFI_AUTH_OPEN: |
| 328 | type = SC_WIFI_AUTH_OPEN; |
| 329 | break; |
| 330 | case LYNQ_WIFI_AUTH_WPA2_PSK: |
| 331 | type = SC_WIFI_AUTH_WPA2_PSK; |
| 332 | break; |
| 333 | case LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH: |
| 334 | type = SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH; |
| 335 | break; |
| 336 | case LYNQ_WIFI_AUTH_WPA3_PSK: |
| 337 | type = SC_WIFI_AUTH_WPA3_PSK; |
| 338 | break; |
| 339 | case LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH: |
| 340 | type = SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH; |
| 341 | break; |
| 342 | default: |
| 343 | type = SC_WIFI_AUTH_MIN; |
| 344 | break; |
| 345 | } |
| 346 | sc_wifi_ap_auth_t auth; |
| 347 | auth.auth = (sc_wifi_auth_e)type; |
| 348 | strncpy(auth.passwd, auth_passwd, sizeof(auth.passwd) - 1); |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 349 | ret = sc_wifi_ap_auth_set((sc_wifi_ap_index_e)idx, &auth); |
| 350 | if (0 != ret) |
| 351 | { |
| 352 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 353 | return ret; |
| 354 | } |
| 355 | LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s\n", __func__, idx, auth_mode, auth_passwd); |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | /******************************************************************** |
| 360 | * @brief: qser_wifi_ap_auth_get, Get the security authentication mode and password of wlan0 or wlan1 |
| 361 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 362 | * @param auth_mode [OUT]: lynq_wifi_auth_e *, Get the security authentication mode |
| 363 | * @param auth_passwd [OUT]: char *, Get password |
| 364 | * @return : int, If equal to 0 succeeds, others fail |
| 365 | * @todo: NA |
| 366 | * @see: NA |
| 367 | * @warning: NA |
| 368 | *********************************************************************/ |
| 369 | int qser_wifi_ap_auth_get(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e *auth_mode, char *auth_passwd) |
| 370 | { |
| 371 | int ret = -1; |
| 372 | sc_wifi_ap_param_t param = {0}; |
| 373 | if (auth_mode == NULL || auth_passwd == NULL) |
| 374 | { |
| 375 | LYERRLOG("[%s ] Null pointer auth_mode = 0x%p auth_passwd = 0x%p\n", __func__, auth_mode, auth_passwd); |
| 376 | return ret; |
| 377 | } |
| 378 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 379 | if (0 != ret) |
| 380 | { |
| 381 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 382 | return ret; |
| 383 | } |
| 384 | LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s \n", __func__, idx, param.auth.auth, param.auth.passwd); |
| 385 | strncpy(auth_passwd, param.auth.passwd, sizeof(param.auth.passwd) - 1); |
| 386 | lynq_wifi_auth_e type; |
| 387 | switch (param.auth.auth) |
| 388 | { |
| 389 | case SC_WIFI_AUTH_OPEN: |
| 390 | type = LYNQ_WIFI_AUTH_OPEN; |
| 391 | break; |
| 392 | case SC_WIFI_AUTH_WPA2_PSK: |
| 393 | type = LYNQ_WIFI_AUTH_WPA2_PSK; |
| 394 | break; |
| 395 | case SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH: |
| 396 | type = LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH; |
| 397 | break; |
| 398 | case SC_WIFI_AUTH_WPA3_PSK: |
| 399 | type = LYNQ_WIFI_AUTH_WPA3_PSK; |
| 400 | break; |
| 401 | case SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH: |
| 402 | type = LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH; |
| 403 | break; |
| 404 | default: |
| 405 | type = LYNQ_WIFI_AUTH_MIN; |
| 406 | break; |
| 407 | } |
| 408 | *auth_mode = type; |
| 409 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | /******************************************************************** |
| 413 | * @brief: qser_wifi_ap_max_sta_set, Set the maximum number of STAs for wlan0 or wlan1 |
| 414 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 415 | * @param max_sta_num [IN]: int, Set the maximum number |
| 416 | * @return : int, If equal to 0 succeeds, others fail |
| 417 | * @todo: NA |
| 418 | * @see: NA |
| 419 | * @warning: NA |
| 420 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 421 | int qser_wifi_ap_max_sta_set(lynq_wifi_ap_index_e idx, int max_sta_num) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 422 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 423 | int ret = -1; |
| 424 | ret = sc_wifi_ap_max_sta_num_set((sc_wifi_ap_index_e)idx, max_sta_num); |
| 425 | if (0 != ret) |
| 426 | { |
| 427 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 428 | return ret; |
| 429 | } |
| 430 | LYINFLOG("[%s ] idx = %d max_sta_num = %d \n", __func__, idx, max_sta_num); |
| 431 | return 0; |
| 432 | } |
| 433 | |
| 434 | /******************************************************************** |
| 435 | * @brief: qser_wifi_ap_max_sta_get, Get the maximum number of STAs for wlan0 or wlan1 |
| 436 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 437 | * @param max_sta_num [OUT]: int *, Get the maximum number |
| 438 | * @return : int, If equal to 0 succeeds, others fail |
| 439 | * @todo: NA |
| 440 | * @see: NA |
| 441 | * @warning: NA |
| 442 | *********************************************************************/ |
| 443 | int qser_wifi_ap_max_sta_get(lynq_wifi_ap_index_e idx, int *max_sta_num) |
| 444 | { |
| 445 | int ret = -1; |
| 446 | sc_wifi_ap_param_t param = {0}; |
| 447 | if (max_sta_num == NULL) |
| 448 | { |
| 449 | LYERRLOG("[%s ] Null pointer max_sta_num = 0x%p\n", __func__,max_sta_num); |
| 450 | return ret; |
| 451 | } |
| 452 | ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m); |
| 453 | if (0 != ret) |
| 454 | { |
| 455 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 456 | return ret; |
| 457 | } |
| 458 | LYINFLOG("[%s ] idx = %d max_sta_num = %d \n", __func__, idx, param.max_sta_num); |
| 459 | *max_sta_num = param.max_sta_num; |
| 460 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | /******************************************************************** |
| 464 | * @brief: qser_wifi_ap_start, Set the ap mode of wlan0 or wlan1 to enable |
| 465 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 466 | * @return : int, If equal to 0 succeeds, others fail |
| 467 | * @todo: NA |
| 468 | * @see: NA |
| 469 | * @warning: NA |
| 470 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 471 | int qser_wifi_ap_start(lynq_wifi_ap_index_e idx) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 472 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 473 | int ret = -1; |
| 474 | ret = sc_wifi_ap_start((sc_wifi_ap_index_e)idx); |
| 475 | if (0 != ret) |
| 476 | { |
| 477 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 478 | return ret; |
| 479 | } |
| 480 | LYINFLOG("[%s ] idx = %d \n", __func__, idx); |
| 481 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | /******************************************************************** |
| 485 | * @brief: qser_wifi_ap_stop, Disable ap mode for wlan0 or wlan1 |
| 486 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 487 | * @return : int, If equal to 0 succeeds, others fail |
| 488 | * @todo: NA |
| 489 | * @see: NA |
| 490 | * @warning: NA |
| 491 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 492 | int qser_wifi_ap_stop(lynq_wifi_ap_index_e idx) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 493 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 494 | int ret = -1; |
| 495 | ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx); |
| 496 | if (0 != ret) |
| 497 | { |
| 498 | LYERRLOG("[%s ] ret = %d\n", __func__,ret); |
| 499 | return ret; |
| 500 | } |
| 501 | LYINFLOG("[%s ] idx = %d \n", __func__, idx); |
| 502 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | /******************************************************************** |
| 506 | * @brief: qser_wifi_ap_restart, Set the ap mode of wlan0 or wlan1 to restart |
| 507 | * @param idx [IN]: int, Set wlan0 or wlan1 |
| 508 | * @return : int, If equal to 0 succeeds, others fail |
| 509 | * @todo: NA |
| 510 | * @see: NA |
| 511 | * @warning: NA |
| 512 | *********************************************************************/ |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 513 | int qser_wifi_ap_restart(lynq_wifi_ap_index_e idx) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 514 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 515 | int ret = -1; |
| 516 | ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx); |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 517 | if (0 != ret) |
| 518 | { |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 519 | LYERRLOG("[%s ] stop: %d ret = %d\n", __func__,ret); |
| 520 | return ret; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 521 | } |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 522 | ret = sc_wifi_ap_start((sc_wifi_ap_index_e)idx); |
| 523 | if (0 != ret) |
| 524 | { |
| 525 | LYERRLOG("[%s ] start: %d ret = %d\n", __func__,ret); |
| 526 | return ret; |
| 527 | } |
| 528 | LYINFLOG("[%s ] idx = %d \n", __func__, idx); |
| 529 | return 0; |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 530 | } |
| 531 | |
wz.wang | e5a0b91 | 2024-03-22 19:11:59 +0800 | [diff] [blame^] | 532 | DEFINE_LYNQ_LIB_LOG(LYNQ_WIFI) |
wz.wang | 7350413 | 2024-03-19 16:38:37 +0800 | [diff] [blame] | 533 | |
| 534 | #ifdef __cplusplus |
| 535 | } |
| 536 | #endif |