Skip to content

Commit e494bea

Browse files
committed
don't mark gear as available unless the uart service is found
1 parent dbb88de commit e494bea

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/Backend/device_registry.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,23 @@ class GetAvailableGear extends _$GetAvailableGear {
184184
baseStatefulDevice.deviceConnectionState
185185
..removeListener(_listener)
186186
..addListener(_listener);
187+
baseStatefulDevice.bluetoothUartService
188+
..removeListener(_listener)
189+
..addListener(_listener);
187190
}
188191
return getState();
189192
}
190193

191194
BuiltList<BaseStatefulDevice> getState() {
192-
return ref.read(knownDevicesProvider).values.where((element) => element.deviceConnectionState.value == ConnectivityState.connected).toBuiltList();
195+
return ref
196+
.read(knownDevicesProvider)
197+
.values
198+
.where((element) => element.deviceConnectionState.value == ConnectivityState.connected)
199+
.where(
200+
// don't consider gear connected until services have been discovered
201+
(element) => element.bluetoothUartService.value != null,
202+
)
203+
.toBuiltList();
193204
}
194205

195206
void _listener() {

0 commit comments

Comments
 (0)