C# WiFiDirect Get Own DeviceId

51 Views Asked by At

I would like to access my own WiFiDirect device address or device ID. With C# and the namespace Windows.Devices.WiFiDirect I can access the WiFi Direct functionalities. Using a device ID, I can connect to another device. You can get the device ID of another device by searching other devices via WiFiDirect:

WiFiDirectConnectionListener connectionListener = new WiFiDirectConnectionListener();
connectionListener.ConnectionRequested += ConnectionListener_ConnectionRequested;

private async void ConnectionListener_ConnectionRequested(WiFiDirectConnectionListener sender, WiFiDirectConnectionRequestedEventArgs args)
{
    WiFiDirectDevice device = await WiFiDirectDevice.FromIdAsync(args.GetConnectionRequest().DeviceInformation.Id);
}

But is there a way that I can get my own DeviceID and give it to the other device in a completely different way? So that you can connect to a device without having to search and find each other first.

If not, is there a way to calculate this ID or address, for example based on the MAC address. How is it structured or is it randomly generated when searching?

Thanks!

I searched all the classes and forums but couldn't find how to get the device ID.

0

There are 0 best solutions below