mirror of https://github.com/aredn/aredn.git
feature: added a wifi scan endpoint to the /api (#379)
* wscan can output results as json * added a page for displaying scan results as json * updated file permissions with +x * added endpoint for wifi scan * Revert "updated file permissions with +x" This reverts commit 6f0a038334fbacc3f585f0a86fb7d9986a47b7d2. * Revert "added a page for displaying scan results as json" This reverts commit 4806ad01b6b717e2e02f248309a0257bb390af23. * Revert "wscan can output results as json" This reverts commit 75454e7e790a0457a0846182b0a8a44205772368. * removed hardcoded device name * exposed freqlist through the api
This commit is contained in:
parent
77a74d9016
commit
58d4d21729
|
@ -41,6 +41,7 @@ require("aredn.http")
|
|||
local aredn_info = require("aredn.info")
|
||||
require("nixio")
|
||||
local json = require("luci.jsonc")
|
||||
require("iwinfo")
|
||||
|
||||
-- Function extensions
|
||||
os.capture = capture
|
||||
|
@ -125,6 +126,17 @@ function getFreeMemory()
|
|||
return info
|
||||
end
|
||||
|
||||
function getScanList()
|
||||
local device = aredn_info.getMeshRadioDevice()
|
||||
local scanlist = iwinfo["nl80211"].scanlist(device)
|
||||
return scanlist
|
||||
end
|
||||
|
||||
function getFreqList()
|
||||
local device = aredn_info.getMeshRadioDevice()
|
||||
local freqlist = iwinfo["nl80211"].freqlist(device)
|
||||
return freqlist
|
||||
end
|
||||
|
||||
-- ==== MAIN =====
|
||||
ctx = uci.cursor()
|
||||
|
@ -175,6 +187,8 @@ for page, comps in pairs(qsset) do
|
|||
info['pages'][page][comp]=aredn_info.getOLSRInfo()
|
||||
elseif comp=="location" then
|
||||
info['pages'][page][comp]=getLocationInfo()
|
||||
elseif comp=="freqlist" then
|
||||
info['pages'][page][comp]=getFreqList()
|
||||
end
|
||||
end
|
||||
elseif page=="mesh" then
|
||||
|
@ -201,7 +215,14 @@ for page, comps in pairs(qsset) do
|
|||
info['pages'][page][comp]=getServicesByService()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif page=="scan" then
|
||||
for i,comp in pairs(comps:split(',')) do
|
||||
if comp=="scanlist" then
|
||||
info['pages'][page][comp]=getScanList()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Output the HTTP header for JSON
|
||||
|
|
Loading…
Reference in New Issue