getMacId method

Future<String?> getMacId()

This method will read the doozCustomCharacteristicUuid if a device is connected and return the MAC address stored

Implementation

Future<String?> getMacId() async {
  String? macId;
  try {
    final macIdChar = await bleInstance.readCharacteristic(QualifiedCharacteristic(
      characteristicId: doozCustomCharacteristicUuid,
      serviceId: doozCustomServiceUuid,
      deviceId: _device!.id,
    ));
    final macIdList = macIdChar.reversed.toList();
    macId = _toMacAddress(macIdList);
    _log('got mac adr from custom service ! $macId');
  } catch (e) {
    _log('caught error during reading dooz custom charac $e');
  }
  return macId;
}