mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 02:53:49 +01:00
Fix wlan state information (and add a number of extra fields).
This commit is contained in:
parent
115e6a7eff
commit
b861f43e11
@ -1,6 +1,5 @@
|
||||
--[[
|
||||
TODO:
|
||||
- network/state returns awfully little information (only station mode)
|
||||
- document REST API (mention rq IDs and endpoint information, list endpoints+args+CRUD type, unknown values are empty fields)
|
||||
- use a slightly more descriptive success/error definition (e.g. errortype=system/missing-arg/generic)
|
||||
- how to handle requests which need a restart of uhttpd? (e.g. network/openap)
|
||||
@ -14,6 +13,7 @@ TODO:
|
||||
in any case, arguments should be put in a new table to pass to the function (since order is undefined it must be an assoc array)
|
||||
|
||||
NOTES:
|
||||
- using iwinfo with interface name 'radio0' yields very little 'info' output while wlan0 works fine
|
||||
- The endpoint function info in response objects is incorrect when the global function is called with a blank argument,
|
||||
to cleanly solve this, module/function resolution should be moved from main() to the request object
|
||||
]]--
|
||||
|
@ -6,7 +6,7 @@ local iwinfo = require("iwinfo")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.DFL_DEVICE = "radio0" -- was wlan0
|
||||
M.DFL_DEVICE = "wlan0" -- was radio0
|
||||
M.AP_SSID = "d3d-ap"
|
||||
M.AP_ADDRESS = "192.168.10.1"
|
||||
M.AP_NETMASK = "255.255.255.0"
|
||||
@ -60,9 +60,16 @@ end
|
||||
function M.getDeviceState()
|
||||
local iw = iwinfo[dev_api]
|
||||
local result = {
|
||||
["mode"] = M.mapDeviceMode(iw.mode(dev), true),
|
||||
["ssid"] = iw.ssid(dev),
|
||||
["bssid"] = iw.bssid(dev)
|
||||
["bssid"] = iw.bssid(dev),
|
||||
["channel"] = iw.channel(dev),
|
||||
["mode"] = M.mapDeviceMode(iw.mode(dev), true),
|
||||
["encryption"] = M.mapEncryptionType(iw.encryption(dev).description),
|
||||
["quality"] = iw.quality(dev),
|
||||
["quality_max"] = iw.quality_max(dev),
|
||||
["txpower"] = iw.txpower(dev),
|
||||
["signal"] = iw.signal(dev),
|
||||
["noise"] = iw.noise(dev)
|
||||
}
|
||||
return result
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ function M.known(d)
|
||||
netInfo["bssid"] = net.bssid or ""
|
||||
netInfo["channel"] = net.channel or ""
|
||||
netInfo["encryption"] = net.encryption
|
||||
netInfo["raw"] = l:dump(net) --TEMP for debugging only
|
||||
--netInfo["raw"] = l:dump(net) --TEMP for debugging only
|
||||
table.insert(netInfoList, netInfo)
|
||||
end
|
||||
end
|
||||
@ -83,7 +83,13 @@ function M.state(d)
|
||||
r:addData("bssid", ds.bssid or "")
|
||||
r:addData("channel", ds.channel or "")
|
||||
r:addData("mode", ds.mode)
|
||||
r:addData("raw", l:dump(ds)) --TEMP for debugging only
|
||||
r:addData("encryption", ds.encryption)
|
||||
r:addData("quality", ds.quality)
|
||||
r:addData("quality_max", ds.quality_max)
|
||||
r:addData("txpower", ds.txpower)
|
||||
r:addData("signal", ds.signal)
|
||||
r:addData("noise", ds.noise)
|
||||
--r:addData("raw", l:dump(ds)) --TEMP for debugging only
|
||||
|
||||
return r
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user