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.
208 lines
6.1 KiB
HTML
208 lines
6.1 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')
|
|
%>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
|
|
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 offset;
|
|
var band;
|
|
var netmode = (data.mode)
|
|
var rfcn = (data.arfcn)
|
|
if (netmode == "LTE") {
|
|
if (rfcn >= 0 && rfcn <= 599) {
|
|
var band = "1";
|
|
} else if (rfcn >= 600 && rfcn <= 1199) {
|
|
var band = "2";
|
|
} else if (rfcn >= 1200 && rfcn <= 1949) {
|
|
var band = "3";
|
|
} else if (rfcn >= 1950 && rfcn <= 2399) {
|
|
var band = "4";
|
|
} else if (rfcn >= 2400 && rfcn <= 2469) {
|
|
var band = "5";
|
|
} else if (rfcn >= 2750 && rfcn <= 3449) {
|
|
var band = "7";
|
|
} else if (rfcn >= 3450 && rfcn <= 3799) {
|
|
var band = "8";
|
|
} else if (rfcn >= 6150 && rfcn <= 6449) {
|
|
var band = "20";
|
|
} else if (rfcn >= 9210 && rfcn <= 9659) {
|
|
var band = "28";
|
|
} else if (rfcn >= 9870 && rfcn <= 9919) {
|
|
var band = "31";
|
|
} else if (rfcn >= 37750 && rfcn <= 38249) {
|
|
var band = "38";
|
|
} else if (rfcn >= 38650 && rfcn <= 39649) {
|
|
var band = "40";
|
|
} else {
|
|
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 = "";
|
|
}
|
|
} else {
|
|
if (rfcn >= 10562 && rfcn <= 10838) {
|
|
var band = "IMT2100";
|
|
} else if (rfcn >= 2937 && rfcn <= 3088) {
|
|
var band = "UMTS900";
|
|
} else if (rfcn >= 955 && rfcn <= 1023) {
|
|
var band = "DSC900";
|
|
} else if (rfcn >= 512 && rfcn <= 885) {
|
|
var band = "DCS1800";
|
|
} else if (rfcn >= 1 && rfcn <= 124) {
|
|
var band = "GSM900";
|
|
} else {
|
|
var band = (rfcn);
|
|
}
|
|
}
|
|
var carrier = "";
|
|
var bcc;
|
|
var distance;
|
|
var calte;
|
|
var namebnd;
|
|
var dist = (data.distance)
|
|
var carrier;
|
|
var bcc;
|
|
var bca = "";
|
|
var scc;
|
|
// 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 = ""
|
|
}
|
|
}
|
|
} else {
|
|
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('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('namebnd'))
|
|
e.innerHTML = String.format('<b>'+namebnd+':</b>');
|
|
}
|
|
);
|
|
//]]></script>
|
|
|
|
<fieldset class="cbi-section">
|
|
<h3><%:Cellular network%></h3>
|
|
<div class="table" width="100%">
|
|
<div class="tr cbi-rowstyle-1">
|
|
<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>
|
|
</fieldset>
|
|
|