connectAllConnectableDevices method

Future<void> connectAllConnectableDevices()

A convenient method for connecting all connectable devices available in each SamplingPackage that has been registered in the SamplingPackageRegistry.

Implementation

Future<void> connectAllConnectableDevices() async {
  for (var package in SamplingPackageRegistry().packages) {
    if (getDevice(package.deviceType) != null &&
        getDevice(package.deviceType)!.isInitialized) {
      if (await package.deviceManager.canConnect()) {
        await getDevice(package.deviceType)?.connect();
      }
    }
  }
}