control method

Future<ScpStatus> control(
  1. String deviceId,
  2. String command
)

Implementation

Future<ScpStatus> control(String deviceId, String command) async {
  log('do control for device: $deviceId');
  final String controlResponse = await ScpMessageSender.sendControl(
      knownDevices.firstWhere((element) => element.deviceId == deviceId),
      command);
  log(controlResponse);
  if (controlResponse == ScpStatus.RESULT_SUCCESS) {
    log('Successfully send control $command to $deviceId');
    return ScpStatus(status: ScpStatus.RESULT_SUCCESS);
  } else {
    log('Failed to send control $command to $deviceId');
    return ScpStatus(status: ScpStatus.RESULT_ERROR);
  }
}