Commit f8ad5f0e authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Organize status info in gui in table format

parent 19ab4811
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -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)
	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)
		}
		}


		// 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)
		}
		}
		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[])
 */
 */
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;
}
}


/**
/**
+2 −5
Original line number Original line Diff line number Diff line
@@ -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")
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") {
}
}
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
			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);
+2 −2
Original line number Original line Diff line number Diff line
@@ -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) {
+108 −39
Original line number Original line Diff line number Diff line
@@ -56,6 +56,20 @@
	$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
@@ -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 @@
		$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 @@
        <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,9 +399,21 @@
          <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
					for ($i = 0; $i < $sensor_ports; $i++) {
						echo "<td>Port " . $i . "</td>";
					}
            		?>
            	</tr>
            	<!-- Sensor port status -->
            	<tr><td>Sensor</td>
            	<?php 
				for ($i = 0; $i < $sensor_ports; $i++) {
					echo "<td>";
					if (elphel_get_state($i) == 0)
					{
					{
						echo "<span class=\"alert\">not initialized!</span>";
						echo "<span class=\"alert\">not initialized!</span>";
						echo " <a href=\"#\" onClick=\"help('sensor');\"><img src=\"images/help.png\"></a>";
						echo " <a href=\"#\" onClick=\"help('sensor');\"><img src=\"images/help.png\"></a>";
@@ -392,17 +421,62 @@
					else
					else
						echo "<span class=\"green\"> working</span>";
						echo "<span class=\"green\"> working</span>";
					
					
			echo "<br />";
					echo "</td>";
			echo "Compressor: ";
				}
			if ($xml_compressor_state != "running") {
            	?>
            	</tr>
            	<!-- 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 "<span class=\"alert\">not running!</span>";
				echo " <a href=\"#\" OnClick=\"start_compressor(this); window.location.reload();\">start compressor</a>";	
						echo " <a href=\"#\" OnClick=\"start_compressor(this, $i); window.location.reload();\">start compressor</a>";	
					}
					}
					else
					else
						echo "<span class=\"green\"> running</span>";
						echo "<span class=\"green\"> running</span>";
			echo "<br />";
					echo "</td>";
			
				}
			echo "Camogm: ";
            	?>
            	</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 />
            <table class="state_table" border="0px" cellpadding="0px" cellspacing="0px">
            	<tr><td width="120px">Camogm:</td>
					<td>
					<?php
					if (!$camogm_running) {
					if (!$camogm_running) {
						echo "<span class=\"alert\">NOT running!</span>";
						echo "<span class=\"alert\">NOT running!</span>";
						echo " <input name=\"camogm_start\" type=\"button\" value=\"start camogm\" >";	
						echo " <input name=\"camogm_start\" type=\"button\" value=\"start camogm\" >";	
@@ -410,17 +484,12 @@
					else
					else
						echo "<span class=\"green\"> running</span>";
						echo "<span class=\"green\"> running</span>";
					?>
					?>
			<br />
					</td>				
			<br />
            	</tr>
            Recording: <span id="ajax_state"><? echo $xml_state; ?></span><br />
				<tr><td>Recording:</td><td id="ajax_state"><? echo $xml_state; ?></td></tr>
            Audio Recording: <span id="ajax_audio_recording">loading...</span><br />
				<tr><td>Audio Recording:</td><td id="ajax_audio_recording">loading...</td></tr>				
            Geo-Tagging: <span id="ajax_geotag_enabled"><? if($xml_geotagging_enabled == "yes") echo "enabled"; else echo "disabled"; ?></span><br />
				<tr><td>Geo-Tagging:</td><td id="ajax_geotag_enabled"><? if($xml_geotagging_enabled == "yes") echo "enabled"; else echo "disabled"; ?></td></tr>
            <br />
                <tr><td>Filename:</td><td id="ajax_file_name">-</td></tr>
            <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>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>        
                <tr><td>JPEG Quality</td><td id="ajax_qual"><? echo elphel_get_P_value(ELPHEL_QUALITY)." %";?></td></tr>        
                <tr><td>Framerate:</td><td id="ajax_fps"><? echo elphel_get_P_value(ELPHEL_FP1000S)/1000 ." fps";?></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>