Giter VIP home page Giter VIP logo

Comments (3)

yanfangliu-google avatar yanfangliu-google commented on September 28, 2024

I also saw this problem. After you fixed it, do you get the GO and GC connected?

from windows-universal-samples.

orineman avatar orineman commented on September 28, 2024

I believe so. I worked more with the C# sample. So see also #1399.

Best way of testing is to make sure the devices aren't already paired and get the C# sample working first.

Life will be better if you make this change to Scenario2_Connector.cpp at approx. line 78.

            deviceWatcher = DeviceInformation::CreateWatcher(deviceSelector, { L"System.Devices.WiFiDirect.InformationElements", L"System.Devices.Aep.CanPair", L"System.Devices.Aep.IsPaired" });

It will make it correctly report the pairing status for the device you are connecting to and stop it from trying to pair when already paired (which fails).

          co_await clientSocket.ConnectAsync(remoteHostName, ServerPortString);

is throwing an exception for me at the moment, but it does make the WiFi Direct connection, but I haven't run this code for a couple of months.

I let all the GO settings default and add "Push button" configuration methods on both sides. I suggest trying this first.

Note that the Advertiser only advertises for a couple of minutes and the Connector only looks for a few seconds. Once it says the enumeration is complete, you won't see any more devices until you stop/restart the watcher.

You are better off doing this:

		WiFiDirectDevice wiFiDevice = WiFiDirectDevice(nullptr);
		hstring selector = wiFiDevice.GetDeviceSelector(WiFiDirectDeviceSelectorType::AssociationEndpoint);

		co_await resume_background();
		DeviceInformationCollection devices = co_await DeviceInformation::FindAllAsync(
			selector,
			{
				L"System.Devices.Aep.CanPair",
				L"System.Devices.Aep.IsPaired",
				L"System.Devices.WiFiDirect.InformationElements"
			}
		);
		co_await winrt::resume_foreground(_queue);

every 30 seconds or so while you aren't suspended.

from windows-universal-samples.

yanfangliu-google avatar yanfangliu-google commented on September 28, 2024

@orineman After look at your reply and the link you mentioned, I realize that only GC needs to do DeviceInformationCustomPairing::PairAsync(...), then both side can get a valid IP address and ping each other. But the problem is that how to use WiFiDirectConfigurationMethod::DisplayPin and ProvidePin? PushButton is kind of unsafe.
I don't see WiFiDirectConnectionParameters::PairingRequested call back handler get called at any situation.
I mentioned this problem in issue #1406

from windows-universal-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.