rename method

Future<ScpStatus> rename(
  1. String deviceId,
  2. String name
)

Implementation

Future<ScpStatus> rename(String deviceId, String name) async {
  log('rename for device: $deviceId');
  final ScpStatus renameResponseStatus = await ScpMessageSender.sendRename(
      knownDevices.firstWhere((element) => element.deviceId == deviceId),
      name);
  log('Rename result: $renameResponseStatus');
  if (renameResponseStatus.status == ScpStatus.RESULT_DONE) {
    log('Successfully send renamed $deviceId');
    return ScpStatus(status: ScpStatus.RESULT_DONE);
  } else {
    log('Failed to rename $deviceId');
    return ScpStatus(status: ScpStatus.RESULT_ERROR);
  }
}