...
 
Commits (69)
# Runs 'make', 'make install', and 'make clean' in specified subdirectories
SUBDIRS := src/php_top src/python_tests src/debugfs-webgui src/jp4-canvas src/update src/eyesis4pi src/index src/pointers src/snapshot src/jp4-viewer src/photofinish src/multicam src/diagnostics # src1
SUBDIRS := src/php_top src/python_tests src/debugfs-webgui src/jp4-canvas src/update src/eyesis4pi \
src/index src/pointers src/snapshot src/jp4-viewer src/photofinish src/multicam src/diagnostics src/lwir16 # src1
INSTALLDIRS = $(SUBDIRS:%=install-%)
CLEANDIRS = $(SUBDIRS:%=clean-%)
......
......@@ -21,18 +21,33 @@
<builder arguments="web-393" command="${workspace_loc:/elphel-web-393/scripts/run_bitbake.sh}" enableCleanBuild="false" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.365026764" incrementalBuildTarget="-c install -f" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder" />
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.785882741" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs" />
<tool id="org.eclipse.cdt.build.core.settings.holder.982996495" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.772251241" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__arm__=1" />
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.8554647" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType" />
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.480226500" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.994702313" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__arm__=1" />
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1347472659" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType" />
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1686385332" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1940520547" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__arm__=1" />
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.716913472" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType" />
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.559915258" name="LLVM bytecode assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1625690961" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__arm__=1" />
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1886099197" languageId="org.eclipse.cdt.managedbuilder.llvm.ui.llvmAssembly" languageName="LLVM bytecode assembly" sourceContentType="org.eclipse.cdt.managedbuilder.llvm.ui.llvmAssemblySource" superClass="org.eclipse.cdt.build.core.settings.holder.inType" />
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1960214219" name="UPC" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1302332589" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__arm__=1" />
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1593701683" languageId="org.eclipse.cdt.core.parser.upc.upc" languageName="UPC" sourceContentType="org.eclipse.cdt.core.parser.upc.upcSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType" />
</tool>
</toolChain>
......@@ -60,4 +75,5 @@
<resource resourceType="PROJECT" workspacePath="/elphel-web-393" />
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets" />
</cproject>
\ No newline at end of file
......@@ -361,7 +361,14 @@ function parse_port(port){
var pn = p.attr('index');
var mux = p.attr('mux');
var sensors = p.attr('sensor');
var format = pp_parse_format(p.find('color'));
var quality = p.find('quality').text()+'%';
// alert(format);
// alert(format.includes("tiff"));
if (format.includes("tiff")){
quality = "lossless"
}
var res = [
'<tr>',
' <td class=\'center\'>'+pn+'</td>',
......@@ -369,12 +376,12 @@ function parse_port(port){
' <td>'+sensors+'</td>',
' <td class=\'center\'>'+pp_parse_sensor_run(p.find('sensor_run'))+'</td>',
' <td class=\'center\'>'+pp_parse_sensor_run(p.find('compressor_run'))+'</td>',
' <td class=\'center\'>'+pp_parse_format(p.find('color'))+'</td>',
' <td class=\'center\'>'+p.find('quality').text()+'%</td>',
' <td class=\'center\'>'+format+'</td>',
' <td class=\'center\'>'+quality+'</td>',
' <td class=\'center\'>'+p.find('woi_width').text()+'x'+p.find('woi_height').text()+'</td>',
' <td class=\'center\'>'+p.find('trig').text()+'</td>',
' <td class=\'center\'>'+p.find('trig_master').text()+'</td>',
' <td class=\'center\'>'+pp_parse_trig_period(p.find('trig_period').text(),p.find('expos').text())+'</td>',
' <td class=\'center\'>'+pp_parse_trig_period(p.find('trig_period').text(),p.find('trig_decimate').text(),p.find('expos').text())+'</td>',
' <td class=\'center\'>'+pp_parse_trig_p(p.find('trig_out').text())+'</td>',
' <td class=\'center\'>'+pp_parse_trig_p(p.find('trig_condition').text())+'</td>',
' <td class=\'right\'>'+pp_parse_expos(p.find('expos').text(),p.find('trig_period').text())+'</td>',
......@@ -433,10 +440,11 @@ function pp_parse_trig_p(str){
}
function pp_calc_trig_period(str){
function pp_calc_trig_period(str, sdecimate){
var clock = 100000000;
var v = parseInt(str);
v = v/clock;
var decimate = 1.0 + parseInt(sdecimate)
v = v/clock*decimate;
return v;
}
......@@ -446,9 +454,9 @@ function pp_calc_exposure(str){
return v;
}
function pp_parse_trig_period(period,str){
function pp_parse_trig_period(period,decimate,str){
var per = pp_calc_trig_period(period);
var per = pp_calc_trig_period(period, decimate);
var exp = pp_calc_exposure(str);
var fps = (1/per);
......@@ -477,10 +485,12 @@ function pp_parse_format(str){
if (fmt==5){
fmt = "jp4";
}else if (fmt==0){
} else if (fmt==15){
fmt = "tiff";
} else if (fmt==0){
color = "rgb(240,160,0)";
fmt = "jpeg";
}else{
} else{
color = "rgb(230,0,0)";
fmt = "else";
}
......
......@@ -238,6 +238,7 @@ function get_port_info($port){
'TRIG' => 0,
'TRIG_MASTER' => 0,
'TRIG_PERIOD' => 0,
'TRIG_DECIMATE' => 0,
'TRIG_CONDITION' => 0,
'TRIG_OUT' => 0,
'GAINR' => 0,
......
......@@ -2,8 +2,11 @@ DOCUMENTROOT=$(DESTDIR)/www/pages
OWN = -o root -g root
INSTDOCS = 0644
INSTALL = install
DOCS= index.html \
index.php
DOCS= img.html \
index.html \
index.php \
index1.php \
mjpeg.html
all:
@echo "make all in src"
......
<html>
<head>
<style>
body {
margin: 0px;
}
#cnv_div {
border: 0px solid red;
}
#display{
height: 100%;
}
</style>
</head>
<body>
<div id='cnv_div'></div>
<script src="js/elphel.js"></script>
<script src="js/UTIF.js"></script>
<script src="js/jquery-3.1.1.js"></script>
<script src="js/jcanvas.js"></script>
<script src="js/exif.js"></script>
<script src="js/jquery-jp4.js"></script>
<script>
const IMGSRV_PORT0 = 2323;
const params = new URLSearchParams(location.search);
const port = params.get('port') || 0;
const refresh = params.get('refresh') || 5;
const sensor_type = params.get('sensor_type') || '';
console.log("img.html: sensor_type="+sensor_type);
if (params.get('port')===null){
let s = "";
if (location.search===""){
s = "?port="+port;
}else{
s = location.search+"&port="+port;
}
window.history.pushState('', '', location.pathname+s);
}
let imgsrv_port = IMGSRV_PORT0 + parseInt(port);
if (sensor_type == "boson640") {
let t1 = $("#cnv_div").jp4({src:"http://"+location.host+":"+imgsrv_port+"/tiff_palette=2/tiff_telem=1/tiff_auto=0/tiff_convert/bimg",width:1600,fast:true,lowres:2,debug:false,refresh:true});
} else {
let t1 = $("#cnv_div").jp4({src:"http://"+location.host+":"+imgsrv_port+"/img",width:1600,fast:true,lowres:2,debug:false,refresh:true});
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<html>
<head>
<style>
body {
margin: 0px;
}
canvas {
height: 100%;
border: 0px solid red;
}
</style>
</head>
<body>
<canvas id='cnv'></canvas>
<script>
const IMGSRV_PORT0 = 2323;
const params = new URLSearchParams(location.search);
const port = params.get('port') || 0;
const refresh = params.get('refresh') || 5;
if (params.get('port')===null){
let s = "";
if (location.search===""){
s = "?port="+port;
}else{
s = location.search+"&port="+port;
}
window.history.pushState('', '', location.pathname+s);
}
let imgsrv_port = IMGSRV_PORT0 + parseInt(port);
let cnv = document.getElementById('cnv');
let ctx = cnv.getContext('2d');
let img = new Image();
img.onload = function() {
canvas_resize();
refreshCanvas();
};
img.src = location.origin+":"+imgsrv_port+"/mimg";
window.addEventListener("resize", ()=>{
canvas_resize();
});
///////////////////////////////////////////////////////////////////////////////////
function canvas_resize(){
ctx.canvas.width = img.width;
ctx.canvas.height = img.height;
}
window.setInterval("refreshCanvas()", refresh);
function refreshCanvas(){
try{
ctx.drawImage(img,0,0,ctx.canvas.width,ctx.canvas.height);
}catch(err){
img.src = location.origin+":2323/mimg";
}
};
</script>
</body>
</html>
\ No newline at end of file
......@@ -7,6 +7,7 @@ DOCS= jp4-canvas.html \
LIBS= elphel.js \
exif.js \
UTIF.js \
jquery-jp4.js \
jcanvas.js \
webworker.js
......
This diff is collapsed.
......@@ -129,13 +129,13 @@ var Elphel = {
* @lowres - valid values: 1 (not scaled), 2, 4, 8 (lowest resolution)
*
*/
reorderBlocksJP4_lowres: function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
//reorderBlocksJP4_lowres: function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
reorderBlocksJP4_lowres: async function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
// the output image is 1/4 because demosaicing = 4 single color channel pixels are put into 1 rgb pixel
var oPixels = new Uint8Array(pixels.length/4);
// check
if ((lowres!=1)&&(lowres!=2)&&(lowres!=4)&&(lowres!=8)){
if (![1,2,4,8].includes(lowres)){
lowres = 4;
}
......@@ -692,4 +692,4 @@ var Elphel = {
console.log("Test message from elphel.js: ok");
}
}
\ No newline at end of file
}
......@@ -44,10 +44,26 @@ $port0 = 2323;
$pointers = elphel_get_circbuf_pointers(intval($port)-$port0,1);
$pointer = $pointers[count($pointers)-1]['circbuf_pointer'];
$contents = file_get_contents("http://$ip:$port/$rel");
$acao = "*";
$ct = "image/jpeg";
// pass some headers from file_get_contents
// $http_response_header is auto populated
foreach($http_response_header as $h){
$hv = explode(":",$h);
if ($hv[0]=="Access-Control-Allow-Origin"){
$acao = trim($hv[1]);
}else if ($hv[0]=="Content-Type"){
$ct = trim($hv[1]);
}
}
// allow CORS
header('Access-Control-Allow-Origin: *');
header('Content-type:image/jpeg');
echo file_get_contents("http://$ip:$port/$pointer/$rel");
header("Access-Control-Allow-Origin: $acao");
header("Content-Type: $ct");
echo $contents;
//echo file_get_contents("http://$ip:$port/$rel");
die();
......
......@@ -7,15 +7,16 @@
<body>
<table>
<tr>
<td><div id='test1'></div></td>
<td><div id='test2'></div></td>
<td valign='top'><div id='test1'></div></td>
<td valign='top'><div id='test2'></div></td>
</tr>
<tr>
<td><div id='test3'></div></td>
<td><div id='test4'></div></td>
<td valign='top'><div id='test3'></div></td>
<td valign='top'><div id='test4'></div></td>
</tr>
</table>
<script src="js/elphel.js"></script>
<script src="js/UTIF.js"></script>
<script src="js/jquery-3.1.1.js"></script>
<script src="js/jcanvas.js"></script>
<script src="js/exif.js"></script>
......
......@@ -26,10 +26,10 @@
*/
$(function(){
var t1 = $("#test1").jp4({ip:"127.0.0.1",port:2323,width:600,fast:true,lowres:4});
var t2 = $("#test2").jp4({ip:"127.0.0.1",port:2324,width:600,fast:true,lowres:4});
var t3 = $("#test3").jp4({ip:"127.0.0.1",port:2325,width:600,fast:true,lowres:4});
var t4 = $("#test4").jp4({ip:"127.0.0.1",port:2326,width:600,fast:true,lowres:4});
let t1 = $("#test1").jp4({src:"http://"+location.host+":"+2323+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t2 = $("#test2").jp4({src:"http://"+location.host+":"+2324+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t3 = $("#test3").jp4({src:"http://"+location.host+":"+2325+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t4 = $("#test4").jp4({src:"http://"+location.host+":"+2326+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
});
This diff is collapsed.
importScripts('elphel.js');
self.onmessage = function(e) {
var W = e.data.width;
var H = e.data.height;
var Mosaic = e.data.mosaic;
var Format = e.data.format;
var settings = e.data.settings;
var Pixels = new Uint8Array(e.data.pixels);
if (settings.lowres==0){
var reorderedPixels = Elphel.Pixels.reorderBlocksJPx(Pixels,W,H,Format,Mosaic,settings.fast);
//reorder first then downscale
if (settings.fast){
W = W/2;
H = H/2;
onmessage = async (e) => {
let W = e.data.width;
let H = e.data.height;
let Mosaic = e.data.mosaic;
let Format = e.data.format;
let settings = e.data.settings;
let Pixels = new Uint8Array(e.data.pixels);
let reorderedPixels;
if (settings.lowres==0){
reorderedPixels = Elphel.Pixels.reorderBlocksJPx(Pixels,W,H,Format,Mosaic,settings.fast);
//reorder first then downscale
if (settings.fast){
W = W/2;
H = H/2;
}
}else{
reorderedPixels = await Elphel.Pixels.reorderBlocksJP4_lowres(Pixels,W,H,Format,Mosaic,settings.lowres);
W = W/2;
H = H/2;
}
}else{
var reorderedPixels = Elphel.Pixels.reorderBlocksJP4_lowres(Pixels,W,H,Format,Mosaic,settings.lowres);
W = W/2;
H = H/2;
}
Elphel.Pixels.applySaturation(reorderedPixels,W,H,2);
postMessage({
width: W,
height: H,
pixels: reorderedPixels.buffer
},[reorderedPixels.buffer]);
Elphel.Pixels.applySaturation(reorderedPixels,W,H,2);
//Elphel.test();
this.close();
postMessage({
width: W,
height: H,
pixels: reorderedPixels.buffer
},[reorderedPixels.buffer]);
};
\ No newline at end of file
//Elphel.test();
this.close();
};
......@@ -8,6 +8,7 @@
<script src="../js/jquery-3.1.1.js"></script>
<script src="../js/jcanvas.js"></script>
<script src="../js/exif.js"></script>
<script src="../js/UTIF.js"></script>
<script src="../js/jquery-jp4.js"></script>
<script type='text/javascript' src='jp4-viewer.js'></script>
......
......@@ -27,7 +27,7 @@ function parseURL(){
$(function(){
$.ajax({
url: "http://192.168.0.9:2323",
url: location.host+":2323",
success: function(){
console.log("success");
}
......@@ -54,6 +54,8 @@ function handleImage(e) {
reader.onload = function(event){
//$("#smallimage").attr("src",event.target.result);
console.log("File loaded");
$("#jp4view").html("");
var view = $("<div>",{id:"img"});
......@@ -63,7 +65,7 @@ function handleImage(e) {
//console.log(SETTINGS.width);
view.jp4({image:myimg, fromhtmlinput: true, width:SETTINGS.width,fast:true, lowres:SETTINGS.quality, webworker_path:"../js"});
view.jp4({src:myimg, fromhtmlinput: true, width:SETTINGS.width,fast:true, lowres:SETTINGS.quality, webworker_path:"../js"});
//view.jp4({image:"test.jp4", input: false, width:1200,fast:true, lowres:1});
$("#jp4view").append(view);
......
DOCUMENTROOT=$(DESTDIR)/www/pages/lwir16
OWN = -o root -g root
INSTDOCS = 0644
INSTEXE = 0755
SYSCONFDIR =/etc
CONFDIR = $(SYSCONFDIR)/elphel393
INSTALL = install
DOCS= index.html \
test_goggles.html \
test_rc.html
PHP_SCRIPTS_EXE=lwir16.php \
dualsock.php \
test_int.php \
test_wpipe.php \
test_ps.php
CONFIGS = lwir16.ini
all:
@echo "make all in src"
install:
@echo "make install in src"
$(INSTALL) $(OWN) -d $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(DOCS) $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTEXE) $(PHP_SCRIPTS_EXE) $(DOCUMENTROOT)
$(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)
$(INSTALL) -d $(DESTDIR)$(CONFDIR)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(CONFIGS) $(DESTDIR)$(CONFDIR)
clean:
@echo "make clean in src"
#!/usr/bin/php
<?php
/*!*******************************************************************************
*! FILE NAME : dualsock.php
*! DESCRIPTION: Skeleton websockets server to connect to 2 smartphones -
*! 1 for stereo goggles, anothe as a hand-held RC
*! Copyright (C) 2021 Elphel, Inc
*! -----------------------------------------------------------------------------**
*!
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*!
*/
// print_r($argv);
set_include_path ( get_include_path () . PATH_SEPARATOR . '/www/pages/include' );
include 'show_source_include.php';
include 'elphel_functions_include.php'; // includes curl functions
define('SOCK_GOGGLES_FILE', '/tmp/wstunnel-nobin.socket'); // defined in /etc/lighttpd.conf ws://<ip>:80/ws-nobin/"
define('SOCK_REMOTE_CONTROL_FILE', '/tmp/wstunnel-nobin1.socket'); // defined in /etc/lighttpd.conf ws://<ip>:80/ws-nobin1/"
define('SOCK_GOGGLES', 'SOCK_GOGGLES');
define('SOCK_REMOTE_CONTROL', 'SOCK_REMOTE_CONTROL');
define('LOGFILE', '/tmp/dualsock.log');
set_time_limit(0); // no limit - run forever
logmsg('Staring dualsock.php');
if(file_exists(SOCK_GOGGLES_FILE)) unlink(SOCK_GOGGLES_FILE); //delete socket if it was already there
if(file_exists(SOCK_REMOTE_CONTROL_FILE)) unlink(SOCK_REMOTE_CONTROL_FILE); //delete socket if it was already there
init();
$GLOBALS[SOCK_GOGGLES] = socket_create(AF_UNIX, SOCK_STREAM, 0);
$GLOBALS[SOCK_REMOTE_CONTROL] = socket_create(AF_UNIX, SOCK_STREAM, 0);
socket_bind($GLOBALS[SOCK_GOGGLES], SOCK_GOGGLES_FILE); // bind new socket with filesystem path
socket_bind($GLOBALS[SOCK_REMOTE_CONTROL], SOCK_REMOTE_CONTROL_FILE);
socket_set_block($GLOBALS[SOCK_GOGGLES]); // will wait for data available /ready to accept
socket_set_block($GLOBALS[SOCK_REMOTE_CONTROL]); // will wait for data available /ready to accept
socket_listen($GLOBALS[SOCK_GOGGLES]); // will listen to the socket for incoming data
socket_listen($GLOBALS[SOCK_REMOTE_CONTROL]); // will listen to the socket for incoming data
// Warning: socket_write(): unable to write to socket [32]: Broken pipe in /www/pages/lwir16/dualsock.php on line 103
// Main loop
while (1) {
$read = array(
$GLOBALS[SOCK_GOGGLES],
$GLOBALS[SOCK_REMOTE_CONTROL]
);
$write = NULL;
$except = NULL;
$select_timeout_sec = 5; // will be used for housekeeping actions, needed if there are no incoming commands
$select_timeout_usec = 0; // when need faster than number of seconds
$num_changed_sockets = socket_select(
$read, // will modify array to have only ready connections
$write,
$except,
$select_timeout_sec,
$select_timeout_usec
); // wait
if ($num_changed_sockets === false) {
/* Error handling */
logmsg ("Error: socket_select returned false!");
sleep (1);
continue;
} else if ($num_changed_sockets > 0) {
/* At least at one of the sockets something interesting happened */
$active_connections = array();
if (in_array($GLOBALS[SOCK_GOGGLES], $read)) {
$active_connections[SOCK_GOGGLES] = socket_accept($GLOBALS[SOCK_GOGGLES]);
}
if (in_array($GLOBALS[SOCK_REMOTE_CONTROL], $read)) {
$active_connections[SOCK_REMOTE_CONTROL] = socket_accept($GLOBALS[SOCK_REMOTE_CONTROL]);
}
// now $active_connections contain one or two temporary sockets, to read command through and respond, if empty - close
foreach ($active_connections as $name=>$conn) {
logmsg("Processing connection $name");
processConnection($conn, $name);
}
} else { // do housekeeping functions
logmsg ("No incoming commands - do housekeeping routines");
}
} // end of while (1) -main loop
function processConnection($conn, $name){
// Just read lines and respond with the name to each until read empty string
while (1) {
$sr = socket_read($conn, 1000);
logmsg($name." -> ".$sr." (".strlen($sr)." bytes)");
if (!$sr){
break; // happens when timeout and websocket is closed (or page refreshed)
}
if (strlen($sr) < 2){
break;
}
$sw = socket_write($conn, $name.", got ".$sr." from you");
}
socket_close($conn);
logmsg($name." closed");
}
function logmsg($msg){
file_put_contents(LOGFILE, time().': '.$msg."\n", FILE_APPEND);
}
function init(){
// Add all required initialization before establishing connection to the clients
}
?>
This diff is collapsed.
#configuration for LWIR 16 camera
multicam_dir = "footage01"
multicam_rperiod = 5.0
multicam_speriod = 2.0
#save current settings to overwrite those in this file
multicam_conf = "/etc/elphel393/multicamconf.xml"
ips = "192.168.0.41,192.168.0.42,192.168.0.43,192.168.0.44,192.168.0.45"
port_masks= "15,15,15,15,15"
duration = 100
pre_delay = 3.0
ffc_period = 30.0
ffc_groups = 2
ffc_frames = 8
ffc = 1
tiff_telem = 1
tiff_mn = 0
tiff_mx = 65535
tiff_bin_shift = 1
tiff_auto = 0
debug = 1
# no spaces around commas!
CMD = INIT,START
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<meta charset="utf-8"/>
<!-- modified from example in https://github.com/joewalnes/websocketd README.md -->
<pre id="log"></pre>
<script>
// helper function: log message to screen
var logelt = document.getElementById('log');
function log(msg) { logelt.textContent += msg + '\n'; }
// helper function: send websocket msg with count (1 .. 5)
var host = location.hostname;
log('SERVER: '+host);
var ll = 0;
function send_msg() {
if (++ll <= 5) {
log('SEND: '+ll);
ws.send(ll+'\n');
} else if (ll <=6){
ws.send('\n');
log('SEND: '+ll);
}
console.log("ll="+ll);
}
// setup websocket with callbacks
var ws = new WebSocket('ws://'+host+':80/ws-nobin/');
ws.onopen = function() { log('CONNECT\n'); send_msg(); };
ws.onclose = function() { log('DISCONNECT'); };
ws.onmessage = function(event) { log('RECV: ' + event.data); send_msg(); };
</script>
#!/usr/bin/php
<?php
set_include_path ( get_include_path () . PATH_SEPARATOR . '/www/pages/include' );
include 'show_source_include.php';
include "elphel_functions_include.php"; // includes curl functions
$pipe_cmd="/tmp/pipe_cmd";
$pipe_response="/tmp/pipe_response";
$mode=0600;
declare(ticks = 1);
pcntl_signal(SIGTERM, "signal_handler");
pcntl_signal(SIGINT, "signal_handler");
function signal_handler($signal) {
switch($signal) {
case SIGTERM:
print "Caught SIGTERM\n";
exit;
case SIGKILL:
print "Caught SIGKILL\n";
exit;
case SIGINT:
print "Caught SIGINT\n";
exit;
}
}
if(file_exists($pipe_cmd)){
unlink($pipe_cmd); //delete pipe if it was already there - waiting prevents signal handling!
}
while(1) {
if(file_exists($pipe_cmd)) {
//block and read from the pipe
$f = fopen($pipe_cmd,"r");
echo "(r) opened cmd\n";
$l = fgets($f);
fclose ($f);
echo "(r) closed cmd\n";
unlink($pipe_cmd); //delete pipe
echo "(r) deleted cmd\n";
if(!file_exists($pipe_response)) {
// create the pipe
umask(0);
posix_mkfifo($pipe_response,$mode);
}
$fr = fopen($pipe_response,"w");
fwrite($fr,"response1: ".$l);
fwrite($fr,"response2: ".$l);
fwrite($fr,"response3: ".$l);
echo "(r) sent responses\n";
sleep(1);
fclose ($fr);
echo "(r) closed response pipe\n";
}
//
}
?>
#!/usr/bin/php
<?php
print_r($argv);
set_include_path ( get_include_path () . PATH_SEPARATOR . '/www/pages/include' );
include 'show_source_include.php';
include "elphel_functions_include.php"; // includes curl functions
$name = 'test_ps.php'; // int.php';
$interpreter='php';
echo "\n--------- interpreter=$interpreter, name = $name ----------\n";
$arr = getPIDByName($name, $interpreter, $active_only=false);
// var_dump($arr);
print_r($arr);
$name = 'test_ps.php'; // 'php-cgi';
$interpreter='';
echo "\n--------- interpreter=$interpreter, name = $name ----------\n";
$arr = getPIDByName($name, $interpreter, $active_only=false);
// var_dump($arr);
print_r($arr);
$interpreter='python';
$name = 'tempmon.py';
echo "\n--------- interpreter=$interpreter, name = $name ----------\n";
$arr = getPIDByName($name, $interpreter, $active_only=false);
// var_dump($arr);
print_r($arr);
?>
<!DOCTYPE html>
<meta charset="utf-8"/>
<!-- modified from example in https://github.com/joewalnes/websocketd README.md -->
<pre id="log"></pre>
<script>
// helper function: log message to screen
var logelt = document.getElementById('log');
function log(msg) { logelt.textContent += msg + '\n'; }
// helper function: send websocket msg with count (1 .. 5)
var host = location.hostname;
log('SERVER: '+host);
var ll = 0;
function send_msg() {
if (++ll <= 5) {
log('SEND: '+ll);
ws.send(ll+'\n');
} else if (ll <=6){
ws.send('\n');
log('SEND: '+ll);
}
console.log("ll="+ll);
}
// setup websocket with callbacks
var ws = new WebSocket('ws://'+host+':80/ws-nobin1/');
ws.onopen = function() { log('CONNECT\n'); send_msg(); };
ws.onclose = function() { log('DISCONNECT'); };
ws.onmessage = function(event) { log('RECV: ' + event.data); send_msg(); };
</script>
#!/usr/bin/php
<?php
define('PIPE_CMD', '/tmp/pipe_cmd');
define('PIPE_RESPONSE', '/tmp/pipe_response');
define('PIPE_MODE', 0600);
set_include_path ( get_include_path () . PATH_SEPARATOR . '/www/pages/include' );
include 'show_source_include.php';
include "elphel_functions_include.php"; // includes curl functions
$cmd = 'STATUS';
$kw = 'CMD';
if (count($argv) > 2){
$kw = $argv[1];
$cmd = $argv[2];
} else if (count($argv) > 1){
$cmd = $argv[1];
}
$mode=0600;
if(!file_exists(PIPE_CMD)) {
// create the pipe
umask(0);
posix_mkfifo(PIPE_CMD,$mode);
}
if (file_exists(PIPE_RESPONSE)){
unlink(PIPE_RESPONSE); //delete old pipe
}
$f = fopen(PIPE_CMD,"w");
// sleep(1);
$cmds = $kw.' = '.$cmd."\n";
fwrite($f,$cmds);
// sleep (1);
echo "(w) sent commands:\n".$cmds."\n";
fclose ($f);
// sleep(1);
echo "(w) closed\n";
if ($cmd == 'STATUS') {
while (!file_exists(PIPE_RESPONSE)); // just wait
echo "(w) got PIPE_RESPONSE\n";
$fl = file(PIPE_RESPONSE);
var_dump($fl);
unlink(PIPE_RESPONSE); //delete pipe
}
?>
DOCUMENTROOT=$(DESTDIR)/www/pages/multicam
DOCUMENTROOTZIP=$(DESTDIR)/www/pages/js/zip
OWN = -o root -g root
INSTDOCS = 0644
INSTALL = install
DOCS= index.html \
index1.html \
index2.html \
multicam.js \
multicam2.js \
multicam.css \
multicam.php
multicam2.css \
multicam.php \
multicam2.php \
reboot.html
ZIPDOCS= zip/deflate.js \
zip/inflate.js \
zip/z-worker.js \
zip/zip.js
all:
@echo "make all in src"
......@@ -14,6 +26,8 @@ install:
@echo "make install in src"
$(INSTALL) $(OWN) -d $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(DOCS) $(DOCUMENTROOT)
$(INSTALL) $(OWN) -d $(DOCUMENTROOTZIP)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(ZIPDOCS) $(DOCUMENTROOTZIP)
clean:
@echo "make clean in src"
......@@ -7,6 +7,7 @@
<script src="../js/jquery-3.1.1.js"></script>
<script src="../js/elphel.js"></script>
<script src="../js/jcanvas.js"></script>
<script src="../js/UTIF.js"></script>
<script src="../js/exif.js"></script>
<script src="../js/jquery-jp4.js"></script>
<script src="../js/zip/zip.js"></script>
......
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Multi cameras control</title>
<script src="../js/jquery-3.1.1.js"></script>
<script src="../js/elphel.js"></script>
<script src="../js/jcanvas.js"></script>
<script src="../js/UTIF.js"></script>
<script src="../js/exif.js"></script>
<script src="../js/jquery-jp4.js"></script>
<script src="../js/zip/zip.js"></script>
<link rel="stylesheet" href="../js/bootstrap/css/bootstrap.css">
<script type='text/javascript' src='multicam.js'></script>
<link rel='stylesheet' type='text/css' href='multicam.css'></link>
</head>
<!-- 192.168.0.41/multicam/index1.html?ip=192.168.0.41,192.168.0.42,192.168.0.43,192.168.0.44,192.168.0.45 -->
<body>
<div id='settings'>
<table>
<tr>
<td>
<div id='rec_button' class='rec_outer' title='start recording'>
<div class='rec_inner'></div>
</div>
</td>
<td>
<button id='snapshot' title='download snapshot' class="btn btn-sm btn-danger">snapshot</button>
</td>
</tr>
<tr id="toggle_awb" title='Auto White Balance'>
<td>Auto WB:</td>
<td>
<div id="toggle_awb" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td>
</tr>
<tr id="toggle_aexp" title='Auto Exposure'>
<td>Auto Exposure:</td>
<td>
<div id="toggle_aexp" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td>
</tr>
<tr>
<td>
<button id='system_tests' title='system info' class="btn btn-sm btn-success">tests</button>
</td>
</tr>
<tr>
<td hidden>
<br/>
<div id='edit_addrs_input' hidden>
<div id='eai_text_div'>
<textarea id='eai_text' rows='4' cols='30'></textarea>
</div>
<div id='eai_ok_div'>
<button id='eai_ok' class="btn btn-sm btn-success">ok</button>
</div>
</div>
<div id='edit_addrs' title='edit ip addresses'>
<button id='ea_btn' class="btn btn-sm btn-success">+</button>
</div>
<div id='addrs'>
</div>
</td>
</tr>
</table>
</div>
<div id='display'>
<div id='display_status'></div>
<hr/>
<div id='display_previews'></div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Multi cameras control</title>
<script src="../js/jquery-3.1.1.js"></script>
<script src="../js/elphel.js"></script>
<script src="../js/jcanvas.js"></script>
<script src="../js/UTIF.js"></script>
<script src="../js/exif.js"></script>
<script src="../js/jquery-jp4.js"></script>
<script src="../js/zip/zip.js"></script>
<link rel="stylesheet" href="../js/bootstrap/css/bootstrap.css">
<script type='text/javascript' src='multicam2.js'></script>
<link rel='stylesheet' type='text/css' href='multicam2.css'></link>
</head>
<!-- 192.168.0.41/multicam/index1.html?ip=192.168.0.41,192.168.0.42,192.168.0.43,192.168.0.44,192.168.0.45 -->
<body>
<div id='display_all'>
<div id='display_previews'></div>
<div id='display_controls'>
<button type="button" class="collapsible">Recording Status</button>
<div id='display_status'></div>
<button type="button" class="collapsible">LWIR16 Status</button>
<div id='lwir16_status'>
<table><tr><td>
<table>
<tr><td><label for="seq_num" >Seq Num</label></td><td><input type="text" id="idsequence_num" name="seq_num" size="5" value="?" disabled="disabled"></td></tr>
<tr><td><label for="request_num">Requests</label></td><td><input type="text" id="idrequest_num" name="request_num" size="5" value="?" disabled="disabled"></td></tr>
<tr><td><label for="capture_run">Running</label></td><td><input type="checkbox" id="idcapture_run" name="capture_run" disabled="disabled"></td></tr>
</table>
</td><td>
<table>
<tr><td><label for="last_ffc" >Last FFC</label></td><td><input type="text" id="idlast_ffc" name="last_ffc" size="5" value="?" disabled="disabled">s</td></tr>
<tr><td><label for="time_to_ffc" >To FFC</label></td><td><input type="text" id="idtime_to_ffc" name="time_to_ffc" size="5" value="?" disabled="disabled">s</td></tr>
<tr><td colspan = "2">&nbsp;</td></tr>
</table>
</td></tr></table>
</div>
<button type="button" class="collapsible">LWIR16 Controls</button>
<div id='lwir16_controls'>
<table><tr><td>
<table>
<tr><td><button id="idStartStop" name = "nStartStop" disabled="true">???</button></td>
<td><button id="idApply" name = "nApply" disabled = "true">???</button></td>
</tr>
<tr><td><label for="idpre_delay" >Inter-Delay</label></td><td><input type="text" id="idpre_delay" name="pre_delay" size="5" value="?">s</td></tr>
<tr><td><label for="duration" >LWIR frames</label></td><td><input type="text" id="idduration" name="duration" size="5" value="?"></td></tr>
<tr><td><label for="duration_eo" >RGB frames</label></td><td><input type="text" id="idduration_eo" name="duration_eo" size="5" value="?"></td></tr>
<tr><td><label for="compressor_run">Compress Init</label></td><td><input type="checkbox" id="idcompressor_run" name="compressor_run"></td></tr>
</table>
</td><td>
<table>
<tr><td><label for="ffc" >FFC</label></td><td><input type="checkbox" id="idffc" name="ffc"></td></tr>
<tr><td><label for="ffc_period" >FFC period</label></td><td><input type="text" id="idffc_period" name="ffc_period" size="5" value="?"></td></tr>
<tr><td><label for="ffc_groups" >FFC groups</label></td><td><select id="idffc_groups" name="idffc_groups">
<option value="1">1</option>
<option value="2">2</option>
<option value="4" selected="selected">4</option>
</select>
</td></tr>
<tr><td><label for="ffc_frames" >FFC frames</label></td><td><input type="text" id="idffc_frames" name="ffc_frames" size="5" value="?"></td></tr>
<tr><td><label for="debug" >Debug</label></td><td><input type="text" id="iddebug" name="debug" size="5" value="?"></td></tr>
</table>
</td></tr></table>
</div>
<button type="button" class="collapsible">Multicam Controls</button>
<div id='multicam settings'>
<table>
<tr>
<td>
<table>
<th><td colspan="2">Image Refresh<td> </th>
<tr> <td><label>Enable</label></td>
<td>
<div id="toggle_refresh" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td> </tr>
<tr><td><label for="ref_rate">Images</label></td>
<td><input type="text" id="ref_rate" name="ref_rate" size="4">s</td>
</tr><tr>
<td><label for="sref_rate">Status</label></td>
<td><input type="text" id="sref_rate" name="sref_rate" size="4">s
</td> </tr>
</table>
</td>
<td>
<table><th><td colspan="2">SSD Recording<td> </th>
<tr><td><label>Record</label></td>
<td><div id="toggle_record" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td>
</tr><tr> <td><label id = "root_dir" for="ssd_directory">/mnt/sda1/</label></td>
<td><input type="text" id="dir_name" name="ssd_directory" size="10"></td>
</tr><tr><td colspan="2">&nbsp;</td></tr></table>
</td>
</tr>
</table>
</div>
<button type="button" class="collapsible">Eyesis Controls</button>
<div id='settings'>
<table>
<tr>
<td>
<div id='rec_button' class='rec_outer' title='start recording'>
<div class='rec_inner'></div>
</div>
</td>
<td>
<button id='snapshot' title='download snapshot' class="btn btn-sm btn-danger">snapshot</button>
</td>
</tr>
<tr id="toggle_awb" title='Auto White Balance'>
<td>Auto WB:</td>
<td>
<div id="toggle_awb" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td>
</tr>
<tr id="toggle_aexp" title='Auto Exposure'>
<td>Auto Exposure:</td>
<td>
<div id="toggle_aexp" class="btn-group btn-toggle">
<button class="btn btn-xs btn-success active">ON</button>
<button class="btn btn-xs btn-default">OFF</button>
</div>
</td>
</tr>
<tr id="manual_exposure_div" title='Manual Exposure'>
<td><label for="exposure_ms">Manual</label></td>
<td><input type="text" id="exposure_ms" name="exposure_ms" size="6" value="50">ms</td>
</tr>
<tr id="image_quality_div" title='Image Quality'>
<td><label for="jpeg_quality">Quality</label></td>
<td><input type="text" id="jpeg_quality" name="jpeg_quality" size="6" value="97">%</td>
</tr>
<tr>
<td>
<button id='system_tests' title='system info' class="btn btn-sm btn-success">tests</button>
</td>
</tr>
<tr>
<td hidden>
<br/>
<div id='edit_addrs_input' hidden>
<div id='eai_text_div'>
<textarea id='eai_text' rows='4' cols='30'></textarea>
</div>
<div id='eai_ok_div'>
<button id='eai_ok' class="btn btn-sm btn-success">ok</button>
</div>
</div>
<div id='edit_addrs' title='edit ip addresses'>
<button id='ea_btn' class="btn btn-sm btn-success">+</button>
</div>
<div id='addrs'>
</div>
</td>
</tr>
</table> <!-- settings table -->
</div> <!-- id='settings' -->
</div> <!-- controls -->
</div>
</body>
</html>
\ No newline at end of file
......@@ -49,6 +49,7 @@ var cams = [];
var wb_en = 1;
var aexp_en = 1;
var skip_previews = 0;
$(function(){
......@@ -62,12 +63,18 @@ function parseURL(){
var parameters=location.href.replace(/\?/ig,"&").split("&");
for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("=");
for (var i=1;i<parameters.length;i++) {
// alert("parseURL(): parameter: "+parameters[i][0]+"="+parameters[i][1]);
// console.log("parseURL(): parameter: "+parameters[i][0]+"="+parameters[i][1]);
switch (parameters[i][0]) {
case "ip":
//ips_from_url = true;
ips_str = parameters[i][1];
ips_str = ips_str.replace(/,|;/gm,'\n');
break;
case "skip_previews": // do not show previews - terribly slow for Bosons
skip_previews = 1;
// alert("parseURL(): got skipping previews");
break;
}
}
......@@ -294,8 +301,11 @@ function rec_button_update_state(){
recording = true;
rec_button_switch(recording);
}
refresh_previews_intvl = setInterval(refresh_previews,2000);
if (!skip_previews) { // do not schedule previews as they are very slow for Bosons
refresh_previews_intvl = setInterval(refresh_previews,2000);
} else {
// alert("skipping previews");
}
refresh_status_intvl = setInterval(refresh_status,2000);
}
......@@ -342,6 +352,19 @@ function init_port(cam_i,port_i){
}
});
var url = "http://"+cams[cam_i].ip+"/parsedit.php?immediate&sensor_port="+cams[cam_i].ports[port_i].index+"&BITS";
$.ajax({
url: url,
cam_i: cam_i,
port_i: port_i,
success: function(res){
bits = parseInt($(res).find("BITS").text());
cams[this.cam_i].ports[this.port_i].bits = bits;
}
});
}
// * if any attribute is not initialized it will be NaN
......@@ -467,6 +490,7 @@ function refresh_previews(){
if (cams[i].init){
for(var j=0;j<cams[i].ports.length;j++){
var cam = cams[i];
var is_lwir = cam.ports[j].bits > 8;
//var img_src = 'http://'+cam.ip+':'+cam.ports[j].port+'/img?'+ts;
var hst_src = 'http://'+cam.ip+'/pnghist.cgi?sensor_port='+cam.ports[j].index+'&sqrt=1&scale=5&average=5&height=128&fillz=1&linterpz=0&draw=2&colors=41&_time='+ts;
......@@ -476,9 +500,15 @@ function refresh_previews(){
if (!cam.ports[j].preview){
//console.log("preview does not exist");
var jp4prev = elem.find(".port_preview[index="+j+"]");
var imgsrv_img = "/img";
if (is_lwir){
imgsrv_img = "/tiff_palette=2/tiff_telem=1/tiff_auto=33/tiff_convert/bimg";
}
var preview = jp4prev.jp4({
ip: cam.ip,
port: cam.ports[j].port,
//ip: cam.ip,
//port: cam.ports[j].port,
// src: "http://"+cam.ip+":"+cam.ports[j].port+"/img",
src: "http://"+cam.ip+":"+cam.ports[j].port+imgsrv_img,
width: 200,
fast: true,
lowres:4,
......@@ -492,11 +522,10 @@ function refresh_previews(){
cam.ports[j].preview.data.refresh();
}
//console.log(jp4prev.data.getAddr());