Giter Site home page Giter Site logo

managednativewifi's Introduction

Managed Native Wifi

ManagedNativeWifi is a managed implementation of Native Wifi API. It provides functionality to manage wireless networks, interfaces and profiles.

Requirements

This library works on Windows and compatible with:

.NET 6.0 .NET Standard 2.0 (including .NET Framework 4.6.1)

Download

NuGet: ManagedNativeWifi

Methods

Available methods including asynchronous ones based on TAP.

Method Description
EnumerateInterfaces Enumerates wireless interface information.
EnumerateInterfaceConnections Enumerates wireless interface and related connection information.
ScanNetworksAsync Asynchronously requests wireless interfaces to scan (rescan) wireless LANs.
EnumerateAvailableNetworkSsids Enumerates SSIDs of available wireless LANs.
EnumerateConnectedNetworkSsids Enumerates SSIDs of connected wireless LANs.
EnumerateAvailableNetworks Enumerates wireless LAN information on available networks.
EnumerateAvailableNetworkGroups Enumerates wireless LAN information on available networks and group of associated BSS networks.
EnumerateBssNetworks Enumerates wireless LAN information on BSS networks.
EnumerateProfileNames Enumerates wireless profile names in preference order.
EnumerateProfiles Enumerates wireless profile information in preference order.
EnumerateProfileRadios Enumerates wireless profile and related radio information in preference order.
SetProfile Sets (add or overwrite) the content of a specified wireless profile.
SetProfilePosition Sets the position of a specified wireless profile in preference order.
SetProfileEapXmlUserData Sets (add or overwirte) the EAP user credentials for a specified wireless profile.
RenameProfile Renames a specified wireless profile.
DeleteProfile Deletes a specified wireless profile.
ConnectNetwork Attempts to connect to the wireless LAN associated to a specified wireless profile.
ConnectNetworkAsync Asynchronously attempts to connect to the wireless LAN associated to a specified wireless profile.
DisconnectNetwork Disconnects from the wireless LAN associated to a specified wireless interface.
DisconnectNetworkAsync Asynchronously disconnects from the wireless LAN associated to a specified wireless interface.
GetInterfaceRadio Gets wireless interface radio information of a specified wireless interface.
TurnOnInterfaceRadio Turns on the radio of a specified wireless interface (software radio state only).
TurnOffInterfaceRadio Turns off the radio of a specified wireless interface (software radio state only).
IsInterfaceAutoConfig Checks if automatic configuration of a specified wireless interface is enabled.

Properties

Property Description
ThrowsOnAnyFailure Whether to throw an exception when any failure occurs

Usage

To check SSIDs of currently available wireless LANs, call EnumerateAvailableNetworkSsids method.

public static IEnumerable<string> EnumerateNetworkSsids()
{
    return NativeWifi.EnumerateAvailableNetworkSsids()
        .Select(x => x.ToString()); // UTF-8 string representation
}

In general, a SSID is represented by a UTF-8 string but it is not guaranteed. So if ToString method seems not to produce a valid value, try ToBytes method instead.

To connect to a wireless LAN, call ConnectNetworkAsync asynchronous method.

public static async Task<bool> ConnectAsync()
{
    var availableNetwork = NativeWifi.EnumerateAvailableNetworks()
        .Where(x => !string.IsNullOrWhiteSpace(x.ProfileName))
        .OrderByDescending(x => x.SignalQuality)
        .FirstOrDefault();

    if (availableNetwork is null)
        return false;

    return await NativeWifi.ConnectNetworkAsync(
        interfaceId: availableNetwork.Interface.Id,
        profileName: availableNetwork.ProfileName,
        bssType: availableNetwork.BssType,
        timeout: TimeSpan.FromSeconds(10));
}

This method returns true if successfully connected to the wireless LAN in contrast to its synchronous sibling, ConnectNetwork method, returns true if the request for the connection succeeds and doesn't indicate the result.

To refresh currently available wireless LANs, call ScanNetworksAsync method.

public static Task RefreshAsync()
{
    return NativeWifi.ScanNetworksAsync(timeout: TimeSpan.FromSeconds(10));
}

This method requests wireless interfaces to scan wireless LANs in parallel. It takes no more than 4 seconds.

To delete an existing wireless profile, use DeleteProfile method. Please note that a profile name is case-sensitive.

public static bool DeleteProfile(string profileName)
{
    var targetProfile = NativeWifi.EnumerateProfiles()
        .Where(x => profileName.Equals(x.Name, StringComparison.Ordinal))
        .FirstOrDefault();

    if (targetProfile is null)
        return false;

    return NativeWifi.DeleteProfile(
        interfaceId: targetProfile.Interface.Id,
        profileName: profileName);
}

To check wireless LAN channels that are already used by surrounding access points, call EnumerateBssNetworks method and filter the results by signal strength.

public static IEnumerable<int> EnumerateNetworkChannels(int signalStrengthThreshold)
{
    return NativeWifi.EnumerateBssNetworks()
        .Where(x => x.SignalStrength > signalStrengthThreshold)
        .Select(x => x.Channel);
}

To turn on the radio of a wireless interface, check the current radio state by GetInterfaceRadio method and then call TurnOnInterfaceRadio method.

public static async Task<bool> TurnOnAsync()
{
    var targetInterface = NativeWifi.EnumerateInterfaces()
        .FirstOrDefault(x =>
        {
            var radioSet = NativeWifi.GetInterfaceRadio(x.Id)?.RadioSets.FirstOrDefault();
            if (radioSet is null)
                return false;

            if (!radioSet.HardwareOn.GetValueOrDefault()) // Hardware radio state is off.
                return false;

            return (radioSet.SoftwareOn == false); // Software radio state is off.
        });

    if (targetInterface is null)
        return false;

    try
    {
        return await Task.Run(() => NativeWifi.TurnOnInterfaceRadio(targetInterface.Id));
    }
    catch (UnauthorizedAccessException)
    {
        return false;
    }
}

Please note that this method can only change software radio state and if hardware radio state is off (like hardware Wi-Fi switch is at off position), the radio cannot be turned on programatically.

Note

  • Creating a wireless profile from scratch is not covered in this library. It is because 1) Native WiFi does not include such functionality, 2) it requires careful consideration on wi-fi technology in use, 3) it involves sensitive security information. Thus, it is left to each user.

History

Ver 2.5 2023-1-9

  • Add: Setting property to throw an exception when any failure occurs; ThrowsOnAnyFailure

Ver 2.4 2022-11-24

  • Add: Special event args for AvailabilityChanged, InterfaceChanged, ConnectionChanged, ProfileChanged events
  • Breaking change: .NET 5.0 is no longer supported

Ver 2.3 2022-8-1

  • Add: PHY types (802.11ad, ax, be)
  • Add: PHY type in profile and related radio information

Ver 2.2 2022-7-25

  • Add: Method to set the EAP user credentials
  • Add: PHY type in BSS network
  • Breaking change: .NET Framework 4.6 or older is no longer supported

Ver 2.1 2021-3-30

  • Fix: GetInterfaceRadio is enabled to handle invalid capabilities information

Ver 2.0 2021-2-4

  • Add: Support for .NET 5.0 and .NET Standard 2.0

Ver 1.8 2020-12-20

  • Breaking change: GetInterfaceAutoConfig is renamed to IsInterfaceAutoConfig

Ver 1.7 2020-9-29

  • Add: WPA3 in authentication method and algorithm

Ver 1.6 2020-8-4

  • Add: Functionality to connect specific access point when connecting network

Ver 1.5 2019-12-1

  • Add: Information obtained by EnumerateAvailableNetworks and EnumerateAvailableNetworkGroups include authentication/cipher algorithms

Ver 1.4 2018-9-2

  • Add: Methods to provide additional information; EnumerateInterfaceConnections, EnumerateAvailableNetworkGroups, EnumerateProfileRadios
  • Breaking change: Radio information related to wireless profiles can be obtained by EnumerateProfileRadios instead of EnumerateProfiles

Ver 1.0 2015-1-30

  • Initial commit

License

  • MIT License

managednativewifi's People

Contributors

adamwendel avatar alanedwardes avatar emoacht avatar jornane avatar shizukudrops avatar zerglrisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

managednativewifi's Issues

DeleteProfile method is throwing error

so here is my small setup of using DeleteProfile method.

var targetProfile = NativeWifi.EnumerateProfiles()
		.FirstOrDefault();

if (targetProfile == null)
	return;

NativeWifi.DeleteProfile(
	interfaceId: targetProfile.Interface.Id,
	profileName: targetProfile.Name);

I guess it looks totally reasonable. but it throwing this error

System.ComponentModel.Win32Exception: 'MethodName: WlanDeleteProfile, ErrorCode: 2, ErrorMessage: The system cannot find the file specified.

I checked my C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces'{my interface id}' folder and confirm that the profile does exist. So why its throwing the exception?

Connecting to a network with temporary profile

I would like to develop an alternative simplified UI to Windows wireless settings. This would require the user to select an available network and then connect to it.
The underlying Native WiFi API has a wlan_connection_mode enum which can allow connecting with a temporary profile created on the fly.
In this library however the connection mode is always set to profile. Aren't you considering adding this functionality? Thanks.

WlanOpenHandle errorcode 5 Access is denied in UWP app

We have a dotnet standard library that uses this library. When we import our library for example in a console or WPF app everything works fine.

When used in a UWP application we get access is denied.

{"MethodName: WlanOpenHandle, ErrorCode: 5, ErrorMessage: Access is denied.\r\n"}

The UWP app has the following capability: <DeviceCapability Name="wiFiControl" />

Establish a new connection

Nice framework... but I am trying to establish a connection to an available network. I have connected manually, and made a snapshot of the XML. Then removed the connection.

I am able to find the network,

I pass in the SSID I want to connect to (yes, it is found..). I also pass the profileSecurity to use... but not really sure what to put there. From my XML I tried bot AES as well as WPA2PSK. But, SetProfile always returns false. And not sure how to extract an error message about what went wrong. That would be nice.

As the profile fails, the ConnectNetwork also fails, but that would be expected I think.

Any pointer would be nice. And a bit more documentation on these points would make the tool a lot better.

// get the network to connect to
var availableNetwork = NativeWifi.EnumerateAvailableNetworks()
    .FirstOrDefault(x => x.Ssid.ToString() == ssid);

if (availableNetwork is null)
    return;

var profile = NativeWifi.EnumerateProfiles().FirstOrDefault(x => x.Name == ssid);

if (profile is null)
{
    // build XML
    // Connects to a known network with WEP security
    string profileName = ssid; // this is also the SSID
    string mac = StringToHex(profileName);
    string profileXml = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns = \"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><hex>{1}</hex><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><connectionMode>auto</connectionMode><MSM><security><authEncryption><authentication>WPA2PSK</authentication><encryption>AES</encryption><useOneX>false</useOneX></authEncryption><sharedKey><keyType>passPhrase</keyType><protected>true</protected><keyMaterial>... key removed for security...</keyMaterial></sharedKey></security></MSM><MacRandomization xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v3\"><enableRandomization>false</enableRandomization><randomizationSeed>153878511</randomizationSeed></MacRandomization></WLANProfile>", ssid, mac);

    // create a profile
    var profileResult = NativeWifi.SetProfile(availableNetwork.Interface.Id, ProfileType.AllUser, profileXml, encryption, true);
}
else
{
    //todo: log here
}

var wasConnected = NativeWifi.ConnectNetwork(availableNetwork.Interface.Id, ssid, availableNetwork.BssType);

EnumerateAvailableNetworks can't get all available networks

I tried to call EnumerateAvailableNetworks() to get available networks repeatedly, interval is 15s, but seems for serveral minutes it only get current connected network but not all networks. Then it could work normally in several minutes again. I am not sure why, are there any mistake in my usage?

var networks = NativeWifi.EnumerateAvailableNetworks();

Issue scanning for networks

When I scan the network using:
await NativeWifi.ScanNetworksAsync(timeout: TimeSpan.FromSeconds(8));
This operation completes very quickly and does not look like it scanned, so I am assuming it just completes the process of starting the scanning threads, however does not complete the scanning.
I am also not sure why, after the scan when I run EnumerateAvailableNetworkSsids(), it finds very few, sometimes only one SSID, yet on the windows OS it shows 20 available networks.
Edit: "netsh wlan show networks" shows the same results, and also returns immediately. How can we force a real scan?
Finally, ScanNetworksAsync() returns a list of interfaces that it scanned, but if I understand correctly, it does not return which one failed, completed, was cancelled, or was interrupted due to timeout being reached.
Am I missing something?

Unhandled System.Reflection.TargetInvocationException when WLANSVC is not running

Test OS: Windows 10.0.19045
ManagedNativeWifi version: 2.5.0.0.
IDE/ENV: Microsoft Visual Studio Enterprise 2019 Version 16.11.17

Noted this issue testing software on Virtual Machines with no Wifi capabilities that by default do not run the WLANSVC service.
Worked-around by try-catching the exception.

Note this is only confirmed using the EnumerateInterfaces() method. I suspect it will occur elsewhere ( WlanOpenHandle calls ).
This occurs with ThrowsOnAnyFailure set to false.

Steps to reproduce:

  • Open a admin-level PowerShell and stop the WLANSVC service with the command "net stop wlansvc"

  • Call the NativeWifi.EnumerateInterfaces() method, eg:

public static void ThrowException()
{
    NativeWifi.ThrowsOnAnyFailure = false;

    try
    {
        var wifiInterfaces = NativeWifi.EnumerateInterfaces();
    }
    catch ( Exception e )
    {
        Debug.WriteLine( e.InnerException?.Message );
        int putABreakPointHere = 0;
    }
}    
  • Note the error:

Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
MethodName: WlanOpenHandle, ErrorCode: 1062, ErrorMessage: The service has not been started.

( Don't forget to "net start wlansvc" again or your Wifi won't work ;) )

nuget package is not signed

Hi,

could you please sign the assembly published in NuGet. If that's not done, then it's not possible to use it in a "signed" application ("A strongly-named assembly is required.")

Thanks & BR,

Martin

EnumerateAvailableNetworkSsids() returns duplicate results.

        var ssids = player.EnumerateAvailableNetworkSsids();
        foreach(var ssid in ssids)
        {
            Trace.WriteLine(ssid);
        }

or

var ssids = NativeWifi.EnumerateAvailableNetworkSsids()
        .Select(x => x.ToString());
        foreach(var ssid in ssids)
        {
            Debug.WriteLine(ssid);
        }

Output:
Redstone
Redstone

But only one SSID present with the name: Redstone

It's observed with connected SSIDs or for SSIDs which are having the profiles already.

Throw exception on any failure

Thinking about #25, I decided to add ThrowOnAnyFailure setting by 41f7fe6

I have originally crafted this library not to throw an exception too much. An exception will be thrown only when the failure at Win32 level obviously suggests a bug in code. However, in some cases, it could make difficult to find the reason of failure.

This setting will make this library throw an exception whenever it encounters the result other than success. I hope this setting is helpful for debug.

Signal quality value under Windows 11

I have found that under Windows 11 (10.0.22449.1000), the value of AvailableNetworkPack.SignalQuality obtained by EnumerateAvailableNetworks or EnumerateAvailableNetworkGroups method indicates an invalid value (a minus value while it supposed to range from 0 to 100) when the system is not connected to the network. After the system is connected to the network, the value indicates the normal value.

Therefore, as a workaround, I would suggest to use the value of AvailableNetworkGroupPack.LinkQuality when the value of AvailableNetworkPack.SignalQuality indicates a minus value for the time being.

The same goes for the value of ProfileRadioPack.SignalQuality and the value of ProfileRadioPack.LinkQuality obtained by GetProfilesAsync method.

dotnet 5

Hi,

I am trying to use the library to get info about wifi running on a raspberry pi (linix), but I get this exception

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.DllNotFoundException: Unable to load shared library 'Wlanapi.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libWlanapi.dll: cannot open shared object file: No such file or directory
at ManagedNativeWifi.Win32.NativeMethod.WlanOpenHandle(UInt32 dwClientVersion, IntPtr pReserved, UInt32& pdwNegotiatedVersion, SafeClientHandle& phClientHandle)
at ManagedNativeWifi.Win32.BaseMethod.WlanClient..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstanceT
at ManagedNativeWifi.Common.DisposableContainer1..ctor(T content) at ManagedNativeWifi.NativeWifi.EnumerateAvailableNetworks(WlanClient client)+MoveNext() at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source, Int32& length)
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
at SatelliteClient.Helpers.NetworkHelper.AvailableWiFiNetworks(OSType osType) in C:\Users\hhgm\source\Workspaces\TM nextGen 3.1\IoTClient\SatelliteClient\Helpers\NetworkHelper.cs:line 166

So seems like there is a library needed when you enumerate the collection on Linux that is missing.

Does this mean that it is not fully dotnet 5 compliant.. or just does not work on Linux?

Syntax issue

Hi,
Firstly, great job putting this together - it is a lot of detailed expertise.
I downloaded the code but unfortunately, there are over 400 errors due to syntax inserts (For example: Trace.WriteLine($"{{Name: {profile.Name}");)
The "$" is not permitted in this method - Are you using some add in that has created all these issues?

Without being able to compile, I had a quick scan through and I was trying to ascertain how one would connect to a wireless SSID, and supply a password with your methods?

Thanks again.

Cheers

ConnectNetworkAsync fails when not logged in locally or via RDP

I have an application that runs in the background. Typically, it is started through an RDP connection, but eventually we will run as a service.
Everything works fine when we are still logged in, but if we start running and then disconnect from RDP, we get an exception on ConnectNetworkAsync:

System.ComponentModel.Win32Exception: 'MethodName: WlanConnect, ErrorCode: 87, ErrorMessage: The parameter is incorrect.
'

The following code should help to reproduce the issue:

// give time to log out to trigger the issue
Thread.Sleep(10000);

// create profile
ManagedNativeWifi.NativeWifi.SetProfile(iface.Id, ProfileType.PerUser, CreateProfileXml(ssid+"_test", ssid, passwd), null, true);

// the following line works correctly while logged in, but throws an exception when logged out
bool connect_success = ManagedNativeWifi.NativeWifi.ConnectNetworkAsync(iface.Id, ssid + "_test", BssType.Infrastructure, new System.Net.NetworkInformation.PhysicalAddress(Array.ConvertAll(bssid.Split(':'), x => Convert.ToByte(x, 16))), new TimeSpan(0, 1, 0), new CancellationToken()).GetAwaiter().GetResult();

// ... snip ...

private static string CreateProfileXml(string profileName, string ssidString, string password) =>
	$@"<?xml version=""1.0""?>
<WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1"">
	<name>{profileName}</name>
	<SSIDConfig>
		<SSID>
			<hex>{toHex(ssidString)}</hex>
			<name>{ssidString}</name>
		</SSID>
	</SSIDConfig>
	<connectionType>ESS</connectionType>
	<connectionMode>manual</connectionMode>
	<MSM>
		<security>
			<authEncryption>
				<authentication>WPA2PSK</authentication>
				<encryption>AES</encryption>
				<useOneX>false</useOneX>
			</authEncryption>
			<sharedKey>
				<keyType>passPhrase</keyType>
				<protected>false</protected>
				<keyMaterial>{password}</keyMaterial>
			</sharedKey>
		</security>
	</MSM>
</WLANProfile>";

Often find just one WiFi access point

Dear readers,

Any idea why I only find one WiFi access point when using NativeWifi.EnumerateBssNetworks(), although Windows shows like 9. And sometimes I get all 9. I am doing this 5 times and each time I also do the following:
Task<IEnumerable> task_Refresh = NativeWifi.ScanNetworksAsync(timeout: TimeSpan.FromSeconds(10));
IEnumerable guids = await task_Refresh;

Best regards and thx for your help,
Rémy Samulski

interfaceID to set new profile

hey dude, great job done by you but i need some guidance in setting new profile for my wireless network. in setProfile(..) we have to provide interfaceID of network.. how i can i retrieve that from my available networks as they are scan and immediately stored in a struct WLAN_AVAILABLE_NETWORK. kindly guide me through

Access denied in ARM64 machine when try to get nearby WiFis

I was trying to get nearby WiFi network in ARM64 machine by
NativeWifi.EnumerateAvailableNetworks()
This code usually works fine in ARM64 machine. But today it failed with exception 'access denied'.
Finally I found that if I open Location Service and allow my app to access Location, It could work again.
I am not sure why it need location permission now?
Does the API call need access Location or OS changed cause this issue?

Can't connect to wifi when using Ethernet

Im trying to connect to a specific wifi but i can't connect when im already connected to a Ethernet connection. When running the ConnectNetwork it responds with true but the network is not connected.

No Information about WIFI6E Access Points in EnumerateBssNetworks

I try to build a little script to gather the RSSI Value to the connected Access Point.
I found out that i dont see netwoks which are in the 6GHz Frequency band.
Any Idea how to gather the information about the 6GHz Networks?

EDIT: The Profilename in EnumerateInterfaceConnections is correct shown and the 6E network card is also shown correctly

NativeWifiPlayer.ProfileChanged event handler is not ignoring duplicate data when "bIgnoreDuplicate" is set to true on WlanRegisterNotification()

image

			private void RegisterNotification()
			{
				// Storing a delegate in class field is necessary to prevent garbage collector from collecting
				// the delegate before it is called. Otherwise, CallbackOnCollectedDelegate may occur.
				_notificationCallback = new WLAN_NOTIFICATION_CALLBACK((data, context) =>
				{
					var notificationData = Marshal.PtrToStructure<WLAN_NOTIFICATION_DATA>(data);
					if (notificationData.NotificationSource != WLAN_NOTIFICATION_SOURCE_ACM)
						return;

					NotificationReceived?.Invoke(null, notificationData);
				});

				var result = WlanRegisterNotification(
					Handle,
					WLAN_NOTIFICATION_SOURCE_ACM,
					true,
					_notificationCallback,
					IntPtr.Zero,
					IntPtr.Zero,
					0);

				// ERROR_INVALID_HANDLE: The client handle was not found in the handle table.
				// ERROR_INVALID_PARAMETER: A parameter is incorrect.
				// ERROR_NOT_ENOUGH_MEMORY: Failed to allocate memory for the query results.
				CheckResult(nameof(WlanRegisterNotification), result, true);
			}

Getting duplicate notification even though the pIgnoreDuplicate parameter is set to true.

Add support for WlanRegisterNotification() Event handler

Should be able to handle below activities with by registering an event handler.

wlan_notification_acm_start,
wlan_notification_acm_autoconf_enabled,
wlan_notification_acm_autoconf_disabled,
wlan_notification_acm_background_scan_enabled,
wlan_notification_acm_background_scan_disabled,
wlan_notification_acm_bss_type_change,
wlan_notification_acm_power_setting_change,
wlan_notification_acm_scan_complete,
wlan_notification_acm_scan_fail,
wlan_notification_acm_connection_start,
wlan_notification_acm_connection_complete,
wlan_notification_acm_connection_attempt_fail,
wlan_notification_acm_filter_list_change,
wlan_notification_acm_interface_arrival,
wlan_notification_acm_interface_removal,
wlan_notification_acm_profile_change,
wlan_notification_acm_profile_name_change,
wlan_notification_acm_profiles_exhausted,
wlan_notification_acm_network_not_available,
wlan_notification_acm_network_available,
wlan_notification_acm_disconnecting,
wlan_notification_acm_disconnected,
wlan_notification_acm_adhoc_network_state_change,
wlan_notification_acm_profile_unblocked,
wlan_notification_acm_screen_power_change,
wlan_notification_acm_profile_blocked,
wlan_notification_acm_scan_list_refresh,
wlan_notification_acm_operational_state_change,
wlan_notification_acm_end

How do I connect?

No sample is given how to connect to a "new" network.

The required profile part is completely left out.

Why?

Usage.SetProfile(..)

i am trying to set profile but it is giving error codes of 87,1338 etc.. i copied xml text from deleteProfile function that has been stored in system and tried to save again after deleting but still giving issue.
after research on error code 1338 i found that The security descriptor structure is invalid. i dont know what security should be provided in form of string as documentation also donot mention any thing regarding this..

Sometimes could only get one WIFI network

There are lots of nearby WIFI networks available, but sometimes call NativeWifi.EnumerateAvailableNetworks() could only get one network return. Click the wifi icon of system seems could fix this issue.

Creating profile for connection

How do you create a profile for a network that has no connection-profile yet? And do you use this profile to connect to the network?

SetProfileEapXmlUserData()

Awesome API!
I see that NativeWifi.SetProfileEapXmlUserData() was recently added. The remarks say "In some cases, this function may return true but fail." This is the very problem I'm struggling with. In short, I want to programmatically add a WPA2 enterprise profile. When using the windows 10 UI, all that's needed is the access point name, user and password. Windows determines all of the other settings from the access point. So obviously it's possible.
Will you be adding a demo or sample of successful usage anytime soon?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.