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(){ function timer_functions(){
list_files(getCookie("current_dir")); list_files(getCookie("current_dir"));
update_state(); update_state();
...@@ -17,13 +22,17 @@ function init() { ...@@ -17,13 +22,17 @@ function init() {
//setTimeout('update_audio_form(document.getElementById("audioform"))', 1500); //setTimeout('update_audio_form(document.getElementById("audioform"))', 1500);
//setTimeout('calc_split_size()', 2300); //setTimeout('calc_split_size()', 2300);
//setTimeout('scan_devices()', 3000); //setTimeout('scan_devices()', 3000);
update_name_scheme(); update_name_scheme();
check_audio_hardware(); check_audio_hardware();
update_audio_form(document.getElementById("audioform")); update_audio_form(document.getElementById("audioform"));
calc_split_size(); calc_split_size();
//calling "is_mounted" at response //calling "is_mounted" at response
scan_devices("is_mounted(selected_device)"); //global_timer = setInterval(timer_functions,2000);
//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() { function reload() {
makeRequest('camogm_interface.php', '?cmd=run_camogm'); makeRequest('camogm_interface.php', '?cmd=run_camogm');
...@@ -104,7 +113,9 @@ function process_is_hdd_mounted(xmldoc) { ...@@ -104,7 +113,9 @@ function process_is_hdd_mounted(xmldoc) {
//scan_devices() - fills the device list. //scan_devices() - fills the device list.
function scan_devices(callback) { 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(); var devices = Array();
...@@ -425,6 +436,18 @@ function process_recording(xmldoc) { ...@@ -425,6 +436,18 @@ function process_recording(xmldoc) {
if (xmldoc.getElementsByTagName('buffer_overruns')[0].firstChild.data > 0) if (xmldoc.getElementsByTagName('buffer_overruns')[0].firstChild.data > 0)
alert ("Buffer overrun! current datarate exceeds max. write rate") 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; recording = false;
function update_state() { function update_state() {
...@@ -806,8 +829,7 @@ function process_raw_dev_list(xmldoc) ...@@ -806,8 +829,7 @@ function process_raw_dev_list(xmldoc)
"<td>" + partition.firstChild.nodeValue + "</td>" + "<td>" + partition.firstChild.nodeValue + "</td>" +
"<td></td><td>" + size.firstChild.nodeValue + " GB" + "</td>" + "<td></td><td>" + size.firstChild.nodeValue + " GB" + "</td>" +
"<td></td><td></td></tr>"; "<td></td><td></td></tr>";
} }
content += "</table>"; content += "</table>";
} else { } else {
content += "<p class=\"alert\">Device partitions without file system are not found. Fast recording can not be started. " + 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) ...@@ -815,4 +837,10 @@ function process_raw_dev_list(xmldoc)
document.getElementById('submit_button').disabled = true; document.getElementById('submit_button').disabled = true;
} }
document.getElementById('ajax_devices').innerHTML = content; 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 @@ ...@@ -117,28 +117,38 @@
// format tab submit // format tab submit
if (isset($_POST['settings_format'])){ if (isset($_POST['settings_format'])){
switch($_POST['container']){ if (!isset($_POST['fastrec_checkbox'])) {
case'ogm': switch($_POST['container']){
$container = $_POST['container']; case'ogm':
break; $container = $_POST['container'];
case'jpg': break;
$container = $_POST['container']; case'jpg':
break; $container = $_POST['container'];
case'mov': break;
$container = $_POST['container']; case'mov':
break; $container = $_POST['container'];
default: break;
$container = "mov"; default:
break; $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) { if ($camogm_running) {
// set format // set format
fprintf($fcmd, "format=%s;\n", $container); fprintf($fcmd, "format=%s;\n", $container);
// set record directory // set record directory
$prefix = $_POST['prefix']; if ($prefix != "") {
fprintf($fcmd, "prefix=%s;\n", $prefix); fprintf($fcmd, "prefix=%s;\n", $prefix);
setcookie("directory", $prefix); // save as cookie so we can get prefered record directory even after camera reboot setcookie("directory", $prefix); // save as cookie so we can get prefered record directory even after camera reboot
}
//set debug file //set debug file
$debug = $_POST['debug']; $debug = $_POST['debug'];
...@@ -150,6 +160,11 @@ ...@@ -150,6 +160,11 @@
} }
else else
fprintf($fcmd, "debug;\ndebuglev=1;\n"); 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 @@ ...@@ -262,6 +277,7 @@
$xml_frame_number = substr($logdata[0]['frame_number'], 0, strlen($logdata[0]['frame_number'])); $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_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_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 // Advanced Settings
$xml_timescale = substr($logdata[0]['timescale'], 0, strlen($logdata[0]['timescale'])); $xml_timescale = substr($logdata[0]['timescale'], 0, strlen($logdata[0]['timescale']));
...@@ -572,8 +588,13 @@ ...@@ -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 />"; echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\" checked> JPEG Sequence<br />";
else else
echo "<input type=\"radio\" id=\"radioJpg\" style=\"top:3px; position:relative;\" name=\"container\" value=\"jpg\" onChange=\"format_changed(this);\"> JPEG Sequence<br />"; 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 /> <a href="#" onClick="help('fast_rec');"><img src="images/help.png"></a><br />
<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