Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add freq information #1045

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/shared-state-wifi_links_info/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ define Package/$(PKG_NAME)
MAINTAINER:=
URL:=http://libremesh.org
DEPENDS:=+lua +luci-lib-jsonc +ubus-lime-utils \
+lime-system shared-state
+lime-system +libiwinfo-lua shared-state
PKGARCH:=all
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
local JSON = require("luci.jsonc")
local node_status = require ("lime.node_status")
local network = require ("lime.network")
local iwinfo = require "iwinfo"


function get_wifi_links_info()
local stations = node_status.get_stations()
Expand All @@ -28,9 +30,10 @@ function get_wifi_links_info()
macparts = network.get_mac(station.iface)
src_macaddr = table.concat(macparts,":")
local station_stats = node_status.get_station_stats(station)
local freq = iwinfo.nl80211.frequency(station.iface)
table.insert(links, {src_mac=src_macaddr ,dst_mac=station.station_mac,
signal=station_stats.signal,chains=station_stats.chains,
rx_rate=station_stats.rx_rate,tx_rate=station_stats.tx_rate } )
rx_rate=station_stats.rx_rate,tx_rate=station_stats.tx_rate,freq=freq } )
end
return links
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ it('a simple test to get links info and assert requiered fields are present', fu
return iwinfo.mocks.iw_station_get_result_wlan1
end)
stub(node_status, "get_stations", function () return iwinfo.mocks.get_stations end)

stub(node_status, "get_stations", function () return iwinfo.mocks.get_stations end)
stub(iwinfo.nl80211,"frequency",function (iface) return 2400 end)
stub(network, "get_mac", function (iface)
if string.match(iface, "wlan0") then
return iwinfo.mocks.wlan0_mesh_mac
Expand All @@ -28,6 +29,7 @@ it('a simple test to get links info and assert requiered fields are present', fu
assert.is.same({-17,-18}, links_info[1].chains)
assert.is.equal(-14, links_info[1].signal)
assert.is.equal(13000, links_info[1].rx_rate)
assert.is.equal(2400, links_info[1].freq)
assert.is.equal("C0:00:00:00:00:00", links_info[1].src_mac)
end)

Loading