controlSensorSwitch method

Future<bool> controlSensorSwitch(
  1. int sensor, {
  2. int timeout = 5,
})

Implementation

Future<bool> controlSensorSwitch(int sensor, {int timeout = 5}) async {
  bool ret =
      await _command.writeCgi("camera_control.cgi?param=38&value=${sensor}&");
  if (ret) {
    CommandResult result =
        await _command.waitCommandResult((int cmd, Uint8List data) {
      return cmd == 24594;
    }, timeout);
    if (result.isSuccess) {
      Map data = result.getMap();
      return data["result"] == "0";
    }
  }
  return false;
}