Commit a8ce685b authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. +functions.js 2. filter out errors that are not actual errors

parent baab9071
......@@ -12,6 +12,7 @@
<script src="js/jquery-ui-1.12.1.custom/jquery-ui.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.12.1.custom/jquery-ui.theme.min.css" />
-->
<script src="js/functions.js" type="text/javascript"></script>
<script src="js/temperatures.js" type="text/javascript"></script>
<script src="js/settings.js" type="text/javascript"></script>
<script src="js/tabs.js" type="text/javascript"></script>
......
......@@ -74,22 +74,22 @@ function camogm_create_table(){
tmpstr = cams[i].ip;
ssdid1 = "cam"+j+"_sda1";
ssdid2 = "cam"+j+"_sda2";
camogm_err = "camogm_error_"+j;
j++;
}else{
tmpstr = "";
ssdid1 = "";
ssdid2 = "";
camogm_err = "";
}
camogm_err = "camogm_error_"+i;
table_html += "<tr>\n\t\
<td>"+tmpstr+"</td>\
<td id='"+ssdid1+"' align='right'></td>\
<td id='"+ssdid2+"' align='right'></td>\
<td align='center'>"+(i+1)+"</td>\
<td><div id='buffer"+i+"_sum' class='buffer'><div id='buffer"+i+"' style='width:200px;' class='buffer_free'>free</div></div></td>\
<td align='center'><div id='"+camogm_err+"'></div></td>\
<td align='left'><div id='"+camogm_err+"'></div></td>\
</tr>";
}
}
......@@ -145,6 +145,7 @@ function camogm_parse_status(data){
var camogm_states = $(data).find('camogm_state');
/*
var unique_cams = get_unique_cams();
for(var i=0;i<unique_cams.length;i++){
......@@ -155,6 +156,7 @@ function camogm_parse_status(data){
$("#camogm_error_"+i).append($("<span style='color:red;'>"+last_error+",&nbsp</span>"));
}
}
*/
for(var i=0;i<cams.length;i++){
ucam_index = get_unique_cams_index(cams[i]);
......@@ -174,6 +176,40 @@ function camogm_parse_status(data){
$("#buffer"+i).css({width:(Math.round(buf_free/buf_sum*$("#buffer"+i+"_sum").width()))+"px"});
}
for(var i=0;i<cams.length;i++){
ucam_index = get_unique_cams_index(cams[i]);
cam_port = cams[i].channel;
var tmp_xml = $(camogm_states[ucam_index]).find("sensor_port_"+cam_port);
if (tmp_xml.length!=0){
var errors = Array(
parseInt($(tmp_xml).find("frame_not_ready").text()),
parseInt($(tmp_xml).find("frame_invalid").text()),
parseInt($(tmp_xml).find("frame_nextfile").text()),
parseInt($(tmp_xml).find("frame_changed").text()),
parseInt($(tmp_xml).find("frame_broken").text()),
parseInt($(tmp_xml).find("frame_file_err").text()),
parseInt($(tmp_xml).find("frame_malloc").text()),
parseInt($(tmp_xml).find("frame_too_early").text()),
parseInt($(tmp_xml).find("frame_other").text()),
parseInt($(tmp_xml).find("frame_nospace").text())
);
//not errors
errors[0] = 0;
errors[3] = 0;
var camogm_error = "";
for(var j=0;j<errors.length;j++){
if (errors[j]!=0) camogm_error += "err"+(j+1)+"("+errors[j]+"),&nbsp";
}
$("#camogm_error_"+i).html($("<span style='color:red;'>"+camogm_error+"</span>"));
}
}
if (camogm_en) {
//status_update(state);
$("#status").html(state);
......
......@@ -55,17 +55,6 @@ var cams = [
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0}
];
function get_master_index(){
for (var i=0;i<cams.length;i++) if (cams[i].master==1) return i;
return -1;
}
function get_logger_index(){
for (var i=0;i<cams.length;i++) if (cams[i].logger==1) return i;
return -1;
}
// for PC recording
function check_footage_path(){
$.ajax({
......@@ -330,49 +319,6 @@ function send_cmd(cmd){
}
}
function cams_to_str(){
var rq_str = "";
for(var i=0;i<cams.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += cams[i].ip+":"+cams[i].port+":"+cams[i].channel+":"+cams[i].master+":"+cams[i].logger;
}
return rq_str;
}
function get_unique_rq_str(){
res_full = get_unique_cams();
rq_str = "";
for(var i=0;i<res_full.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += res_full[i].ip+":"+res_full[i].port+":"+res_full[i].channel+":"+res_full[i].master+":"+res_full[i].logger;
}
return rq_str;
}
function get_unique_cams(){
res = [];
res_full = [];
for(var i=0;i<cams.length;i++){
if (res.indexOf(cams[i].ip)==-1) {
res.push(cams[i].ip);
res_full.push(cams[i]);
}
}
return res_full;
}
function get_unique_cams_index(cam){
ucam = get_unique_cams();
for(var i=0;i<ucam.length;i++){
if (cam.ip==ucam[i].ip) return i;
}
return -1;
}
function settings_activate() {
if (!$("#settings").is(":visible")) {
$("#settings").css({top:'50px',left:'10px','z-index':3}).fadeToggle(300,function(){
......
/*
var cams = [
{"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0},
{"ip":"192.168.0.161","port":2325,"channel":2,"master":0,"logger":0},
{"ip":"192.168.0.161","port":2323,"channel":0,"master":0,"logger":1},
{"ip":"192.168.0.161","port":2324,"channel":1,"master":0,"logger":0},
{"ip":"192.168.0.162","port":2326,"channel":3,"master":0,"logger":0},
{"ip":"192.168.0.162","port":2325,"channel":2,"master":0,"logger":0},
{"ip":"192.168.0.162","port":2323,"channel":0,"master":0,"logger":0},
{"ip":"192.168.0.162","port":2324,"channel":1,"master":0,"logger":0},
{"ip":"192.168.0.163","port":2325,"channel":2,"master":1,"logger":0},
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0}
];
*/
function get_master_index(){
for (var i=0;i<cams.length;i++) if (cams[i].master==1) return i;
return -1;
}
function get_logger_index(){
for (var i=0;i<cams.length;i++) if (cams[i].logger==1) return i;
return -1;
}
function cams_to_str(){
var rq_str = "";
for(var i=0;i<cams.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += cams[i].ip+":"+cams[i].port+":"+cams[i].channel+":"+cams[i].master+":"+cams[i].logger;
}
return rq_str;
}
function get_unique_rq_str(){
res_full = get_unique_cams();
rq_str = "";
for(var i=0;i<res_full.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += res_full[i].ip+":"+res_full[i].port+":"+res_full[i].channel+":"+res_full[i].master+":"+res_full[i].logger;
}
return rq_str;
}
function get_unique_cams(){
res = [];
res_full = [];
for(var i=0;i<cams.length;i++){
if (res.indexOf(cams[i].ip)==-1) {
res.push(cams[i].ip);
res_full.push(cams[i]);
}
}
return res_full;
}
function get_unique_cams_index(cam){
ucam = get_unique_cams();
for(var i=0;i<ucam.length;i++){
if (cam.ip==ucam[i].ip) return i;
}
return -1;
}
......@@ -22,51 +22,6 @@ var cams = [
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0}
];
function get_master_index(){
for (var i=0;i<cams.length;i++) if (cams[i].master==1) return i;
return -1;
}
function get_logger_index(){
for (var i=0;i<cams.length;i++) if (cams[i].logger==1) return i;
return -1;
}
function get_unique_cams(){
res = [];
res_full = [];
for(var i=0;i<cams.length;i++){
if (res.indexOf(cams[i].ip)==-1) {
res.push(cams[i].ip);
res_full.push(cams[i]);
}
}
return res_full;
}
function get_unique_rq_str(){
res_full = get_unique_cams();
rq_str = "";
for(var i=0;i<res_full.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += res_full[i].ip+":"+res_full[i].port+":"+res_full[i].channel+":"+res_full[i].master+":"+res_full[i].logger;
}
return rq_str;
}
function cams_to_str(){
var rq_str = "";
for(var i=0;i<cams.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += cams[i].ip+":"+cams[i].port+":"+cams[i].channel+":"+cams[i].master+":"+cams[i].logger;
}
return rq_str;
}
function parseURL() {
/*
var parameters=location.href.replace(/\?/ig,"&").split("&");
......
......@@ -3,6 +3,7 @@
<title>Eyesis4Pi tests</title>
<link rel="shortcut icon" href="favicon.ico" />
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script src="js/tests.js" type="text/javascript"></script>
<script src="js/temperatures.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="js/temperatures.css" />
......
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