api enhancement: convert getFreq to use lib-iwinfo (#101)

This commit is contained in:
dman776 2021-05-06 00:05:57 -05:00 committed by GitHub
parent 8ef6e56925
commit 232d7bf6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -229,11 +229,10 @@ end
-------------------------------------
function model.getFreq()
local wlanInf=get_ifname('wifi')
local freq=""
freq=os.capture("iwinfo " .. wlanInf .. " info | egrep 'Mode:'")
freq=freq:gsub("^%s*(.-)%s*$", "%1")
freq=string.match(freq, "%((.-)%)")
return freq
local api=iwinfo.type(wlanInf)
local iw = iwinfo[api]
local freq = iw.frequency(wlanInf)
return tostring(freq)
end
-------------------------------------