yanshouwang / bluetooth_low_energy

A Flutter plugin for controlling the bluetooth low energy.
https://pub.dev/packages/bluetooth_low_energy
MIT License
50 stars 16 forks source link

'CentralManager.instance.readCharacteristic()' function on windows always return the initial value #42

Closed Tunahan0155 closed 10 months ago

Tunahan0155 commented 10 months ago

Hi, When the notify feature is disabled in Windows, the 'CentralManager.instance.readCharacteristic()' function always gives the value when the project is first opened, and then it continues to give the same value even if the value in the characteristic is changed on the peripheral device. This problem does not occur when notify is enabled, it occurs when it is disabled. I did not encounter this problem on Android, iOS, or Mac, I encountered this problem only on Windows.

yanshouwang commented 10 months ago

Thanks for this report, the windows API is a little different from other platforms, it cached values of the peripherals, after looked at the GattCharacteristic.ReadValueAsync and GattDescriptor.ReadValueAsync documents, I need to add the cacheMode argument when I call this method.

yanshouwang commented 10 months ago

@Tunahan0155 Please test with 5.0.5 to see if this error has resolved.

Tunahan0155 commented 10 months ago

Thank you for your answer, I tested it with version 5.0.5, the error was solved.