BluetoothGATTRegisterEvent function (bluetoothleapis.h)

The BluetoothGATTRegisterEvent function registers a routine to be called back during a characteristic value change event on the given characteristic identified by its characteristic handle.

Syntax

HRESULT BluetoothGATTRegisterEvent(
  [in]           HANDLE                           hService,
  [in]           BTH_LE_GATT_EVENT_TYPE           EventType,
  [in]           PVOID                            EventParameterIn,
  [in]           PFNBLUETOOTH_GATT_EVENT_CALLBACK Callback,
  [in, optional] PVOID                            CallbackContext,
  [out]          BLUETOOTH_GATT_EVENT_HANDLE      *pEventHandle,
  [in]           ULONG                            Flags
);

Parameters

[in] hService

Handle to the service.

[in] EventType

A value from BTH_LE_GATT_EVENT_TYPE. Currently, only CharacteristicValueChangedEvent is supported.

[in] EventParameterIn

Pointer to a BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION structure to pass when the event is triggered.

[in] Callback

The routine to call when the Characteristic value changes.

[in, optional] CallbackContext

Context to pass to Callback.

[out] pEventHandle

Pointer to buffer to receive a handle for the registration. Profile drivers must pass this handle when calling BluetoothGATTUnregisterEvent.

[in] Flags

Flags to modify the behavior of BluetoothGATTRegisterEvent:

Flag Description
BLUETOOTH_GATT_FLAG_NONE The client does not have specific GATT requirements (default).

Return value

BluetoothGATTRegisterEvent returns the following values:

Return code Description
S_OK
The operation completed successfully.
ERROR_ACCESS_DENIED
Returned if both a parent service and a service handle are provided and the service hierarchy does not roll up to the provided parent service handle.
ERROR_INVALID_PARAMETER
A parameter was invalid.

Requirements

Requirement Value
Minimum supported client Supported in Windows 8 and later versions of Windows.
Target Platform Universal
Header bluetoothleapis.h
Library BluetoothApis.lib
DLL BluetoothAPIs.dll

See also

BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION

BTH_LE_GATT_EVENT_TYPE

Bluetooth GATT Event Callback Function

BluetoothGATTUnregisterEvent