You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
442 lines
14 KiB
HTML
442 lines
14 KiB
HTML
<%#
|
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
|
Licensed to the public under the Apache License 2.0.
|
|
-%>
|
|
|
|
|
|
<%
|
|
local sys = require("luci.sys")
|
|
luci.sys.exec('rm -f /tmp/modemdevice')
|
|
%>
|
|
|
|
<%+header%>
|
|
|
|
<h2 name="content"><%:Modeminfo%></h2>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
|
|
var bar_line = '<div class="cbi-progressbar">' +
|
|
'<div style="animation-direction: reverse; width:%d%%">' +
|
|
'<div style="position:absolute; bottom:0px">' +
|
|
'<p>%s</p>' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</div>';
|
|
|
|
function bar(v, m)
|
|
{
|
|
var vn = parseInt(v) || 0;
|
|
var mn = parseInt(m) || 100;
|
|
if (vn > -50) { vn = -50 };
|
|
if (vn < -110) { vn = -110 };
|
|
var pc = Math.floor(100*(1-(-50 - vn)/(-50 - mn)));
|
|
return String.format(bar_line, pc, v, m, pc);
|
|
}
|
|
|
|
function rsrp_bar(v, m)
|
|
{
|
|
var vn = parseInt(v) || 0;
|
|
var mn = parseInt(m) || 100;
|
|
if (vn > -50) { vn = -50 };
|
|
if (vn < -140) { vn = -140 };
|
|
var pc = Math.floor(100*(1-(-50 - vn)/(-50 - mn)));
|
|
return String.format(bar_line, pc, v, m, pc);
|
|
}
|
|
|
|
function sinr_bar(v, m)
|
|
{
|
|
var vn = parseInt(v) || 0;
|
|
var mn = parseInt(m) || 100;
|
|
var pc = Math.floor(100-(100*(1-((mn - vn)/(mn - 30)))));
|
|
return String.format(bar_line, pc, v, m, pc);
|
|
}
|
|
|
|
function rsrq_bar(v, m)
|
|
{
|
|
var vn = parseInt(v) || 0;
|
|
var mn = parseInt(m) || 100;
|
|
var pc = Math.floor(100-(100/mn)*vn);
|
|
if (vn > 0) { vn = 0; };
|
|
return String.format(bar_line, pc, v, m, pc);
|
|
}
|
|
|
|
|
|
XHR.poll(4, '<%=url("admin/modem/data")%>', null,
|
|
function(x, data)
|
|
{
|
|
// percent icon
|
|
var icon;
|
|
var p = (data.csq_per);
|
|
if (p < 0)
|
|
icon = "<%=resource%>/icons/signal-none.png";
|
|
else if (p == 0)
|
|
icon = "<%=resource%>/icons/signal-none.png";
|
|
else if (p < 10)
|
|
icon = "<%=resource%>/icons/signal-0.png";
|
|
else if (p < 25)
|
|
icon = "<%=resource%>/icons/signal-0-25.png";
|
|
else if (p < 50)
|
|
icon = "<%=resource%>/icons/signal-25-50.png";
|
|
else if (p < 75)
|
|
icon = "<%=resource%>/icons/signal-50-75.png";
|
|
else
|
|
icon = "<%=resource%>/icons/signal-75-100.png";
|
|
|
|
// reg data status
|
|
var reg;
|
|
var rg = (data.reg)
|
|
if (rg == 0)
|
|
reg = "<%:No Registration%>";
|
|
else if (rg == 1 || rg == 6 || rg == 9)
|
|
reg = "<%:Registered%>";
|
|
else if (rg == 2 || rg == 8)
|
|
reg = "<%:Searching%>";
|
|
else if (rg == 3)
|
|
reg = "<%:Denied%>";
|
|
else if (rg == 4)
|
|
reg = "<%:Unknown%>";
|
|
else if (rg == 5 || rg == 7 || rg == 10)
|
|
reg = "<%:Roaming%>";
|
|
else
|
|
reg = "<%:No Data%>";
|
|
|
|
// frequency band calculator
|
|
var frul;
|
|
var frdl;
|
|
var offset;
|
|
var band;
|
|
var netmode = (data.mode)
|
|
var rfcn = (data.arfcn)
|
|
if (netmode == "LTE") {
|
|
if (rfcn >= 0 && rfcn <= 599) {
|
|
var frdl = 2110;
|
|
var frul = 1920;
|
|
var offset = 0;
|
|
var band = "1";
|
|
} else if (rfcn >= 600 && rfcn <= 1199) {
|
|
var frdl = 1930;
|
|
var frul = 1850;
|
|
var offset = 600;
|
|
var band = "2";
|
|
} else if (rfcn >= 1200 && rfcn <= 1949) {
|
|
var frdl = 1805;
|
|
var frul = 1710;
|
|
var offset = 1200;
|
|
var band = "3";
|
|
} else if (rfcn >= 1950 && rfcn <= 2399) {
|
|
var frdl = 2110;
|
|
var frul = 1710;
|
|
var offset = 1950;
|
|
var band = "4";
|
|
} else if (rfcn >= 2400 && rfcn <= 2469) {
|
|
var rfdl = 869;
|
|
var frul = 824;
|
|
var offset = 2400;
|
|
var band = "5";
|
|
} else if (rfcn >= 2750 && rfcn <= 3449) {
|
|
var frdl = 2620;
|
|
var frul = 2500;
|
|
var offset = 2750;
|
|
var band = "7";
|
|
} else if (rfcn >= 3450 && rfcn <= 3799) {
|
|
var frdl = 925;
|
|
var frul = 880;
|
|
var offset = 3450;
|
|
var band = "8";
|
|
} else if (rfcn >= 6150 && rfcn <= 6449) {
|
|
var frdl = 791;
|
|
var frul = 832;
|
|
var offset = 6150;
|
|
var band = "20";
|
|
} else if (rfcn >= 9210 && rfcn <= 9659) {
|
|
var frdl = 758;
|
|
var frul = 703;
|
|
var offset = 9210;
|
|
var band = "28";
|
|
} else if (rfcn >= 9870 && rfcn <= 9919) {
|
|
var frdl = 452.5;
|
|
var frul = 462.5;
|
|
var offset = 9870;
|
|
var band = "31";
|
|
} else if (rfcn >= 37750 && rfcn <= 38249) {
|
|
var frdl = 2570;
|
|
var frul = 2570;
|
|
var offset = 37750;
|
|
var band = "38";
|
|
} else if (rfcn >= 38650 && rfcn <= 39649) {
|
|
var frdl = 2300;
|
|
var frul = 2300;
|
|
var offset = 38650;
|
|
var band = "40";
|
|
} else {
|
|
var offset = 0;
|
|
var frdl = 0;
|
|
var frul = 0;
|
|
var rfcn = 0;
|
|
var band = (rfcn);
|
|
}
|
|
var bwdld = (data.bwdl);
|
|
if (bwdld == 0) {
|
|
var bw = 1.4;
|
|
} else if (bwdld == 1) {
|
|
var bw = 3;
|
|
} else if (bwdld == 2) {
|
|
var bw = 5;
|
|
} else if (bwdld == 3) {
|
|
var bw = 10;
|
|
} else if (bwdld == 4) {
|
|
var bw = 15;
|
|
} else if (bwdld == 5) {
|
|
var bw = 20;
|
|
} else {
|
|
var bw = "";
|
|
}
|
|
var dlfreq = (frdl + (rfcn - offset)/10);
|
|
var ulfreq = (frul + (rfcn - offset)/10);
|
|
} else {
|
|
if (rfcn >= 10562 && rfcn <= 10838) {
|
|
var offset = 950;
|
|
var dlfreq = (rfcn/5);
|
|
var ulfreq = ((rfcn - offset)/5);
|
|
var band = "IMT2100";
|
|
} else if (rfcn >= 2937 && rfcn <= 3088) {
|
|
var frul = 925;
|
|
var offset = 340;
|
|
var ulfreq = (offset + (rfcn/5));
|
|
var dlfreq = (ulfreq - 45);
|
|
var band = "UMTS900";
|
|
} else if (rfcn >= 955 && rfcn <= 1023) {
|
|
var frul = 890;
|
|
var ulfreq = (frul + ((rfcn - 1024)/5));
|
|
var dlfreq = (ulfreq + 45);
|
|
var band = "DSC900";
|
|
} else if (rfcn >= 512 && rfcn <= 885) {
|
|
var frul = 1710;
|
|
var ulfreq = (frul + (rfcn - 512)/5);
|
|
var dlfreq = (ulfreq + 95);
|
|
var band = "DCS1800";
|
|
} else if (rfcn >= 1 && rfcn <= 124) {
|
|
var frul = 890;
|
|
var ulfreq = (frul + (rfcn/5));
|
|
var dlfreq = (ulfreq + 45);
|
|
var band = "GSM900";
|
|
} else {
|
|
var ulfreq = 0;
|
|
var dlfreq = 0;
|
|
var band = (rfcn);
|
|
}
|
|
}
|
|
var carrier = "";
|
|
var bcc;
|
|
var freq;
|
|
var distance;
|
|
var lactac;
|
|
var calte;
|
|
var namebnd;
|
|
var dist = (data.distance)
|
|
if (data.enbid && data.cell && data.pci) {
|
|
var namecid = "LAC/CID/eNB ID-Cell/PCI";
|
|
var lactac = data.lac + " / " + data.cid + " / " + data.enbid + "-" + data.cell +" / " +data.pci;
|
|
} else if (data.enbid && data.cell) {
|
|
var namecid = "LAC/CID/eNB ID-Cell";
|
|
var lactac = data.lac + " / " + data.cid + " / " + data.enbid + "-" + data.cell;
|
|
} else if (data.enbid) {
|
|
var namecid = "LAC/CID/eNB ID";
|
|
var lactac = data.lac + " / " + data.cid + " / " + data.enbid;
|
|
} else {
|
|
var namecid = "LAC/CID";
|
|
var lactac = data.lac + " / " + data.cid;
|
|
}
|
|
var carrier;
|
|
var bcc;
|
|
var bca = "";
|
|
var scc;
|
|
var cid;
|
|
var arfcn = data.arfcn + " (" + dlfreq + " / " + ulfreq + " MHz)";
|
|
// name channels and signal/noise
|
|
if (netmode == "LTE") {
|
|
var calte = (data.lteca)
|
|
var carrier;
|
|
var scc;
|
|
var bwca = data.bwca;
|
|
distance = " ~"+ dist +" Km";
|
|
if (calte > 0) {
|
|
carrier = "+";
|
|
scc = data.scc;
|
|
bw = bwca;
|
|
bca = " / " + bw + " MHz";
|
|
bcc = " B" + band + "" + scc;
|
|
} else {
|
|
scc = "";
|
|
bcc = " B" + band;
|
|
if (bw) {
|
|
bca = " / " + bw + " MHz";
|
|
} else{
|
|
bca = ""
|
|
}
|
|
}
|
|
var namech = "EARFCN";
|
|
var namesnr = "SINR";
|
|
//var lactac = data.lac + " (" + data.lac_num + ") / " + data.enbid;
|
|
} else if (netmode ==
|
|
"3G" || netmode ==
|
|
"UMTS" || netmode ==
|
|
"HSPA" || netmode ==
|
|
"HSUPA" || netmode ==
|
|
"HSDPA" || netmode ==
|
|
"HSPA+" || netmode ==
|
|
"WCDMA" || netmode ==
|
|
"DC-HSPA+" || netmode ==
|
|
"HSDPA+HSUPA" || netmode ==
|
|
"HSDPA,HSUPA") {
|
|
var namech = "UARFCN";
|
|
var namesnr = "ECIO";
|
|
var namecid = "LAC/CID";
|
|
var lactac = data.lac + " / " + data.cid;
|
|
var bcc = " " + band;
|
|
} else {
|
|
var namech = "ARFCN";
|
|
var namesnr = "SINR/ECIO";
|
|
var namecid = "LAC/CID";
|
|
var lactac = data.lac + " / " + data.cid;
|
|
var bcc = " " + band;
|
|
}
|
|
if (bw) {
|
|
namebnd = "<%:Network/Band/Bandwidth%>";
|
|
} else {
|
|
namebnd = "<%:Network/Band%>";
|
|
}
|
|
// stuff
|
|
if (e = document.getElementById('reg'))
|
|
if (e)
|
|
e.innerHTML = String.format(reg);
|
|
|
|
if (e = document.getElementById('cid'))
|
|
e.innerHTML = String.format(cidcell);
|
|
|
|
if (e = document.getElementById('mccmnc'))
|
|
e.innerHTML = String.format(data.mcc + " " + data.mnc);
|
|
|
|
if (e = document.getElementById('cops'))
|
|
e.innerHTML = String.format(data.cops);
|
|
|
|
if (e = document.getElementById('mode'))
|
|
e.innerHTML = String.format(data.mode + "" + carrier + " /"+ bcc +""+ bca);
|
|
|
|
if (e = document.getElementById('status'))
|
|
if (e)
|
|
if (rg == 1 || rg == 6 || rg == 9) {
|
|
if( dist== "--" || dist == "" || dist == "0.00"){
|
|
e.innerHTML = String.format(data.cops +'<img style="padding-left: 10px;" src="%s"/>' + " " + '<span class="ifacebadge"><p style="color:'+ data.csq_col +'"><b>%d%%</b></p></span>', icon, p);
|
|
} else {
|
|
e.innerHTML = String.format(data.cops +'<img style="padding-left: 10px;" src="%s"/>' + " " + '<span class="ifacebadge"><p style="color:'+ data.csq_col +'"><b>%d%%</b></p></span>' + distance, icon, p);
|
|
}
|
|
} else if (rg == 5 || rg == 7 || rg == 10) {
|
|
if( dist== "--" || dist == "" || dist == "0.00"){
|
|
e.innerHTML = String.format(data.cops + "(" + reg + ')<img style="padding-left: 10px;" src="%s"/>' + " " + '<span class="ifacebadge"><p style="color:'+ data.csq_col +'"><b>%d%%</b></p></span>', icon, p);
|
|
} else {
|
|
e.innerHTML = String.format(data.cops + "(" + reg + ')<img style="padding-left: 10px;" src="%s"/>' + " " + '<span class="ifacebadge"><p style="color:'+ data.csq_col +'"><b>%d%%</b></p></span>' +distance, icon, p);
|
|
}
|
|
} else {
|
|
e.innerHTML = String.format(reg);
|
|
}
|
|
if (e = document.getElementById('csq_per'))
|
|
e.innerHTML = String.format(data.csq_per+"%");
|
|
|
|
if (e = document.getElementById('arfcn'))
|
|
e.innerHTML = String.format(arfcn);
|
|
|
|
if (e = document.getElementById('lac'))
|
|
e.innerHTML = String.format(lactac);
|
|
|
|
if (e = document.getElementById('rssi'))
|
|
if (data.rssi == "--") {
|
|
e.innerHTML = String.format(data.rssi + " dBm");
|
|
} else {
|
|
var rssi_min = -110;
|
|
e.innerHTML = bar(data.rssi + " dBm", rssi_min);
|
|
}
|
|
if (e = document.getElementById('sinr'))
|
|
if (data.sinr == "--" || netmode == "--") {
|
|
e.innerHTML = String.format(data.sinr + " dB");
|
|
} else {
|
|
if (netmode == "LTE") {
|
|
var sinr_min = -20;
|
|
e.innerHTML = sinr_bar(data.sinr + " dB", sinr_min);
|
|
} else {
|
|
var sinr_min = -24;
|
|
e.innerHTML = rsrq_bar(data.sinr + " dB", sinr_min);
|
|
}
|
|
}
|
|
if (e = document.getElementById('rsrp'))
|
|
if (data.rsrp == "--") {
|
|
e.innerHTML = String.format(data.rsrp + " dBm");
|
|
} else {
|
|
var rsrp_min = -140;
|
|
e.innerHTML = rsrp_bar(data.rsrp + " dBm", rsrp_min);
|
|
}
|
|
if (e = document.getElementById('rsrq'))
|
|
if (data.rsrq == "--") {
|
|
e.innerHTML = String.format(data.rsrq + " dB");
|
|
} else {
|
|
var rsrq_min = -20;
|
|
e.innerHTML = rsrq_bar(data.rsrq + " dB", rsrq_min);
|
|
}
|
|
|
|
if (e = document.getElementById('namecid'))
|
|
e.innerHTML = String.format('<b>'+namecid+':</b>');
|
|
|
|
if (e = document.getElementById('chname'))
|
|
e.innerHTML = String.format('<b>'+namech+':</b>');
|
|
|
|
if (e = document.getElementById('snrname'))
|
|
e.innerHTML = String.format('<b>'+namesnr+':</b>');
|
|
if (e = document.getElementById('namebnd'))
|
|
e.innerHTML = String.format('<b>'+namebnd+':</b>');
|
|
|
|
}
|
|
);
|
|
//]]></script>
|
|
|
|
<fieldset class="cbi-section">
|
|
<legend><%:Cellular network%></legend>
|
|
<div class="table" width="100%">
|
|
<div class="tr cbi-rowstyle-2">
|
|
<div class="td left" width="25%"><b><%:Operator:%></b></div>
|
|
<div class="td left" width="25%" id="status">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-1">
|
|
<div class="td left" width="25%" id="namebnd"><b><%:Network/band:%></b></div>
|
|
<div class="td left" width="25%" id="mode">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-2">
|
|
<div class="td left" width="25%" id="chname"><b><%:E/U/ARFCN:%></b></div>
|
|
<div class="td left" width="25%" id="arfcn">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-1">
|
|
<div class="td left" width="25%" id="namecid"><b><%:LAC/CID:%></b></div>
|
|
<div class="td left" width="25%" id="lac">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-2">
|
|
<div class="td left" width="25%"><b><%:RSSI:%></b></div>
|
|
<div class="td left" width="25%" id="rssi">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-1">
|
|
<div class="td left" width="25%" id="snrname"><b><%:SINR/ECIO:%></b></div>
|
|
<div class="td left" width="25%" id="sinr">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-2">
|
|
<div class="td left" width="25%"><b><%:RSRP:%></b></div>
|
|
<div class="td left" width="25%" id="rsrp">-</div>
|
|
</div>
|
|
<div class="tr cbi-rowstyle-1">
|
|
<div class="td left" width="25%"><b><%:RSRQ:%></b></div>
|
|
<div class="td left" width="25%" id="rsrq">-</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
|
|
<%+footer%>
|