Closed andreassch closed 5 months ago
copy paste error, try again
Now I have the following situation: after a measurement, the reading measurement message is shown until the device switches itself off, when it changes to measurement failed. However, the correct values are taken over. When closing the measurement failed window, tapping on Save is first ignored. After changing some content (e.g. removing the entry "notes" inside the notes field), clicking Save works. The log shows the following exception before the device is found:
06-17 18:34:55.648 18390 18416 I flutter : TRACE: _BluetoothInputState _deviceScanCubit: Instance of 'DeviceListLoading'
06-17 18:34:55.713 18390 18416 I flutter : TRACE: _onScanResult devices: []
06-17 18:34:55.715 18390 18416 E flutter : [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:blood_pressure_app/bluetooth/device_scan_cubit.dart': Failed assertion: line 75 pos 12: '_flutterBluePlus.isScanningNow': is not true.
06-17 18:34:55.715 18390 18416 E flutter : #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
06-17 18:34:55.715 18390 18416 E flutter : #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
06-17 18:34:55.715 18390 18416 E flutter : #2 DeviceScanCubit._onScanResult (package:blood_pressure_app/bluetooth/device_scan_cubit.dart:75:12)
06-17 18:34:55.715 18390 18416 E flutter : #3 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
06-17 18:34:55.715 18390 18416 E flutter : #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
06-17 18:34:55.715 18390 18416 E flutter : #5 _DelayedData.perform (dart:async/stream_impl.dart:541:14)
06-17 18:34:55.715 18390 18416 E flutter : #6 _PendingEvents.handleNext (dart:async/stream_impl.dart:646:11)
06-17 18:34:55.715 18390 18416 E flutter : #7 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617:7)
06-17 18:34:55.715 18390 18416 E flutter : #8 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
06-17 18:34:55.715 18390 18416 E flutter : #9 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
06-17 18:34:55.715 18390 18416 E flutter :
Later, it connects and receives data that are decoded to BleMeasurementData with the correct values for systolic, diastolic, pulse, and date. After that, the log reads:
06-17 18:35:36.819 18390 18416 I flutter : TRACE: _BluetoothInputState _deviceScanCubit: Instance of 'DeviceSelected'
06-17 18:35:36.820 18390 18416 I flutter : TRACE: _BluetoothInputState BleReadCubit: Instance of 'BleReadInProgress'
[...]
06-17 18:35:37.869 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.connected
06-17 18:35:37.869 18390 18416 I flutter : TRACE: BleReadCubit allServices: [BluetoothService{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1800, isPrimary: true, characteristics: [BluetoothCharacteristic{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a00, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a01, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: A
06-17 18:35:37.869 18390 18416 I flutter : TRACE: BleReadCubit allCharacteristics: [BluetoothCharacteristic{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1810, secondaryServiceUuid: null, characteristicUuid: 2a35, descriptors: [BluetoothDescriptor{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1810, characteristicUuid: 2a35, descriptorUuid: 2902, lastValue: [2, 0]}], properties: CharacteristicProperties{broadcast: false, read: false, writeWithoutResponse: false, write: false, notify: false, indicate: true, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: [nn, nnn, n, nn, n, nn, n, nnn, n, n, nn, nn, nn, n, nn, n, n, n]}, BluetoothCharacteristic{remoteId: yy:yy:yy:yy:yy:yy, serviceUuid: 1810, secondaryServiceUuid: null, characteristicUuid: 2a49, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryp
06-17 18:35:37.869 18390 18416 I flutter : TRACE: BleReadCubit indicationsSet: true
Here, the measurement seems to be read again. It continues:
06-17 18:35:42.125 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
06-17 18:35:42.125 2478 2615 D BluetoothA2dp: getState(xx:xx:xx:xx:xx:xx)
06-17 18:35:42.126 26815 26815 D BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
06-17 18:35:42.126 26815 26815 I BluetoothMapService: sRemoteDevice :null device:yy:yy:yy:yy:yy:yy
06-17 18:35:42.126 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION} Attempting reconnect
06-17 18:35:42.126 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection
06-17 18:35:42.126 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection: Attempting to connect with boso medicus CE6674
06-17 18:35:42.126 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
06-17 18:35:42.127 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION} Attempting reconnect
06-17 18:35:42.127 1514 1872 D CompatibilityInfo: mCompatibilityFlags - 0
06-17 18:35:42.127 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection
06-17 18:35:42.127 1514 1872 D CompatibilityInfo: applicationDensity - 480
06-17 18:35:42.127 1514 1872 D CompatibilityInfo: applicationScale - 1.0
06-17 18:35:42.127 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection: Attempting to connect with boso medicus CE6674
06-17 18:35:42.127 18390 18390 D [FBP-Android]: [FBP] onMethodCall: connect
06-17 18:35:42.128 18390 18390 D BluetoothGatt: connect() - device: yy:yy:yy:yy:yy:yy, auto: false, eattSupport: false
06-17 18:35:42.128 18390 18390 D BluetoothGatt: registerApp()
06-17 18:35:42.129 18390 18390 D BluetoothGatt: registerApp() - UUID=2f53c4f0-102d-4c93-986d-272df2797c46
06-17 18:35:42.130 26815 26989 D BluetoothPbapService: getConnectionState: xx:xx:xx:xx:xx:xx
06-17 18:35:42.131 2478 2615 D BluetoothHeadset: getConnectionState(xx:xx:xx:xx:xx:xx)
[...]
06-17 18:36:12.141 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
06-17 18:36:12.141 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 255, UNKNOWN_HCI_ERROR (255)} Attempting reconnect
06-17 18:36:12.141 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection
06-17 18:36:12.142 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
06-17 18:36:12.142 18390 18416 I flutter : TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 255, UNKNOWN_HCI_ERROR (255)} Attempting reconnect
06-17 18:36:12.142 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection
06-17 18:36:12.145 18390 18416 I flutter : -----------------------------
06-17 18:36:12.145 18390 18416 I flutter : ERROR BleReadCubit _device.connect failed::
06-17 18:36:12.178 1005 26903 I vendor.qti.bluetooth@1.0-ibs_handler: ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE
06-17 18:36:12.180 18390 18416 I flutter : #0 debugPrintStack (package:flutter/src/foundation/assertions.dart:1201:29)
06-17 18:36:12.180 18390 18416 I flutter : #1 Log.err (package:blood_pressure_app/logging.dart:13:7)
06-17 18:36:12.180 18390 18416 I flutter : #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:102:13)
06-17 18:36:12.180 18390 18416 I flutter : <asynchronous suspension>
06-17 18:36:12.180 18390 18416 I flutter : #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:124:7)
06-17 18:36:12.180 18390 18416 I flutter : <asynchronous suspension>
06-17 18:36:12.180 18390 18416 I flutter : BluetoothDevice{remoteId: yy:yy:yy:yy:yy:yy, platformName: boso medicus CE6674 , services: Instance of 'BmDiscoverServicesResult'}
06-17 18:36:12.180 18390 18416 I flutter : FlutterBluePlusException | connect | android-code: 255 | UNKNOWN_HCI_ERROR (255)
06-17 18:36:12.180 18390 18416 I flutter : TRACE: BleReadCubit _ensureConnection: Device not connected
06-17 18:36:12.181 18390 18416 E flutter : [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:blood_pressure_app/bluetooth/ble_read_cubit.dart': Failed assertion: line 88 pos 12: '!_debugEnsureConnectionInProgress': is not true.
06-17 18:36:12.181 18390 18416 E flutter : #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
06-17 18:36:12.181 18390 18416 E flutter : #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
06-17 18:36:12.181 18390 18416 E flutter : #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:88:12)
06-17 18:36:12.181 18390 18416 E flutter : #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:124:13)
06-17 18:36:12.181 18390 18416 E flutter : #4 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
06-17 18:36:12.181 18390 18416 E flutter : #5 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
06-17 18:36:12.181 18390 18416 E flutter : #6 _DelayedData.perform (dart:async/stream_impl.dart:541:14)
06-17 18:36:12.181 18390 18416 E flutter : #7 _PendingEvents.handleNext (dart:async/stream_impl.dart:646:11)
06-17 18:36:12.181 18390 18416 E flutter : #8 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617:7)
06-17 18:36:12.181 18390 18416 E flutter : #9 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
06-17 18:36:12.181 18390 18416 E flutter : #10 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
06-17 18:36:12.181 18390 18416 E flutter :
06-17 18:36:12.181 18390 18416 E flutter : [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:blood_pressure_app/bluetooth/ble_read_cubit.dart': Failed assertion: line 88 pos 12: '!_debugEnsureConnectionInProgress': is not true.
06-17 18:36:12.181 18390 18416 E flutter : #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
06-17 18:36:12.181 18390 18416 E flutter : #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
06-17 18:36:12.181 18390 18416 E flutter : #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:88:12)
06-17 18:36:12.181 18390 18416 E flutter : #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:124:13)
06-17 18:36:12.181 18390 18416 E flutter : #4 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
06-17 18:36:12.181 18390 18416 E flutter : #5 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
06-17 18:36:12.181 18390 18416 E flutter : #6 _DelayedData.perform (dart:async/stream_impl.dart:541:14)
06-17 18:36:12.181 18390 18416 E flutter : #7 _PendingEvents.handleNext (dart:async/stream_impl.dart:646:11)
06-17 18:36:12.181 18390 18416 E flutter : #8 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617:7)
06-17 18:36:12.181 18390 18416 E flutter : #9 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
06-17 18:36:12.181 18390 18416 E flutter : #10 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
06-17 18:36:12.181 18390 18416 E flutter :
Added a fix. Could you try running with the --release
flag if it still doesn't work?
and what happens when the cuff is too loose or the measurement position is wrong, or when you move during measurements?
With the new version, it reads a measurement successfully and fills in the correct values into the fields in the dialog, however, the reading measurement pane stays endlessly. Tapping Save does not work in this situation. In the log, I found the following exception (might be unrelated to the behaviour mentioned above):
06-18 21:09:48.330 14047 15059 I flutter : TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
06-18 21:09:48.334 2921 3326 I bt_stack: [INFO:btm_ble_bgconn.cc(433)] Already connection initiated (or) No Pending connections(or) Resources of lcb are exhausted
06-18 21:09:48.334 14047 15059 I flutter : -----------------------------
06-18 21:09:48.334 14047 15059 I flutter : ERROR BleReadCubit _device.connect failed::
06-18 21:09:48.352 14047 15059 I flutter : #0 debugPrintStack (package:flutter/src/foundation/assertions.dart:1201:29)
06-18 21:09:48.352 14047 15059 I flutter : #1 Log.err (package:blood_pressure_app/logging.dart:13:7)
06-18 21:09:48.352 14047 15059 I flutter : #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:100:13)
06-18 21:09:48.352 14047 15059 I flutter : <asynchronous suspension>
06-18 21:09:48.352 14047 15059 I flutter : #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:126:7)
06-18 21:09:48.352 14047 15059 I flutter : <asynchronous suspension>
06-18 21:09:48.352 14047 15059 I flutter : BluetoothDevice{remoteId: xx:xx:xx:xx:xx:xx, platformName: boso medicus CE6674 , services: Instance of 'BmDiscoverServicesResult'}
06-18 21:09:48.353 14047 15059 I flutter : FlutterBluePlusException | connect | android-code: 255 | UNKNOWN_HCI_ERROR (255)
06-18 21:09:48.353 14047 15059 I flutter : TRACE: BleReadCubit _ensureConnection: Device not connected
Trying to run flutter run --flavor github --release
fails:
Caught exception: Already watching path: /opt/flutter/packages/flutter_tools/gradle
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageGithubRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> SigningConfig "release" is missing required property "storeFile".
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 16s
Running Gradle task 'assembleGithubRelease'... 76,7s
Error: Gradle task assembleGithubRelease failed with exit code 1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidGradleBuilder.buildGradleApp
(package:flutter_tools/src/android/gradle.dart:498:9)
<asynchronous suspension>
#2 AndroidGradleBuilder.buildApk
(package:flutter_tools/src/android/gradle.dart:223:5)
<asynchronous suspension>
#3 AndroidDevice.startApp
(package:flutter_tools/src/android/android_device.dart:583:7)
<asynchronous suspension>
#4 FlutterDevice.runCold
(package:flutter_tools/src/resident_runner.dart:533:33)
<asynchronous suspension>
#5 ColdRunner.run (package:flutter_tools/src/run_cold.dart:55:28)
<asynchronous suspension>
#6 RunCommand.runCommand
(package:flutter_tools/src/commands/run.dart:833:27)
<asynchronous suspension>
#7 FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#8 AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#10 FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#11 AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand
(package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
#13 run.<anonymous closure>.<anonymous closure>
(package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#14 AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#15 main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>
Ah sorry, forgot about the whole signing thing. You can leave builds with --release
out, they were only meant as a quick way to disable assertions anyways.
I fixed the bug you described (and managed to write a unit test for it :)). Could you try again?
The behaviour is still the same: the reading measurement pane stays infinitely. I see in the log:
I/flutter ( 1582): TRACE: BleReadCubit data received: [n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n]
I/flutter ( 1582): TRACE: BleReadCubit decoded: BleMeasurementData{systolic: x, diastolic: x, meanArterialPressure: x, isMMHG: true, pulse: x, userID: null, status: BleMeasurementStatus{bodyMovementDetected: false, cuffTooLose: false, irregularPulseDetected: false, pulseRateInRange: true, pulseRateExceedsUpperLimit: false, pulseRateIsLessThenLowerLimit: false, improperMeasurementPosition: false}, timestamp: 2024-06-22 16:55:58.000}
I/flutter ( 1582): TRACE: _BluetoothInputState _deviceScanCubit: Instance of 'DeviceSelected'
I/flutter ( 1582): TRACE: _BluetoothInputState BleReadCubit: Instance of 'BleReadInProgress'
D/[FBP-Android]( 1582): [FBP] onMethodCall: discoverServices
D/BluetoothGatt( 1582): discoverServices() - device: xx:xx:xx:xx:xx:xx
D/BluetoothGatt( 1582): onSearchComplete() = Device=xx:xx:xx:xx:xx:xx Status=0
D/[FBP-Android]( 1582): [FBP] onServicesDiscovered:
D/[FBP-Android]( 1582): [FBP] count: 6
D/[FBP-Android]( 1582): [FBP] status: 0GATT_SUCCESS
D/[FBP-Android]( 1582): [FBP] onMethodCall: setNotifyValue
D/BluetoothGatt( 1582): setCharacteristicNotification() - uuid: 00002a35-0000-1000-8000-00805f9b34fb enable: true
D/[FBP-Android]( 1582): [FBP] onDescriptorWrite:
D/[FBP-Android]( 1582): [FBP] chr: 2a35
D/[FBP-Android]( 1582): [FBP] desc: 2902
D/[FBP-Android]( 1582): [FBP] status: GATT_SUCCESS (0)
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.connected
I/flutter ( 1582): TRACE: BleReadCubit allServices: [BluetoothService{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1800, isPrimary: true, characteristics: [BluetoothCharacteristic{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a00, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1800, secondaryServiceUuid: null, characteristicUuid: 2a01, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: []}, BluetoothCharacteristic{remoteId: A
I/flutter ( 1582): TRACE: BleReadCubit allCharacteristics: [BluetoothCharacteristic{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1810, secondaryServiceUuid: null, characteristicUuid: 2a35, descriptors: [BluetoothDescriptor{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1810, characteristicUuid: 2a35, descriptorUuid: 2902, lastValue: [2, 0]}], properties: CharacteristicProperties{broadcast: false, read: false, writeWithoutResponse: false, write: false, notify: false, indicate: true, authenticatedSignedWrites: false, extendedProperties: false, notifyEncryptionRequired: false, indicateEncryptionRequired: false}, value: [n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n]}, BluetoothCharacteristic{remoteId: xx:xx:xx:xx:xx:xx, serviceUuid: 1810, secondaryServiceUuid: null, characteristicUuid: 2a49, descriptors: [], properties: CharacteristicProperties{broadcast: false, read: true, writeWithoutResponse: false, write: false, notify: false, indicate: false, authenticatedSignedWrites: false, extendedProperties: false, notifyEncry
I/flutter ( 1582): TRACE: BleReadCubit indicationsSet: true
D/BluetoothGatt( 1582): onClientConnectionState() - status=19 clientIf=9 device=xx:xx:xx:xx:xx:xx
D/[FBP-Android]( 1582): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android]( 1582): [FBP] status: REMOTE_USER_TERMINATED_CONNECTION
D/BluetoothGatt( 1582): close()
D/BluetoothGatt( 1582): unregisterApp() - mClientIf=9
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION} Attempting reconnect
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection: Attempting to connect with boso medicus CE6674
D/[FBP-Android]( 1582): [FBP] onMethodCall: connect
D/BluetoothGatt( 1582): connect() - device: xx:xx:xx:xx:xx:xx, auto: false, eattSupport: false
D/BluetoothGatt( 1582): registerApp()
D/BluetoothGatt( 1582): registerApp() - UUID=4ada1a42-64ab-4123-b959-2076647af128
D/BluetoothGatt( 1582): onClientRegistered() - status=0 clientIf=9
D/BluetoothGatt( 1582): onClientConnectionState() - status=255 clientIf=9 device=xx:xx:xx:xx:xx:xx
D/[FBP-Android]( 1582): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android]( 1582): [FBP] status: UNKNOWN_HCI_ERROR (255)
D/BluetoothGatt( 1582): close()
D/BluetoothGatt( 1582): unregisterApp() - mClientIf=9
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 255, UNKNOWN_HCI_ERROR (255)} Attempting reconnect
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection
I/flutter ( 1582): -----------------------------
I/flutter ( 1582): ERROR BleReadCubit _device.connect failed::
I/flutter ( 1582): #0 debugPrintStack (package:flutter/src/foundation/assertions.dart:1201:29)
I/flutter ( 1582): #1 Log.err (package:blood_pressure_app/logging.dart:13:7)
I/flutter ( 1582): #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:100:13)
I/flutter ( 1582): <asynchronous suspension>
I/flutter ( 1582): #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:126:7)
I/flutter ( 1582): <asynchronous suspension>
I/flutter ( 1582): BluetoothDevice{remoteId: xx:xx:xx:xx:xx:xx, platformName: boso medicus CE6674 , services: Instance of 'BmDiscoverServicesResult'}
I/flutter ( 1582): FlutterBluePlusException | connect | android-code: 255 | UNKNOWN_HCI_ERROR (255)
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection: Device not connected
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection: Attempting to connect with boso medicus CE6674
D/[FBP-Android]( 1582): [FBP] onMethodCall: connect
D/BluetoothGatt( 1582): connect() - device: xx:xx:xx:xx:xx:xx, auto: false, eattSupport: false
D/BluetoothGatt( 1582): registerApp()
D/BluetoothGatt( 1582): registerApp() - UUID=9452efd7-3411-4632-a4e6-da04f545e52d
D/BluetoothGatt( 1582): onClientRegistered() - status=0 clientIf=9
D/BluetoothGatt( 1582): onClientConnectionState() - status=255 clientIf=9 device=xx:xx:xx:xx:xx:xx
D/[FBP-Android]( 1582): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android]( 1582): [FBP] status: UNKNOWN_HCI_ERROR (255)
D/BluetoothGatt( 1582): close()
D/BluetoothGatt( 1582): unregisterApp() - mClientIf=9
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged: BluetoothConnectionState.disconnected
I/flutter ( 1582): TRACE: BleReadCubit _onConnectionStateChanged disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 255, UNKNOWN_HCI_ERROR (255)} Attempting reconnect
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection
I/flutter ( 1582): -----------------------------
I/flutter ( 1582): ERROR BleReadCubit _device.connect failed::
I/flutter ( 1582): #0 debugPrintStack (package:flutter/src/foundation/assertions.dart:1201:29)
I/flutter ( 1582): #1 Log.err (package:blood_pressure_app/logging.dart:13:7)
I/flutter ( 1582): #2 BleReadCubit._ensureConnection (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:100:13)
I/flutter ( 1582): <asynchronous suspension>
I/flutter ( 1582): #3 BleReadCubit._onConnectionStateChanged (package:blood_pressure_app/bluetooth/ble_read_cubit.dart:126:7)
I/flutter ( 1582): <asynchronous suspension>
I/flutter ( 1582): BluetoothDevice{remoteId: xx:xx:xx:xx:xx:xx, platformName: boso medicus CE6674 , services: Instance of 'BmDiscoverServicesResult'}
I/flutter ( 1582): FlutterBluePlusException | connect | android-code: 255 | UNKNOWN_HCI_ERROR (255)
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection: Device not connected
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection
I/flutter ( 1582): TRACE: BleReadCubit _ensureConnection: Attempting to connect with boso medicus CE6674
D/[FBP-Android]( 1582): [FBP] onMethodCall: connect
D/BluetoothGatt( 1582): connect() - device: xx:xx:xx:xx:xx:xx, auto: false, eattSupport: false
D/BluetoothGatt( 1582): registerApp()
D/BluetoothGatt( 1582): registerApp() - UUID=83b42b9c-34e6-4dd5-9f9f-f7def912a198
D/BluetoothGatt( 1582): onClientRegistered() - status=0 clientIf=9
I/flutter ( 1582): TRACE: BleReadCubit close
D/[FBP-Android]( 1582): [FBP] onMethodCall: stopScan
D/BluetoothAdapter( 1582): isLeEnabled(): ON
I've made some more adjustments, please try again.
Thanks for your work. Now the app shows Measurement taken successfully! and the mean arterial pressure after receiving a measurement. The correct data are filled into the field. I can directly click on Save to take over the measurement. The feature now works fine.
A nice extra would be to synchronize the clock of the device after a measurement. This seems to be done with the Date Time characteristic (UUID 0x2A08). I notice that the time of my device is some minutes off.
Thanks for your persistence in testing this. This greatly improved my understanding in BLE GATT and can be useful to other implementing something similar as well.
A nice extra would be to synchronize the clock of the device after a measurement.
Personally I wouldn't expect time sync during after every measurement and I'm not sure if there are devices that behave weirdly after that (I could imagine records on the device becoming out of order). It's a bit out of scope, but I can imagine this to be some feature in the settings. Implementing measurements has been quite exhausting already but I would gladly accept any PRs.
In the mean time I provoked some errors. When moving during a measurement, the device showes Err in its display while the app gets the following result:
I/flutter (22320): TRACE: BleReadCubit data received: [22, 255, 7, 255, 7, 255, 7, 232, 7, 6, 23, 14, 35, 10, 255, 7, 0, 0]
I/flutter (22320): TRACE: BleReadCubit decoded: BleMeasurementData{systolic: 2047.0, diastolic: 2047.0, meanArterialPressure: 2047.0, isMMHG: true, pulse: 2047.0, userID: null, status: BleMeasurementStatus{bodyMovementDetected: false, cuffTooLose: false, irregularPulseDetected: false, pulseRateInRange: true, pulseRateExceedsUpperLimit: false, pulseRateIsLessThenLowerLimit: false, improperMeasurementPosition: false}, timestamp: 2024-06-23 14:35:10.000}
I notice that the incorrect measurement flag is not set for some reason. The app takes it as a regular measurement.
When the cuff is too loose, the display of the device shows Err CUF. The received data is:
I/flutter (22320): TRACE: BleReadCubit data received: [22, 255, 7, 255, 7, 255, 7, 232, 7, 6, 23, 14, 47, 59, 255, 7, 0, 0]
I/flutter (22320): TRACE: BleReadCubit decoded: BleMeasurementData{systolic: 2047.0, diastolic: 2047.0, meanArterialPressure: 2047.0, isMMHG: true, pulse: 2047.0, userID: null, status: BleMeasurementStatus{bodyMovementDetected: false, cuffTooLose: false, irregularPulseDetected: false, pulseRateInRange: true, pulseRateExceedsUpperLimit: false, pulseRateIsLessThenLowerLimit: false, improperMeasurementPosition: false}, timestamp: 2024-06-23 14:47:59.000}
Again, the app takes it as a regular measurement. I'm not sure whether the device is not implementing GATT completely correct or the app is not interpreting it right.
Personally I wouldn't expect time sync during after every measurement and I'm not sure if there are devices that behave weirdly after that (I could imagine records on the device becoming out of order). It's a bit out of scope, but I can imagine this to be some feature in the settings. Implementing measurements has been quite exhausting already but I would gladly accept any PRs.
I agree that syncing time is out of scope of this issue. Thanks for enduring and finishing this great feature. When I have time, I may have a look into the date/time synchronization.
Just FTR: I can confirm that this works with the omron x7 smart on 1.7.0
Thanks a lot for the effort put into this!
It would be great to support Bluetooth LE blood pressure monitors via the standard GATT protocol. This would reduce the chances for typos while entering the values as well as enhance comfort. Moreover, such a feature might get users away from commercial apps shipped with devices. If I understand correctly, the app needs to subscribe to the Blood Pressure GATT service (UUID 0x1810) with the Blood Pressure Measurement characteristic (UUID 0x2A35) and potentially the Date Time characteristic (UUID 0x2A08). The Blood Pressure Measurement characteristic is described in Section 3.31 of the GATT Specification Supplement.