qs.xiong | 1af5daf | 2022-03-14 09:12:12 -0400 | [diff] [blame] | 1 | /**@File libwifi6.h |
| 2 | * @Brief :about function test |
| 3 | * @details : |
| 4 | * @Author : qs.xiong |
| 5 | * @Date : 2022-3-14 |
| 6 | * @Version : V1.0 |
| 7 | * @copy ritght : Copyright (c) MobileTek |
| 8 | */ |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 9 | #ifndef __LIBWIFI6_H__ |
| 10 | #define __LIBWIFI6_H__ |
| 11 | |
| 12 | typedef enum { |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 13 | LYNQ_WIFI_BANDWIDTH_HT10 = 0, // not support in ap mode |
| 14 | LYNQ_WIFI_BANDWIDTH_HT20, |
| 15 | LYNQ_WIFI_BANDWIDTH_HT40, // not support in ap mode |
| 16 | LYNQ_WIFI_BANDWIDTH_HT80, |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 17 | }lynq_wifi_bandwidth_type_m; |
| 18 | |
| 19 | typedef enum { |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 20 | LYNQ_WIFI_AUTH_OPEN = 0, |
| 21 | LYNQ_WIFI_AUTH_WEP, |
| 22 | LYNQ_WIFI_AUTH_WPA_PSK, |
| 23 | LYNQ_WIFI_AUTH_WPA2_PSK, |
| 24 | }lynq_wifi_auth_s; |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 25 | |
| 26 | typedef enum { |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 27 | LYNQ_WIFI_2G_band = 1, |
| 28 | LYNQ_WIFI_5G_band, |
| 29 | LYNQ_WIFI_2_and_5G_band, //not support |
| 30 | }lynq_wifi_band_m; |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 31 | |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 32 | typedef enum { |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 33 | LYNQ_WIFI_AP_STATUS_DISABLE = 0, |
| 34 | LYNQ_WIFI_AP_STATUS_ENABLE, //ap is running status |
| 35 | }lynq_wifi_ap_run_status_s; |
| 36 | |
| 37 | typedef enum { |
| 38 | LYNQ_WIFI_STA_STATUS_DISABLE = 0, |
| 39 | LYNQ_WIFI_STA_STATUS_ENABLE, //sta is running status |
| 40 | }lynq_wifi_sta_run_status_s; |
| 41 | |
| 42 | typedef enum { |
| 43 | LYNQ_WIFI_INTERFACE_0 = 0, //sta |
| 44 | LYNQ_WIFI_INTERFACE_1, //ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 45 | }lynq_wifi_index_e; |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 46 | |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 47 | typedef enum { |
| 48 | LYNQ_WIFI_STATUS_DISCONNECT = 0, |
| 49 | LYNQ_WIFI_STATUS_CONNECT, |
| 50 | }lynq_wifi_ap_status_s; |
| 51 | |
| 52 | typedef struct ap_info |
| 53 | { |
| 54 | char ap_ip[32]; |
| 55 | char ap_mac[32]; |
qs.xiong | fef4650 | 2023-02-16 15:54:49 +0800 | [diff] [blame^] | 56 | char ap_ssid[64]; |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 57 | char psw[64]; //password |
| 58 | lynq_wifi_auth_s auth; |
| 59 | lynq_wifi_band_m band; |
| 60 | }ap_info_s; |
| 61 | |
| 62 | typedef struct device_info |
| 63 | { |
| 64 | char sta_ip[32]; |
| 65 | char sta_mac[32]; |
| 66 | char hostname[32]; |
| 67 | lynq_wifi_ap_status_s status; |
| 68 | }device_info_s; |
| 69 | |
| 70 | typedef struct scan_info |
| 71 | { |
| 72 | char mac[32]; |
qs.xiong | fef4650 | 2023-02-16 15:54:49 +0800 | [diff] [blame^] | 73 | char ssid[64]; |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 74 | lynq_wifi_band_m band; |
| 75 | lynq_wifi_auth_s auth; |
| 76 | int rssi; |
| 77 | }scan_info_s; |
| 78 | |
| 79 | typedef struct ap_detail_info |
| 80 | { |
| 81 | struct ap_info base_info; // base_info : base info of strcut ap_info |
| 82 | lynq_wifi_ap_run_status_s status; // status:is not running 1:is running |
| 83 | int rssi; //[0~199] |
| 84 | }ap_detail_info_s; |
| 85 | |
| 86 | typedef struct saved_ap_info |
| 87 | { |
| 88 | struct ap_info base_info; |
| 89 | }saved_ap_info_s; |
| 90 | |
| 91 | |
| 92 | // insmod drive and start service of wifi |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 93 | int lynq_wifi_enable(void); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 94 | //rmmod drive |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 95 | int lynq_wifi_disable(void); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 96 | //set ssid of ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 97 | int lynq_wifi_ap_ssid_set(lynq_wifi_index_e idx,char *ap_ssid); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 98 | //get ap of ssid |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 99 | int lynq_wifi_ap_ssid_get(lynq_wifi_index_e idx,char *ap_ssid); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 100 | |
| 101 | //set frquency for ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 102 | int lynq_wifi_ap_frequency_set(lynq_wifi_index_e idx,int lynq_wifi_frequency); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 103 | //get freuency of ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 104 | int lynq_wifi_ap_frequency_get(lynq_wifi_index_e idx,int *lynq_wifi_frequency); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 105 | |
| 106 | //set bandwidth for ap |
| 107 | int lynq_wifi_ap_bandwidth_set(lynq_wifi_index_e idx,lynq_wifi_bandwidth_type_m bandwidth); |
| 108 | //get thr bandwidth of ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 109 | int lynq_wifi_ap_bandwidth_get(lynq_wifi_index_e idx,lynq_wifi_bandwidth_type_m *bandwidth); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 110 | |
| 111 | //set channel for ap |
qs.xiong | 0fb469a | 2022-04-14 03:50:45 -0400 | [diff] [blame] | 112 | int lynq_wifi_ap_channel_set( lynq_wifi_index_e idx,int channel); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 113 | //get channel of ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 114 | int lynq_wifi_ap_channel_get( lynq_wifi_index_e idx,int* channel); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 115 | |
| 116 | //set auth for ap |
| 117 | int lynq_wifi_ap_auth_set(lynq_wifi_index_e idx, lynq_wifi_auth_s auth); |
| 118 | //get ap auth |
| 119 | int lynq_wifi_ap_auth_get(lynq_wifi_index_e idx, lynq_wifi_auth_s *auth); |
| 120 | |
| 121 | //start ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 122 | int lynq_wifi_ap_start(lynq_wifi_index_e idx); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 123 | //stop ap |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 124 | int lynq_wifi_ap_stop(lynq_wifi_index_e idx); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 125 | //restart ap |
| 126 | int lynq_wifi_ap_restart(lynq_wifi_index_e idx); |
| 127 | |
| 128 | //hide ssid |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 129 | int lynq_wifi_ap_hide_ssid(lynq_wifi_index_e idx); |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 130 | //unhide ssid |
qs.xiong | f1b525b | 2022-03-31 00:58:23 -0400 | [diff] [blame] | 131 | int lynq_wifi_ap_unhide_ssid(lynq_wifi_index_e idx); |
qs.xiong | 97fa59b | 2022-04-07 05:41:29 -0400 | [diff] [blame] | 132 | |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 133 | //set the password for ap |
| 134 | int lynq_ap_password_set(lynq_wifi_index_e idx, char *password); |
| 135 | //get the ap password |
| 136 | int lynq_ap_password_get(lynq_wifi_index_e idx, char *password); |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 137 | |
you.chen | 3502019 | 2022-05-06 11:30:57 +0800 | [diff] [blame] | 138 | //set the password to connet to dest_ap |
| 139 | int lynq_sta_ssid_password_set(lynq_wifi_index_e idx, ap_info_s *ap, char *password); |
| 140 | int lynq_sta_ssid_password_get(lynq_wifi_index_e idx, ap_info_s *ap, char *password); |
| 141 | |
| 142 | //get the ssid of sta |
| 143 | int lynq_wifi_get_sta_ssid(lynq_wifi_index_e idx,char *sta_ssid); |
| 144 | //get availble device info such as:ssid mac band rssi status auth |
| 145 | int lynq_wifi_get_sta_available_ap(lynq_wifi_index_e idx,ap_detail_info_s *info); |
| 146 | |
| 147 | |
| 148 | |
| 149 | //get the sta connect ap auth |
| 150 | int lynq_wifi_get_sta_auth(lynq_wifi_index_e idx, lynq_wifi_auth_s* auth); //auth 0:OPEN 1:WEP 2:WPA-PSK 3:WPA2-PSK |
| 151 | |
| 152 | //sta start connect to dest_ap |
| 153 | int lynq_wifi_sta_connect(lynq_wifi_index_e idx, char *ssid, lynq_wifi_auth_s auth, char *psw); |
| 154 | //disconnect |
| 155 | int lynq_wifi_sta_disconnect(lynq_wifi_index_e idx,char *ssid); |
| 156 | |
| 157 | //start sta mode;enable sta |
| 158 | int lynq_wifi_sta_start(lynq_wifi_index_e idx); |
| 159 | //stop sta:disable sta |
| 160 | int lynq_wifi_sta_stop(lynq_wifi_index_e idx); |
| 161 | |
| 162 | //Get all device info linked ap |
| 163 | int lynq_get_ap_device_list(lynq_wifi_index_e idx, ap_info_s **ap, device_info_s ** list,int * len); //list info:mac ip hostname status len:device len |
| 164 | //Get scan_result info |
| 165 | int lynq_get_scan_list(lynq_wifi_index_e idx, scan_info_s ** list,int * len); //list info:mac ssid band auth rssi len:scan_info len |
| 166 | int lynq_sta_forget_ap(lynq_wifi_index_e idx, char *ssid,lynq_wifi_auth_s auth); |
| 167 | int lynq_get_sta_saved_ap(lynq_wifi_index_e idx,saved_ap_info_s ** list,int * len); //len: length of saved_ap_info |
| 168 | |
| 169 | //start scan availbale ap active |
| 170 | int lynq_wifi_sta_start_scan(lynq_wifi_index_e idx); |
| 171 | |
| 172 | /* |
| 173 | * event usage: |
| 174 | * first declare a funcion like AP_CALLBACK_FUNC_PTR to recv messge from wifi lib |
| 175 | * call lynq_reg_ap_event_callback to register whih private data pointer and the callback fuction pointer declared before |
| 176 | * when envent comes the last registered callback function will been called |
| 177 | */ |
| 178 | |
| 179 | typedef void(*AP_CALLBACK_FUNC_PTR)(void *priv, lynq_wifi_ap_status_s status); |
| 180 | int lynq_reg_ap_event_callback(void *priv, AP_CALLBACK_FUNC_PTR cb); |
| 181 | int lynq_unreg_ap_event_callback(void *priv); |
| 182 | |
| 183 | typedef enum { |
| 184 | LYNQ_WIFI_STA_STATUS_DISCONNECT = 0, |
| 185 | LYNQ_WIFI_STA_STATUS_CONNECT, |
| 186 | LYNQ_WIFI_STA_STATUS_SCAN_RESULT, //finish sta scan |
| 187 | }lynq_wifi_sta_status_s; |
| 188 | typedef enum |
| 189 | { |
| 190 | LYNQ_TIME_OUT = 0, |
| 191 | LYNQ_PSW_ERROR, |
| 192 | LYNQ_AUTH_ERROR, |
| 193 | LYNQ_NOT_FIND_AP, |
| 194 | }error_number_s; |
| 195 | |
| 196 | typedef void(*STA_CALLBACK_FUNC_PTR)(void *priv, lynq_wifi_sta_status_s status, error_number_s number); |
| 197 | int lynq_reg_sta_event_callback(void * priv, STA_CALLBACK_FUNC_PTR cb); |
| 198 | int lynq_unreg_sta_event_callback(void * priv); |
| 199 | |
| 200 | //get current ap status |
| 201 | int lynq_get_ap_status(lynq_wifi_index_e idx, lynq_wifi_ap_run_status_s * ap_status); |
| 202 | //get curent sta status |
| 203 | int lynq_get_sta_status(lynq_wifi_index_e idx, lynq_wifi_sta_run_status_s * sta_status); |
| 204 | |
| 205 | //set the country code |
| 206 | int lynq_get_country_code(lynq_wifi_index_e idx, char *country_code); |
| 207 | //get current country code |
| 208 | int lynq_set_country_code(lynq_wifi_index_e idx, char *country_code); |
| 209 | |
| 210 | //get wlan0/ap0 ip or mac |
| 211 | int lynq_get_interface_ip(lynq_wifi_index_e idx,char *ip); |
| 212 | int lynq_get_interface_mac(lynq_wifi_index_e idx,char *mac); |
| 213 | |
| 214 | |
| 215 | //get current connect ap mac rssi band |
| 216 | int lynq_get_connect_ap_mac(lynq_wifi_index_e idx,char *mac); |
| 217 | int lynq_get_connect_ap_rssi(lynq_wifi_index_e idx,int * rssi); |
| 218 | int lynq_get_connect_ap_band(lynq_wifi_index_e idx,lynq_wifi_band_m * band); |
you.chen | f58b3c9 | 2022-06-21 16:53:48 +0800 | [diff] [blame] | 219 | int lynq_get_connect_ap_ip(lynq_wifi_index_e idx,char *ip); |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 220 | |
qs.xiong | 026c5c7 | 2022-10-17 11:15:45 +0800 | [diff] [blame] | 221 | /*****add limit of connected ap device number 2022.10.12 by qs.xiong |
| 222 | * |
| 223 | *sta_number: |
| 224 | * ap max be connected no more than 15 |
| 225 | * so sta_number : [1-15] |
| 226 | */ |
| 227 | int lynq_ap_connect_num(int sta_number); |
| 228 | |
qs.xiong | 7790555 | 2022-10-17 11:19:57 +0800 | [diff] [blame] | 229 | /****add acs contrl api***************** |
| 230 | * |
| 231 | *idx: |
| 232 | * 1 is ap and only 1 is legal in this api |
| 233 | *acs_mode: |
| 234 | * 2 is open acs at 2.4GHz |
| 235 | * 5 is open acs at 5GHz |
| 236 | * didnt ssuport 2.4G&5G together |
| 237 | * add by qs.xiong 20221012*************/ |
| 238 | int lynq_enable_acs(lynq_wifi_index_e idx,int acs_mode); |
| 239 | |
you.chen | 0f5c643 | 2022-11-07 18:31:14 +0800 | [diff] [blame] | 240 | //you.chen add for tv-box start |
| 241 | /** |
| 242 | * @brief enableGBW, repeat call will fail before disableGBW |
| 243 | * @param mac of tv-box |
| 244 | * @return |
| 245 | */ |
| 246 | int enableGBW(const char* mac); |
| 247 | /** |
| 248 | * @brief disableGBW |
| 249 | * @return |
| 250 | */ |
| 251 | int disableGBW(); |
| 252 | //you.chen add for tv-box end |
| 253 | |
qs.xiong | 7a105ce | 2022-03-02 09:43:11 -0500 | [diff] [blame] | 254 | #endif |