connect method

Ask this DeviceManager to start connecting to the device. Returns the DeviceStatus of the device.

Implementation

@nonVirtual
Future<DeviceStatus> connect() async {
  if (!isInitialized) {
    warning('$runtimeType has not been initialized - cannot connect to it.');
    return status;
  }

  info(
      '$runtimeType - Trying to connect to device of type: $type and id: $id');

  try {
    status = await onConnect();
  } catch (error) {
    warning(
        '$runtimeType - cannot connect to device, descriptor: $deviceDescriptor - error: $error');
  }

  return status;
}