fromByte static method

DeviceState? fromByte(
  1. int byte
)

Parse device state from advertisement data byte. Returns null if byte value is invalid.

Implementation

static DeviceState? fromByte(int byte) {
  return switch (byte) {
    0 => DeviceState.ready,
    1 => DeviceState.busy,
    2 => DeviceState.dataReady,
    _ => null,
  };
}