Example #1
0
        public bool ConnectToAP(string profilename)
        {
            Log("Connecting to " + profilename);
            try
            {
                m_WlanApi.ProfileConnect(m_TestInterface.Id, profilename, new TimeSpan(0, 0, 30));
            }
            catch (Exception e)
            {
                LogError("Failed to Connect to to ssid " + profilename + " with a timeout of 30s. Please refer to traces for details.  Error: " + e.Message);
                return(false);
            }

            try
            {
                LogMajor("Waiting for full network connectivity");
                m_LocalIP = Helpers.WaitForFullNetworkConnectivity(m_TestInterface.Id, DefaultTimeOuts.DefaultDHCPTimeout, m_AssociationConfiguration.ServiceAPChannelAddress, c_EchoPort, c_EchoByteStream);
            }
            catch (Exception e)
            {
                LogError("An error was encountered when waiting for full L3 connectivity, after connecting to [" + profilename + "] with a timeout of " + DefaultTimeOuts.DefaultDHCPTimeout + "ms. Please refer to traces for details. Error: " + e.Message);
                return(false);
            }

            return(true);
        }
        public bool ConnectToAP(string profilename)
        {
            // Before starting the connect, perform a scan
            Log("Triggering a scan");
            try
            {
                Api.Scan(TestInterface.Id, false, new TimeSpan(0, 0, 10));
            }
            catch (Exception e)
            {
                // This error is OK
                Log("Failed to do a scan. Please refer to traces for details. " + e.Message);
            }

            Log("Connecting to " + profilename);
            try
            {
                Api.ProfileConnect(TestInterface.Id, profilename, new TimeSpan(0, 0, 30));
            }
            catch (Exception e)
            {
                LogError("Failed to do a profile connect to ssid " + profilename + " with a timeout of 30s. Please refer to traces for details. " + e.Message);
                return(false);
            }
            try
            {
                Helpers.WaitForFullNetworkConnectivity(TestInterface.Id, DefaultTimeOuts.DefaultDHCPTimeout, RoamingConfiguration.ServiceAPChannelAddress, EchoPort, EchoByteStream);
            }
            catch (Exception e)
            {
                LogError("An Error was encountered when waiting for full L3 connectivity, after connecting to " + profilename + " with a timeout of " + DefaultTimeOuts.DefaultDHCPTimeout + "ms. Please refer to traces for details." + e.Message);
                return(false);
            }

            return(true);
        }