first commit

main
Ben 1 year ago
commit 905cb34f14

@ -0,0 +1,10 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Information dashboard for 3G/LTE dongle
LUCI_DEPENDS:=+luci-compat +modeminfo
PKG_LICENSE:=GPLv3
PKG_VERSION:=0.3.1-1
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

@ -0,0 +1,70 @@
# luci-app-modeminfo
3G/LTE dongle information for OpenWrt LuCi
luci-app-modeminfo is fork from https://github.com/IceG2020/luci-app-3ginfo
Supported devices:
- Quectel EC200T/EC21/EC25/EP06/EM12/EM160R-GL
- SimCom SIM7600E-H/SIM7906
- Huawei E3372 (LTE)/ME909
- Sierra Wireless EM7455
- HP LT4220
- Dell DW5821e
- MikroTik R11e-LTE/R11e-LTE6 (temporary dropped)
- Fibocom NL668/NL678/L850/L860
- Gosuncnwelink GM510
- ZTE MF823/MF823D
<details>
<summary>Package contents:</summary>
|Package |Description |
|:-------|:-----------|
|luci-app-modeminfo |LuCI web interface |
|modeminfo |common files |
|modeminfo-qmi |Qualcomm MSM Interface support |
|modeminfo-serial-quectel |Quectel modems support |
|modeminfo-serial-telit |Telit LN940 (HP LT4220) modem support |
|modeminfo-serial-huawei |Huawei ME909/E3372(stick mode, LTE only) modems support|
|modeminfo-serial-sierra |Sierra EM7455 modem support |
|modeminfo-serial-simcom |SimCOM modems support |
|modeminfo-serial-dell |Dell DW5821e modem support |
|modeminfo-serial-fibocom |Fibocom LN668/NL678 modems support |
|modeminfo-serial-xmm |Fibocom L850/L860 modems support |
|modeminfo-serial-gosun |Gosuncnwelink GM510 support |
|modeminfo-serial-gosun |ZTE MF823/MF823D support |
</details>
<details>
<summary>Screenshots</summary>
* Overview page. Short network info.
![](https://raw.githubusercontent.com/koshev-msk/modemfeed/master/luci/applications/luci-app-modeminfo/screenshots/modeminfo-overview.png)
* Modeminfo index page. Verbose network info.
![](https://raw.githubusercontent.com/koshev-msk/modemfeed/master/luci/applications/luci-app-modeminfo/screenshots/modeminfo-network.png)
* Modeminfo hardware page.
![](https://raw.githubusercontent.com/koshev-msk/modemfeed/master/luci/applications/luci-app-modeminfo/screenshots/modeminfo-hardware.png)
* Modeminfo setup page.
![](https://raw.githubusercontent.com/koshev-msk/modemfeed/master/luci/applications/luci-app-modeminfo/screenshots/modeminfo-setup.png)
</details>

@ -0,0 +1,24 @@
local nixio = require "nixio"
module("luci.controller.modem.modeminfo", package.seeall)
local utl = require "luci.util"
function index()
entry({"admin", "modem"}, firstchild(), translate("Modem"), 45).acl_depends={"unauthenticated"}
entry({"admin", "modem", "main"}, alias ("admin", "modem", "main", "main"), translate("Modeminfo"), 10).acl_depends={"unauthenticated"}
entry({"admin", "modem", "main", "main"}, template("modem/modeminfo"), translate("Network"), 51).acl_depends={"unauthenticated"}
entry({"admin", "modem", "main", "hw"}, template("modem/modeminfohw"), translate("Hardware"), 52).acl_depends={"unauthenticated"}
entry({"admin", "modem", "main", "config"}, cbi("modem/modeminfo"), translate("Setup"), 53).acl_depends={"unauthenticated"}
entry({"admin", "modem", "data"}, call("get_data"))
end
function get_data()
local fs = require "nixio.fs"
local data = luci.sys.exec("/usr/bin/modeminfo")
luci.http.prepare_content("application/json")
luci.http.write(data)
end

@ -0,0 +1,78 @@
-- Copyright 2021 Konstantine Shevlyakov <shevlakov@132lan.ru>
-- Copyright 2021 modified by Vladislav Kadulin <spanky@yandex.ru>
-- Licensed to the GNU General Public License v3.0.
require("nixio.fs")
local PATH = {
"/dev/tty[A-Z][A-Z]*",
"/dev/cdc-wdm*"
}
-- check devices
function check_dev(path)
local try_port, size = nixio.fs.glob(path)
if size > 0 then
port = translate("In automatic mode detect first answered DATA port.")
else
port = translate("Port not found!")
end
end
-- add device in ListValue
function try_port(path)
local try_port = nixio.fs.glob(path)
dev:value("", translate("Autodetect"))
for node in try_port do
dev:value(node, node)
end
end
local m = Map("modeminfo", translate("Modeminfo: Configuration"),
translate("Configuration panel of Modeminfo."))
local s = m:section(TypedSection, "modeminfo")
s.anonymous = true
local qmi_mode = s:option(Flag, "qmi_mode", translate("Use QMI"),
translate("Get modem data via qmicli (experimental). Require install qmi-utils."))
qmi_mode.rmempty = true
check_dev(PATH[1])
dev = s:option(ListValue, "device", translate("Data port"), port)
dev.default = ""
dev.rmempty = true
dev:depends("qmi_mode", 0)
try_port(PATH[1])
check_dev(PATH[2])
dev = s:option(ListValue, "device_qmi", translate("Data port"), port)
dev.default = ""
dev.rmempty = true
dev:depends("qmi_mode", 1)
try_port(PATH[2])
local decimail = s:option(Flag, "decimail", translate("Show decimal"),
translate("Show LAC and CID in decimal."))
decimail.rmempty = true
local name = s:option(Flag, "mmcli_name", translate("Name via mmcli"),
translate("Get device hardware name via mmcli utility if aviable."))
name.rmempty = true
name:depends("qmi_mode", 0)
local qmi_proxy = s:option(Flag, "qmi_proxy", translate("QMI proxy"),
translate("Enable qmi-proxy mode."))
qmi_proxy.rmempty = true
qmi_proxy:depends("qmi_mode", 1)
local short = s:option(Flag, "index", translate("Index page"),
translate("Short info on Overview page"))
short.rmempty = true
function m.on_after_commit(Map)
luci.sys.call("rm -f /tmp/modemdevice")
end
return m

@ -0,0 +1,4 @@
<%uci = require "luci.model.uci".cursor()%>
<%if uci:get_first("modeminfo", "modeminfo", "index") then%>
<%+modem/modemview%>
<%end%>

@ -0,0 +1,441 @@
<%#
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%>

@ -0,0 +1,65 @@
<%#
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.
-%>
<%+header%>
<h2 name="content"><%:Modeminfo%></h2>
<script type="text/javascript">//<![CDATA[
XHR.poll(4, '<%=url("admin/modem/data")%>', null,
function(x, hw)
{
// stuff
if (e = document.getElementById('device'))
e.innerHTML = String.format(hw.device);
if (e = document.getElementById('imei'))
e.innerHTML = String.format(hw.imei);
if (e = document.getElementById('firmware'))
e.innerHTML = String.format(hw.firmware);
if (e = document.getElementById('iccid'))
e.innerHTML = String.format(hw.iccid);
if (e = document.getElementById('imsi'))
e.innerHTML = String.format(hw.imsi);
if (e = document.getElementById('chiptemp'))
e.innerHTML = String.format(hw.chiptemp + " &deg;C");
}
);
//]]></script>
<fieldset class="cbi-section">
<legend><%:Hardware Info%></legend>
<div class="table" width="100%">
<div class="tr cbi-rowstyle-2">
<div class="td left" width="25%"><b><%:Device:%></b></div>
<div class="td left" width="25%" id="device">-</div>
</div>
<div class="tr cbi-rowstyle-1">
<div class="td left" width="25%"><b><%:Firmware:%></b></div>
<div class="td left" width="25%" id="firmware">-</div>
</div>
<div class="tr cbi-rowstyle-2">
<div class="td left" width="25%"><b><%:IMSI:%></b></div>
<div class="td left" width="25%" id="imsi">-</div>
</div>
<div class="tr cbi-rowstyle-1">
<div class="td left" width="25%"><b><%:ICCID:%></b></div>
<div class="td left" width="25%" id="iccid">-</div>
</div>
<div class="tr cbi-rowstyle-2">
<div class="td left" width="25%"><b><%:IMEI:%></b></div>
<div class="td left" width="25%" id="imei">-</div>
</div>
<div class="tr cbi-rowstyle-1">
<div class="td left" width="25%"><b><%:Chiptemp:%></b></div>
<div class="td left" width="25%" id="chiptemp">-</div>
</div>
</div>
</fieldset>
<%+footer%>

@ -0,0 +1,207 @@
<%#
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>

@ -0,0 +1,156 @@
"Language: ru\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: Konstantine Shevlyakov <shevlakov@132lan.ru>\n"
#: applications/luci-app-modeminfo/luasrc/controller/modem/modeminfo.lua:8
msgid "Modem"
msgstr "Модем"
#: applications/luci-app-modeminfo/luasrc/controller/modem/modeminfo.lua:9
msgid "Modeminfo"
msgstr "Модеминфо"
#: applications/luci-app-modeminfo/luasrc/controller/modem/modeminfo.lua:10
msgid "Network"
msgstr "Сеть"
#: applications/luci-app-modeminfo/luasrc/controller/modem/modeminfo.lua:11
msgid "Hardware"
msgstr "Оборудование"
#: applications/luci-app-modeminfo/luasrc/controller/modem/modeminfo.lua:12
msgid "Setup"
msgstr "Настройка"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:10
msgid "Modeminfo"
msgstr "Модеминфо"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:109
msgid "No Registration"
msgstr "Нет регистрации"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:111
msgid "Registered"
msgstr "Зарегистрирован"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:113
msgid "Searching"
msgstr "Поиск сети"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:115
msgid "Denied"
msgstr "Запрет регистрации"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:117
msgid "Unknown"
msgstr "Неизвестно"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:119
msgid "Roaming"
msgstr "Гостевая сеть"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:121
msgid "No Data"
msgstr "Нет данных"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:315
msgid "Network/Band/Bandwidth"
msgstr "Сеть/Диапазон/Полоса"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:315
msgid "Network/Band"
msgstr "Сеть/Диапазон"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:402
msgid "Cellular network"
msgstr "Сотовая сеть"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:405
msgid "Operator:"
msgstr "Оператор:"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfo.htm:265
msgid "Status:"
msgstr "Состояние:"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfohw.htm:35
msgid "Hardware Info"
msgstr "Информация о модеме"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfohw.htm:38
msgid "Device:"
msgstr "Устройство:"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfohw.htm:42
msgid "Firmware:"
msgstr "Встроенное ПО:"
#: applications/luci-app-modeminfo/luasrc/view/modem/modeminfohw.htm:58
msgid "Chiptemp:"
msgstr "Температура:"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:16
msgid "In automatic mode detect first answered DATA port."
msgstr "В автоматическом режиме находит первый отвечающий порт данных."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:13
msgid "Port not found!"
msgstr "Порт не обнаружен!"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:25
msgid "Autodetect"
msgstr "Автоматически"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:31
msgid "Modeminfo: Configuration"
msgstr "Modeminfo: Конфигурация"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:32
msgid "Configuration panel of Modeminfo."
msgstr "Страница конфигурации Modeminfo."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:37
msgid "Use QMI"
msgstr "Использовать QMI"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:65
msgid "Get modem data via qmicli (experimental). Require install qmi-utils."
msgstr "Получать данные модема через qmicli (экспериментально). Требуется установленный qmi-utils."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:42
msgid "Data port"
msgstr "Порт данных"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:55
msgid "Show decimal"
msgstr "Показать в десятичных"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:56
msgid "Show LAC and CID in decimal."
msgstr "Показать LAC и CID соты в десятичных."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:56
msgid "Get device hardware name via mmcli utility if aviable."
msgstr "Если доступно, использовать утилиту mmcli для имени модема."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:59
msgid "Name via mmcli"
msgstr "Имя модема через mmcli"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:64
msgid "QMI proxy"
msgstr "QMI прокси"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:64
msgid "Enable qmi-proxy mode."
msgstr "Задействовать режим прокси."
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:69
msgid "Index page"
msgstr "На главную"
#: applications/luci-app-modeminfo/luasrc/model/cbi/modem/modeminfo.lua:70
msgid "Short info on Overview page"
msgstr "Краткая информация о сети на главной странице"

@ -0,0 +1,11 @@
{
"luci-app-modeminfo": {
"description": "Grant UCI access for luci-app-modeminfo",
"read": {
"uci": [ "modeminfo" ]
},
"write": {
"uci": [ "modeminfo" ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Loading…
Cancel
Save