Ejemplo n.º 1
0
        private void AssociateSameAP(int routerIndex, bool b5Ghz, bool bHibernate)
        {
            Log("Deleting all wlan profiles");
            DeleteProfiles();

            Log("Starting Echo Services");
            CreateEchoServer();

            //Radios of all APs are turned on by the SetupRoutersIfNeeded();
            Log("Setting up Routers");
            SetupRoutersIfNeeded();

            string   Profile;
            APConfig apConfig = m_APConfigs[routerIndex];
            string   ap_ssid  = (b5Ghz) ? apConfig.SSID_5GHZ : apConfig.SSID_24GHZ;

            //Turn off all APs
            SetRadioState(0, false, false);
            SetRadioState(0, false, true);
            SetRadioState(1, false, false);
            SetRadioState(1, false, true);
            //Turn on AP used for this run
            SetRadioState(routerIndex, true, b5Ghz);

            LogMajor("Associate with manual profile to " + ap_ssid + " - Enter lower powerstate - Wake - Verify connectivity to same AP");

            Log("Creating a manual profile for SSID " + ap_ssid);
            Profile = CreateProfile(routerIndex, ConnectionMode.Manual, b5Ghz);

            LogMajor("Connecting to " + ap_ssid);
            if (!ConnectToAP(ap_ssid))
            {
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(routerIndex, b5Ghz))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(routerIndex, b5Ghz))
            {
                return;
            }

            m_ApConfigClient.Disconnect(); //must disconnect from ap controller before going to sleep
            if (bHibernate)
            {
                LogMajor("Entering hibernate");
                m_PowerManager.Sleep(120 * 1000, SleepState.S4);
            }
            else
            {
                LogMajor("Entering deepest supported sleep");
                m_PowerManager.DeepestSleep(120 * 1000);
            }
            LogMajor("Sleeping for 30 seconds after wake up");
            Wlan.Sleep(30 * 1000);      // 30s
            m_ApConfigClient.Connect(); //must reconnect to ap controller after waking up

            if (!Helpers.IsConnected(m_WlanApi, m_TestInterface))
            {
                LogError("After resuming system not connected to " + ap_ssid);
                return;
            }

            LogMajor("Validating association bssid");
            if (!ValidateRadioAssociation(routerIndex, b5Ghz))
            {
                return;
            }
            LogMajor("Validating connection by connecting to echo services and performing echo");
            if (!PerformEcho(routerIndex, b5Ghz))
            {
                return;
            }

            m_WlanApi.DeleteAllProfiles(m_TestInterface.Id);
        }