private bool Discover()
        {
            DiscoveryScenario discoveryScenario = new DiscoveryScenario(
                this.localWFDController,
                this.remoteWFDController,
                this.reconnectScenarioType == ReconnectScenarioType.SendReinvokeInvitationToClient ? DiscoveryScenarioType.DiscoverAsDevice : DiscoveryScenarioType.DiscoverAsGo,
                true,  /* targetted discovery */
                WFD_DISCOVER_TYPE.wfd_discover_type_auto,
                10000, /* 10 second timeout */
                false  /* skip Vendor Specific IE validation */
                );

            DiscoveryScenarioResult discoveryScenarioResult = discoveryScenario.Execute();

            return(discoveryScenarioResult.ScenarioSucceeded);
        }
        void ExecuteDiscoveryScenario(DiscoveryScenarioType discoveryScenarioType,
                                      bool isTargetedDiscovery,
                                      WFD_DISCOVER_TYPE discoverType,
                                      uint searchTimeoutMs)
        {
            DiscoveryScenario discoveryScenario = new DiscoveryScenario(
                localWFDController,
                remoteWFDController,
                discoveryScenarioType,
                isTargetedDiscovery,
                discoverType,
                searchTimeoutMs,
                true // Validate Vendor extension IEs
                );

            DiscoveryScenarioResult discoveryScenarioResult = discoveryScenario.Execute();

            Verify.IsTrue(discoveryScenarioResult.ScenarioSucceeded);
        }
        private bool PerformTargetedDiscovery()
        {
            DiscoveryScenarioType discoveryScenarioType;

            switch (pairingScenarioType)
            {
            case PairingScenarioType.JoinExistingGo:
                discoveryScenarioType = DiscoveryScenarioType.DiscoverAsGo;
                break;

            case PairingScenarioType.Invitation:
            case PairingScenarioType.GoNegotiationDutBecomesGo:
            case PairingScenarioType.GoNegotiationDutBecomesClient:
                discoveryScenarioType = DiscoveryScenarioType.DiscoverAsDevice;
                break;

            default:
                throw new Exception("Cannot map pairing scenario to discovery scenario.");
            }

            DiscoveryScenario discoveryScenario = new DiscoveryScenario(
                localWFDController,
                remoteWFDController,
                discoveryScenarioType,
                true, // isTargettedDiscovery
                WFD_DISCOVER_TYPE.wfd_discover_type_auto,
                pairingScenarioDiscoveryTimeoutMs,
                false // discoverTestIe
                );
            DiscoveryScenarioResult discoveryScenarioResult = discoveryScenario.Execute();

            if (!discoveryScenarioResult.ScenarioSucceeded)
            {
                WiFiDirectTestLogger.Error("Targetted discovery failed for device {0} ({1}).  Aborting pairing operation.", remoteWFDController.DeviceAddress, remoteWFDController.MachineName);
            }

            return(discoveryScenarioResult.ScenarioSucceeded);
        }