Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #268 from MXCzkEVM/blueberry_ring
Browse files Browse the repository at this point in the history
fix: Empty data
  • Loading branch information
reasje authored Jul 29, 2024
2 parents 75654dc + 675556b commit 1a433b5
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readLevel();
collectLog('readLevel:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readLevel:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readLevel(Uint8List.fromList(value!));
Expand All @@ -180,7 +180,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readVersion();
collectLog('readVersion:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readVersion:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readVersion(Uint8List.fromList(value!));
Expand All @@ -194,7 +194,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readTime();
collectLog('readTime:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readTime:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readTime(Uint8List.fromList(value!));
Expand All @@ -208,7 +208,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readSleep();
collectLog('readSleep:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readSleep:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readSleep(Uint8List.fromList(value!));
Expand All @@ -222,7 +222,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readBloodOxygens();
collectLog('readBloodOxygens:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readBloodOxygens:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readBloodOxygens(Uint8List.fromList(value!));
Expand All @@ -236,7 +236,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readSteps();
collectLog('readSteps:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readSteps:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readSteps(Uint8List.fromList(value!));
Expand All @@ -250,7 +250,7 @@ class BlueberryRingUseCase extends ReactiveUseCase {
final command = BlueberryCommands.readHeartRates();
collectLog('readHeartRate:command $command');
blueberryRingCharacteristic.value?.write(command);
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first;
final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty);
collectLog('readHeartRate:value $value');
collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}');
return BlueberryResolves.readHeartRates(Uint8List.fromList(value!));
Expand Down

0 comments on commit 1a433b5

Please sign in to comment.