Commit 89621f29 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

dl exif histories if '?debug' in GET

parent 0221ad74
......@@ -29,6 +29,8 @@
$trig_master = -1;
$trig_master_port = -1;
$dl_exif_histories = 0;
for($i=0;$i<4;$i++){
$sensor = $path."/sensor{$i}0";
......@@ -47,7 +49,12 @@
$trig_master_port = $trig_master + $port0;
}
if (isset($_GET['debug'])){
$dl_exif_histories = 1;
}
if ($trig_master>=0){
if (isset($_GET['trig'])){
// just in case one wants to override master
......@@ -60,6 +67,34 @@
die("trigger ok: http://{$_SERVER['SERVER_ADDR']}:$trig_master_port/trig/pointers");
}
// get exif data from all buffers in a single text file
if (isset($_GET['exifs'])){
if (isset($_GET['sensor_port'])){
$port = $_GET['sensor_port'];
}else{
$port = $available_ports[0]-$port0;
}
$circbuf_pointers = elphel_get_circbuf_pointers($port,1);
// get metas
$meta = array();
foreach($circbuf_pointers as $k=>$v){
$meta[$k] = array (
'circbuf_pointer' => $v['circbuf_pointer'],
'meta' => elphel_get_interframe_meta($port,$v['circbuf_pointer']),
'Exif' => elphel_get_exif_elphel($port, $v['exif_pointer'])
);
}
print_r($meta);
die();
}
}
?>
......@@ -131,10 +166,13 @@
<script>
var ip = location.origin;
var href = location.href;
//var href = location.href;
var ports = [<?php echo implode(",",$available_ports);?>];
var trig_master = <?php echo $trig_master;?>;
var trig_master_port = <?php echo $trig_master_port;?>;
var dl_exif_histories = <?php echo $dl_exif_histories;?>;
</script>
</head>
......
var tp_old = 0;
var DLC = 0;
var DLC_exif = 0;
var filenames = [];
function take_snapshot(){
......@@ -31,7 +33,7 @@ function read_trig_master(){
function trigger(){
$.ajax({
url:href+"?trig",
url:"?trig",
success:function(){
setTimeout(function(){
......@@ -46,7 +48,8 @@ function download_all(rtp){
DLC = 0;
ports.forEach(function(c,i){
download_single(ip+":"+c+"/timestamp_name/img");
//download_single(ip+":"+c+"/timestamp_name/img");
download_single(ip+":"+c+"/timestamp_name/bimg");
});
}
......@@ -71,7 +74,12 @@ function download_single(addr){
DLC++;
if (DLC==ports.length){
if ($("#synced").prop("checked")) {
if (dl_exif_histories==1){
console.log("getting exif histories");
get_exifs();
}else{
read_tp();
}
}else{
$("#snapshot").attr("disabled",false);
}
......@@ -100,6 +108,8 @@ function pass_to_file_reader(filename,fileblob){
}
}
filenames.push(filename);
var url = window.URL.createObjectURL(fileblob);
var a = $('<a>')
......@@ -158,6 +168,55 @@ function pass_to_file_reader(filename,fileblob){
}
function get_exifs(){
DLC_exif = 0;
filenames.forEach(function(c,i){
var base = c.split(".");
base = base[0];
var port = base.split("_");
port = port[2];
var filename = base+"_exifs.txt";
var addr = "?exifs&sensor_port="+port;
var http = new XMLHttpRequest();
http.open("GET", addr, true);
http.responseType = "blob";
http.onload = function(e){
if (this.status === 200) {
// To access the header, had to add
// printf("Access-Control-Expose-Headers: Content-Disposition\r\n");
// to imgsrv
//var filename = this.getResponseHeader("Content-Disposition");
pass_to_file_reader(filename,http.response);
DLC_exif++;
if (DLC_exif==ports.length){
if ($("#synced").prop("checked")) {
// empty
filenames = [];
read_tp();
}else{
$("#snapshot").attr("disabled",false);
}
}
}
}
http.send();
});
}
function read_tp(){
var param = "TRIG_PERIOD";
......
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