Поделиться через


BluetoothSetLocalServiceInfo function

The BluetoothSetLocalServiceInfo function sets local service information for a specific Bluetooth radio. This function is used to advertise services to which remote devices can connect.

Note  Service information set with this function will persist across reboots.

 

Syntax

DWORD WINAPI BluetoothSetLocalServiceInfo(
  _In_opt_       HANDLE                       hRadioIn,
  _In_     const GUID                         *pClassGuid,
                 ULONG                        ulInstance,
           const BLUETOOTH_LOCAL_SERVICE_INFO *pServiceInfoIn
);

Parameters

  • hRadioIn [in, optional]
    A handle of the Bluetooth radio device to which the local service information applies. If this parameter is NULL, BluetoothSetLocalServiceInfo searches for the first available local Bluetooth radio.

  • pClassGuid [in]
    The GUID of the service to expose. This should match the GUID in the server-side INF file for the profile driver.

  • ulInstance
    An instance ID for the device node of the Plug and Play (PnP) ID.

  • pServiceInfoIn
    A pointer to a BLUETOOTH_LOCAL_SERVICE_INFO structure that describes the local service to set.

Return value

Returns ERROR_SUCCESS upon successful completion. The following table shows some common errors.

Return code Description
ERROR_NOT_FOUND

The specified Bluetooth radio was not detected.

ERROR_BAD_UNIT

No Bluetooth radios were detected.

STATUS_INSUFFICIENT_RESOURCES

There were insufficient resources to complete the operation. This condition occurs when more than 100 local physical device objects (PDOs) corresponding to Bluetooth services.

STATUS_PRIVILEGE_NOT_HELD

The caller does not have the required privileges.

 

Remarks

Applications can call BluetoothSetLocalServiceInfo subsequent times with the same service GUID but with a different instance ID to create multiple instances of the specified server-side profile. It is important that each instance ID associated with a device is unique, as it will prevent the service driver from being prematurely uninstalled if one, of possibly many, dependent devices is unpaired.

The process that calls BluetoothSetLocalServiceInfo must have the SE_LOAD_DRIVER_NAME privilege. A process running in the system or in the administrator context can elevate its privilege using the LookupPrivilegeValue and AdjustTokenPrivileges functions.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

None supported

Header

BluetoothAPIs.h (include Bthsdpdef.h or BluetoothAPIs.h)

Library

Bthprops.lib

DLL

Bthprops.dll

See also

BLUETOOTH_LOCAL_SERVICE_INFO

BluetoothSetLocalServiceInfo (WDK)