Developing lightweight computation at the DSG edge

Commit d9d8c6aa authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Add "Client (WAN)" mode" to wireless mode. Modify qmp_wireless.sh to add...

Add "Client (WAN)" mode" to wireless mode. Modify qmp_wireless.sh to add changes on wireless interfaces to qmp config file
parent 292bfdb9
......@@ -118,7 +118,7 @@ qmp_get_devices() {
local brlan_enabled=0
for dev in $(uci get qmp.interfaces.mesh_devices 2>/dev/null); do
# Lookging if device is defined as LAN, in such case dev=br-lan, but only once
# Looking if device is defined as LAN, in such case dev=br-lan, but only once
# except eth1 for RouterStation Pro
if ! ( [[ "$dev" == "eth1" ]] && qmp_is_routerstationpro ) ; then
for landev in $(uci get qmp.interfaces.lan_devices 2>/dev/null); do
......
......@@ -116,9 +116,68 @@ qmp_configure_wifi_device() {
local id=$1
local device="$(qmp_uci_get @wireless[$id].device)"
# checking if device is configured as "none"
# Remove the wireless device in $device from the previous lan/wan/mesh groups
# and put it in the appropriate ones according to the selected mode
#
# The possible modes are:
# adhoc_ap ==> Ad hoc (mesh) + access point (LAN)
# adhoc =====> Ad hoc (mesh)
# ap ========> Access point (mesh)
# aplan =====> Access point (LAN)
# client ====> Client (mesh)
# clientwan => Client (WAN)
local mode="$(qmp_uci_get @wireless[$id].mode)"
[ "$mode" == "none" ] && { echo "Interface $device is not managed by the qMp system"; return; }
# Remove $device and also unneeded white spaces
local allmeshdevs="$(qmp_uci_get interfaces.mesh_devices)"
local meshdevs="$(echo $allmeshdevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
local allwandevs="$(qmp_uci_get interfaces.wan_devices)"
local wandevs="$(echo $allwandevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
local alllandevs="$(qmp_uci_get interfaces.lan_devices)"
local landevs="$(echo $alllandevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
case $mode in
adhoc_ap)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs $device"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
adhoc)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
ap)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
aplan)
qmp_uci_set interfaces.lan_devices "$landevs $device"
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
client)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
clientwan)
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs $device"
;;
none)
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
echo "Interface $device is not managed by the qMp system"
return
;;
esac
# spliting channel in channel number and ht40 mode
local channel_raw="$(qmp_uci_get @wireless[$id].channel)"
......
......@@ -95,7 +95,7 @@ for _,wdev in ipairs(wdevs) do
mode:value("ap","Access point (mesh)")
mode:value("aplan","Access point (LAN)")
mode:value("client","Client (mesh)")
-- mode:value("clientwan","Client (WAN)")
mode:value("clientwan","Client (WAN)")
mode:value("none","Disabled")
-- Name
......@@ -126,7 +126,7 @@ for _,wdev in ipairs(wdevs) do
key:depends("mode","aplan")
key:depends("mode","adhoc_ap")
key:depends("mode","client")
--key:depends("mode","clientwan")
key:depends("mode","clientwan")
-- Txpower
txpower = s_wireless:option(ListValue,"txpower",translate("Transmission power (dBm)"),translate("Radio power in dBm. Each 3 dB increment doubles the power."))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment