--pretranslated: do not change this file -- Enable localization gettext.textdomain('webui-core') -- -- -- Custom Gui for Technicolor Modem: utility script and modified gui for the Technicolor Modem -- interface based on OpenWrt -- -- Copyright (C) 2018 Christian Marangi -- -- This file is part of Custom Gui for Technicolor Modem. -- -- Custom Gui for Technicolor Modem is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Custom Gui for Technicolor Modem is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Custom Gui for Technicolor Modem. If not, see . -- -- local proxy = require("datamodel") local ui_helper = require("web.ui_helper") local band = { Ds1Band = tonumber(proxy.get("rpc.xdslctl.Ds1ScannedBand")[1].value) or -1, Ds2Band = tonumber(proxy.get("rpc.xdslctl.Ds2ScannedBand")[1].value) or -1, Us1Band = tonumber(proxy.get("rpc.xdslctl.Us1ScannedBand")[1].value) or -1, Us2Band = tonumber(proxy.get("rpc.xdslctl.Us2ScannedBand")[1].value) or -1, Us3Band = tonumber(proxy.get("rpc.xdslctl.Us3ScannedBand")[1].value) or -1, Us4Band = tonumber(proxy.get("rpc.xdslctl.Us4ScannedBand")[1].value) or -1, } local function xdslctlget(request,bandtype) local data={} if bandtype == "Us" then local Us1 = proxy.get("rpc.xdslctl." .. request .. "Us1") if Us1 then data[#data+1] = Us1[1].value end local Us2 = proxy.get("rpc.xdslctl." .. request .. "Us2") if Us2 then for i=1,band.Ds1Band do --Space data[#data+1] = "NaN," end data[#data+1] = Us2[1].value end local Us3 = proxy.get("rpc.xdslctl." .. request .. "Us3") if Us3 then for i=1,band.Ds2Band do --Space data[#data+1] = "NaN," end data[#data+1] = Us3[1].value end local Us4 = proxy.get("rpc.xdslctl." .. request .. "Us4") if Us4 then data[#data+1] = Us4[1].value end else --Ds local Ds1 = proxy.get("rpc.xdslctl." .. request .. "Ds1") if Ds1 then for i=1,band.Us1Band do --Space data[#data+1] = "NaN," end data[#data+1] = Ds1[1].value end local Ds2 = proxy.get("rpc.xdslctl." .. request .. "Ds2") if Ds2 then for i=1,band.Us2Band do --Space data[#data+1] = "NaN," end data[#data+1] = Ds2[1].value end local Ds3Split1 = proxy.get("rpc.xdslctl." .. request .. "Ds3Split1") if Ds3Split1 then for i=1,(band.Us3Band+band.Us4Band) do --Space data[#data+1] = "NaN," end data[#data+1] = Ds3Split1[1].value end local Ds3Split2 = proxy.get("rpc.xdslctl." .. request .. "Ds3Split2") if Ds3Split2 then data[#data+1] = Ds3Split2[1].value end local Ds4 = proxy.get("rpc.xdslctl." .. request .. "Ds4") if Ds4 then data[#data+1] = Ds4[1].value end end if data == "" then return "NaN" end return data end local scanband = proxy.get("rpc.xdslctl.HlogScanBand") if scanband then scanband = tonumber(scanband[1].value) or 0 scanband = scanband +1 else scanband = "1" end local _, HlogUs = pcall(xdslctlget, "Hlog","Us") local _, BitsUs = pcall(xdslctlget, "Bits","Us") local _, QLNUs = pcall(xdslctlget, "QLN","Us") local _, SNRUs = pcall(xdslctlget, "SNR","Us") local _, HlogDs = pcall(xdslctlget, "Hlog","Ds") local _, BitsDs = pcall(xdslctlget, "Bits","Ds") local _, QLNDs = pcall(xdslctlget, "QLN","Ds") local _, SNRDs = pcall(xdslctlget, "SNR","Ds") ngx.print('\ \ '); ngx.print(ui_helper.createHeader(T"Diagnostics DSL", false, true)) ngx.print('\ \ \ \ '); ngx.print(ui_helper.createFooter()) ngx.print('\ \ ');