Skip to content

HardwareDeviceRegistration

A DeviceRegistration for a hardware device, with its name and battery state.

Inheritance
Implementers
Annotations

Constructors

HardwareDeviceRegistration.fromJson

HardwareDeviceRegistration.fromJson(
  1. Map<String, dynamic> json
)

HardwareDeviceRegistration

HardwareDeviceRegistration({
  1. String? deviceId,
  2. String? deviceDisplayName,
  3. DateTime? registrationCreatedOn,
  4. bool isConnected = false,
  5. BatteryChargingState batteryChargingState = BatteryChargingState.unknown,
  6. String? hardwareName,
})

Creates a new HardwareDeviceRegistration based on hardware information, incl. hardwareName and batteryChargingState.

If no deviceDisplayName is given, it is built from hardwareName and batteryChargingState.

Properties

batteryChargingState

BatteryChargingState batteryChargingState
getter/setter pair

The battery charging state of the device upon registration.

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

hardwareName

String? hardwareName
getter/setter pair

The hardware name of this device, if available.

Methods

parseBatteryLevel

BatteryChargingState parseBatteryLevel(
  1. int batteryLevel
)

The BatteryChargingState for a battery level percentage (0-100).

0-10 is critical, 11-20 low, 21-90 normal, 91-100 full, and anything above 100 unknown.

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.