Bluetooth and WSASetService

Bluetooth uses the WSASetService function to register or remove a service instance within the Bluetooth namespace (NS_BTH) from the registry. The handle returned by this operation may only be used to delete the service.

Bluetooth has two means of advertising services using the WSASetService function:

  • The application can have the system advertise a simple Bluetooth SDP service record, constructed from standard members in the WSAQUERYSET structure.
  • The application can have the system advertise their own Bluetooth SDP record by passing a BTH_SET_SERVICE structure in the lpBlob member of the WSAQUERYSET structure. This is a more complex approach.

Note

SDP records advertised by WSASetService do not persist after the process that published them has quit.

 

Use of WSASetService with Bluetooth has the following requirements:

  • The lpqsRegInfo parameter is the address of the WSAQUERYSET structure to be registered.
  • The essOperation parameter is an enumeration that contains one of the operations shown in the following table.
Value Description
RNRSERVICE_REGISTER Starts advertising the service to remote radios querying using the Bluetooth SDP protocol.
RNRSERVICE_DEREGISTER Not valid. Returns an error.
RNRSERVICE_DELETE Stops advertising the service.

 

Note

Service handles discovered during a WSALookupServiceBegin or WSALookupServiceNext call are incompatible with the RNRSERVICE_DELETE operation.

 

  • The dwControlFlags parameter is reserved, and must be zero.

For more information and a list of Bluetooth socket options, see Bluetooth and Socket Options.

Windows Sockets