blob: a148d67be9552f59419ca84a0398ad645eaf3c9e [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ÏûÏ¢****************/
zw.wangc08ce042024-08-08 18:42:05 +0800136
lh9ed821d2023-04-07 01:36:19 -0700137 MSG_CMD_AP_STA_CONNECTED,
138 MSG_CMD_AP_STA_DISCONNECTED,
139
xf.li6c8fc1e2023-08-12 00:11:09 -0700140 //cap recv
141 MSG_CMD_CAP_WIFI_STATUS,
142 MSG_CMD_CAP_AP_STATUS,
143 MSG_CMD_CAP_AP_STA_CHANGE,
144 MSG_CMD_CAP_STA_STATUS,
145 MSG_CMD_CAP_STA_SCAN_RES,
146
147 //cap send
148 MSG_CMD_CAP_WIFI_ENABLE, //wifiÇý¶¯³õʼ»¯, wlan up
149 MSG_CMD_CAP_WIFI_DISABLE, //wifiÇý¶¯È¥³õʼ»¯, wlan down
150 MSG_CMD_CAP_WIFI_WORK_MODE, //wifi¹¤×÷ģʽÉèÖÃ
151 MSG_CMD_CAP_WIFI_SET_SSID, //
152 MSG_CMD_CAP_WIFI_SET_HIDESSID, //0 not hide, 1 hide
153 MSG_CMD_CAP_WIFI_SET_MODE, //80211 mode bgn...
154 MSG_CMD_CAP_WIFI_SET_BANDWIDTH, //0 20M, 1 20/40M
155 //MSG_CMD_CAP_WIFI_SET_CHANNEL, //0 - 13
156 MSG_CMD_CAP_WIFI_SET_MAXSTANUM, //0 - 32
157 MSG_CMD_CAP_WIFI_SET_CC_CH, //country code, channel
158 MSG_CMD_CAP_WIFI_SET_ACL,
159 MSG_CMD_CAP_WIFI_SET_AUTH, //wpa
160 MSG_CMD_CAP_WIFI_AP_ENABLE, //ap on off
161
zw.wangc08ce042024-08-08 18:42:05 +0800162 MSG_CMD_CAP_WIFI_TEST_ENABLE, //wifi²âÊÔģʽÇý¶¯³õʼ»¯, 1 insmod/0 rmmod
163
164 //for cap sync API
165 MSG_CMD_CAP_WIFI_STA_STAT_REQ,
166 MSG_CMD_CAP_WIFI_STA_STAT_RSP,
xf.li6c8fc1e2023-08-12 00:11:09 -0700167
lh9ed821d2023-04-07 01:36:19 -0700168};
169
170
171#define WIFI_SSID_LEN 33
172#define WLAN_PSK_LEN 65
173#define WLAN_SECURITY_LEN 20
174#define WLAN_ENCRYPT_LEN 10
175#define WLAN_DEFAULTID_LEN 4
176#define WLAN_WEPKEY_LEN 32
177#define WLAN_ENCODE_PSK_LEN 100
178#define WLAN_MAX_ACCESS_NUM_LEN 4
179#define WLAN_HIDESSID_LEN 4
180#define WF_AUTH_OPEN "OPEN"
181#define WF_AUTH_SHARE "SHARED"
182#define WF_AUTH_WEPAUTO "WEPAUTO"
183#define WF_AUTH_WPA "WPAPSK"
184#define WF_AUTH_WPA2 "WPA2PSK"
185#define WF_AUTH_WPA_WPA2 "WPAPSKWPA2PSK"
186#define WF_AUTH_WAPIPSK "WAPIPSK"
187#define WF_ENCRP_NONE "NONE" //encrypt
188#define WF_ENCRP_WEP "WEP"
189#define WF_ENCRP_TKIP "TKIP"
190#define WF_ENCRP_CCMP "CCMP"
191#define WF_ENCRP_AES "AES"
192#define WF_ENCRP_TKIP_CCMP "TKIPCCMP"
193#define WF_ENCRP_TKIP_AES "TKIPAES"
194
195/**
196* @brief ¶¨ÒåMSG_CMD_WIFI_CFG_AP ,MSG_CMD_WIFI_CFG_AP2 ÏûÏ¢¸½´øÊý¾Ý½á¹¹Ìå
197*
198*
199*
200*/
201typedef struct wlan_cfg_basic {
202 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
203 char pwd[WLAN_PSK_LEN]; //pwd len should be in 8~64 bytes
204 char authmode[WLAN_SECURITY_LEN];
205 char encrypt[WLAN_ENCRYPT_LEN];
206 char max_access_num[WLAN_MAX_ACCESS_NUM_LEN];
207 char hidessid[WLAN_HIDESSID_LEN];
208} wlan_basic_info;
209
210typedef struct _wlan_mac_info{
211 char hostname[32];
212 char mac[20];
213}wlan_mac_info;
214
215typedef struct _wlan_mac_info_list{
216 wlan_mac_info mac_info[MAX_NUMBER_OF_MAC];
217 int access_count;
218}wlan_mac_info_list;
219
220/**
221* @brief ¶¨Òåwifi״̬ÃüÁî
222 * @param WIFI_ADVANCED_CLOSE ¹Ø±ÕwifiµÄÏûÏ¢
223 * @param WIFI_ADVANCED_OPEN ¿ªÆôwifiµÄÏûÏ¢
224 * @param WIFI_ADVANCED_OPEN_VA01 ͬʱ¿ªÆôÖ÷¡¢¸±ssidµÄÏûÏ¢
225 * @param WIFI_ADVANCED_CLOSE_MSSID ¹Ø±Õ¸±ssidµÄÏûÏ¢
226 * @param WIFI_ADVANCED_OPEN_VA1 ´ò¿ª¸±ssidµÄÏûÏ¢
227 * @param WIFI_ADVANCED_RF ÉèÖÃÉ䯵²ÎÊýµÄÏûÏ¢
228 * @param WIFI_ADVANCED_RESTART Ð¾Æ¬ÖØÆôµÄÏûÏ¢
229*/
230enum {
231 WIFI_ADVANCED_CLOSE = 0, // 0 ¹Ø±Õwifi
232 WIFI_ADVANCED_OPEN, // 1 ¿ªÆôva0
233 WIFI_ADVANCED_OPEN_VA01, // 2 ͬʱ¿ªÆôÖ÷¡¢¸±ssid
234 WIFI_ADVANCED_CLOSE_MSSID, // 3¹Ø±Õ¸±ssid
235 WIFI_ADVANCED_OPEN_VA1, // 4 ´ò¿ª¸±ssid
236 WIFI_ADVANCED_RF, // 5 ÉèÖÃÉ䯵²ÎÊý
237 WIFI_ADVANCED_RESTART, // 6 Ð¾Æ¬ÖØÆô
238};
239
240/**********wlan atate***************/
241#define WIFI_OPENED "1" //ÒÑ»½ÐÑ
242#define WIFI_CLOSED "0" //ÒѹرÕ
243
244#define WLAN_ON 1 //ÒÑ»½ÐÑ
245#define WLAN_OFF 0
246
247/**
248* @brief ¶¨Òåwifi apstation SIM¿¨×´Ì¬
249 * @param CARD_MODE_NO_SIM ûÓÐSIMµÄÏûÏ¢
250 * @param WCARD_MODE_SIM ´æÔÚSIMµÄÏûÏ¢
251 * @param CARD_MODE_USIM ´æÔÚUSIMµÄÏûÏ¢
252*/
253//ÓÃÓÚapsta¹¦ÄÜÀïʶ±ðsim¿¨
254enum CardMode_Def {
255 /*T_zUfi_CardMode*/
256 CARD_MODE_NO_SIM = 0x1b00,
257 CARD_MODE_SIM,
258 CARD_MODE_USIM,
259 /*--------------------*/
260};
261
262
263/**
264* @brief ¶¨Òåwifi PIN״̬
265 * @param PIN_STATUS_NO_PIN ûÓÐPINÂëµÄÏûÏ¢
266 * @param PIN_STATUS_PIN1 PIN1ÂëµÄÏûÏ¢
267 * @param PIN_STATUS_PIN2 PIN2ÂëµÄÏûÏ¢
268 * @param PIN_STATUS_PUK1 PUK1ÂëµÄÏûÏ¢
269 * @param PIN_STATUS_PUK2 PUK2ÂëµÄÏûÏ¢
270*/
271enum PinStatus_Def {
272 /*T_zUfi_PinStatus*/
273 PIN_STATUS_NO_PIN = 0x1c00,
274 PIN_STATUS_PIN1,
275 PIN_STATUS_PIN2,
276 PIN_STATUS_PUK1,
277 PIN_STATUS_PUK2,
278 /*--------------------*/
279};
280
281/*********************station begin****************/
282
283//#ifndef __REALTEK_8192_CHIP__
284#if !(defined(__REALTEK_8192_CHIP__) || defined(__SSV_6X5X_CHIP__) || defined(__AIC_8800DW_CHIP__))
285
286
287#define WIFI_STATION_MAC_LEN 20
288#define WIFI_STATION_SSID_LEN 128
289#define WIFI_STATION_AUTH_MODE_LEN 20
290#define WIFI_STATION_ENCRYPT_TYPE_LEN 20
291#define WIFI_STATION_SPOT_PASSWORD_LEN 128
292
293typedef struct scan_result {
294 char mac[WIFI_STATION_MAC_LEN];
295 char ssid[WIFI_STATION_SSID_LEN];
296 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
297 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
298 short connect_status;
299 short channel;
300 short signal;
301 short network_id;
302} scan_result_t;
303
304typedef struct spot {
305 char mac[WIFI_STATION_MAC_LEN];
306 char ssid[WIFI_STATION_SSID_LEN];
307 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
308 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
309 char password[WIFI_STATION_SPOT_PASSWORD_LEN];
310 short network_id;
311} spot_t;
312
313typedef enum{
314 SAVE_ACTION,
315 DEL_ACTION,
316 CONNECTING_ACTION,
317 DHCPING_ACTION,
318 CONNECTED_ACTION,
319 DISCONNECT_ACTION,
320
321 //kw 3
322 ACTION_MAX
323}spot_action_t;
324
325typedef struct msg_act_spot {
326 spot_action_t act;
327 char mac[WIFI_STATION_MAC_LEN];
328 char ssid[WIFI_STATION_SSID_LEN];
329 int network_id;
330} msg_act_spot_t;
331
332typedef enum scan_content {
333 WIFI_STATION_AP_CONTENT_UNDEFINED,
334 WIFI_STATION_AP_MAC,
335 WIFI_STATION_AP_SSID,
336 WIFI_STATION_AP_AUTH_MODE,
337 WIFI_STATION_AP_ENCRYPT_TYPE,
338 WIFI_STATION_AP_CHANNEL,
339 WIFI_STATION_AP_SIGNAL,
340 WIFI_STATION_AP_CONNECT_STATUS,
341 WIFI_STATION_AP_NETWORK_ID,
342} scan_content_t;
343
344typedef enum{
345 DISCONNECT_STATUS,
346 CONNECTING_STATUS,
347 DHCPING_STATUS,
348 CONNECTED_STATUS,
349}connect_status_t;
350
351typedef enum {
352 WIFI_STATION_WRONG_KEY,
353 WIFI_STATION_IP_FAIL,
354 WIFI_STATION_AUTH_FAIL,
355 WIFI_STATION_OTHER,
356}conn_fail_reason_t;
357
358#else
359
360#define WIFI_STATION_SPOT_ACTION_LEN 32
361#define WIFI_STATION_SPOT_LEN 256
362#define WIFI_STATION_SPOT_LIST_NUM 10
363#define WIFI_STATION_SPOT_PROFILE_NAME_LEN 30
364#define WIFI_STATION_SPOT_PASSWORD_LEN 128
365#define WIFI_STATION_SPOT_KEY_ID_LEN 10
366#define WIFI_STATION_PROFILE_NV_NAME_LEN 20
367
368#define WIFI_STATION_WPA_STATUS_LEN 30
369#define WIFI_STATION_MAC_LEN 20
370#define WIFI_STATION_SSID_LEN 128
371#define WIFI_STATION_AUTH_MODE_LEN 20
372#define WIFI_STATION_ENCRYPT_TYPE_LEN 20
373#define WIFI_STATION_FLAGS_LEN 128
374
375typedef struct update_spot_info {
376 char spot[WIFI_STATION_SPOT_LEN];
377 char action[WIFI_STATION_SPOT_ACTION_LEN];
378} updateinfo_t;
379
380typedef enum wifi_profile_content {
381 WIFI_STATION_CONTENT_UNDEFINED,
382 WIFI_STATION_PROFILE_NAME,
383 WIFI_STATION_FROM_PROVIDER,
384 WIFI_STATION_CONNECT_STATUS,
385 WIFI_STATION_SIGNAL,
386 WIFI_STATION_SSID,
387 WIFI_STATION_AUTH_MODE,
388 WIFI_STATION_ENCRYPT_TYPE,
389 WIFI_STATION_PASSWORD,
390 WIFI_STATION_KEY_ID,
391 WIFI_STATION_AP_MAC
392} wifi_profile_content_t;
393
394typedef struct scan_result {
395 char mac[WIFI_STATION_MAC_LEN];
396 char ssid[WIFI_STATION_SSID_LEN];
397 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
398 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
399 short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
400 short connect_status;
401 short channel;
402 short signal;
xf.lif2330622024-05-15 18:17:18 -0700403#ifdef USE_CAP_SUPPORT
404 //short ch_freq;
405 signed char signal_db;
406#endif
lh9ed821d2023-04-07 01:36:19 -0700407} scan_result_t;
408
409
410typedef struct spot {
411 char profile_name[WIFI_STATION_SPOT_PROFILE_NAME_LEN];
412 short from_provider;//0:·ÇÔËÓªÉÌ£¬1:ÔËÓªÉÌ
413 short connect_status;
414 short signal;
415 char ssid[WIFI_STATION_SSID_LEN];
416 char auth_mode[WIFI_STATION_AUTH_MODE_LEN];
417 char encrypt_type[WIFI_STATION_ENCRYPT_TYPE_LEN];
418 char password[WIFI_STATION_SPOT_PASSWORD_LEN];
419 short keyID;
420 char mac[WIFI_STATION_MAC_LEN];
421 BOOL is_tried_connect;
422 short network_id;
423} spot_t;
424
425
426typedef struct spot_ssid_id {
427 int id;
428 char ssid[WIFI_STATION_SSID_LEN];
429} spot_ssid_id_t;
430#endif
431
432/*********************station end****************/
433
434/*nv set flags */
435
436//wifi
437
438#define NVIO_WIFI_MAX_LEN 200 /*write or read nv length*/
439#define WIFI_PSW_DEFAULT_LENGTH 65
440#define WIFI_STATUS_LEN 2
441#define WIFI_PSW_MIN_LEN 1
442#define WIFI_PSW_MAN_LEN 64
443#define WIFI_CONFIG_DEFAULT_LENGTH 128
444#define WF_WPS_KEY_INDEX_LEN 2
445#define WF_KEY_MODE_LEN 3
446#define WF_WEP_KEY_MAX_LEN 27
447#define WF_WPA_KEY_MAX_LEN 65
448#define WF_ENCRY_TYPE_LEN 16
449#define WF_AU_MODE_LEN 16
450#define WPS_MODE_PIN "PIN" //wps mode
451#define WPS_MODE_PBC "PBC"
452#define WPS_MODE_AP_PIN "APPIN"
453#define WF_AU_OPEN "OPEN" //wifi auth mode?
454#define WF_AU_SHARE "SHARED"
455#define WF_AU_WEPAUTO "WEPAUTO"
456#define WF_AU_WPA "WPAPSK"
457#define WF_AU_WPA2 "WPA2PSK"
458#define WF_AU_WPA_WPA2 "WPAPSKWPA2PSK"
459#define WF_AU_WPA3 "WPA3Personal"
460#define WF_AU_WPA2_WPA3 "WPA2WPA3"
461#define WF_AU_WAPIPSK "WAPIPSK"
462#define WF_ENCRY_NONE "NONE" //encrypt
463#define WF_ENCRY_WEP "WEP"
464#define WF_ENCRY_TKIP "TKIP"
465#define WF_ENCRY_CCMP "CCMP"
466#define WF_ENCRY_AES "AES"
467#define WF_ENCRY_TKIP_CCMP "TKIPCCMP"
468#define WF_ENCRY_TKIP_AES "TKIPAES"
469#define WIFI_SSID_INDEX "ssid_index"
470#define WIFI_STATION_MAC "mac_addr"
471#define WIFI_STATION_HOSTNAME "hostname"
472#define WIFI_STATION_IPADDR "ip_addr"
473#define WIFI_STATION_CONNECTTIME "connect_time"
474#define WIFI_STATION_VALIDTIME "valid_time"
475#define WIFI_STATION_IPTYPE "ip_type"
476#define WIFI_STATION_DEVTYPE "dev_type"
477#define WIFI_NV_ITEM_WIFI_SET_FLAGS "wifi_set_flags"
478#define NV_WIFI_SCAN_FINISH "scan_finish"
479
480#define NV_WIFI_WPA_PASS "WPAPSK1"
481#define NV_WIFI_WPA_PASS_ENCODE "WPAPSK1_encode"
482#define NV_WIFI_WPA_PASS_M "m_WPAPSK1"
483#define NV_WIFI_WPA_PASS_M_ENCODE "m_WPAPSK1_encode"
484#define NV_WIFI_COVERAGE "wifi_coverage"
485#define NV_WIFI_WPS_STATE "WscModeOption"
486#define NV_WIFI_WPS_MODE "wps_mode"
487#define NV_WIFI_WPS_SSID "WPS_SSID"
488#define NV_WIFI_WPS_INDEX "wifi_wps_index"
489#define NV_WIFI_WPS_PIN "wps_pin"
490#define NV_WIFI_WPS_AP_PIN "wifi_ap_pin"
491#define NV_WIFI_WPS_DEF_PIN "wifi_def_pin"
492#define CMD_WIFI_STATION_LIST "station_list"
493#define CMD_HOSTNAME_LIST "hostNameList"
494#define CMD_WIFI_WPS_AP_PIN "wifi_ap_pin"
495#define CMD_WIFI_WPS_AP_DEF_PIN "wifi_def_pin"
496
497typedef enum {
498 ZTE_WLAN_SSID_SET = 0x1,
499 ZTE_WLAN_BROADCAST_SET = 0x2,
500 ZTE_WLAN_BASIC_SECURITY_SET = 0x4,
501 ZTE_WLAN_MAX_ACCESS_NUM_SET = 0x8,
502
503
504 ZTE_WLAN_ON_OFF_SET = 0x10,
505 ZTE_WLAN_WIRELESS_MODE_SET = 0x20,
506 ZTE_WLAN_CHANNEL_SET = 0x40,
507 ZTE_WLAN_COUNTRY_SET = 0x80,
508 ZTE_WLAN_WIFI_BAND_SET = 0x100,
509
510 ZTE_WLAN_POWER_SET = 0x1000,
511 ZTE_WLAN_ACL_SET = 0x2000,
512 ZTE_WLAN_WPS_SET = 0x4000,
513 ZTE_WLAN_SET_AP_SLEEPTIMER = 0x8000,
514
515
516 ZTE_WLAN_SET_AP_MSSID = 0x10000,
517
518} zte_wlan_set_e_flags;
519
xf.li6c8fc1e2023-08-12 00:11:09 -0700520
521//cap:api->wlan_proxy->ap:wlan_server
522typedef enum
523{
zw.wangc08ce042024-08-08 18:42:05 +0800524 IN_WIFI_STATUS_DISABLED = 0,
525 IN_WIFI_STATUS_ENABLED,
526 IN_WIFI_STATUS_INVALID_MAC,
527 IN_WIFI_STATUS_DEV_INIT_FAIL,
528 IN_WIFI_STATUS_FIRMWARE_CRASH,
xf.li6c8fc1e2023-08-12 00:11:09 -0700529} inner_wifi_status_e;
530
531//nei bu zhuan huan yong
532//same as sc_wifi_ap_index_e
533typedef enum
534{
535 IN_WIFI_AP_INDEX_MIN = -1,
xf.li84027492024-04-09 00:17:51 -0700536 IN_WIFI_AP_INDEX_AP0 = 0, //2.4G
537 IN_WIFI_AP_INDEX_AP1, //5G
xf.li6c8fc1e2023-08-12 00:11:09 -0700538 IN_WIFI_AP_INDEX_MAX
539} inner_wifi_ap_id_e;
540
541typedef struct {
542 int idx; //refers to: wlan0,1...
543 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
544} wlan_ap_ssid_t;
545
546typedef struct {
547 int idx; //refers to: wlan0,1...
548 int ssid_hide; //0 not hide, 1 hide
549} wlan_ap_ssid_hide_t;
550
551typedef struct {
552 int idx; //refers to: wlan0,1...
xf.lif2330622024-05-15 18:17:18 -0700553 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 -0700554} wlan_ap_wl_mode_t;
555
556typedef struct {
557 int idx; //refers to: wlan0,1...
xf.lif2330622024-05-15 18:17:18 -0700558 int htMode; //4 20/40/80M, 1 20/40M, 0 20M
xf.li6c8fc1e2023-08-12 00:11:09 -0700559 //int force_40m;
560} wlan_ap_bandwidth_t;
561
562typedef struct {
563 int idx; //refers to: wlan0,1...
564 int max_sta_num; //1-32
565} wlan_ap_max_sta_t;
566
567typedef struct {
568 int idx; //refers to: wlan0,1...
569 char countrycode[3]; //default CN
570 int channel; //0-13
571} wlan_ap_cc_ch_t;
572
573typedef struct {
574 int idx; //refers to: wlan0,1...
575 int acl_rule; //0 none, 1 white, 2 black
576 char acl_list[360]; //max 10 mac1;mac2...
577} wlan_ap_acl_t;
578
579typedef struct {
580 int idx; //refers to: wlan0,1...
581 char authmode[WLAN_SECURITY_LEN];
582 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
583 char pwd[WLAN_PSK_LEN]; //max 64
584} wlan_ap_auth_t;
585
586typedef struct {
587 int idx; //refers to: wlan0,1...
588 int enable; //1 ap on , 0 ap off
589} wlan_ap_enable_t;
590
591//station
592typedef struct {
593 int enable; //1 ap on , 0 ap off
594} wlan_sta_enable_t;
595
596
597//ap->cap:ind
598//½á¹¹Ìå,ºÃÀ©Õ¹
599typedef struct {
600 int wifi_status;
601} wlan_status_t;
602
603//same as sc_wifi_work_mode_e to do: hu huan
604typedef enum
605{
606 IN_WIFI_WORK_MODE_MIN = -1,
xf.li84027492024-04-09 00:17:51 -0700607 IN_WIFI_WORK_MODE_AP0 = 0, //2.4G single ap / ap+sta
608 IN_WIFI_WORK_MODE_AP1, //5G single ap / ap+sta
zw.wangc08ce042024-08-08 18:42:05 +0800609 IN_WIFI_WORK_MODE_STA,
xf.li6c8fc1e2023-08-12 00:11:09 -0700610 IN_WIFI_WORK_MODE_MAX
611} inner_wifi_work_mode_e;
612
613//same as sc_wifi_ap_status_e
614typedef enum
615{
616 IN_WIFI_AP_STATUS_NONE = 0,
617 IN_WIFI_AP_STATUS_IDLE, //or disable
618 IN_WIFI_AP_STATUS_ENABLING,
619 IN_WIFI_AP_STATUS_ENABLED,
620 IN_WIFI_AP_STATUS_DISABLING,
621 IN_WIFI_AP_STATUS_ERROR
622} inner_wifi_ap_status_e;
623
624typedef struct {
625 int idx;
626 int pre_status; //½öcap×ÔÐи³Öµ
627 int status;
628 char ifname[32];
xf.lif2330622024-05-15 18:17:18 -0700629 char bssid[18]; //½öcap×ÔÐи³Öµ
xf.li6c8fc1e2023-08-12 00:11:09 -0700630} wlan_ap_status_t;
631
632//sc_wifi_sta_connect_status_t
633typedef struct {
634 int idx;
635 int is_connected;
636 char macaddr[18];
637} wlan_sta_connect_status_t;
638
639//cap station
640typedef struct {
641 char ssid[WIFI_SSID_LEN]; //ssid should be less than 32 bytes
642 char authmode[WLAN_SECURITY_LEN];
643 char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
644 char pwd[WLAN_PSK_LEN]; //max 64
645} wlan_sta_param_t;
646
647//same as sc_wifi_sta_status_e
648typedef enum
649{
650 IN_WIFI_STA_STATUS_NONE, //close
651 IN_WIFI_STA_STATUS_IDLE,
652 IN_WIFI_STA_STATUS_CONNECTING, //Trying to associate with
653 IN_WIFI_STA_STATUS_ASSOCIATED, //dhcping
654 IN_WIFI_STA_STATUS_CONNECTED,
655 IN_WIFI_STA_STATUS_DISCONNECTED,
656 IN_WIFI_STA_STATUS_ERROR
657} in_wifi_sta_status_e;
658
659//same as sc_wifi_reason_code_e
660typedef enum
661{
662 IN_WIFI_REASON_CODE_NONE,
663 IN_WIFI_REASON_CODE_WRONG_KEY,
664 IN_WIFI_REASON_CODE_AUTH_FAILED,
665 IN_WIFI_REASON_CODE_CONN_FAILED,
666 IN_WIFI_REASON_CODE_SET_FAILED,
667 IN_WIFI_REASON_CODE_DHCP_FAILED
668} in_wifi_reason_code_e;
669
xf.libe704612024-05-28 19:09:12 -0700670typedef struct
671{
672 char addr[16]; //255.255.255.255 16 IPV4ADDLEN_MAX
673 char netmask[16];
674 unsigned char subnet_bits; //255.255.255.0 is 24
675 char gateway[16];
676 char dnsp[16]; //primary DNS
677 char dnss[16]; //secondary DNS
678} in_wifi_net_addr_t;
679
680typedef struct
681{
682 char addr[48]; //0001:0002:0003:0004:0001:0002:0003:0004 40 (+8:, 48)
683 char prefix[48];
684 unsigned char prefix_bits;
685 char gateway[48];
686 char dnsp[48]; //primary DNS
687 char dnss[48]; //secondary DNS
688} in_wifi_net_addr6_t;
689
xf.li6c8fc1e2023-08-12 00:11:09 -0700690//same as sc_wifi_sta_status_t
691typedef struct {
692 int pre_status; //proxy record
693
694 int status; //in_wifi_sta_status_e
695 char ifname[32];
696 char ap_bssid[18]; //cur ap mac
xf.libe704612024-05-28 19:09:12 -0700697 int rssi;
xf.li6c8fc1e2023-08-12 00:11:09 -0700698 unsigned char signal_level;
699 unsigned char has_addr;
xf.libe704612024-05-28 19:09:12 -0700700 in_wifi_net_addr_t addr;
xf.li6c8fc1e2023-08-12 00:11:09 -0700701 unsigned char has_addr6;
xf.libe704612024-05-28 19:09:12 -0700702 in_wifi_net_addr6_t addr6;
xf.li6c8fc1e2023-08-12 00:11:09 -0700703 int reason_code; //in_wifi_reason_code_e
704} wlan_sta_status_t;
705
706typedef struct {
zw.wangc08ce042024-08-08 18:42:05 +0800707 int rssi;
708} wlan_sta_stat_sync_t;
709
710
711typedef struct {
xf.li6c8fc1e2023-08-12 00:11:09 -0700712 int result;
713 wlan_sta_status_t status;
714} scwifi_sta_stat_res_t;
715
716
717#define CAP_WIFI_MAX_SCAN_CNT 30
718
xf.liaa4d92f2023-09-13 00:18:58 -0700719#define CAP_WIFI_AUTH_UNSUP -1 //"not support"
720#define CAP_WIFI_AUTH_OPEN 0 //"OPEN"
721#define CAP_WIFI_AUTH_WPA2 1 //"WPA2PSK"
722#define CAP_WIFI_AUTH_WPA3 2 //"WPA3Personal"
723#define CAP_WIFI_AUTH_WPA12 3 //"WPAPSKWPA2PSK"
724#define CAP_WIFI_AUTH_WPA23 4 //"WPA2WPA3"
725
726#define CAP_WIFI_ENCRYPT_UNSUP -1 //"not support"
727#define CAP_WIFI_ENCRYPT_AUTO 0 //"TKIPCCMP"
728#define CAP_WIFI_ENCRYPT_TKIP 1 //"TKIP"
729#define CAP_WIFI_ENCRYPT_AES 2 //"CCMP"
xf.li6c8fc1e2023-08-12 00:11:09 -0700730
731//sc_wifi_sta_scan_info_t
732typedef struct
733{
734 char bssid[18];//mac
735 char essid[33];
xf.lif2330622024-05-15 18:17:18 -0700736 signed char signal; //dbm
xf.li6c8fc1e2023-08-12 00:11:09 -0700737 unsigned char signal_level; //0-5, max 5
xf.lif2330622024-05-15 18:17:18 -0700738 unsigned char channel; //1-13, 36...
xf.li6c8fc1e2023-08-12 00:11:09 -0700739 unsigned char auth;
xf.liaa4d92f2023-09-13 00:18:58 -0700740 unsigned char cipher;
xf.lif2330622024-05-15 18:17:18 -0700741 //int frequency; //Hz
xf.li6c8fc1e2023-08-12 00:11:09 -0700742} wlan_sta_scan_info_t;
743
744//sc_wifi_sta_scan_list_t
745typedef struct
746{
747 int cnt;
748 wlan_sta_scan_info_t info[CAP_WIFI_MAX_SCAN_CNT];
749} wlan_sta_scan_list_t;
750
xf.li84027492024-04-09 00:17:51 -0700751typedef struct {
zw.wangc08ce042024-08-08 18:42:05 +0800752 int work_mode; //inner_wifi_work_mode_e
xf.li84027492024-04-09 00:17:51 -0700753} wlan_work_mode_t;//scwifi_workmode_t
754
lh9ed821d2023-04-07 01:36:19 -0700755#endif