blob: ab6aac6f07226efdc30399f9a78cb759ed4295ee [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/**
2* @file Wifi_msg.h
3* @brief ÌṩwifiÉèÖõÄÏûÏ¢½Ó¿Ú
4*
5* Copyright (C) 2017 Sanechips Technology Co., Ltd.
6* @author Linxu Gebin
7*
8* This program is free software; you can redistribute it and/or modify
9* it under the terms of the GNU General Public License version 2 as
10* published by the Free Software Foundation.
11*
12************************************************************************
13*/
14
15#ifndef __WIFI_MSG_H__
16#define __WIFI_MSG_H__
17
18#include "message.h"
19#include "wifi.h"
20
21
22/**
23* @brief ¶¨ÒåwifiÏûÏ¢
24 * @param MSG_CMD_WIFI_BASE ÉèÖÃÖ÷ssidµÄ»ù±¾²ÎÊýÏûÏ¢
25 * @param MSG_CMD_WIFI_SSID_M ÉèÖø±ssidµÄ»ù±¾²ÎÊýÏûÏ¢
26 * @param MSG_CMD_WIFI_CLOSE ¹Ø±ÕwifiÏûÏ¢
27 * @param MSG_CMD_WIFI_OPEN ¿ªÆôwifiÏûÏ¢
28 * @param MSG_CMD_WIFI_RESTART ÖØÆôwifiÏûÏ¢
29 * @param MSG_CMD_WIFI_ADVANCED wifiµÄ¸ß¼¶²ÎÊýÉèÖÃÏûÏ¢
30 * @param MSG_CMD_WIFI_WPS ¿ªÆôWPS¹¦ÄÜÏûÏ¢
31 * @param MSG_CMD_WIFI_WPS_UP WPSÄ£¿é·¢À´µÄWPSÆô¶¯ÏûÏ¢
32 * @param MSG_CMD_WIFI_WPS_DOWN WPSÄ£¿é·¢À´µÄWPS ¹Ø±ÕÏûÏ¢
33 * @param MSG_CMD_WIFI_SLEEP WEBUIÉèÖÃ˯Ãßʱ³¤ÏûÏ¢
34 * @param MSG_CMD_CAPTURE_STATION ²éѯstaµÄÁ¬½ÓÇé¿öÏûÏ¢
35 * @param MSG_CMD_WIFI_COVERAGE ÉèÖÃwifiµÄ¸²¸Ç·¶Î§ÏûÏ¢
36 * @param MSG_CMD_WIFI_MAC ÉèÖÃmac¹ýÂ˹¦ÄÜÏûÏ¢
37 * @param MSG_CMD_USB_CHARGING_CHANGED Çý¶¯¼ì²âµ½usb³äµç״̬±ä»¯Éϱ¨ÏûÏ¢
38 * @param MSG_CMD_WIFI_STATION_OPEN ´ò¿ªapsta¹¦ÄÜÏûÏ¢
39 * @param MSG_CMD_WIFI_STATION_CLOSE ¹Ø±Õapsta¹¦ÄÜÏûÏ¢
40 * @param MSG_CMD_WIFI_STATION_CLOSE_OPEN_MSSID ´ò¿ªapsta£¬¹Ø±Õ¶àssidÏûÏ¢
41 * @param MSG_CMD_WIFI_STATION_SCAN ɨÃèÈȵãÏûÏ¢
42 * @param MSG_CMD_WIFI_STATION_CONNECT Á¬½ÓÈȵãÏûÏ¢
43 * @param MSG_CMD_WIFI_STATION_CONNECT_TIMEOUT Á¬½Ó³¬Ê±µÄ´¦ÀíÏûÏ¢
44 * @param MSG_CMD_WIFI_STATION_SIM_INIT_TIMER_PROCESS ²éѯsim¿¨ÓÐÎÞÆôÓõĶ¨Ê±Æ÷ÏûÏ¢
45 * @param MSG_CMD_WIFI_STATION_GET_SCAN_RESULTS_TIMER_PROCESS wpa_supplicantÖ÷¶¯É¨ÃèÏûÏ¢
46 * @param MSG_CMD_WIFI_STATION_DISCONNECT Ö÷¶¯¶Ï¿ªÕýÔÚÁ¬½ÓµÄÈȵãÏûÏ¢
47 * @param MSG_CMD_WIFI_STATION_SPOT_UPDATE ¸üÐÂÈȵãÁбíÏûÏ¢
48 * @param MSG_CMD_WIFI_STATION_EVENT_CONNECTING wpa_supplicantÕýÔÚ³¢ÊÔÁ¬½ÓʼþÏûÏ¢
49 * @param MSG_CMD_WIFI_STATION_EVENT_CONNECTED apstaÓëÈȵãÁ¬½Ó³É¹¦Í¨ÖªÏûÏ¢
50 * @param MSG_CMD_WIFI_STATION_EVENT_DISCONNECTED apstaÓëÈȵã¶Ï¿ªÁ¬½Ó֪ͨÏûÏ¢
51 * @param MSG_CMD_BLC_OPEN_WIFISTATION_ACCESS blc·¢Ë͵ÄÁ¬½Ó³É¹¦£¬stationµÄipÒÑ·ÖÅäµ½ÏûÏ¢
52 * @param MSG_CMD_BLC_OPEN_WIFISTATION_ACCESS blc·¢À´ÏûÏ¢´ò¿ªapstaÁ¬½ÓÏûÏ¢
53 * @param MSG_CMD_BLC_CLOSE_WIFISTATION_ACCESS blc·¢À´ÏûÏ¢¶Ï¿ªapstaÁ¬½ÓÏûÏ¢
54 * @param MSG_CMD_WIFI_STATION_NO_AVAILABLE_AP apstaÎÞЧÏûÏ¢
55 * @param MSG_CMD_WIFI_STATION_END apstationµÄÏûÏ¢·¶Î§end
56 * @param MSG_CMD_WIFI_TSW_SET ÉèÖö¨Ê±Ë¯Ãß»½ÐѵÄÏûÏ¢
57 * @param MSG_CMD_WIFI_TSW_CLOSE ¹Ø±Õ¶¨Ê±Ë¯Ãß»½Ðѹ¦ÄܵÄÏûÏ¢
58 * @param MSG_CMD_RTC_TIME_UPDATE ¸üÐÂÐèÖØÐÂÉèÖö¨Ê±Ë¯Ãß»½ÐÑÏûÏ¢
59 * @param MSG_CMD_WIFI_RESET_TIMER mmi°´¼üÖØÐÂÉèÖÃ˯Ãßtimer
60*/
61enum wifi_msg_cmd {
62 MSG_CMD_WIFI_CFG_AP = MSG_CMD_WIFI_BASE, //ÉèÖÃÖ÷ssidµÄ»ù±¾²ÎÊýµÄÏûÏ¢4001
63 MSG_CMD_WIFI_CFG_AP2, //ÉèÖø±ssidµÄ»ù±¾²ÎÊýµÄÏûÏ¢
64 //³ýMMIÆäËûÄ£¿é²»Ó¦¸Ã´¦Àí¼Ù¹Ø»úµÄÂß¼­£¬ÓÉMMIÌṩ1¸ö¹Ø»ú²»±£´æNV£¬ÐèÒªµÄÄ£¿é¶ÁÈ¡ÅжÏÊÇ·ñ¼Ù¹Ø»ú¼´¿É
65 //MSG_CMD_WIFI_CLOSE_FAST, //ÉèÖÿìËٹػúµÄÏûÏ¢
66 MSG_CMD_WIFI_CLOSE, //¹Ø±ÕwifiµÄÏûÏ¢
67 MSG_CMD_WIFI_OPEN, //¿ªÆôwifiµÄÏûÏ¢
68 MSG_CMD_WIFI_FORCE_RESTART, //CrashºóÇ¿ÖÆÖØÆôwifiµÄÏûÏ¢
69 MSG_CMD_WIFI_ADVANCED, //wifiµÄ¸ß¼¶²ÎÊýÉèÖÃÏûÏ¢
70 MSG_CMD_WIFI_WPS, //¿ªÆôWPS¹¦ÄÜ£¬2·ÖÖÓ×Ô¶¯¹Ø£¬¹Ê²»ÐèÒª¹Ø±ÕÏûÏ¢
71 MSG_CMD_WIFI_WPS_UP, //WPSÄ£¿é·¢À´µÄWPSÆô¶¯µÄÏûÏ¢
72 MSG_CMD_WIFI_WPS_DOWN, //WPSÄ£¿é·¢À´µÄWPS ¹Ø±ÕµÄÏûÏ¢
73 MSG_CMD_WIFI_SLEEP, //WEBUIÉèÖÃ˯Ãßʱ³¤µÄÏûÏ¢
74 MSG_CMD_CAPTURE_STATION, //²éѯstaµÄÁ¬½ÓÇé¿ö
75 MSG_CMD_WIFI_COVERAGE, //ÉèÖÃwifiµÄ¸²¸Ç·¶Î§
76 MSG_CMD_WIFI_MAC, //ÉèÖÃmac¹ýÂ˹¦ÄÜ
77 MSG_CMD_WIFI_CHANNEL_FOLLOW, //ÉèÖÃwifi APÐŵÀ¸úËæSTA
78
79 MSG_CMD_USB_CHARGING_CHANGED, //Çý¶¯¼ì²âµ½usb³äµç״̬±ä»¯Éϱ¨ÏûÏ¢
80
81 //for apstation
82 MSG_CMD_WIFI_STATION_OPEN, //´ò¿ªapsta¹¦ÄÜ
83 MSG_CMD_WIFI_STATION_OPEN_SUCCESS, //0x4010
84 MSG_CMD_WIFI_STATION_OPEN_FAIL,
85 MSG_CMD_WIFI_STATION_CLOSE, //¹Ø±Õapsta¹¦ÄÜ
86 MSG_CMD_WIFI_STATION_CLOSE_SUCCESS,
87 MSG_CMD_WIFI_STATION_CLOSE_OPEN_MSSID, //´ò¿ªapsta£¬¹Ø±Õ¶àssid
88 MSG_CMD_WIFI_STATION_SCAN, //ɨÃèÈȵã
89 MSG_CMD_WIFI_STATION_CONNECT, //Á¬½ÓÈȵã
90 MSG_CMD_WIFI_STATION_CONNECT_TIMEOUT, //Á¬½Ó³¬Ê±µÄ´¦ÀíÏûÏ¢
91
92 MSG_CMD_WIFI_STATION_SIM_INIT_TIMER_PROCESS, //eap-sim/aka¹¦ÄÜ£¬²éѯsim¿¨ÓÐÎÞÆôÓõĶ¨Ê±Æ÷ÏûÏ¢
93 MSG_CMD_WIFI_STATION_GET_SCAN_RESULTS, // wpa_supplicantÖ÷¶¯É¨Ãè8sÒ»´Î
94 MSG_CMD_WIFI_STATION_DISCONNECT, //Ö÷¶¯¶Ï¿ªÕýÔÚÁ¬½ÓµÄÈȵã
95 MSG_CMD_WIFI_STATION_SPOT_UPDATE, //¸üÐÂÈȵãÁбí
96 MSG_CMD_WIFI_STATION_EVENT_CONNECTING, //wpa_supplicantÕýÔÚ³¢ÊÔÁ¬½ÓʼþÏûÏ¢
97 MSG_CMD_WIFI_STATION_EVENT_CONNECTED, //apstaÓëÈȵãÁ¬½Ó³É¹¦Í¨ÖªÏûÏ¢
98 MSG_CMD_WIFI_STATION_EVENT_DISCONNECTED, //apstaÓëÈȵã¶Ï¿ªÁ¬½Ó֪ͨÏûÏ¢
99 MSG_CMD_WIFI_STATION_BLC_CONNECTED, //blc·¢Ë͵ÄÁ¬½Ó³É¹¦£¬stationµÄipÒÑ·ÖÅäµ½
100 MSG_CMD_BLC_OPEN_WIFISTATION_ACCESS, //blc·¢À´ÏûÏ¢´ò¿ªapstaÁ¬½Ó//0x4020
101 MSG_CMD_BLC_CLOSE_WIFISTATION_ACCESS, //blc·¢À´ÏûÏ¢¶Ï¿ªapstaÁ¬½Ó
102 MSG_CMD_WIFI_STATION_NO_AVAILABLE_AP,
103 MSG_CMD_WIFI_STATION_FORGET, //
104 MSG_CMD_WIFI_STATION_INDICATE_SCAN_RESULTS,
105 MSG_CMD_WIFI_STATION_CONNECT_FAIL,
106 MSG_CMD_WIFI_STATION_SUPPLICANT_EVT, //
107 MSG_CMD_WIFI_STATION_TEMP_DISABLED, //apstaδ³É¹¦Á¬½ÓÉÏÈȵãµÄ¹ý¶Éʼþ£¬Ö®ºó»á×Ô¶¯ÖØÁ¬
108 MSG_CMD_WIFI_STATION_FAILED_SET, //apstaδ³É¹¦Á¬½ÓÉÏÈȵãµÄ¼øÈ¨Ê§°Üʼþ£¬Ö®ºó²»ÖØÁ¬
109
110 MSG_CMD_WIFI_STATION_DEBUG_DUMP,
111 MSG_CMD_WIFI_STATION_WPA_CMD,
112 MSG_CMD_WIFI_STATION_CONNECTED_ENABLE_AP_CMD, //apstaÁ¬½ÓÈȵã³É¹¦Æô¶¯ap
xf.li6c8fc1e2023-08-12 00:11:09 -0700113
114 //cap->ap
115 MSG_CMD_CAP_STA_SET_PARAM, //sta ssid auth pw
116 MSG_CMD_CAP_STA_ENABLE, //ap on off
117 MSG_CMD_CAP_STA_SCAN, //scan
118
lh9ed821d2023-04-07 01:36:19 -0700119 MSG_CMD_WIFI_STATION_END, //apstationµÄÏûÏ¢·¶Î§end
120
121 //timing of sleep wake up
122 MSG_CMD_WIFI_TSW_SET, //ÉèÖö¨Ê±Ë¯Ãß»½ÐѵÄÏûÏ¢
123 MSG_CMD_WIFI_TSW_CLOSE, //¹Ø±Õ¶¨Ê±Ë¯Ãß»½Ðѹ¦ÄܵÄÏûÏ¢
124 MSG_CMD_RTC_TIME_UPDATE, //rtcʱ¼ä ¸üÐÂÐèÖØÐÂÉèÖö¨Ê±Ë¯Ãß»½ÐÑ
125 MSG_CMD_WIFI_RESET_TIMER, //mmi°´¼üÖØÐÂÉèÖÃ˯Ãßtimer
126
127
128 /***************wifi OPENCPUÏûÏ¢****************/
129 MSG_CMD_WIFI_SWITCH_REQ,
130 MSG_CMD_WIFI_SWITCH_RSP,
131 MSG_CMD_WIFI_CFG_SSID_REQ, //0x4030
132 MSG_CMD_WIFI_CFG_SSID_RSP,
133 MSG_CMD_WIFI_CFG_PWD_REQ,
134 MSG_CMD_WIFI_CFG_PWD_RSP,
135 /***************wifi OPENCPUÏûÏ¢****************/
136 MSG_CMD_AP_STA_CONNECTED,
137 MSG_CMD_AP_STA_DISCONNECTED,
138
xf.li6c8fc1e2023-08-12 00:11:09 -0700139 //cap recv
140 MSG_CMD_CAP_WIFI_STATUS,
141 MSG_CMD_CAP_AP_STATUS,
142 MSG_CMD_CAP_AP_STA_CHANGE,
143 MSG_CMD_CAP_STA_STATUS,
144 MSG_CMD_CAP_STA_SCAN_RES,
145
146 //cap send
147 MSG_CMD_CAP_WIFI_ENABLE, //wifiÇý¶¯³õʼ»¯, wlan up
148 MSG_CMD_CAP_WIFI_DISABLE, //wifiÇý¶¯È¥³õʼ»¯, wlan down
149 MSG_CMD_CAP_WIFI_WORK_MODE, //wifi¹¤×÷ģʽÉèÖÃ
150 MSG_CMD_CAP_WIFI_SET_SSID, //
151 MSG_CMD_CAP_WIFI_SET_HIDESSID, //0 not hide, 1 hide
152 MSG_CMD_CAP_WIFI_SET_MODE, //80211 mode bgn...
153 MSG_CMD_CAP_WIFI_SET_BANDWIDTH, //0 20M, 1 20/40M
154 //MSG_CMD_CAP_WIFI_SET_CHANNEL, //0 - 13
155 MSG_CMD_CAP_WIFI_SET_MAXSTANUM, //0 - 32
156 MSG_CMD_CAP_WIFI_SET_CC_CH, //country code, channel
157 MSG_CMD_CAP_WIFI_SET_ACL,
158 MSG_CMD_CAP_WIFI_SET_AUTH, //wpa
159 MSG_CMD_CAP_WIFI_AP_ENABLE, //ap on off
160
161
lh9ed821d2023-04-07 01:36:19 -0700162};
163
164
165#define WIFI_SSID_LEN 33
166#define WLAN_PSK_LEN 65
167#define WLAN_SECURITY_LEN 20
168#define WLAN_ENCRYPT_LEN 10
169#define WLAN_DEFAULTID_LEN 4
170#define WLAN_WEPKEY_LEN 32
171#define WLAN_ENCODE_PSK_LEN 100
172#define WLAN_MAX_ACCESS_NUM_LEN 4
173#define WLAN_HIDESSID_LEN 4
174#define WF_AUTH_OPEN "OPEN"
175#define WF_AUTH_SHARE "SHARED"
176#define WF_AUTH_WEPAUTO "WEPAUTO"
177#define WF_AUTH_WPA "WPAPSK"
178#define WF_AUTH_WPA2 "WPA2PSK"
179#define WF_AUTH_WPA_WPA2 "WPAPSKWPA2PSK"
180#define WF_AUTH_WAPIPSK "WAPIPSK"
181#define WF_ENCRP_NONE "NONE" //encrypt
182#define WF_ENCRP_WEP "WEP"
183#define WF_ENCRP_TKIP "TKIP"
184#define WF_ENCRP_CCMP "CCMP"
185#define WF_ENCRP_AES "AES"
186#define WF_ENCRP_TKIP_CCMP "TKIPCCMP"
187#define WF_ENCRP_TKIP_AES "TKIPAES"
188
189/**
190* @brief ¶¨ÒåMSG_CMD_WIFI_CFG_AP ,MSG_CMD_WIFI_CFG_AP2 ÏûÏ¢¸½´øÊý¾Ý½á¹¹Ìå
191*
192*
193*
194*/
195typedef struct wlan_cfg_basic {
196 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
197 char pwd[WLAN_PSK_LEN]; //pwd len should be in 8~64 bytes
198 char authmode[WLAN_SECURITY_LEN];
199 char encrypt[WLAN_ENCRYPT_LEN];
200 char max_access_num[WLAN_MAX_ACCESS_NUM_LEN];
201 char hidessid[WLAN_HIDESSID_LEN];
202} wlan_basic_info;
203
204typedef struct _wlan_mac_info{
205 char hostname[32];
206 char mac[20];
207}wlan_mac_info;
208
209typedef struct _wlan_mac_info_list{
210 wlan_mac_info mac_info[MAX_NUMBER_OF_MAC];
211 int access_count;
212}wlan_mac_info_list;
213
214/**
215* @brief ¶¨Òåwifi״̬ÃüÁî
216 * @param WIFI_ADVANCED_CLOSE ¹Ø±ÕwifiµÄÏûÏ¢
217 * @param WIFI_ADVANCED_OPEN ¿ªÆôwifiµÄÏûÏ¢
218 * @param WIFI_ADVANCED_OPEN_VA01 ͬʱ¿ªÆôÖ÷¡¢¸±ssidµÄÏûÏ¢
219 * @param WIFI_ADVANCED_CLOSE_MSSID ¹Ø±Õ¸±ssidµÄÏûÏ¢
220 * @param WIFI_ADVANCED_OPEN_VA1 ´ò¿ª¸±ssidµÄÏûÏ¢
221 * @param WIFI_ADVANCED_RF ÉèÖÃÉ䯵²ÎÊýµÄÏûÏ¢
222 * @param WIFI_ADVANCED_RESTART Ð¾Æ¬ÖØÆôµÄÏûÏ¢
223*/
224enum {
225 WIFI_ADVANCED_CLOSE = 0, // 0 ¹Ø±Õwifi
226 WIFI_ADVANCED_OPEN, // 1 ¿ªÆôva0
227 WIFI_ADVANCED_OPEN_VA01, // 2 ͬʱ¿ªÆôÖ÷¡¢¸±ssid
228 WIFI_ADVANCED_CLOSE_MSSID, // 3¹Ø±Õ¸±ssid
229 WIFI_ADVANCED_OPEN_VA1, // 4 ´ò¿ª¸±ssid
230 WIFI_ADVANCED_RF, // 5 ÉèÖÃÉ䯵²ÎÊý
231 WIFI_ADVANCED_RESTART, // 6 Ð¾Æ¬ÖØÆô
232};
233
234/**********wlan atate***************/
235#define WIFI_OPENED "1" //ÒÑ»½ÐÑ
236#define WIFI_CLOSED "0" //ÒѹرÕ
237
238#define WLAN_ON 1 //ÒÑ»½ÐÑ
239#define WLAN_OFF 0
240
241/**
242* @brief ¶¨Òåwifi apstation SIM¿¨×´Ì¬
243 * @param CARD_MODE_NO_SIM ûÓÐSIMµÄÏûÏ¢
244 * @param WCARD_MODE_SIM ´æÔÚSIMµÄÏûÏ¢
245 * @param CARD_MODE_USIM ´æÔÚUSIMµÄÏûÏ¢
246*/
247//ÓÃÓÚapsta¹¦ÄÜÀïʶ±ðsim¿¨
248enum CardMode_Def {
249 /*T_zUfi_CardMode*/
250 CARD_MODE_NO_SIM = 0x1b00,
251 CARD_MODE_SIM,
252 CARD_MODE_USIM,
253 /*--------------------*/
254};
255
256
257/**
258* @brief ¶¨Òåwifi PIN״̬
259 * @param PIN_STATUS_NO_PIN ûÓÐPINÂëµÄÏûÏ¢
260 * @param PIN_STATUS_PIN1 PIN1ÂëµÄÏûÏ¢
261 * @param PIN_STATUS_PIN2 PIN2ÂëµÄÏûÏ¢
262 * @param PIN_STATUS_PUK1 PUK1ÂëµÄÏûÏ¢
263 * @param PIN_STATUS_PUK2 PUK2ÂëµÄÏûÏ¢
264*/
265enum PinStatus_Def {
266 /*T_zUfi_PinStatus*/
267 PIN_STATUS_NO_PIN = 0x1c00,
268 PIN_STATUS_PIN1,
269 PIN_STATUS_PIN2,
270 PIN_STATUS_PUK1,
271 PIN_STATUS_PUK2,
272 /*--------------------*/
273};
274
275/*********************station begin****************/
276
277//#ifndef __REALTEK_8192_CHIP__
278#if !(defined(__REALTEK_8192_CHIP__) || defined(__SSV_6X5X_CHIP__) || defined(__AIC_8800DW_CHIP__))
279
280
281#define WIFI_STATION_MAC_LEN 20
282#define WIFI_STATION_SSID_LEN 128
283#define WIFI_STATION_AUTH_MODE_LEN 20
284#define WIFI_STATION_ENCRYPT_TYPE_LEN 20
285#define WIFI_STATION_SPOT_PASSWORD_LEN 128
286
287typedef struct scan_result {
288 char mac[WIFI_STATION_MAC_LEN];
289 char ssid[WIFI_STATION_SSID_LEN];
290 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
291 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
292 short connect_status;
293 short channel;
294 short signal;
295 short network_id;
296} scan_result_t;
297
298typedef struct spot {
299 char mac[WIFI_STATION_MAC_LEN];
300 char ssid[WIFI_STATION_SSID_LEN];
301 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
302 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
303 char password[WIFI_STATION_SPOT_PASSWORD_LEN];
304 short network_id;
305} spot_t;
306
307typedef enum{
308 SAVE_ACTION,
309 DEL_ACTION,
310 CONNECTING_ACTION,
311 DHCPING_ACTION,
312 CONNECTED_ACTION,
313 DISCONNECT_ACTION,
314
315 //kw 3
316 ACTION_MAX
317}spot_action_t;
318
319typedef struct msg_act_spot {
320 spot_action_t act;
321 char mac[WIFI_STATION_MAC_LEN];
322 char ssid[WIFI_STATION_SSID_LEN];
323 int network_id;
324} msg_act_spot_t;
325
326typedef enum scan_content {
327 WIFI_STATION_AP_CONTENT_UNDEFINED,
328 WIFI_STATION_AP_MAC,
329 WIFI_STATION_AP_SSID,
330 WIFI_STATION_AP_AUTH_MODE,
331 WIFI_STATION_AP_ENCRYPT_TYPE,
332 WIFI_STATION_AP_CHANNEL,
333 WIFI_STATION_AP_SIGNAL,
334 WIFI_STATION_AP_CONNECT_STATUS,
335 WIFI_STATION_AP_NETWORK_ID,
336} scan_content_t;
337
338typedef enum{
339 DISCONNECT_STATUS,
340 CONNECTING_STATUS,
341 DHCPING_STATUS,
342 CONNECTED_STATUS,
343}connect_status_t;
344
345typedef enum {
346 WIFI_STATION_WRONG_KEY,
347 WIFI_STATION_IP_FAIL,
348 WIFI_STATION_AUTH_FAIL,
349 WIFI_STATION_OTHER,
350}conn_fail_reason_t;
351
352#else
353
354#define WIFI_STATION_SPOT_ACTION_LEN 32
355#define WIFI_STATION_SPOT_LEN 256
356#define WIFI_STATION_SPOT_LIST_NUM 10
357#define WIFI_STATION_SPOT_PROFILE_NAME_LEN 30
358#define WIFI_STATION_SPOT_PASSWORD_LEN 128
359#define WIFI_STATION_SPOT_KEY_ID_LEN 10
360#define WIFI_STATION_PROFILE_NV_NAME_LEN 20
361
362#define WIFI_STATION_WPA_STATUS_LEN 30
363#define WIFI_STATION_MAC_LEN 20
364#define WIFI_STATION_SSID_LEN 128
365#define WIFI_STATION_AUTH_MODE_LEN 20
366#define WIFI_STATION_ENCRYPT_TYPE_LEN 20
367#define WIFI_STATION_FLAGS_LEN 128
368
369typedef struct update_spot_info {
370 char spot[WIFI_STATION_SPOT_LEN];
371 char action[WIFI_STATION_SPOT_ACTION_LEN];
372} updateinfo_t;
373
374typedef enum wifi_profile_content {
375 WIFI_STATION_CONTENT_UNDEFINED,
376 WIFI_STATION_PROFILE_NAME,
377 WIFI_STATION_FROM_PROVIDER,
378 WIFI_STATION_CONNECT_STATUS,
379 WIFI_STATION_SIGNAL,
380 WIFI_STATION_SSID,
381 WIFI_STATION_AUTH_MODE,
382 WIFI_STATION_ENCRYPT_TYPE,
383 WIFI_STATION_PASSWORD,
384 WIFI_STATION_KEY_ID,
385 WIFI_STATION_AP_MAC
386} wifi_profile_content_t;
387
388typedef struct scan_result {
389 char mac[WIFI_STATION_MAC_LEN];
390 char ssid[WIFI_STATION_SSID_LEN];
391 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
392 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
393 short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
394 short connect_status;
395 short channel;
396 short signal;
xf.lif2330622024-05-15 18:17:18 -0700397#ifdef USE_CAP_SUPPORT
398 //short ch_freq;
399 signed char signal_db;
400#endif
lh9ed821d2023-04-07 01:36:19 -0700401} scan_result_t;
402
403
404typedef struct spot {
405 char profile_name[WIFI_STATION_SPOT_PROFILE_NAME_LEN];
406 short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
407 short connect_status;
408 short signal;
409 char ssid[WIFI_STATION_SSID_LEN];
410 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
411 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
412 char password[WIFI_STATION_SPOT_PASSWORD_LEN];
413 short keyID;
414 char mac[WIFI_STATION_MAC_LEN];
415 BOOL is_tried_connect;
416 short network_id;
417} spot_t;
418
419
420typedef struct spot_ssid_id {
421 int id;
422 char ssid[WIFI_STATION_SSID_LEN];
423} spot_ssid_id_t;
424#endif
425
426/*********************station end****************/
427
428/*nv set flags */
429
430//wifi
431
432#define NVIO_WIFI_MAX_LEN 200 /*write or read nv length*/
433#define WIFI_PSW_DEFAULT_LENGTH 65
434#define WIFI_STATUS_LEN 2
435#define WIFI_PSW_MIN_LEN 1
436#define WIFI_PSW_MAN_LEN 64
437#define WIFI_CONFIG_DEFAULT_LENGTH 128
438#define WF_WPS_KEY_INDEX_LEN 2
439#define WF_KEY_MODE_LEN 3
440#define WF_WEP_KEY_MAX_LEN 27
441#define WF_WPA_KEY_MAX_LEN 65
442#define WF_ENCRY_TYPE_LEN 16
443#define WF_AU_MODE_LEN 16
444#define WPS_MODE_PIN "PIN" //wps mode
445#define WPS_MODE_PBC "PBC"
446#define WPS_MODE_AP_PIN "APPIN"
447#define WF_AU_OPEN "OPEN" //wifi auth mode?
448#define WF_AU_SHARE "SHARED"
449#define WF_AU_WEPAUTO "WEPAUTO"
450#define WF_AU_WPA "WPAPSK"
451#define WF_AU_WPA2 "WPA2PSK"
452#define WF_AU_WPA_WPA2 "WPAPSKWPA2PSK"
453#define WF_AU_WPA3 "WPA3Personal"
454#define WF_AU_WPA2_WPA3 "WPA2WPA3"
455#define WF_AU_WAPIPSK "WAPIPSK"
456#define WF_ENCRY_NONE "NONE" //encrypt
457#define WF_ENCRY_WEP "WEP"
458#define WF_ENCRY_TKIP "TKIP"
459#define WF_ENCRY_CCMP "CCMP"
460#define WF_ENCRY_AES "AES"
461#define WF_ENCRY_TKIP_CCMP "TKIPCCMP"
462#define WF_ENCRY_TKIP_AES "TKIPAES"
463#define WIFI_SSID_INDEX "ssid_index"
464#define WIFI_STATION_MAC "mac_addr"
465#define WIFI_STATION_HOSTNAME "hostname"
466#define WIFI_STATION_IPADDR "ip_addr"
467#define WIFI_STATION_CONNECTTIME "connect_time"
468#define WIFI_STATION_VALIDTIME "valid_time"
469#define WIFI_STATION_IPTYPE "ip_type"
470#define WIFI_STATION_DEVTYPE "dev_type"
471#define WIFI_NV_ITEM_WIFI_SET_FLAGS "wifi_set_flags"
472#define NV_WIFI_SCAN_FINISH "scan_finish"
473
474#define NV_WIFI_WPA_PASS "WPAPSK1"
475#define NV_WIFI_WPA_PASS_ENCODE "WPAPSK1_encode"
476#define NV_WIFI_WPA_PASS_M "m_WPAPSK1"
477#define NV_WIFI_WPA_PASS_M_ENCODE "m_WPAPSK1_encode"
478#define NV_WIFI_COVERAGE "wifi_coverage"
479#define NV_WIFI_WPS_STATE "WscModeOption"
480#define NV_WIFI_WPS_MODE "wps_mode"
481#define NV_WIFI_WPS_SSID "WPS_SSID"
482#define NV_WIFI_WPS_INDEX "wifi_wps_index"
483#define NV_WIFI_WPS_PIN "wps_pin"
484#define NV_WIFI_WPS_AP_PIN "wifi_ap_pin"
485#define NV_WIFI_WPS_DEF_PIN "wifi_def_pin"
486#define CMD_WIFI_STATION_LIST "station_list"
487#define CMD_HOSTNAME_LIST "hostNameList"
488#define CMD_WIFI_WPS_AP_PIN "wifi_ap_pin"
489#define CMD_WIFI_WPS_AP_DEF_PIN "wifi_def_pin"
490
491typedef enum {
492 ZTE_WLAN_SSID_SET = 0x1,
493 ZTE_WLAN_BROADCAST_SET = 0x2,
494 ZTE_WLAN_BASIC_SECURITY_SET = 0x4,
495 ZTE_WLAN_MAX_ACCESS_NUM_SET = 0x8,
496
497
498 ZTE_WLAN_ON_OFF_SET = 0x10,
499 ZTE_WLAN_WIRELESS_MODE_SET = 0x20,
500 ZTE_WLAN_CHANNEL_SET = 0x40,
501 ZTE_WLAN_COUNTRY_SET = 0x80,
502 ZTE_WLAN_WIFI_BAND_SET = 0x100,
503
504 ZTE_WLAN_POWER_SET = 0x1000,
505 ZTE_WLAN_ACL_SET = 0x2000,
506 ZTE_WLAN_WPS_SET = 0x4000,
507 ZTE_WLAN_SET_AP_SLEEPTIMER = 0x8000,
508
509
510 ZTE_WLAN_SET_AP_MSSID = 0x10000,
511
512} zte_wlan_set_e_flags;
513
xf.li6c8fc1e2023-08-12 00:11:09 -0700514
515//cap:api->wlan_proxy->ap:wlan_server
516typedef enum
517{
518 IN_WIFI_STATUS_DEV_INIT_FAIL = 0,
519 IN_WIFI_STATUS_INVALID_MAC
520} inner_wifi_status_e;
521
522//nei bu zhuan huan yong
523//same as sc_wifi_ap_index_e
524typedef enum
525{
526 IN_WIFI_AP_INDEX_MIN = -1,
xf.li84027492024-04-09 00:17:51 -0700527 IN_WIFI_AP_INDEX_AP0 = 0, //2.4G
528 IN_WIFI_AP_INDEX_AP1, //5G
xf.li6c8fc1e2023-08-12 00:11:09 -0700529 IN_WIFI_AP_INDEX_MAX
530} inner_wifi_ap_id_e;
531
532typedef struct {
533 int idx; //refers to: wlan0,1...
534 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
535} wlan_ap_ssid_t;
536
537typedef struct {
538 int idx; //refers to: wlan0,1...
539 int ssid_hide; //0 not hide, 1 hide
540} wlan_ap_ssid_hide_t;
541
542typedef struct {
543 int idx; //refers to: wlan0,1...
xf.lif2330622024-05-15 18:17:18 -0700544 int wl_mode; //2.4G: 6 bgnax, 4 bgn; 5G: 6 a/n/ac/ax, 5 a/n/ac, 4 a/n
xf.li6c8fc1e2023-08-12 00:11:09 -0700545} wlan_ap_wl_mode_t;
546
547typedef struct {
548 int idx; //refers to: wlan0,1...
xf.lif2330622024-05-15 18:17:18 -0700549 int htMode; //4 20/40/80M, 1 20/40M, 0 20M
xf.li6c8fc1e2023-08-12 00:11:09 -0700550 //int force_40m;
551} wlan_ap_bandwidth_t;
552
553typedef struct {
554 int idx; //refers to: wlan0,1...
555 int max_sta_num; //1-32
556} wlan_ap_max_sta_t;
557
558typedef struct {
559 int idx; //refers to: wlan0,1...
560 char countrycode[3]; //default CN
561 int channel; //0-13
562} wlan_ap_cc_ch_t;
563
564typedef struct {
565 int idx; //refers to: wlan0,1...
566 int acl_rule; //0 none, 1 white, 2 black
567 char acl_list[360]; //max 10 mac1;mac2...
568} wlan_ap_acl_t;
569
570typedef struct {
571 int idx; //refers to: wlan0,1...
572 char authmode[WLAN_SECURITY_LEN];
573 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
574 char pwd[WLAN_PSK_LEN]; //max 64
575} wlan_ap_auth_t;
576
577typedef struct {
578 int idx; //refers to: wlan0,1...
579 int enable; //1 ap on , 0 ap off
580} wlan_ap_enable_t;
581
582//station
583typedef struct {
584 int enable; //1 ap on , 0 ap off
585} wlan_sta_enable_t;
586
587
588//ap->cap:ind
589//½á¹¹Ìå,ºÃÀ©Õ¹
590typedef struct {
591 int wifi_status;
592} wlan_status_t;
593
594//same as sc_wifi_work_mode_e to do: hu huan
595typedef enum
596{
597 IN_WIFI_WORK_MODE_MIN = -1,
xf.li84027492024-04-09 00:17:51 -0700598 IN_WIFI_WORK_MODE_AP0 = 0, //2.4G single ap / ap+sta
599 IN_WIFI_WORK_MODE_AP1, //5G single ap / ap+sta
xf.li6c8fc1e2023-08-12 00:11:09 -0700600 IN_WIFI_WORK_MODE_MAX
601} inner_wifi_work_mode_e;
602
603//same as sc_wifi_ap_status_e
604typedef enum
605{
606 IN_WIFI_AP_STATUS_NONE = 0,
607 IN_WIFI_AP_STATUS_IDLE, //or disable
608 IN_WIFI_AP_STATUS_ENABLING,
609 IN_WIFI_AP_STATUS_ENABLED,
610 IN_WIFI_AP_STATUS_DISABLING,
611 IN_WIFI_AP_STATUS_ERROR
612} inner_wifi_ap_status_e;
613
614typedef struct {
615 int idx;
616 int pre_status; //½öcap×ÔÐи³Öµ
617 int status;
618 char ifname[32];
xf.lif2330622024-05-15 18:17:18 -0700619 char bssid[18]; //½öcap×ÔÐи³Öµ
xf.li6c8fc1e2023-08-12 00:11:09 -0700620} wlan_ap_status_t;
621
622//sc_wifi_sta_connect_status_t
623typedef struct {
624 int idx;
625 int is_connected;
626 char macaddr[18];
627} wlan_sta_connect_status_t;
628
629//cap station
630typedef struct {
631 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
632 char authmode[WLAN_SECURITY_LEN];
633 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
634 char pwd[WLAN_PSK_LEN]; //max 64
635} wlan_sta_param_t;
636
637//same as sc_wifi_sta_status_e
638typedef enum
639{
640 IN_WIFI_STA_STATUS_NONE, //close
641 IN_WIFI_STA_STATUS_IDLE,
642 IN_WIFI_STA_STATUS_CONNECTING, //Trying to associate with
643 IN_WIFI_STA_STATUS_ASSOCIATED, //dhcping
644 IN_WIFI_STA_STATUS_CONNECTED,
645 IN_WIFI_STA_STATUS_DISCONNECTED,
646 IN_WIFI_STA_STATUS_ERROR
647} in_wifi_sta_status_e;
648
649//same as sc_wifi_reason_code_e
650typedef enum
651{
652 IN_WIFI_REASON_CODE_NONE,
653 IN_WIFI_REASON_CODE_WRONG_KEY,
654 IN_WIFI_REASON_CODE_AUTH_FAILED,
655 IN_WIFI_REASON_CODE_CONN_FAILED,
656 IN_WIFI_REASON_CODE_SET_FAILED,
657 IN_WIFI_REASON_CODE_DHCP_FAILED
658} in_wifi_reason_code_e;
659
xf.libe704612024-05-28 19:09:12 -0700660typedef struct
661{
662 char addr[16]; //255.255.255.255 16 IPV4ADDLEN_MAX
663 char netmask[16];
664 unsigned char subnet_bits; //255.255.255.0 is 24
665 char gateway[16];
666 char dnsp[16]; //primary DNS
667 char dnss[16]; //secondary DNS
668} in_wifi_net_addr_t;
669
670typedef struct
671{
672 char addr[48]; //0001:0002:0003:0004:0001:0002:0003:0004 40 (+8:, 48)
673 char prefix[48];
674 unsigned char prefix_bits;
675 char gateway[48];
676 char dnsp[48]; //primary DNS
677 char dnss[48]; //secondary DNS
678} in_wifi_net_addr6_t;
679
xf.li6c8fc1e2023-08-12 00:11:09 -0700680//same as sc_wifi_sta_status_t
681typedef struct {
682 int pre_status; //proxy record
683
684 int status; //in_wifi_sta_status_e
685 char ifname[32];
686 char ap_bssid[18]; //cur ap mac
xf.libe704612024-05-28 19:09:12 -0700687 int rssi;
xf.li6c8fc1e2023-08-12 00:11:09 -0700688 unsigned char signal_level;
689 unsigned char has_addr;
xf.libe704612024-05-28 19:09:12 -0700690 in_wifi_net_addr_t addr;
xf.li6c8fc1e2023-08-12 00:11:09 -0700691 unsigned char has_addr6;
xf.libe704612024-05-28 19:09:12 -0700692 in_wifi_net_addr6_t addr6;
xf.li6c8fc1e2023-08-12 00:11:09 -0700693 int reason_code; //in_wifi_reason_code_e
694} wlan_sta_status_t;
695
696typedef struct {
697 int result;
698 wlan_sta_status_t status;
699} scwifi_sta_stat_res_t;
700
701
702#define CAP_WIFI_MAX_SCAN_CNT 30
703
xf.liaa4d92f2023-09-13 00:18:58 -0700704#define CAP_WIFI_AUTH_UNSUP -1 //"not support"
705#define CAP_WIFI_AUTH_OPEN 0 //"OPEN"
706#define CAP_WIFI_AUTH_WPA2 1 //"WPA2PSK"
707#define CAP_WIFI_AUTH_WPA3 2 //"WPA3Personal"
708#define CAP_WIFI_AUTH_WPA12 3 //"WPAPSKWPA2PSK"
709#define CAP_WIFI_AUTH_WPA23 4 //"WPA2WPA3"
710
711#define CAP_WIFI_ENCRYPT_UNSUP -1 //"not support"
712#define CAP_WIFI_ENCRYPT_AUTO 0 //"TKIPCCMP"
713#define CAP_WIFI_ENCRYPT_TKIP 1 //"TKIP"
714#define CAP_WIFI_ENCRYPT_AES 2 //"CCMP"
xf.li6c8fc1e2023-08-12 00:11:09 -0700715
716//sc_wifi_sta_scan_info_t
717typedef struct
718{
719 char bssid[18];//mac
720 char essid[33];
xf.lif2330622024-05-15 18:17:18 -0700721 signed char signal; //dbm
xf.li6c8fc1e2023-08-12 00:11:09 -0700722 unsigned char signal_level; //0-5, max 5
xf.lif2330622024-05-15 18:17:18 -0700723 unsigned char channel; //1-13, 36...
xf.li6c8fc1e2023-08-12 00:11:09 -0700724 unsigned char auth;
xf.liaa4d92f2023-09-13 00:18:58 -0700725 unsigned char cipher;
xf.lif2330622024-05-15 18:17:18 -0700726 //int frequency; //Hz
xf.li6c8fc1e2023-08-12 00:11:09 -0700727} wlan_sta_scan_info_t;
728
729//sc_wifi_sta_scan_list_t
730typedef struct
731{
732 int cnt;
733 wlan_sta_scan_info_t info[CAP_WIFI_MAX_SCAN_CNT];
734} wlan_sta_scan_list_t;
735
xf.li84027492024-04-09 00:17:51 -0700736typedef struct {
737 int work_mode;
738} wlan_work_mode_t;//scwifi_workmode_t
739
lh9ed821d2023-04-07 01:36:19 -0700740#endif