<%# Copyright 2008-2009 Steven Barth Copyright 2008-2015 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <%- local ip = require "luci.ip" local fs = require "nixio.fs" local sys = require "luci.sys" local utl = require "luci.util" local mUtl = require "luci.moreUtils" local uci = require "luci.model.uci".cursor() local ntm = require "luci.model.network" local path = luci.dispatcher.context.requestpath local cl = path[1] or "operator" local has_iwinfo = pcall(require, "iwinfo") local url if string.find(utl.ubus("system", "board").hostname, "04M") then url = "operator/network" else url = "operator/charging/"..path[3].."/network" end local sn = mUtl.get_serialnumber() local master = mUtl.identify_pseudo_maestre(path[3] or sn ) local method if master == true then method = "webmanager.network" else method = path[3].."/webmanager.network" end local info = utl.ubus(method, "wifi_overview") local modes = {} local device local button = {} local msg = {} for k , v in pairs (info) do if type(v) == "table" then if v and v.disabled and v.disabled == 1 then button[k] = "reload" msg[k] = "Enable" elseif v and v.disabled and v.disabled == 0 then button[k] = "reset" msg[k] = "Disable" end modes[k] = v end if type(v) == "string" then device = "Generic 802.11 Wireless Controller ("..v..")" end end if luci.http.formvalue("status") == "1" then luci.http.prepare_content("application/json") luci.http.write_json(modes) return end -%> <%+header%> <% if not has_iwinfo then %>
<%:Package libiwinfo required!%>
<%_The libiwinfo-lua package is not installed. You must install this component for working wireless configuration!%>
<% end %>

<%:Wireless Overview%> - <%=path[3]%>

<% for i , net in pairs(modes) do %> <%end%>
<%=translate(device) or "No wireless adapter found" %>

0%
<%:Collecting data...%> " style="width:100px" onclick="actions('<%=msg[i]%>','<%=net.network%>', '<%=i%>' )" title="<%:Delete this network%>" value="<%=msg[i]%>" />
<%for i , net in pairs (modes) do %> <%local link = utl.ubus(method, "check_ap_link" )%> <%if net.mode == "Client" and net.disabled == 0 and link and link.link == true then %>

<%:Associated Stations%>

<%:SSID%> <%:MAC-Address%> <%:Signal (dBm)%> <%:Quality%> <%:Frequency (GHz)%> <%:Channel%>
<%:Collecting data...%>
<%end%> <%end%>
<%+footer%>