BluetoothGATTBeginReliableWrite function (bluetoothleapis.h)

The BluetoothGATTBeginReliableWrite function specifies that reliable writes are about to begin.

Syntax

HRESULT BluetoothGATTBeginReliableWrite(
  [in]  HANDLE                              hDevice,
  [out] PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT ReliableWriteContext,
  [in]  ULONG                               Flags
);

Parameters

[in] hDevice

Handle to the service.

[out] ReliableWriteContext

Address of a BTH_LE_GATT_RELIABLE_WRITE_CONTEXT structure containing the context describing the reliable write operation.

[in] Flags

Flags to modify the behavior of BluetoothGATTBeginReliableWrite:

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

Return value

The BluetoothGATTBeginReliableWrite function 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_FUNCTION
A reliable write operation is already presently underway.

Remarks

The BluetoothGATTBeginReliableWrite function notifies the Bluetooth stack that procedures that are to be called after the function returns are reliable write operations. Any operations that do not support reliable writes will return an ERROR_INVALID_FUNCTION error. Only the following functions support reliable write operations:

Examples


BTH_LE_GATT_RELIABLE_WRITE_CONTEXT ReliableWriteContext = NULL;
hr = BluetoothGATTBeginReliableWrite(hDevice, 
                                    &ReliableWriteContext,
                                    BLUETOOTH_GATT_FLAG_NONE);

if (SUCCEEDED(hr)) {
    // Calls to BluetoothGATTSetCharacteristicValue
}

if (NULL != ReliableWriteContext) {
    BluetoothGATTEndReliableWrite(hDevice, 
                                 ReliableWriteContext,
                                  BLUETOOTH_GATT_FLAG_NONE);
}

Requirements

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