33using System . Diagnostics ;
44using System . Threading . Tasks ;
55using Windows . Devices . WiFi ;
6+ using Windows . Networking . Connectivity ;
67
78//https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.requestaccessasync
89//var access = await WiFiAdapter.RequestAccessAsync();
@@ -52,7 +53,8 @@ public static async Task<IEnumerable<WiFiNetworkInfo>> GetNetworksAsync(WiFiAdap
5253 NetworkRssiInDecibelMilliwatts = network . NetworkRssiInDecibelMilliwatts ,
5354 PhyKind = network . PhyKind ,
5455 NetworkKind = network . NetworkKind ,
55- Security = network . SecuritySettings ,
56+ AuthenticationType = network . SecuritySettings . NetworkAuthenticationType ,
57+ EncryptionType = network . SecuritySettings . NetworkEncryptionType ,
5658 BeaconInterval = network . BeaconInterval ,
5759 Uptime = network . Uptime
5860 } ) ;
@@ -174,5 +176,47 @@ public static double ConvertChannelFrequencyToGigahertz(int kilohertz)
174176 {
175177 return Convert . ToDouble ( kilohertz ) / 1000 / 1000 ;
176178 }
179+
180+ public static string GetHumanReadableNetworkAuthenticationType ( NetworkAuthenticationType networkAuthenticationType )
181+ {
182+ string type = "-/-" ;
183+
184+ switch ( networkAuthenticationType )
185+ {
186+ case NetworkAuthenticationType . Ihv :
187+ type = "-/-" ;
188+ break ;
189+ case NetworkAuthenticationType . None :
190+ type = "-/-" ;
191+ break ;
192+ case NetworkAuthenticationType . Open80211 :
193+ type = "Open" ;
194+ break ;
195+ case NetworkAuthenticationType . Rsna :
196+ type = "-/-" ;
197+ break ;
198+ case NetworkAuthenticationType . RsnaPsk :
199+ type = "WPA2 PSK" ;
200+ break ;
201+ case NetworkAuthenticationType . SharedKey80211 :
202+ type = "-/-" ;
203+ break ;
204+ case NetworkAuthenticationType . Unknown :
205+ type = "Unkown" ;
206+ break ;
207+ case NetworkAuthenticationType . Wpa :
208+ type = "-/-" ;
209+ break ;
210+ case NetworkAuthenticationType . WpaNone :
211+ type = "-/-" ;
212+ break ;
213+ case NetworkAuthenticationType . WpaPsk :
214+ type = "WPA PSK" ;
215+ break ;
216+
217+ }
218+
219+ return type ;
220+ }
177221 }
178222}
0 commit comments