Purpose of WiFiDirectAdvertisementPublisher in WiFiDirect UWP sample

Mauro Fantina 106 Reputation points
2020-09-10T05:52:26.787+00:00

Hello,
I download UWP samples and I open WiFiDirect sample.

I see there is Scenario2_Connector that set PC to discover nearby WiFi Peers.

The first action that the code execute is

_publisher.Start();

where _pubblisher is defined as WiFiDirectAdvertisementPublisher _publisher = new WiFiDirectAdvertisementPublisher().

I dont' understand the purpose of this pubblisher ... if I omit this ... the code can work correctly ?

Universal Windows Platform (UWP)
No comments
{count} votes

Accepted answer
  1. Roy Li - MSFT 26,636 Reputation points Microsoft Employee
    2020-09-10T07:46:48.517+00:00

    Hello @Mauro Fantina

    if I omit this ... the code can work correctly?

    No. The WiFiDirectAdvertisementPublisher object is the object that publishes advertisements. In the sample code, you could see that all the code runs after the publisher.Start() method is called. When this method is called, it means the current device is advertising wifi and is willing to connect another wifi that comes from the advertiser which is scenario 1 in the wifi direct sample.

    You could also check this video about WiFi Direct: Wi-Fi Direct and Wi-Fi Direct Services API.

    Thank you.

    No comments

0 additional answers

Sort by: Most helpful