diff --git a/src/main.lua b/src/main.lua index ccdd038..af086c3 100644 --- a/src/main.lua +++ b/src/main.lua @@ -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 ]]-- diff --git a/src/network/wlanconfig.lua b/src/network/wlanconfig.lua index 92380a1..102b98e 100644 --- a/src/network/wlanconfig.lua +++ b/src/network/wlanconfig.lua @@ -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 diff --git a/src/rest/api/api_network.lua b/src/rest/api/api_network.lua index 47097f5..21f059a 100644 --- a/src/rest/api/api_network.lua +++ b/src/rest/api/api_network.lua @@ -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