Commit f8ad5f0e authored by Mikhail Karpenko's avatar Mikhail Karpenko

Organize status info in gui in table format

parent 19ab4811
...@@ -1053,7 +1053,7 @@ void camogm_status(camogm_state *state, char * fn, int xml) ...@@ -1053,7 +1053,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
" <ignore_fps>\"%s\"</ignore_fps>\n" \ " <ignore_fps>\"%s\"</ignore_fps>\n" \
" <raw_device_path>\"%s\"</raw_device_path>\n" \ " <raw_device_path>\"%s\"</raw_device_path>\n" \
" <raw_device_overruns>%d</raw_device_overruns>\n" \ " <raw_device_overruns>%d</raw_device_overruns>\n" \
" <raw_device_pos_write>0x%llx</raw_dev_pos_write>\n" \ " <raw_device_pos_write>0x%llx</raw_device_pos_write>\n" \
" <raw_device_pos_read>0x%llx (%d%% done)</raw_device_pos_read>\n", " <raw_device_pos_read>0x%llx (%d%% done)</raw_device_pos_read>\n",
_state, state->path, state->frameno, state->start_after_timestamp, _dur, _udur, _len, \ _state, state->path, state->frameno, state->start_after_timestamp, _dur, _udur, _len, \
_frames_skip, _sec_skip, \ _frames_skip, _sec_skip, \
...@@ -1226,11 +1226,9 @@ int parse_cmd(camogm_state *state, FILE* npipe) ...@@ -1226,11 +1226,9 @@ int parse_cmd(camogm_state *state, FILE* npipe)
if (!cmd) return 0; // nothing in the pipe if (!cmd) return 0; // nothing in the pipe
D2(fprintf(debug_file, "Got command: '%s'\n", cmd)); D2(fprintf(debug_file, "Got command: '%s'\n", cmd));
#ifdef DISABLE_CODE
// Acknowledge received command by copying frame number to per-daemon parameter // Acknowledge received command by copying frame number to per-daemon parameter
// GLOBALPARS(state->port_num, G_DAEMON_ERR + lastDaemonBit[state->port_num]) = GLOBALPARS(state->port_num, G_THIS_FRAME); // GLOBALPARS(state->port_num, G_DAEMON_ERR + lastDaemonBit[state->port_num]) = GLOBALPARS(state->port_num, G_THIS_FRAME);
setGValue(state->port_num, G_DAEMON_ERR + lastDaemonBit[state->port_num], getGPValue(state->port_num, G_THIS_FRAME)); setGValue(state->port_num, G_DAEMON_ERR + lastDaemonBit[state->port_num], getGPValue(state->port_num, G_THIS_FRAME));
#endif /* DISABLE_CODE */
args = strpbrk(cmd, "= \t"); args = strpbrk(cmd, "= \t");
// is it just a single word command or does it have parameters? // is it just a single word command or does it have parameters?
if (args) { if (args) {
...@@ -1831,7 +1829,6 @@ int open_files(camogm_state *state) ...@@ -1831,7 +1829,6 @@ int open_files(camogm_state *state)
} }
// now open/mmap file to read sensor/compressor parameters (currently - just free memory in circbuf and compressor state) // now open/mmap file to read sensor/compressor parameters (currently - just free memory in circbuf and compressor state)
#ifdef DISABLE_CODE
state->fd_fparmsall[port] = open(ctlFileNames[port], O_RDWR); state->fd_fparmsall[port] = open(ctlFileNames[port], O_RDWR);
if (state->fd_fparmsall[port] < 0) { // check control OK if (state->fd_fparmsall[port] < 0) { // check control OK
D0(fprintf(debug_file, "%s:%d:%s: Error opening %s\n", __FILE__, __LINE__, __FUNCTION__, ctlFileNames[port])); D0(fprintf(debug_file, "%s:%d:%s: Error opening %s\n", __FILE__, __LINE__, __FUNCTION__, ctlFileNames[port]));
...@@ -1849,7 +1846,6 @@ int open_files(camogm_state *state) ...@@ -1849,7 +1846,6 @@ int open_files(camogm_state *state)
} }
framePars[port] = frameParsAll[port]->framePars; framePars[port] = frameParsAll[port]->framePars;
aglobalPars[port] = frameParsAll[port]->globalPars; aglobalPars[port] = frameParsAll[port]->globalPars;
#endif /* DISABLE_CODE */
} }
return ret; return ret;
...@@ -1928,12 +1924,9 @@ int main(int argc, char *argv[]) ...@@ -1928,12 +1924,9 @@ int main(int argc, char *argv[])
*/ */
unsigned long getGPValue(unsigned int port, unsigned long GPNumber) unsigned long getGPValue(unsigned int port, unsigned long GPNumber)
{ {
#ifdef DISABLE_CODE
return (GPNumber >= FRAMEPAR_GLOBALS) ? return (GPNumber >= FRAMEPAR_GLOBALS) ?
GLOBALPARS(port, GPNumber) : GLOBALPARS(port, GPNumber) :
framePars[port][GLOBALPARS(port, G_THIS_FRAME) & PARS_FRAMES_MASK].pars[GPNumber]; framePars[port][GLOBALPARS(port, G_THIS_FRAME) & PARS_FRAMES_MASK].pars[GPNumber];
#endif /* DESABLE_CODE */
return 0;
} }
/** /**
......
...@@ -103,7 +103,6 @@ if ($cmd == "run_camogm") ...@@ -103,7 +103,6 @@ if ($cmd == "run_camogm")
} }
if ($debug) { if ($debug) {
// $cmd_pipe = "/var/state/camogm_cmd";
$fcmd = fopen($cmd_pipe, "w"); $fcmd = fopen($cmd_pipe, "w");
fprintf($fcmd,"debuglev=$debuglev"); fprintf($fcmd,"debuglev=$debuglev");
} }
...@@ -112,7 +111,6 @@ if ($cmd == "run_camogm") ...@@ -112,7 +111,6 @@ if ($cmd == "run_camogm")
else if ($cmd == "status") else if ($cmd == "status")
{ {
$pipe="/var/state/camogm.state"; $pipe="/var/state/camogm.state";
// $cmd_pipe="/var/state/camogm_cmd";
$mode=0777; $mode=0777;
if(!file_exists($pipe)) { if(!file_exists($pipe)) {
umask(0); umask(0);
...@@ -292,8 +290,6 @@ else if ($cmd=="list") { ...@@ -292,8 +290,6 @@ else if ($cmd=="list") {
} }
else else
{ {
// $cmd_pipe = "/var/state/camogm_cmd";
$fcmd = fopen($cmd_pipe, "w"); $fcmd = fopen($cmd_pipe, "w");
xml_header(); xml_header();
...@@ -538,7 +534,8 @@ else ...@@ -538,7 +534,8 @@ else
fprintf($fcmd, "timelapse=%s;\n", $timelapse_value); fprintf($fcmd, "timelapse=%s;\n", $timelapse_value);
break; break;
case "init_compressor": case "init_compressor":
elphel_compressor_run(); $sensor_port = $_GET['sensor_port'];
elphel_compressor_run($sensor_port);
break; break;
case "check_audio_hardware": case "check_audio_hardware":
exec('arecord -l', $arr1); exec('arecord -l', $arr1);
......
...@@ -221,8 +221,8 @@ function process_list_file(xmldoc) { ...@@ -221,8 +221,8 @@ function process_list_file(xmldoc) {
document.getElementById('filelist').innerHTML = response; document.getElementById('filelist').innerHTML = response;
} }
} }
function start_compressor(parent) { function start_compressor(parent, port) {
makeRequest('camogm_interface.php', '?cmd=init_compressor'); makeRequest('camogm_interface.php', '?cmd=init_compressor', '&sensor_port=' + port);
parent.style.display = 'none'; parent.style.display = 'none';
} }
function update_audio_form(thisform) { function update_audio_form(thisform) {
......
...@@ -56,7 +56,21 @@ ...@@ -56,7 +56,21 @@
$cmd_port = "3456"; $cmd_port = "3456";
$start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port; $start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port;
$mode = 0777; $mode = 0777;
$sensor_ports = elphel_num_sensors();
// check if any compressor is in running state
function check_compressors($states)
{
global $sensor_ports;
$ret_val = 0;
for ($i = 0; $i < $sensor_ports; $i++) {
if ($states[$i] == "running")
$ret_val = 1;
}
return $ret_val;
}
if(!file_exists($pipe)) { if(!file_exists($pipe)) {
// create the pipe // create the pipe
umask(0); umask(0);
...@@ -242,7 +256,6 @@ ...@@ -242,7 +256,6 @@
$xml_format = substr($logdata[0]['format'], 1, strlen($logdata[0]['format'])-2); $xml_format = substr($logdata[0]['format'], 1, strlen($logdata[0]['format'])-2);
$xml_state = substr($logdata[0]['state'], 1, strlen($logdata[0]['state'])-2); $xml_state = substr($logdata[0]['state'], 1, strlen($logdata[0]['state'])-2);
$xml_directory = substr($logdata[0]['prefix'], 1, strlen($logdata[0]['prefix'])-2); $xml_directory = substr($logdata[0]['prefix'], 1, strlen($logdata[0]['prefix'])-2);
$xml_compressor_state = substr($logdata[0]['compressor_state'], 1, strlen($logdata[0]['compressor_state'])-2);
$xml_file_length = substr($logdata[0]['file_length'], 0, strlen($logdata[0]['file_length'])); // file size in bytes $xml_file_length = substr($logdata[0]['file_length'], 0, strlen($logdata[0]['file_length'])); // file size in bytes
$xml_file_duration = substr($logdata[0]['file_duration'], 0, strlen($logdata[0]['file_duration'])); $xml_file_duration = substr($logdata[0]['file_duration'], 0, strlen($logdata[0]['file_duration']));
$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']));
...@@ -280,7 +293,11 @@ ...@@ -280,7 +293,11 @@
$xml_audio_volume = substr($logdata[0]['audio_volume'], 1, strlen($logdata[0]['audio_volume'])-2); $xml_audio_volume = substr($logdata[0]['audio_volume'], 1, strlen($logdata[0]['audio_volume'])-2);
$xml_audio_syncmode = substr($logdata[0]['allow_sync'], 1, strlen($logdata[0]['allow_sync'])-2); $xml_audio_syncmode = substr($logdata[0]['allow_sync'], 1, strlen($logdata[0]['allow_sync'])-2);
// Get per sensor port parameters
$xml_compressor_state = array();
for ($i = 0; $i < $sensor_ports; $i++) {
$xml_compressor_state[$i] = substr($logdata[$i]['compressor_state'], 1, strlen($logdata[$i]['compressor_state'])-2);
}
if ($camogm_running) { if ($camogm_running) {
if (($xml_directory == "\"\"") || ($xml_directory == "")) if (($xml_directory == "\"\"") || ($xml_directory == ""))
...@@ -367,7 +384,7 @@ ...@@ -367,7 +384,7 @@
<div id="TabbedPanels1" class="TabbedPanels"> <div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup"> <ul class="TabbedPanelsTabGroup">
<? <?
if (($xml_compressor_state != "running") || (!$camogm_running)) if ((check_compressors($xml_compressor_state) != 1) || (!$camogm_running))
echo "<li class=\"TabbedPanelsTabAlert\" tabindex=\"0\">Status</li>"; echo "<li class=\"TabbedPanelsTabAlert\" tabindex=\"0\">Status</li>";
else else
echo "<li class=\"TabbedPanelsTab\" tabindex=\"0\">Status</li>"; echo "<li class=\"TabbedPanelsTab\" tabindex=\"0\">Status</li>";
...@@ -382,45 +399,97 @@ ...@@ -382,45 +399,97 @@
<div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> <div class="TabbedPanelsContent">
<!-- Status --> <!-- Status -->
<? <table class="state_table" border="0px" cellpadding="opx" cellspacing="0px">
echo "Sensor: "; <!-- Table header -->
if (elphel_get_state() == 0) <tr><td width="120px"></td>
{ <?php
echo "<span class=\"alert\">not initialized!</span>"; for ($i = 0; $i < $sensor_ports; $i++) {
echo " <a href=\"#\" onClick=\"help('sensor');\"><img src=\"images/help.png\"></a>"; echo "<td>Port " . $i . "</td>";
} }
else ?>
echo "<span class=\"green\"> working</span>"; </tr>
<!-- Sensor port status -->
echo "<br />"; <tr><td>Sensor</td>
echo "Compressor: "; <?php
if ($xml_compressor_state != "running") { for ($i = 0; $i < $sensor_ports; $i++) {
echo "<span class=\"alert\">not running!</span>"; echo "<td>";
echo " <a href=\"#\" OnClick=\"start_compressor(this); window.location.reload();\">start compressor</a>"; if (elphel_get_state($i) == 0)
} {
else echo "<span class=\"alert\">not initialized!</span>";
echo "<span class=\"green\"> running</span>"; echo " <a href=\"#\" onClick=\"help('sensor');\"><img src=\"images/help.png\"></a>";
echo "<br />"; }
else
echo "Camogm: "; echo "<span class=\"green\"> working</span>";
if (!$camogm_running) {
echo "<span class=\"alert\">NOT running!</span>"; echo "</td>";
echo " <input name=\"camogm_start\" type=\"button\" value=\"start camogm\" >"; }
} ?>
else </tr>
echo "<span class=\"green\"> running</span>"; <!-- Compressor status -->
?> <tr><td>Compressor</td>
<?php
for ($i = 0; $i < $sensor_ports; $i++) {
echo "<td>";
if ($xml_compressor_state[$i] != "running") {
echo "<span class=\"alert\">not running!</span>";
echo " <a href=\"#\" OnClick=\"start_compressor(this, $i); window.location.reload();\">start compressor</a>";
}
else
echo "<span class=\"green\"> running</span>";
echo "</td>";
}
?>
</tr>
<!-- Image resolution on each port -->
<tr><td>Image resolution</td>
<?php
for ($i = 0; $i < $sensor_ports; $i++) {
echo "<td id=\"ajax_res\">";
echo elphel_get_P_value($i, ELPHEL_ACTUAL_WIDTH) . " x " . elphel_get_P_value($i, ELPHEL_ACTUAL_HEIGHT);
echo "</td>";
}
?>
</tr>
<!-- JPEG quality on each port -->
<tr><td>JPEG quality</td>
<?php
for ($i = 0; $i < $sensor_ports; $i++) {
echo "<td id=\"ajax_qual\">";
echo elphel_get_P_value($i, ELPHEL_QUALITY) . " %";
echo "</td>";
}
?>
</tr>
<!-- Frame rate on each port -->
<tr><td>Framerate</td>
<?php
for ($i = 0; $i < $sensor_ports; $i++) {
echo "<td id=\"ajax_fps\">";
echo elphel_get_P_value($i, ELPHEL_FP1000S) / 1000 . " fps";
echo "</td>";
}
?>
</tr>
</table>
<br /> <br />
<br /> <br />
Recording: <span id="ajax_state"><? echo $xml_state; ?></span><br />
Audio Recording: <span id="ajax_audio_recording">loading...</span><br />
Geo-Tagging: <span id="ajax_geotag_enabled"><? if($xml_geotagging_enabled == "yes") echo "enabled"; else echo "disabled"; ?></span><br />
<br />
<table class="state_table" border="0px" cellpadding="0px" cellspacing="0px"> <table class="state_table" border="0px" cellpadding="0px" cellspacing="0px">
<tr><td width="120px">Filename:</td><td id="ajax_file_name">-</td></tr> <tr><td width="120px">Camogm:</td>
<tr><td>Image Resolution:</td><td id="ajax_res"><? echo elphel_get_P_value(ELPHEL_ACTUAL_WIDTH)." x ".elphel_get_P_value(ELPHEL_ACTUAL_HEIGHT); ?></td></tr> <td>
<tr><td>JPEG Quality</td><td id="ajax_qual"><? echo elphel_get_P_value(ELPHEL_QUALITY)." %";?></td></tr> <?php
<tr><td>Framerate:</td><td id="ajax_fps"><? echo elphel_get_P_value(ELPHEL_FP1000S)/1000 ." fps";?></td></tr> if (!$camogm_running) {
echo "<span class=\"alert\">NOT running!</span>";
echo " <input name=\"camogm_start\" type=\"button\" value=\"start camogm\" >";
}
else
echo "<span class=\"green\"> running</span>";
?>
</td>
</tr>
<tr><td>Recording:</td><td id="ajax_state"><? echo $xml_state; ?></td></tr>
<tr><td>Audio Recording:</td><td id="ajax_audio_recording">loading...</td></tr>
<tr><td>Geo-Tagging:</td><td id="ajax_geotag_enabled"><? if($xml_geotagging_enabled == "yes") echo "enabled"; else echo "disabled"; ?></td></tr>
<tr><td>Filename:</td><td id="ajax_file_name">-</td></tr>
<tr><td>Record Time:</td><td id="ajax_file_duration">-</td></tr> <tr><td>Record Time:</td><td id="ajax_file_duration">-</td></tr>
<tr><td>File Size:</td><td id="ajax_file_length">-</td></tr> <tr><td>File Size:</td><td id="ajax_file_length">-</td></tr>
<tr><td>Data Rate:</td><td id="ajax_data_rate">-</td></tr> <tr><td>Data Rate:</td><td id="ajax_data_rate">-</td></tr>
......
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