none
Get GATT Characteristic Value after BluetoothGATTRegisterEvent Callback RRS feed

  • Question

  • I have a BLE GATT device and I have paired Windows with it.

    I need to register for Indication with the device on one of the characteristics and then read the characteristic's value after the notification/indication callback from the BLE device.

    I've got the code setup and I register for the indication callback with BluetoothGATTRegisterEvent and I can see the callback getting fired.  However when I try to read the characteristics value after the callback with BluetoothGATTGetCharacteristicValue I get an ERROR_FILE_NOT_FOUND error from BluetoothGATTGetCharacteristicValue.  At this point gattCharacteristic->IsReadable = 0.

    I've tried setting the BLUETOOTH_GATT_FLAG_NONE and the BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE for BluetoothGATTGetCharacteristicValue.  No luck.

    How do I read the changed value from the characteristic after the indication?  Any ideas.

    This works on Android, so I know the firmware is working.

    Thanx in advance.

    Monday, April 6, 2015 11:03 PM

Answers

  • Turns out you cast the EventOutParameter to PBLUETOOTH_GATT_VALUE_CHANGED_EVENT and you can get the value there.

    PBLUETOOTH_GATT_VALUE_CHANGED_EVENT ValueChangedEventParameters = (PBLUETOOTH_GATT_VALUE_CHANGED_EVENT)EventOutParameter;

    • Marked as answer by sdermanffs Thursday, April 9, 2015 12:33 PM
    Thursday, April 9, 2015 12:33 PM