Commit ac64468a authored by Mikhail Karpenko's avatar Mikhail Karpenko

Update the list of partitions in camogmgui

parent 0faa9606
// store path to partition that camogm is currently using
var rawdev_path = "";
// shows if partition selection should be updated
var update_dev_radio = false;
function timer_functions(){
list_files(getCookie("current_dir"));
update_state();
......@@ -17,13 +22,17 @@ function init() {
//setTimeout('update_audio_form(document.getElementById("audioform"))', 1500);
//setTimeout('calc_split_size()', 2300);
//setTimeout('scan_devices()', 3000);
update_name_scheme();
check_audio_hardware();
update_audio_form(document.getElementById("audioform"));
calc_split_size();
//calling "is_mounted" at response
scan_devices("is_mounted(selected_device)");
//global_timer = setInterval(timer_functions,2000);
update_name_scheme();
check_audio_hardware();
update_audio_form(document.getElementById("audioform"));
calc_split_size();
//calling "is_mounted" at response
//global_timer = setInterval(timer_functions,2000);
if (document.getElementById('fast_rec').checked) {
makeRequest('camogm_interface.php', '?cmd=list_raw_devices');
} else {
scan_devices("is_mounted(selected_device)");
}
}
function reload() {
makeRequest('camogm_interface.php', '?cmd=run_camogm');
......@@ -104,7 +113,9 @@ function process_is_hdd_mounted(xmldoc) {
//scan_devices() - fills the device list.
function scan_devices(callback) {
makeRequest('camogm_interface.php','?cmd=listdevices',callback);
if (document.getElementById('fast_rec').checked == false) {
makeRequest('camogm_interface.php','?cmd=listdevices',callback);
}
}
var devices = Array();
......@@ -425,6 +436,18 @@ function process_recording(xmldoc) {
if (xmldoc.getElementsByTagName('buffer_overruns')[0].firstChild.data > 0)
alert ("Buffer overrun! current datarate exceeds max. write rate")
// update partition selection
if (update_dev_radio) {
var radios = document.getElementsByName('rawdev_path');
rawdev_path = xmldoc.getElementsByTagName('raw_device_path')[0].firstChild.data;
for (var i = 0; i < radios.length; i++) {
if (rawdev_path == '"' + radios[i].value + '"') {
radios[i].checked = true;
}
}
update_dev_radio = false;
}
}
recording = false;
function update_state() {
......@@ -806,8 +829,7 @@ function process_raw_dev_list(xmldoc)
"<td>" + partition.firstChild.nodeValue + "</td>" +
"<td></td><td>" + size.firstChild.nodeValue + " GB" + "</td>" +
"<td></td><td></td></tr>";
}
}
content += "</table>";
} else {
content += "<p class=\"alert\">Device partitions without file system are not found. Fast recording can not be started. " +
......@@ -815,4 +837,10 @@ function process_raw_dev_list(xmldoc)
document.getElementById('submit_button').disabled = true;
}
document.getElementById('ajax_devices').innerHTML = content;
}
\ No newline at end of file
// get current partition if we have more than one available and update selection
if (items.length > 1) {
update_dev_radio = true;
makeRequest('camogm_interface.php', '?cmd=status');
}
}
......@@ -117,28 +117,38 @@
// format tab submit
if (isset($_POST['settings_format'])){
switch($_POST['container']){
case'ogm':
$container = $_POST['container'];
break;
case'jpg':
$container = $_POST['container'];
break;
case'mov':
$container = $_POST['container'];
break;
default:
$container = "mov";
break;
if (!isset($_POST['fastrec_checkbox'])) {
switch($_POST['container']){
case'ogm':
$container = $_POST['container'];
break;
case'jpg':
$container = $_POST['container'];
break;
case'mov':
$container = $_POST['container'];
break;
default:
$container = "mov";
break;
}
$rawdev_path = "";
$prefix = $_POST['prefix'];
} else {
// fast recording supports jpeg format only
$container = "jpeg";
$rawdev_path = $_POST['rawdev_path'];
$prefix = "";
}
if ($camogm_running) {
// set format
fprintf($fcmd, "format=%s;\n", $container);
// set record directory
$prefix = $_POST['prefix'];
fprintf($fcmd, "prefix=%s;\n", $prefix);
setcookie("directory", $prefix); // save as cookie so we can get prefered record directory even after camera reboot
if ($prefix != "") {
fprintf($fcmd, "prefix=%s;\n", $prefix);
setcookie("directory", $prefix); // save as cookie so we can get prefered record directory even after camera reboot
}
//set debug file
$debug = $_POST['debug'];
......@@ -150,6 +160,11 @@
}
else
fprintf($fcmd, "debug;\ndebuglev=1;\n");
if ($rawdev_path != "")
fprintf($fcmd, "rawdev_path=%s;\n", $rawdev_path);
else
fprintf($fcmd, "rawdev_path;\n");
}
}
......@@ -262,6 +277,7 @@
$xml_frame_number = substr($logdata[0]['frame_number'], 0, strlen($logdata[0]['frame_number']));
$xml_res_x = substr($logdata[0]['frame_width'], 0, strlen($logdata[0]['frame_width']));
$xml_res_y = substr($logdata[0]['frame_height'], 0, strlen($logdata[0]['frame_height']));
$xml_rawdev_path = substr($logdata[0]['raw_device_path'], 1, strlen($logdata[0]['raw_device_path']) - 2);
// Advanced Settings
$xml_timescale = substr($logdata[0]['timescale'], 0, strlen($logdata[0]['timescale']));
......@@ -572,8 +588,13 @@
echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\" checked> JPEG Sequence<br />";
else
echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\"> JPEG Sequence<br />";
if ($xml_rawdev_path != "") {
$fastrec_checked = "checked=\"checked\"";
} else {
$fastrec_checked = "";
}
?>
<input id="fast_rec" type="checkbox" style="left:1px; top:3px; position:relative;" name="fastrec_checkbox" value="checked" onChange="fast_rec_changed(this)"> Use fast recording
<input id="fast_rec" type="checkbox" style="left:1px; top:3px; position:relative;" name="fastrec_checkbox" value="checked" onChange="fast_rec_changed(this)" <?php echo $fastrec_checked; ?>> Use fast recording
<a href="#" onClick="help('fast_rec');"><img src="images/help.png"></a><br />
<br />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment