createRegistration method

  1. @override
BLEDeviceRegistration createRegistration()
override

Creates a registration of this device for the deployment.

This method is used when a device is connected and a registration for this device is needed in the deployment and hence in the deployment service. The registration is typically created from the device information of the real device, e.g., the ID, name, and BLE address of the smartphone or a connected Bluetooth device.

Implementation

@override
BLEDeviceRegistration createRegistration() => BLEDeviceRegistration(
  deviceDisplayName: bleName,
  isConnected: isConnected,
  batteryChargingState: batteryLevel != null
      ? HardwareDeviceRegistration.parseBatteryLevel(batteryLevel!)
      : BatteryChargingState.unknown,
  bleAddress: bleName ?? 'Unknown eSense Device',
  bleName: bleName,
);