예제 #1
0
 public static void StopAccessPoint()
 {
     DebugHelper.LogInformation("Stopping Access Point...");
     _AccessPoint.Stop();
     _AccessPoint = null;
     DebugHelper.LogInformation("Access Point stopping.");
 }
        private static void InitAccessPoint()
        {
            string mac = MACFinder.GetWiFiAdapterMAC();

            if (_AccessPoint != null)
            {
                StopAccessPoint();
            }
            _AccessPoint = new OnboardingAccessPoint($"{SecretManager.AccessPointSsid}_{mac}", SecretManager.AccessPointPassword, AccessPointId);
        }
예제 #3
0
        private static void InitAccessPoint()
        {
            AdapterInfo adapter = null;

            try
            {
                if (SecretManager.AccessPointSsid == Common.Helpers.SharedConstants.DEFAULT_AP_SSID)
                {
                    var listAdapters = AdaptersHelper.GetAdapters();
                    adapter = listAdapters.FindAll(p => p.Type == AdapterType.Wifi).OrderBy(p => p.Name).FirstOrDefault();
                    if (adapter == null)
                    {
                        adapter = listAdapters.OrderBy(p => p.Name).FirstOrDefault();
                    }

                    if (adapter == null)
                    {
                        throw new Exception("Could not retrieve MAC address");
                    }

                    SecretManager.AccessPointSsid = $"{Common.Helpers.SharedConstants.DEFAULT_AP_SSID}_{adapter.RawMAC}";
                }
            }
            catch (Exception e)
            {
                DebugHelper.LogError($"Could not retrieve MAC address: {e.Message}");
                return;
            }

            DebugHelper.LogInformation($"Access Point Id: {SecretManager.AccessPointSsid}");

            if (_AccessPoint != null)
            {
                StopAccessPoint();
            }
            _AccessPoint = new OnboardingAccessPoint(SecretManager.AccessPointSsid, SecretManager.AccessPointPassword, AccessPointId);
        }