aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs
blob: 39404934d58cb501f2f025d3b2174b44b7265d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;

namespace Tango.PPC.Common.Connectivity
{
    /// <summary>
    /// Represents an internet connection manager.
    /// </summary>
    public interface IConnectivityProvider
    {
        /// <summary>
        /// Occurs when the connectivity provider state has changed (e.g network connected/disconnected).
        /// </summary>
        event EventHandler<ConnectionStateEventArgs> ConnectionStateChanged;

        /// <summary>
        /// Gets a value indicating whether there is a WiFi connection.
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// Gets a value indicating whether there is LAN connection.
        /// </summary>
        bool IsLanConnected { get; }

        /// <summary>
        /// Gets the available WiFi networks.
        /// </summary>
        ObservableCollection<WiFiNetwork> AvailableWiFiNetworks { get; }

        /// <summary>
        /// Gets the available WiFi networks as a sorted view source by signal strength.
        /// </summary>
        ICollectionView AvailableWiFiNetworksViewSource { get; set; }

        /// <summary>
        /// Gets the available WiFi networks.
        /// </summary>
        /// <returns></returns>
        Task<List<WiFiNetwork>> GetAvailableWiFiNetworks();

        /// <summary>
        /// Resets the available WiFi networks collection.
        /// </summary>
        Task RefreshAvailableWiFiNetworks();

        /// <summary>
        /// Checks the Internet connection.
        /// </summary>
        /// <returns></returns>
        Task<bool> CheckInternetConnection();

        /// <summary>
        /// Gets the connect to WiFi command.
        /// </summary>
        RelayCommand<WiFiNetwork> ConnectToWiFiCommand { get; }

        /// <summary>
        /// Gets the disconnect from WiFi command.
        /// </summary>
        RelayCommand<WiFiNetwork> DisconnectFromWiFiCommand { get; }

        /// <summary>
        /// Gets or sets the refresh available WiFi networks command.
        /// </summary>
        RelayCommand RefreshAvailableWiFiNetworksCommand { get; set; }

        /// <summary>
        /// Connects the specified network.
        /// </summary>
        /// <param name="network">The network.</param>
        /// <returns></returns>
        Task<bool> Connect(WiFiNetwork network, String password = null);

        /// <summary>
        /// Disconnects the specified network.
        /// </summary>
        /// <param name="network">The network.</param>
        /// <returns></returns>
        void Disconnect(WiFiNetwork network);
    }
}