Bluetooth and WSAQUERYSET for Set Service

Bluetooth uses the WSAQUERYSET structure to facilitate the discovery of devices and services in the Bluetooth namespace, NS_BTH.

The WSASetService function uses the WSAQUERYSET structure to register or remove service instances in the Bluetooth namespace. The following table lists member values in the WSAQUERYSET structure.

Member Required value (input) Output
dwSize Must be set to sizeof(WSAQUERYSET). Used as a versioning mechanism. None.
dwOutputFlags Not used. None.
lpszServiceInstanceName Optional, but recommended. Used to construct the Bluetooth ServiceName attribute. None.
lpServiceClassId Required. GUID corresponding to the service class. This value should correspond to a GUID from the Bluetooth Assigned Numbers document for known profiles, or a unique application-generated UUID for applications that are not profile based. Used to construct a ServiceClassIdList attribute sequence with this as its only member. None.
lpVersion Not used. None.
lpszComment Optional. Used to construct the Bluetooth ServiceDescription attribute. None.
dwNameSpace Namespace in which to constrain the service. Must be NS_BTH. None.
lpNSProviderId Not required. None.
lpszContext Not used. None.
dwNumberOfProtocols Not used. None.
lpafpProtocols Not used. None.
lpszQueryString Not used. None.
dwNumberOfCsAddrs Number of addresses to register. Must be 1. None.
lpcsaBuffer Required if lpBlob has not been populated with a raw SDP stream. Pointer to a CSADDR_INFO structure with its LocalAddr.lpSockaddr member pointing to the SOCKADDR_BTH where the server is listening for connections. The getsockname function can be used to return the SOCKADDR_BTH structure for a bound socket. Information in the lpcsaBuffer member is used by the system to construct the Bluetooth ProtocolDescriptorList SDP attribute. The protocol and port provided in lpcsaBuffer must be unique (not previously registered), and are used to index the record for subsequent calls to delete. Used to construct the Bluetooth ProtocolDescriptorList attribute of the SDP record. None.
lpBlob Optional. Pointer to a BLOB structure that points to a BTH_SET_SERVICE structure, enabling the client to provide a Bluetooth-specific structure containing a binary SDP record constructed by the application. If lpBlob is provided to the WSASetService function, all other members of the WSAQUERYSET structure except dwSize and dwNameSpace are ignored. See Bluetooth and BLOB for more information. Submitting a binary SDP record is necessary in many cases, because a limited number of SDP attributes can be converted from the WSAQUERYSET structure, and strings are converted only to default language UTF-8 encoding. If the optional BLOB and BTH_SET_SERVICE structures have been provided on input, along with the ULONG version and HANDLE values which must be pointed to by BTH_SET_SERVICE, the version is updated to contain the BTH_SDP_VERSION value for the Bluetooth Windows Sockets provider, and the handle is provided, which is required to subsequently delete the record.

 

Note

To remove a service, the only required members in the BTH_SET_SERVICE structure are the pSdpVersion and pRecordHandle members.

 

Bluetooth and WSAQUERYSET for Device Inquiry

Bluetooth and WSAQUERYSET for Service Inquiry

Bluetooth and BLOB

Bluetooth and WSASetService

BLOB

BTH_SET_SERVICE

CSADDR_INFO

getsockname

SOCKADDR_BTH

WSAQUERYSET

Windows Sockets