Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing elements in enum WlanNotificationCodeAcm #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Supported operating systems
- Windows Vista
- Windows 7
- Windows 8
- Windows 10

Related links
-------------
Expand Down
49 changes: 38 additions & 11 deletions SimpleWifi/Wifi.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SimpleWifi.Win32;
using SimpleWifi.Win32;
using System;
using System.Collections.Generic;
using System.Text;
Expand Down Expand Up @@ -29,11 +29,38 @@ public Wifi()
foreach (var inte in _client.Interfaces)
inte.WlanNotification += inte_WlanNotification;
}

/// <summary>
/// Returns a list over all available access points
/// </summary>
public List<AccessPoint> GetAccessPoints()

/// <summary>
/// Scann all interfaces
/// </summary>
public void InterfacesScan()
{
foreach (WlanInterface wlanIface in _client.Interfaces)
{
wlanIface.Scan();
}
}

/// <summary>
/// Returns count Wi-Fi Interfaces
/// </summary>
public int InterfacesCount()
{
return _client.Interfaces.Length;
}

/// <summary>
/// Returns Interfaces
/// </summary>
public WlanInterface[] Interfaces()
{
return _client.Interfaces;
}

/// <summary>
/// Returns a list over all available access points
/// </summary>
public List<AccessPoint> GetAccessPoints()
{
List<AccessPoint> accessPoints = new List<AccessPoint>();
if (_client.NoWifiAvailable)
Expand Down Expand Up @@ -94,11 +121,11 @@ private set

private void inte_WlanNotification(WlanNotificationData notifyData)
{
if (notifyData.notificationSource == WlanNotificationSource.ACM && (NotifCodeACM)notifyData.NotificationCode == NotifCodeACM.Disconnected)
OnConnectionStatusChanged(WifiStatus.Disconnected);
else if (notifyData.notificationSource == WlanNotificationSource.MSM && (NotifCodeMSM)notifyData.NotificationCode == NotifCodeMSM.Connected)
OnConnectionStatusChanged(WifiStatus.Connected);
}
if (notifyData.notificationSource == WlanNotificationSource.ACM && (NotifCodeACM)notifyData.NotificationCode == NotifCodeACM.Disconnected)
OnConnectionStatusChanged(WifiStatus.Disconnected);
else if (notifyData.notificationSource == WlanNotificationSource.ACM && (NotifCodeACM)notifyData.NotificationCode == NotifCodeACM.ConnectionComplete)
OnConnectionStatusChanged(WifiStatus.Connected);
}

private void OnConnectionStatusChanged(WifiStatus newStatus)
{
Expand Down
9 changes: 7 additions & 2 deletions SimpleWifi/Win32/Interop/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,13 @@ public enum WlanNotificationCodeAcm
NetworkAvailable,
Disconnecting,
Disconnected,
AdhocNetworkStateChange
}
AdhocNetworkStateChange,
Profile_unblocked,
ScreenPowerChange,
ProfileBlocked,
ScanListRefresh,
AcmEnd
}

/// <summary>
/// Indicates the type of an MSM (<see cref="WlanNotificationSource.MSM"/>) notification.
Expand Down