WSASetService (Bluetooth) (Compact 2013)
3/26/2014
This function adds, updates, or removes service records from the local SDP database.
Syntax
INT WSASetService(
LPWSAQUERYSET lpqsRegInfo,
WSAESETSERVICEOP essoperation,
DWORD dwControlFlags
);
Parameters
- lpqsRegInfo
[in] Pointer to the service information for registration or deregistration.
- essoperation
[in] Value that is to be set to RNRSERVICE_REGISTER.
- dwControlFlags
[in] Flag that is to be set to zero.
Return Value
Returns zero on success; otherwise SOCKET_ERROR. The specific error code can be retrieved by calling WSAGetLastError.
The following table shows possible error codes for the last error, if SOCKET_ERROR is set.
Error code |
Description |
---|---|
WSASERVICE_NOT_FOUND |
SDP is not running. |
WSAEINVAL |
The parameter is invalid. |
WSA_NOT_ENOUGH_MEMORY |
Memory is insufficient. |
Remarks
Note
This function is actually a Winsock function. However, the information that is presented in it is specific to Bluetooth.
Servers use this function to register specific service information with SDP. The following table shows the members of the WSAQUERYSET (Bluetooth) structure that are associated with values in the SDP record.
Member |
Submember |
Description |
---|---|---|
lpqsRegInfo |
dwSize |
|
|
lpszServiceInstanceName |
Not supported on Windows Embedded Compact. Set to 0. |
|
lpServiceClassId |
Not supported on Windows Embedded Compact. Set to 0. |
|
dwNameSpace |
NS_BTH. |
|
dwNumberOfCsAddrs |
Not supported on Windows Embedded Compact. Set to 0. |
|
IpcsaBuffer |
Not supported on Windows Embedded Compact. Set to 0. |
|
lpBlob |
Points to a BTHNS_SETBLOB structure, containing information about the service to be added. |
|
All other WSAQUERYSET fields are ignored. |
|
essOperation |
|
RNRSERVICE_REGISTER. |
dwControlFlags |
|
Equal to 0 (clear). |
This function can be used to update an existing SDP record with new information. The parameters of the call are the same as in the initial record registration. The following table shows the exceptions.
Member |
Submember |
Description |
---|---|---|
lpqsRegInfo |
lpBlob |
BTHNS_SETBLOB structure, containing the service record handle. The service record handle is a critical piece of data. Any differences between the existing SD record and the passed-in SD record will be applied to match the passed-in record. Attributes could be added, changed, or deleted, so long as the resulting record is legal according to SDP. Changes that could result in an invalid record cause this function to return an error. If an error is returned, the existing SDP record remains unchanged. |
This function can be used to delete existing SDP records. The following table shows the fields of the WSAQUERYSET structure.
Member |
Submember |
Description |
---|---|---|
lpqsRegInfo |
dwSize |
|
|
dwNameSpace |
NS_BTH. |
|
lpBlob |
BTHNS_SETBLOB structure, containing the service record handle. |
|
* |
All other fields are ignored. |
essOperation |
|
RNRSERVICE_DELETE. |
dwControlFlags |
|
0 (clear). |
Requirements
Header |
winsock2.h |
Library |
Ws2.lib |
See Also
Reference
Bluetooth API Miscellaneous Functions
WSAQUERYSET (Bluetooth)
BTHNS_SETBLOB