getCameraParams method
Implementation
Future<bool> getCameraParams({int timeout = 5}) async {
bool ret = await writeCgi("get_camera_params.cgi?");
if (ret == true) {
CommandResult result = await waitCommandResult((cmd, data) {
return cmd == 24579;
}, timeout);
Map data = result.getMap();
if (result.isSuccess) {
this.contrast =
int.tryParse(data["vcontrast"] ?? "") ?? (255 * 0.5).floor();
this.brightness =
int.tryParse(data["vbright"] ?? "") ?? (255 * 0.5).floor();
try {
this.direction =
VideoDirection.values[int.tryParse(data["flip"] ?? "") ?? 0];
} catch (e) {
this.direction = VideoDirection.values[0];
}
this.ircut = int.tryParse(data["ircut"] ?? "") ?? 1;
this.night_vision_mode =
int.tryParse(data["night_vision_mode"] ?? "") ?? 0;
//print"night_vision_mode ===========0>> " + night_vision_mode.toString());
this.full_color_mode =
int.tryParse(data["full_color_mode"] ?? "") ?? 0; //全彩子项为定时
//print"full_color_mode ===========1>> " + full_color_mode.toString());
this.full_color_show =
int.tryParse(data["full_color_show"] ?? "") ?? 0; //全彩子项全显示 二进制的
//print"full_color_show ===========2>> " + full_color_show.toString());
this.full_color_default =
int.tryParse(data["full_color_default"] ?? "") ??
1; //全彩定时 是否勾选默认 0 使用自定义 1 使用默认
//print"full_color_default ===========3>> " + full_color_default.toString());
this.full_color_start_hw =
int.tryParse(data["full_color_start_hw"] ?? "") ??
0; //全彩定时 APP自定义开始时间
this.full_color_end_hw =
int.tryParse(data["full_color_end_hw"] ?? "") ??
0; //全彩定时 APP自定义结束时间
this.full_color_start =
int.tryParse(data["full_color_start"] ?? "") ?? 0; //全彩定时 APP自定义开始时间
//print"full_color_start ===========6>> " + full_color_start.toString());
this.full_color_end =
int.tryParse(data["full_color_end"] ?? "") ?? 0; //全彩定时 APP自定义结束时间
//print"full_color_end ===========7>> " + full_color_end.toString());
try {
this.lightMode = int.tryParse(data["mode"] ?? "") ?? 0;
} catch (e) {
this.lightMode = 0;
}
this.osdEnable = int.tryParse(data["OSDEnable"] ?? "") ?? 0;
this.involume = int.tryParse(data["involume"] ?? "") ?? 0;
this.outvolume = int.tryParse(data["outvolume"] ?? "") ?? 0;
}
return result.isSuccess;
}
return false;
}