WFD_OPEN_SESSION_COMPLETE_CALLBACK callback function

The WFD_OPEN_SESSION_COMPLETE_CALLBACK function defines the callback function that is called by the WFDStartOpenSession function when the WFDStartOpenSession operation completes.

Syntax

WFD_OPEN_SESSION_COMPLETE_CALLBACK WfdOpenSessionCompleteCallback;

void WfdOpenSessionCompleteCallback(
  HANDLE hSessionHandle,
  PVOID pvContext,
  GUID guidSessionInterface,
  DWORD dwError,
  DWORD dwReasonCode
)
{...}

Parameters

hSessionHandle

A session handle to a Wi-Fi Direct session. This is a session handle previously returned by the WFDStartOpenSession function.

pvContext

An context pointer passed to the callback function from the WFDStartOpenSession function.

guidSessionInterface

The interface GUID of the local network interface on which this Wi-Fi Direct device has an open session. This parameter is useful if higher-layer protocols need to determine which network interface a Wi-Fi Direct session is bound to. This value is only returned if the dwError parameter is ERROR_SUCCESS.

dwError

A value that specifies whether there was an error encountered during the call to the WFDStartOpenSession function. If this value is ERROR_SUCCESS, then no error occurred and the operation to open the session completed successfully.

The following other values are possible:

Value Meaning
ERROR_INVALID_PARAMETER
The parameter is incorrect. This error is returned if the hClientHandle parameter is NULL or not valid.
ERROR_INVALID_STATE
The group or resource is not in the correct state to perform the requested operation. This error is returned if the Wi-Fi Direct service is disabled by group policy on a domain.
ERROR_SERVICE_NOT_ACTIVE
The service has not been started. This error is returned if the WLAN AutoConfig Service is not running.
RPC_STATUS
Various RPC and other error codes. Use FormatMessage to obtain the message string for the returned error.

dwReasonCode

A value that specifies the more detail if an error occurred during WFDStartOpenSession.

Return Value

This callback function does not return a value.

Remarks

The WFD_OPEN_SESSION_COMPLETE_CALLBACK function is part of Wi-Fi Direct, a new feature in Windows 8 and Windows Server 2012. Wi-Fi Direct is based on the development of the Wi-Fi Peer-to-Peer Technical Specification v1.1 by the Wi-Fi Alliance (see Wi-Fi Alliance Published Specifications). The goal of the Wi-Fi Peer-to-Peer Technical Specification is to provide a solution for Wi-Fi device-to-device connectivity without the need for either a Wireless Access Point (wireless AP) to setup the connection or the use of the existing Wi-Fi adhoc (IBSS) mechanism.

The WFDStartOpenSession function starts an asynchronous operation to start an on-demand connection to a specific Wi-Fi Direct device. The target Wi-Fi device must previously have been paired through the Windows Pairing experience. When the asynchronous operation to make the Wi-FI Direct connection completes, the callback function specified in the pfnCallback parameter is called.

Requirements

   
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header wlanapi.h

See Also

WFDCancelOpenSession

WFDCloseHandle

WFDCloseSession

WFDOpenHandle

WFDStartOpenSession

WFD_OPEN_SESSION_COMPLETE_CALLBACK