Exemplo n.º 1
0
        /// <summary>
        /// Calls WiFiManager.GetFoundAPs() to get scan result and return a list
        /// that contains Wi-Fi AP information
        /// </summary>
        /// <returns>APInfo list with scan results</returns>
        public List <APInfo> ScanResult()
        {
            Logger.Log("ScanResult()");

            try
            {
                _apList = WiFiManager.GetFoundAPs();

                List <APInfo> apInfoList = new List <APInfo>();
                foreach (var item in _apList)
                {
                    apInfoList.Add(new APInfo
                    {
                        Name  = item.NetworkInformation.Essid,
                        State = item.NetworkInformation.ConnectionState.ToString(),
                    });
                }

                return(apInfoList);
            }
            catch (Exception e)
            {
                Logger.Log(e.ToString());
                return(null);
            }
        }
Exemplo n.º 2
0
 public void init()
 {
     this.wlanManager = new WiFiManager();
     this.wlanManager.HostedNetworkAvailable   += new EventHandler(wlanManager_HostedNetworkAvailable);
     this.wlanManager.HostedNetworkUnavailable += new EventHandler(wlanManager_HostedNetworkUnavailable);
     this.wlanManager.HostedNetworkStarted     += new EventHandler(wlanManager_HostedNetworkStarted);
     this.wlanManager.StationJoin  += new EventHandler <WiFiManager.EventStationJoin>(wlanManager_StationJoin);
     this.wlanManager.StationLeave += new EventHandler <WiFiManager.EventStationLeave>(wlanManager_StationLeave);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Checks if info about given Access Point is stored in
 /// Wi-Fi Configurations
 /// </summary>
 /// <param name="apName">Access Point name</param>
 /// <returns>True if Access Point is stored, false otherwise</returns>
 public bool IsAPInfoStored(string apName)
 {
     try
     {
         var configurations = WiFiManager.GetWiFiConfigurations();
         return(configurations.Any(c => c.Name == apName));
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Call WiFiManager.GetFoundAPs() to get scan result and return a list that contains Wi-Fi AP information
        /// </summary>
        /// <returns>scan result by a list of Wi-Fi AP information</returns>
        public List <APInfo> ScanResult()
        {
            LogImplementation.DLog("ScanResult()");
            try
            {
                // Call Tizen C# API
                apList = WiFiManager.GetFoundAPs();
                // return a list that contains Wi-Fi ESSID
                return(GetAPList());
            }
            catch (Exception e)
            {
                LogImplementation.DLog(e.ToString());
            }

            return(null);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Call WiFiManager.DeactivateAsync() to turn off Wi-Fi interface
 /// </summary>
 /// <returns>Task to do DeactivateAsync</returns>
 public Task Deactivate()
 {
     LogImplementation.DLog("Deactivate()");
     // Call Tizen C# API
     return(WiFiManager.DeactivateAsync());
 }
Exemplo n.º 6
0
 /// <summary>
 /// Call WiFiManager.ScanAsync() to scan
 /// </summary>
 /// <returns>Task to do ScanAsync</returns>
 public Task Scan()
 {
     LogImplementation.DLog("Scan()");
     // Call Tizen C# API
     return(WiFiManager.ScanAsync());
 }
Exemplo n.º 7
0
 /// <summary>
 /// Get the ESSID of the AP that this device is connected to
 /// </summary>
 /// <returns>ESSID of the connected Wi-Fi AP</returns>
 public String ConnectedAP()
 {
     // Call Tizen C# API
     return(WiFiManager.GetConnectedAP().NetworkInformation.Essid);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Call WiFiManager.ActivateAsync() to turn on Wi-Fi interface
 /// </summary>
 /// <returns>Task to do ActivateAsync</returns>
 public async Task Activate()
 {
     LogImplementation.DLog("Activate()");
     // Call Tizen C# API
     await WiFiManager.ActivateAsync();
 }
Exemplo n.º 9
0
 void wlanManager_StationLeave(object sender, WiFiManager.EventStationLeave e)
 {
     if (Peers.ContainsKey(e.MACAddress))
         Peers[e.MACAddress].leaveWiFi();
 }
Exemplo n.º 10
0
 public void init()
 {
     this.wlanManager = new WiFiManager();
     this.wlanManager.HostedNetworkAvailable += new EventHandler(wlanManager_HostedNetworkAvailable);
     this.wlanManager.HostedNetworkUnavailable += new EventHandler(wlanManager_HostedNetworkUnavailable);
     this.wlanManager.HostedNetworkStarted += new EventHandler(wlanManager_HostedNetworkStarted);
     this.wlanManager.StationJoin += new EventHandler<WiFiManager.EventStationJoin>(wlanManager_StationJoin);
     this.wlanManager.StationLeave += new EventHandler<WiFiManager.EventStationLeave>(wlanManager_StationLeave);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Calls WiFiManager.DeactivateAsync() to turn off Wi-Fi interface
 /// </summary>
 /// <returns>Task to do DeactivateAsync</returns>
 public Task Deactivate()
 {
     return(WiFiManager.DeactivateAsync());
 }
Exemplo n.º 12
0
 void wlanManager_StationJoin(object sender, WiFiManager.EventStationJoin e)
 {
     if (!Peers.ContainsKey(e.pStation.MacAddress))
         Peers.Add(e.pStation.MacAddress, new NetworkPeerService());
     Peers[e.pStation.MacAddress].updateWiFi(e.pStation);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Calls WiFiManager.ScanAsync() to scan for APs
 /// </summary>
 /// <returns>Task to do ScanAsync</returns>
 public Task Scan()
 {
     Logger.Log("Scan()");
     return(WiFiManager.ScanAsync());
 }
Exemplo n.º 14
0
 /// <summary>
 /// Calls WiFiManager.ActivateAsync() to turn on Wi-Fi interface
 /// </summary>
 /// <returns>Task to do ActivateAsync</returns>
 public async Task Activate()
 {
     await WiFiManager.ActivateAsync();
 }
Exemplo n.º 15
0
 /// <summary>
 /// Calls WiFiManager.DeactivateAsync() to turn off Wi-Fi interface
 /// </summary>
 /// <returns>Task to do DeactivateAsync</returns>
 public Task Deactivate()
 {
     Logger.Log("Deactivate()");
     return(WiFiManager.DeactivateAsync());
 }
Exemplo n.º 16
0
 /// <summary>
 /// Calls WiFiManager.ActivateAsync() to turn on Wi-Fi interface
 /// </summary>
 /// <returns>Task to do ActivateAsync</returns>
 public async Task Activate()
 {
     Logger.Log("Activate()");
     await WiFiManager.ActivateAsync();
 }
Exemplo n.º 17
0
 /// <summary>
 /// Gets the ESSID of the AP device is connected to
 /// </summary>
 /// <returns>ESSID of the connected Wi-Fi AP</returns>
 public string ConnectedAP()
 {
     return(WiFiManager.GetConnectedAP()?.NetworkInformation.Essid ?? null);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Gets the currently connected AP
 /// </summary>
 public void GetConnectedAP()
 {
     currentAP = WiFiManager.GetConnectedAP();
 }
Exemplo n.º 19
0
 /// <summary>
 /// Calls WiFiManager.ScanAsync() to scan for APs
 /// </summary>
 /// <returns>Task to do ScanAsync</returns>
 public Task Scan()
 {
     return(WiFiManager.ScanAsync());
 }