Why does Bluetooth WinRt..WriteValueWithResultAsync send more slowly than BluetoothApis.dll GATTSetCharacteristicValue?

Mike Tang 1 Reputation point
2022-12-12T08:19:30.36+00:00
  1. Hardware environment:
    1. The same BLE mouse device
  2. Compare
    1. Winrt.Windows.Devices.Bluetooth Write
      1. code
      cpp
      characteristic->WriteValueWithResultAsync(value, withoutResponse).Completed(
      bind2(this, &BLEManager::OnWrite, uuid, serviceId, characteristicId));
      1. bushound packet:
        1. send: 14 0e 00 00 10 04 00 00 recv (HCI_EVT) time: 156ms
    13.2 19 OUT 01 0e 0f 00 0b 00 04 00 12 3d 00 14 0e 00 00 10 04 00 00 11ms 2022-12-09 16:51:29.161
    13.1 7 IN 13 05 01 01 0e 01 00 156ms 2022-12-09 16:51:29.318
    1. BluetoothApi.dll Write
      1. code
      cpp
      HRESULT hr = BluetoothGATTSetCharacteristicValue(hBtleDevice,
      writeGattChar,
      writeValue,
      NULL,
      BLUETOOTH_GATT_FLAG_NONE);
      1. bushound packet:
        1. send: 14 0e 00 00 10 04 00 00 recv (HCI_EVT) time: 5.9ms
          5.2 19 OUT 02 00 0f 00 0b 00 04 00 12 3d 00 14 0e 00 00 10 04 00 00 .........=......... 9.0ms 337.1.0 15:54:02.439 ntoskrnl
          5.1 7 IN 13 05 01 02 00 01 00 ....... 5.9ms 338.1.0 15:54:02.445 ntoskrnl
          Untitled
  3. Question:
    1. Please ask winrt.windows.devices bluetooth(recv HCI_EVT 156ms) and bluetoothApi.dll(recv HCI_EVT5.9ms) why write times different?
Developer technologies | C++
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.