diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 12:06:36 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 12:06:36 +0300 |
| commit | 9dbb8f8eb3d07ee07cf7ce1beab72df056e157c6 (patch) | |
| tree | cd5ace2339d8f3f4a4b92381843497d4f6b21301 /Software/Visual_Studio/Tango.WiFi | |
| parent | a3aedf6ba1e0f9cc65877c88f66af6f330484086 (diff) | |
| download | Tango-9dbb8f8eb3d07ee07cf7ce1beab72df056e157c6.tar.gz Tango-9dbb8f8eb3d07ee07cf7ce1beab72df056e157c6.zip | |
New Implementation of PPC WiFI networks management!
Diffstat (limited to 'Software/Visual_Studio/Tango.WiFi')
4 files changed, 0 insertions, 220 deletions
diff --git a/Software/Visual_Studio/Tango.WiFi/AvailableWifiNetwork.cs b/Software/Visual_Studio/Tango.WiFi/AvailableWifiNetwork.cs deleted file mode 100644 index c9aeb0722..000000000 --- a/Software/Visual_Studio/Tango.WiFi/AvailableWifiNetwork.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; - -namespace Tango.WiFi -{ - public class AvailableWifiNetwork : ExtendedObject - { - private Wifi _wifi; - - private bool _isConnected; - public bool IsConnected - { - get { return _isConnected; } - set { _isConnected = value; RaisePropertyChangedAuto(); } - } - - private String _name; - public String Name - { - get { return _name; } - set { _name = value; RaisePropertyChangedAuto(); } - } - - private double _signalStregth; - public double SignalStrength - { - get { return _signalStregth; } - set { _signalStregth = value; RaisePropertyChangedAuto(); } - } - - private bool _isSecure; - public bool IsSecure - { - get { return _isSecure; } - set { _isSecure = value; RaisePropertyChangedAuto(); } - } - - private bool _hasProfile; - public bool HasProfile - { - get { return _hasProfile; } - set { _hasProfile = value; RaisePropertyChangedAuto(); } - } - - private AccessPoint _accessPoint; - public AccessPoint AccessPoint - { - get { return _accessPoint; } - set { _accessPoint = value; RaisePropertyChangedAuto(); } - } - - public AvailableWifiNetwork(AccessPoint accessPoint, Wifi wifi) - { - _wifi = wifi; - AccessPoint = accessPoint; - } - - public NetworkAuthenticationRequest CreateAuthenticationRequest() - { - return new NetworkAuthenticationRequest(new AuthRequest(AccessPoint)); - } - - public Task<bool> Connect(NetworkAuthenticationRequest request) - { - return Task.Factory.StartNew<bool>(() => - { - return AccessPoint.Connect(request.AuthRequest, false); - }); - } - - public void Forget() - { - AccessPoint.DeleteProfile(); - HasProfile = false; - } - - public void Disconnect() - { - _wifi.Disconnect(); - IsConnected = false; - } - } -} diff --git a/Software/Visual_Studio/Tango.WiFi/NetworkAuthenticationRequest.cs b/Software/Visual_Studio/Tango.WiFi/NetworkAuthenticationRequest.cs deleted file mode 100644 index 238161987..000000000 --- a/Software/Visual_Studio/Tango.WiFi/NetworkAuthenticationRequest.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; - -namespace Tango.WiFi -{ - public class NetworkAuthenticationRequest : ExtendedObject - { - public AuthRequest AuthRequest { get; set; } - - public bool IsUserNameRequired - { - get { return AuthRequest.IsUsernameRequired; } - } - - public bool IsPasswordRequired - { - get { return AuthRequest.IsPasswordRequired; } - } - - public String UserName - { - get { return AuthRequest.Username; } - set { AuthRequest.Username = value; RaisePropertyChangedAuto(); } - } - - public String Password - { - get { return AuthRequest.Password; } - set { AuthRequest.Password = value; RaisePropertyChangedAuto(); } - } - - public NetworkAuthenticationRequest(AuthRequest request) - { - AuthRequest = request; - } - } -} diff --git a/Software/Visual_Studio/Tango.WiFi/Tango.WiFi.csproj b/Software/Visual_Studio/Tango.WiFi/Tango.WiFi.csproj index c7d345402..7e4d85621 100644 --- a/Software/Visual_Studio/Tango.WiFi/Tango.WiFi.csproj +++ b/Software/Visual_Studio/Tango.WiFi/Tango.WiFi.csproj @@ -62,12 +62,9 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="AccessPoint.cs" /> - <Compile Include="AvailableWifiNetwork.cs" /> <Compile Include="EapUserFactory.cs" /> <Compile Include="AuthRequest.cs" /> - <Compile Include="NetworkAuthenticationRequest.cs" /> <Compile Include="ProfileFactory.cs" /> - <Compile Include="WiFiManager.cs" /> <Compile Include="Win32\Helpers\WlanHelpers.cs" /> <Compile Include="Win32\Interop\Enums.cs" /> <Compile Include="Win32\Interop\Exceptions.cs" /> diff --git a/Software/Visual_Studio/Tango.WiFi/WiFiManager.cs b/Software/Visual_Studio/Tango.WiFi/WiFiManager.cs deleted file mode 100644 index 68f020ae0..000000000 --- a/Software/Visual_Studio/Tango.WiFi/WiFiManager.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Tango.Core; - -namespace Tango.WiFi -{ - public class WiFiManager : ExtendedObject - { - private Wifi _wifi; - private Thread _scanThread; - - private bool _enabled; - public bool Enabled - { - get { return _enabled; } - set - { - if (_enabled != value) - { - _enabled = value; - RaisePropertyChangedAuto(); - - if (_enabled) - { - Start(); - } - } - } - } - - public ObservableCollection<AvailableWifiNetwork> AvailableWifiNetworks { get; set; } - - public WiFiManager() - { - _wifi = new Wifi(); - AvailableWifiNetworks = new ObservableCollection<AvailableWifiNetwork>(); - AvailableWifiNetworks.EnableCrossThreadOperations(); - } - - public void Start() - { - Enabled = true; - _scanThread = new Thread(ScanThreadMethod); - _scanThread.IsBackground = true; - _scanThread.Start(); - } - - private void ScanThreadMethod() - { - while (_enabled) - { - var accessPoints = _wifi.GetAccessPoints().OrderByDescending(ap => ap.SignalStrength).ToList(); - - AvailableWifiNetworks.Where(x => !accessPoints.Exists(y => y.Name == x.Name)).ToList().ForEach(x => AvailableWifiNetworks.Remove(x)); - - foreach (AccessPoint ap in accessPoints) - { - var network = AvailableWifiNetworks.FirstOrDefault(x => x.Name == ap.Name); - - if (network == null) - { - network = new AvailableWifiNetwork(ap, _wifi); - AvailableWifiNetworks.Add(network); - } - - network.AccessPoint = ap; - network.Name = ap.Name; - network.IsConnected = ap.IsConnected; - network.SignalStrength = ap.SignalStrength; - network.IsSecure = ap.IsSecure; - network.HasProfile = ap.HasProfile; - } - - Thread.Sleep(5000); - } - } - - public void Stop() - { - Enabled = false; - _scanThread = null; - } - } -} |
