다음을 통해 공유


BthNsSetService (Windows CE 5.0)

Send Feedback

This function adds, updates, or removes service records from the local SDP database.

Note   To preserve Win32 compatibility, consider using the Winsock equivalent of this function. This function is equivalent to WSASetService.

INTBthNsSetService(LPWSAQUERYSETlpqsRegInfo,WSAESETSERVICEOPessoperation,DWORDdwControlFlags);

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 Values

If the operation is successful, the return value is zero (ERROR_SUCCESS). Otherwise, the value SOCKET_ERROR is returned. 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

Servers use this function to register specific service information with SDP. The following table shows the members of the WSAQUERYSET structure that are associated with values in the SDP record.

Member Submember Description
lpqsRegInfo dwSize sizeof(WSAQUERYSET)
  lpszServiceInstanceName Not supported on Windows CE.

Set to 0.

  lpServiceClassId Not supported on Windows CE.

Set to 0.

  dwNameSpace NS_BTH.
  dwNumberOfCsAddrs Not supported on Windows CE.

Set to 0.

  IpcsaBuffer Not supported on Windows CE.

Set to 0.

  lpBlob Points to a BTHNS_SETBLOB structure, containing information about the service to be added.
  * All other WSAQUERYSET members are ignored.
essOperation   RNRSERVICE_REGISTER.
dwControlFlags   Equal to 0 (clear).

This function can be used to update an existing SD 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.

Field Subfield Description
lpqsRegInfo dwSize sizeof(WSAQUERYSET)
  dwNameSpace NS_BTH
  lpBlob BTHNS_SETBLOB structure, containing the service record handle
  * All other fields are ignored
essOperation   RNRSERVICE_DELETE
dwControlFlags   0 (clear)

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Bt_api.h.
Link Library: Btdrt.lib.

See Also

Bluetooth OS Functions | WSAQUERYSET | BTHNS_SETBLOB | Bluetooth Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.