deviceName property

String get deviceName

Gets the Bluetooth device name.

Implementation

String get deviceName {
  if (attributes.containsKey(EIRType.CompleteLocalName)) {
    return utf8.decode(attributes[EIRType.CompleteLocalName]!);
  } else if (attributes.containsKey(EIRType.ShortenedLocalName)) {
    return utf8.decode(attributes[EIRType.ShortenedLocalName]!);
  } else {
    return "";
  }
}
set deviceName (String deviceName)

Sets the Bluetooth device name.

Implementation

set deviceName(String deviceName) {
  attributes[EIRType.CompleteLocalName] = utf8.encode(deviceName);
  if (attributes.containsKey(EIRType.ShortenedLocalName)) {
    attributes.remove(EIRType.ShortenedLocalName);
  }
}