changeDirection method

Future<bool> changeDirection(
  1. VideoDirection direction, {
  2. int timeout = 5,
})

Implementation

Future<bool> changeDirection(VideoDirection direction,
    {int timeout = 5}) async {
  if (direction == null) {
    return false;
  }
  if (this.direction != direction) {
    bool ret = await writeCgi(
        "camera_control.cgi?param=5&value=${direction.index}&");
    if (ret == true) {
      CommandResult result = await waitCommandResult((cmd, data) {
        return cmd == 24594;
      }, timeout);
      if (result.isSuccess == true) {
        this.direction = direction;
      }
      return result.isSuccess;
    }
    return false;
  }
  return true;
}