@@ -18,6 +18,224 @@ LOG_MODULE_REGISTER(net_wifi_mgmt, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL);
1818#include <zephyr/net/wifi_nm.h>
1919#endif /* CONFIG_WIFI_NM */
2020
21+ const char * const wifi_security_txt (enum wifi_security_type security )
22+ {
23+ switch (security ) {
24+ case WIFI_SECURITY_TYPE_NONE :
25+ return "OPEN" ;
26+ case WIFI_SECURITY_TYPE_WEP :
27+ return "WEP" ;
28+ case WIFI_SECURITY_TYPE_WPA_PSK :
29+ return "WPA-PSK" ;
30+ case WIFI_SECURITY_TYPE_PSK :
31+ return "WPA2-PSK" ;
32+ case WIFI_SECURITY_TYPE_PSK_SHA256 :
33+ return "WPA2-PSK-SHA256" ;
34+ case WIFI_SECURITY_TYPE_SAE :
35+ return "WPA3-SAE" ;
36+ case WIFI_SECURITY_TYPE_WAPI :
37+ return "WAPI" ;
38+ case WIFI_SECURITY_TYPE_EAP :
39+ return "EAP" ;
40+ case WIFI_SECURITY_TYPE_UNKNOWN :
41+ default :
42+ return "UNKNOWN" ;
43+ }
44+ }
45+
46+ const char * const wifi_mfp_txt (enum wifi_mfp_options mfp )
47+ {
48+ switch (mfp ) {
49+ case WIFI_MFP_DISABLE :
50+ return "Disable" ;
51+ case WIFI_MFP_OPTIONAL :
52+ return "Optional" ;
53+ case WIFI_MFP_REQUIRED :
54+ return "Required" ;
55+ case WIFI_MFP_UNKNOWN :
56+ default :
57+ return "UNKNOWN" ;
58+ }
59+ }
60+
61+ const char * const wifi_band_txt (enum wifi_frequency_bands band )
62+ {
63+ switch (band ) {
64+ case WIFI_FREQ_BAND_2_4_GHZ :
65+ return "2.4GHz" ;
66+ case WIFI_FREQ_BAND_5_GHZ :
67+ return "5GHz" ;
68+ case WIFI_FREQ_BAND_6_GHZ :
69+ return "6GHz" ;
70+ case WIFI_FREQ_BAND_UNKNOWN :
71+ default :
72+ return "UNKNOWN" ;
73+ }
74+ }
75+
76+ const char * const wifi_state_txt (enum wifi_iface_state state )
77+ {
78+ switch (state ) {
79+ case WIFI_STATE_DISCONNECTED :
80+ return "DISCONNECTED" ;
81+ case WIFI_STATE_INACTIVE :
82+ return "INACTIVE" ;
83+ case WIFI_STATE_INTERFACE_DISABLED :
84+ return "INTERFACE_DISABLED" ;
85+ case WIFI_STATE_SCANNING :
86+ return "SCANNING" ;
87+ case WIFI_STATE_AUTHENTICATING :
88+ return "AUTHENTICATING" ;
89+ case WIFI_STATE_ASSOCIATING :
90+ return "ASSOCIATING" ;
91+ case WIFI_STATE_ASSOCIATED :
92+ return "ASSOCIATED" ;
93+ case WIFI_STATE_4WAY_HANDSHAKE :
94+ return "4WAY_HANDSHAKE" ;
95+ case WIFI_STATE_GROUP_HANDSHAKE :
96+ return "GROUP_HANDSHAKE" ;
97+ case WIFI_STATE_COMPLETED :
98+ return "COMPLETED" ;
99+ case WIFI_STATE_UNKNOWN :
100+ default :
101+ return "UNKNOWN" ;
102+ }
103+ }
104+
105+ const char * const wifi_mode_txt (enum wifi_iface_mode mode )
106+ {
107+ switch (mode ) {
108+ case WIFI_MODE_INFRA :
109+ return "STATION" ;
110+ case WIFI_MODE_IBSS :
111+ return "ADHOC" ;
112+ case WIFI_MODE_AP :
113+ return "ACCESS POINT" ;
114+ case WIFI_MODE_P2P_GO :
115+ return "P2P GROUP OWNER" ;
116+ case WIFI_MODE_P2P_GROUP_FORMATION :
117+ return "P2P GROUP FORMATION" ;
118+ case WIFI_MODE_MESH :
119+ return "MESH" ;
120+ case WIFI_MODE_UNKNOWN :
121+ default :
122+ return "UNKNOWN" ;
123+ }
124+ }
125+
126+ const char * const wifi_link_mode_txt (enum wifi_link_mode link_mode )
127+ {
128+ switch (link_mode ) {
129+ case WIFI_0 :
130+ return "WIFI 0 (802.11)" ;
131+ case WIFI_1 :
132+ return "WIFI 1 (802.11b)" ;
133+ case WIFI_2 :
134+ return "WIFI 2 (802.11a)" ;
135+ case WIFI_3 :
136+ return "WIFI 3 (802.11g)" ;
137+ case WIFI_4 :
138+ return "WIFI 4 (802.11n/HT)" ;
139+ case WIFI_5 :
140+ return "WIFI 5 (802.11ac/VHT)" ;
141+ case WIFI_6 :
142+ return "WIFI 6 (802.11ax/HE)" ;
143+ case WIFI_6E :
144+ return "WIFI 6E (802.11ax 6GHz/HE)" ;
145+ case WIFI_7 :
146+ return "WIFI 7 (802.11be/EHT)" ;
147+ case WIFI_LINK_MODE_UNKNOWN :
148+ default :
149+ return "UNKNOWN" ;
150+ }
151+ }
152+
153+ const char * const wifi_ps_txt (enum wifi_ps ps_name )
154+ {
155+ switch (ps_name ) {
156+ case WIFI_PS_DISABLED :
157+ return "Power save disabled" ;
158+ case WIFI_PS_ENABLED :
159+ return "Power save enabled" ;
160+ default :
161+ return "UNKNOWN" ;
162+ }
163+ }
164+
165+ const char * const wifi_ps_mode_txt (enum wifi_ps_mode ps_mode )
166+ {
167+ switch (ps_mode ) {
168+ case WIFI_PS_MODE_LEGACY :
169+ return "Legacy power save" ;
170+ case WIFI_PS_MODE_WMM :
171+ return "WMM power save" ;
172+ default :
173+ return "UNKNOWN" ;
174+ }
175+ }
176+
177+ const char * const wifi_twt_operation_txt (enum wifi_twt_operation twt_operation )
178+ {
179+ switch (twt_operation ) {
180+ case WIFI_TWT_SETUP :
181+ return "TWT setup" ;
182+ case WIFI_TWT_TEARDOWN :
183+ return "TWT teardown" ;
184+ default :
185+ return "UNKNOWN" ;
186+ }
187+ }
188+
189+ const char * const wifi_twt_negotiation_type_txt (enum wifi_twt_negotiation_type twt_negotiation )
190+ {
191+ switch (twt_negotiation ) {
192+ case WIFI_TWT_INDIVIDUAL :
193+ return "TWT individual negotiation" ;
194+ case WIFI_TWT_BROADCAST :
195+ return "TWT broadcast negotiation" ;
196+ case WIFI_TWT_WAKE_TBTT :
197+ return "TWT wake TBTT negotiation" ;
198+ default :
199+ return "UNKNOWN" ;
200+ }
201+ }
202+
203+ const char * const wifi_twt_setup_cmd_txt (enum wifi_twt_setup_cmd twt_setup )
204+ {
205+ switch (twt_setup ) {
206+ case WIFI_TWT_SETUP_CMD_REQUEST :
207+ return "TWT request" ;
208+ case WIFI_TWT_SETUP_CMD_SUGGEST :
209+ return "TWT suggest" ;
210+ case WIFI_TWT_SETUP_CMD_DEMAND :
211+ return "TWT demand" ;
212+ case WIFI_TWT_SETUP_CMD_GROUPING :
213+ return "TWT grouping" ;
214+ case WIFI_TWT_SETUP_CMD_ACCEPT :
215+ return "TWT accept" ;
216+ case WIFI_TWT_SETUP_CMD_ALTERNATE :
217+ return "TWT alternate" ;
218+ case WIFI_TWT_SETUP_CMD_DICTATE :
219+ return "TWT dictate" ;
220+ case WIFI_TWT_SETUP_CMD_REJECT :
221+ return "TWT reject" ;
222+ default :
223+ return "UNKNOWN" ;
224+ }
225+ }
226+
227+ const char * const wifi_ps_wakeup_mode_txt (enum wifi_ps_wakeup_mode ps_wakeup_mode )
228+ {
229+ switch (ps_wakeup_mode ) {
230+ case WIFI_PS_WAKEUP_MODE_DTIM :
231+ return "PS wakeup mode DTIM" ;
232+ case WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL :
233+ return "PS wakeup mode listen interval" ;
234+ default :
235+ return "UNKNOWN" ;
236+ }
237+ }
238+
21239static const struct wifi_mgmt_ops * const get_wifi_api (struct net_if * iface )
22240{
23241 const struct device * dev = net_if_get_device (iface );
0 commit comments