findAndConnectSenseH method
Scans and connects to the nearby SenseH Device
Implementation
Future<Map<String, dynamic>> findAndConnectSenseH() async {
bool isClientVerified = store.fetchBool('isClientVerified')!;
bool isConnected = false;
if (isClientVerified) {
final senseDevices = await deviceController.scan();
logger.d(senseDevices);
if (senseDevices.isNotEmpty) {
await Future.delayed(const Duration(seconds: 2)).then((value) async {
isConnected = await deviceController.connect(senseDevices[0]);
});
}
return {'connected': isConnected, 'clientVerified': isClientVerified};
}
return {'connected': isConnected, 'clientVerified': isClientVerified};
}