BluetoothGATTBeginReliableWrite 函式 (bluetoothleapis.h)

BluetoothGATTBeginReliableWrite 函式會指定即將開始可靠的寫入。

語法

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

參數

[in] hDevice

服務句柄。

[out] ReliableWriteContext

包含描述可靠寫入作業之內容 之BTH_LE_GATT_RELIABLE_WRITE_CONTEXT 結構的位址。

[in] Flags

用來修改 BluetoothGATTBeginReliableWrite 行為的旗標:

旗標 描述
BLUETOOTH_GATT_FLAG_NONE 客戶端沒有特定的 GATT 需求, (預設) 。

傳回值

BluetoothGATTBeginReliableWrite 函式會傳回下列值:

傳回碼 描述
S_OK
作業已成功完成。
ERROR_ACCESS_DENIED
如果同時提供父服務與服務句柄,且服務階層不會匯總至提供的父服務句柄,則會傳回 。
ERROR_INVALID_FUNCTION
可靠的寫入作業目前正在進行中。

備註

BluetoothGATTBeginReliableWrite 函式會通知藍牙堆棧,在函式傳回之後呼叫的程式是可靠的寫入作業。 任何不支援可靠寫入的作業都會傳回 ERROR_INVALID_FUNCTION 錯誤。 只有下列函式支援可靠的寫入作業:

範例


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);
}

規格需求

需求
最低支援的用戶端 Windows 8 和更新版本的 Windows 支援。
目標平台 Universal
標頭 bluetoothleapis.h
程式庫 BluetoothAPIs.lib
Dll BluetoothAPIs.dll