Developing lightweight computation at the DSG edge

Commit 48a66140 authored by p4u's avatar p4u
Browse files

Wizard changes WiFi devices too. New wait.html file

parent cd031be3
......@@ -95,14 +95,21 @@ function netmode.write(self, section, value)
uciout:set("qmp","non_overlapping","ignore","1")
uciout:set("qmp","networks","publish_lan","1")
uciout:set("qmp","networks","lan_address",nodeip)
uciout:set("qmp","networks","bmx6_ipv4_address",nodeip)
uciout:set("qmp","networks","lan_netmask",nodemask)
else
uciout:set("qmp","non_overlapping","ignore","0")
uciout:set("qmp","networks","publish_lan","0")
uciout:set("qmp","networks","lan_address","172.30.22.1")
uciout:set("qmp","networks","lan_netmask","255.255.0.0")
end
uciout:set("qmp","networks","bmx6_ipv4_prefix24","10.202")
uciout:set("qmp","networks","bmx6_ipv4_address","")
uciout:set("qmp","networks","olsr6_ipv4_address","")
uciout:set("qmp","networks","olsr6_ipv4_prefix24","10.201")
end
local i,v,devmode,devname
local lan_devices = ""
local wan_devices = ""
......@@ -124,12 +131,20 @@ function netmode.write(self, section, value)
for i,v in ipairs(nodedevs_wifi) do
devmode = v[2]:formvalue(section)
devname = v[1]
if devmode == "AP" then
lan_devices = lan_devices..devname.." "
elseif devmode == "Mesh" then
mesh_devices = mesh_devices..devname.." "
end
function setmode(s)
if s.device == devname then
if devmode == "AP" then uciout:set("qmp",s['.name'],"mode","ap") end
if devmode == "Mesh" then uciout:set("qmp",s['.name'],"mode","adhoc") end
end
end
uciout:foreach("qmp","wireless",setmode)
end
uciout:set("qmp","interfaces","lan_devices",lan_devices)
......@@ -137,11 +152,13 @@ function netmode.write(self, section, value)
uciout:set("qmp","interfaces","mesh_devices",mesh_devices)
uciout:commit("qmp")
apply()
end
function m.on_commit(self,map)
luci.sys.call('/etc/qmp/qmp_control.sh configure_network > /tmp/log/qmp_control_network.log &')
luci.sys.call('/etc/qmp/qmp_control.sh configure_wifi > /tmp/log/qmp_control_wifi.log &')
function apply(self)
http.redirect("/luci-static/resources/qmp/wait.html")
luci.sys.call('qmpcontrol configure_network >> /tmp/log/qmp_control_network.log &')
luci.sys.call('qmpcontrol configure_wifi >> /tmp/log/qmp_control_wifi.log &')
end
......
<html>
<head></head>
<style>
div#showbar{
position: relative;
width: 100%;
height: 25px;
margin: 0px;
background-color: #556270;
}
div#progress{
position: absolute;
top: 0px;
left: 0px;
width: 0%;
height: 100%;
background-color: #C3FF68;
}
</style>
<body>
<script>
wait_a_moment = function(seconds) {
progress_update();
setTimeout(back_page, seconds*1000);
}
back_page = function() { history.back(); }
var progressEnd = 12; // set to number of progress <span>'s.
var progressInterval = 1666; // set to time between updates (milli-seconds)
var progressElement = document.getElementById('progress')
var progressAt = 0;
var progressTimer;
function progress_update() {
progressAt++;
progressTimer = setTimeout('progress_update()',progressInterval);
progress.style.width=progressAt*100/progressEnd+'%';
}
</script>
<table align="center">
<tr><td>
The configuration is being applyied, please wait a moment...
</td></tr>
<tr><td>
<div id="showbar">
<div id="progress">
</div>
</div>
</td></tr>
</table>
<script>
wait_a_moment(20);
</script>
</body>
</html>
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