Comments (3)
I also saw this problem. After you fixed it, do you get the GO and GC connected?
from windows-universal-samples.
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.
@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)
- Always OnHaptic Feedback HOT 1
- error while saving the 3mf
- Second WiFi Direct connection fails HOT 2
- WiFiDirect Watcher sometimes fails to restart HOT 1
- C++/WinRT Versions of All Samples HOT 2
- Can not build and debug the sample HOT 1
- InitializeComponent call in cppwinrt sample page constructors
- InitializeComponent call in C++/WinRT sample page constructors
- WiFiDirect cppwinrt can not get "PairingRequested" callback after GO/GC calls PairingRequested() HOT 5
- Missing xaml files in ApplicationData sample HOT 2
- A lot of projects are outdated HOT 1
- Bug or incomplete / outdated documentation for the B2B Microsoft Store Example
- Can Lamp Array adapt to Bluetooth HID
- The CameraResolution project cannot obtain the H264 format of the usb camera HOT 1
- Can't receive the ScanResponse advertisement
- Switching Between System Power Saving Mode in UWP app ,makes the app non-responded for a while
- UWP - Strange line appears when Hover in ARM pc
- BasicMediaCasting - Cast Button Not Appearing When Building for HoloLens
- compile errors indicate something is wrong HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windows-universal-samples.