controlPTZ method

Future<bool> controlPTZ(
  1. String deviceSerial,
  2. int cameraId,
  3. String command,
  4. String action,
  5. int speed,
)

云台控制

  • Parameters:
    • deviceSerial: 设备序列号
    • cameraId: 通道号
    • command: 云台指令
    • action: 云台动作
    • speed: 云台速度

Implementation

Future<bool> controlPTZ(
  String deviceSerial,
  int cameraId,
  String command,
  String action,
  int speed,
) async {
  if (!EzvizPtzCommands.isPtzCommand(command)) {
    ezvizLog('不合法的参数: command');
    return false;
  }

  if (!EzvizPtzActions.isPtzAction(action)) {
    ezvizLog('不合法的参数: action');
    return false;
  }

  if (!EzvizPtzSpeeds.isPtzSpeed(speed)) {
    ezvizLog('不合法的参数: speed');
    return false;
  }

  final bool result = await _channel
      .invokeMethod(EzvizChannelMethods.controlPTZ, {
        "deviceSerial": deviceSerial,
        "cameraId": cameraId,
        "command": command,
        "action": action,
        "speed": speed,
      });

  return result;
}