blob: 83ae37616a0e9948caff03cd4888f60a1b7e1a90 [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;
397} scan_result_t;
398
399
400typedef struct spot {
401 char profile_name[WIFI_STATION_SPOT_PROFILE_NAME_LEN];
402 short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
403 short connect_status;
404 short signal;
405 char ssid[WIFI_STATION_SSID_LEN];
406 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
407 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
408 char password[WIFI_STATION_SPOT_PASSWORD_LEN];
409 short keyID;
410 char mac[WIFI_STATION_MAC_LEN];
411 BOOL is_tried_connect;
412 short network_id;
413} spot_t;
414
415
416typedef struct spot_ssid_id {
417 int id;
418 char ssid[WIFI_STATION_SSID_LEN];
419} spot_ssid_id_t;
420#endif
421
422/*********************station end****************/
423
424/*nv set flags */
425
426//wifi
427
428#define NVIO_WIFI_MAX_LEN 200 /*write or read nv length*/
429#define WIFI_PSW_DEFAULT_LENGTH 65
430#define WIFI_STATUS_LEN 2
431#define WIFI_PSW_MIN_LEN 1
432#define WIFI_PSW_MAN_LEN 64
433#define WIFI_CONFIG_DEFAULT_LENGTH 128
434#define WF_WPS_KEY_INDEX_LEN 2
435#define WF_KEY_MODE_LEN 3
436#define WF_WEP_KEY_MAX_LEN 27
437#define WF_WPA_KEY_MAX_LEN 65
438#define WF_ENCRY_TYPE_LEN 16
439#define WF_AU_MODE_LEN 16
440#define WPS_MODE_PIN "PIN" //wps mode
441#define WPS_MODE_PBC "PBC"
442#define WPS_MODE_AP_PIN "APPIN"
443#define WF_AU_OPEN "OPEN" //wifi auth mode?
444#define WF_AU_SHARE "SHARED"
445#define WF_AU_WEPAUTO "WEPAUTO"
446#define WF_AU_WPA "WPAPSK"
447#define WF_AU_WPA2 "WPA2PSK"
448#define WF_AU_WPA_WPA2 "WPAPSKWPA2PSK"
449#define WF_AU_WPA3 "WPA3Personal"
450#define WF_AU_WPA2_WPA3 "WPA2WPA3"
451#define WF_AU_WAPIPSK "WAPIPSK"
452#define WF_ENCRY_NONE "NONE" //encrypt
453#define WF_ENCRY_WEP "WEP"
454#define WF_ENCRY_TKIP "TKIP"
455#define WF_ENCRY_CCMP "CCMP"
456#define WF_ENCRY_AES "AES"
457#define WF_ENCRY_TKIP_CCMP "TKIPCCMP"
458#define WF_ENCRY_TKIP_AES "TKIPAES"
459#define WIFI_SSID_INDEX "ssid_index"
460#define WIFI_STATION_MAC "mac_addr"
461#define WIFI_STATION_HOSTNAME "hostname"
462#define WIFI_STATION_IPADDR "ip_addr"
463#define WIFI_STATION_CONNECTTIME "connect_time"
464#define WIFI_STATION_VALIDTIME "valid_time"
465#define WIFI_STATION_IPTYPE "ip_type"
466#define WIFI_STATION_DEVTYPE "dev_type"
467#define WIFI_NV_ITEM_WIFI_SET_FLAGS "wifi_set_flags"
468#define NV_WIFI_SCAN_FINISH "scan_finish"
469
470#define NV_WIFI_WPA_PASS "WPAPSK1"
471#define NV_WIFI_WPA_PASS_ENCODE "WPAPSK1_encode"
472#define NV_WIFI_WPA_PASS_M "m_WPAPSK1"
473#define NV_WIFI_WPA_PASS_M_ENCODE "m_WPAPSK1_encode"
474#define NV_WIFI_COVERAGE "wifi_coverage"
475#define NV_WIFI_WPS_STATE "WscModeOption"
476#define NV_WIFI_WPS_MODE "wps_mode"
477#define NV_WIFI_WPS_SSID "WPS_SSID"
478#define NV_WIFI_WPS_INDEX "wifi_wps_index"
479#define NV_WIFI_WPS_PIN "wps_pin"
480#define NV_WIFI_WPS_AP_PIN "wifi_ap_pin"
481#define NV_WIFI_WPS_DEF_PIN "wifi_def_pin"
482#define CMD_WIFI_STATION_LIST "station_list"
483#define CMD_HOSTNAME_LIST "hostNameList"
484#define CMD_WIFI_WPS_AP_PIN "wifi_ap_pin"
485#define CMD_WIFI_WPS_AP_DEF_PIN "wifi_def_pin"
486
487typedef enum {
488 ZTE_WLAN_SSID_SET = 0x1,
489 ZTE_WLAN_BROADCAST_SET = 0x2,
490 ZTE_WLAN_BASIC_SECURITY_SET = 0x4,
491 ZTE_WLAN_MAX_ACCESS_NUM_SET = 0x8,
492
493
494 ZTE_WLAN_ON_OFF_SET = 0x10,
495 ZTE_WLAN_WIRELESS_MODE_SET = 0x20,
496 ZTE_WLAN_CHANNEL_SET = 0x40,
497 ZTE_WLAN_COUNTRY_SET = 0x80,
498 ZTE_WLAN_WIFI_BAND_SET = 0x100,
499
500 ZTE_WLAN_POWER_SET = 0x1000,
501 ZTE_WLAN_ACL_SET = 0x2000,
502 ZTE_WLAN_WPS_SET = 0x4000,
503 ZTE_WLAN_SET_AP_SLEEPTIMER = 0x8000,
504
505
506 ZTE_WLAN_SET_AP_MSSID = 0x10000,
507
508} zte_wlan_set_e_flags;
509
xf.li6c8fc1e2023-08-12 00:11:09 -0700510
511//cap:api->wlan_proxy->ap:wlan_server
512typedef enum
513{
514 IN_WIFI_STATUS_DEV_INIT_FAIL = 0,
515 IN_WIFI_STATUS_INVALID_MAC
516} inner_wifi_status_e;
517
518//nei bu zhuan huan yong
519//same as sc_wifi_ap_index_e
520typedef enum
521{
522 IN_WIFI_AP_INDEX_MIN = -1,
523 IN_WIFI_AP_INDEX_AP0 = 0,
524 //IN_WIFI_AP_INDEX_AP1,
525 IN_WIFI_AP_INDEX_MAX
526} inner_wifi_ap_id_e;
527
528typedef struct {
529 int idx; //refers to: wlan0,1...
530 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
531} wlan_ap_ssid_t;
532
533typedef struct {
534 int idx; //refers to: wlan0,1...
535 int ssid_hide; //0 not hide, 1 hide
536} wlan_ap_ssid_hide_t;
537
538typedef struct {
539 int idx; //refers to: wlan0,1...
540 int wl_mode; //6 bgnax, 4 bgn
541} wlan_ap_wl_mode_t;
542
543typedef struct {
544 int idx; //refers to: wlan0,1...
545 int htMode; //1 20/40M, 0 20M
546 //int force_40m;
547} wlan_ap_bandwidth_t;
548
549typedef struct {
550 int idx; //refers to: wlan0,1...
551 int max_sta_num; //1-32
552} wlan_ap_max_sta_t;
553
554typedef struct {
555 int idx; //refers to: wlan0,1...
556 char countrycode[3]; //default CN
557 int channel; //0-13
558} wlan_ap_cc_ch_t;
559
560typedef struct {
561 int idx; //refers to: wlan0,1...
562 int acl_rule; //0 none, 1 white, 2 black
563 char acl_list[360]; //max 10 mac1;mac2...
564} wlan_ap_acl_t;
565
566typedef struct {
567 int idx; //refers to: wlan0,1...
568 char authmode[WLAN_SECURITY_LEN];
569 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
570 char pwd[WLAN_PSK_LEN]; //max 64
571} wlan_ap_auth_t;
572
573typedef struct {
574 int idx; //refers to: wlan0,1...
575 int enable; //1 ap on , 0 ap off
576} wlan_ap_enable_t;
577
578//station
579typedef struct {
580 int enable; //1 ap on , 0 ap off
581} wlan_sta_enable_t;
582
583
584//ap->cap:ind
585//½á¹¹Ìå,ºÃÀ©Õ¹
586typedef struct {
587 int wifi_status;
588} wlan_status_t;
589
590//same as sc_wifi_work_mode_e to do: hu huan
591typedef enum
592{
593 IN_WIFI_WORK_MODE_MIN = -1,
594 IN_WIFI_WORK_MODE_AP0 = 0,
595 IN_WIFI_WORK_MODE_AP0_STA,
596 IN_WIFI_WORK_MODE_MAX
597} inner_wifi_work_mode_e;
598
599//same as sc_wifi_ap_status_e
600typedef enum
601{
602 IN_WIFI_AP_STATUS_NONE = 0,
603 IN_WIFI_AP_STATUS_IDLE, //or disable
604 IN_WIFI_AP_STATUS_ENABLING,
605 IN_WIFI_AP_STATUS_ENABLED,
606 IN_WIFI_AP_STATUS_DISABLING,
607 IN_WIFI_AP_STATUS_ERROR
608} inner_wifi_ap_status_e;
609
610typedef struct {
611 int idx;
612 int pre_status; //½öcap×ÔÐи³Öµ
613 int status;
614 char ifname[32];
615 //char bssid[18];
616} wlan_ap_status_t;
617
618//sc_wifi_sta_connect_status_t
619typedef struct {
620 int idx;
621 int is_connected;
622 char macaddr[18];
623} wlan_sta_connect_status_t;
624
625//cap station
626typedef struct {
627 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
628 char authmode[WLAN_SECURITY_LEN];
629 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
630 char pwd[WLAN_PSK_LEN]; //max 64
631} wlan_sta_param_t;
632
633//same as sc_wifi_sta_status_e
634typedef enum
635{
636 IN_WIFI_STA_STATUS_NONE, //close
637 IN_WIFI_STA_STATUS_IDLE,
638 IN_WIFI_STA_STATUS_CONNECTING, //Trying to associate with
639 IN_WIFI_STA_STATUS_ASSOCIATED, //dhcping
640 IN_WIFI_STA_STATUS_CONNECTED,
641 IN_WIFI_STA_STATUS_DISCONNECTED,
642 IN_WIFI_STA_STATUS_ERROR
643} in_wifi_sta_status_e;
644
645//same as sc_wifi_reason_code_e
646typedef enum
647{
648 IN_WIFI_REASON_CODE_NONE,
649 IN_WIFI_REASON_CODE_WRONG_KEY,
650 IN_WIFI_REASON_CODE_AUTH_FAILED,
651 IN_WIFI_REASON_CODE_CONN_FAILED,
652 IN_WIFI_REASON_CODE_SET_FAILED,
653 IN_WIFI_REASON_CODE_DHCP_FAILED
654} in_wifi_reason_code_e;
655
656//same as sc_wifi_sta_status_t
657typedef struct {
658 int pre_status; //proxy record
659
660 int status; //in_wifi_sta_status_e
661 char ifname[32];
662 char ap_bssid[18]; //cur ap mac
663 //int rssi;
664 unsigned char signal_level;
665 unsigned char has_addr;
666 char str_addr[16]; //255.255.255.255 16
667 unsigned char has_addr6;
668 char str_addr6[48]; //0001:0002:0003:0004:0001:0002:0003:0004 40 (+8:, 48)
669 int reason_code; //in_wifi_reason_code_e
670} wlan_sta_status_t;
671
672typedef struct {
673 int result;
674 wlan_sta_status_t status;
675} scwifi_sta_stat_res_t;
676
677
678#define CAP_WIFI_MAX_SCAN_CNT 30
679
680#define CAP_WIFI_AUTH_UNSUP -1 //"not support");
681#define CAP_WIFI_AUTH_OPEN 0 //"OPEN");
682#define CAP_WIFI_AUTH_WPA2 1 //"WPA2PSK");
683#define CAP_WIFI_AUTH_WPA3 2 //"WPA3Personal");
684#define CAP_WIFI_AUTH_WPA12 3 //"WPAPSKWPA2PSK");
685#define CAP_WIFI_AUTH_WPA23 4 //"WPA2WPA3");
686
687//sc_wifi_sta_scan_info_t
688typedef struct
689{
690 char bssid[18];//mac
691 char essid[33];
692 //int signal;
693 unsigned char signal_level; //0-5, max 5
694 //int frequency;
695 unsigned char channel; //1-13
696 unsigned char auth;
697} wlan_sta_scan_info_t;
698
699//sc_wifi_sta_scan_list_t
700typedef struct
701{
702 int cnt;
703 wlan_sta_scan_info_t info[CAP_WIFI_MAX_SCAN_CNT];
704} wlan_sta_scan_list_t;
705
lh9ed821d2023-04-07 01:36:19 -0700706#endif