OpenWrt_Luci_Lua/Mi_Lua/xiaoqiang/module/XQAPModule.lua

26 lines
829 B
Lua
Raw Normal View History

2015-05-09 10:48:46 +00:00
module ("xiaoqiang.module.XQAPModule", package.seeall)
local XQFunction = require("xiaoqiang.common.XQFunction")
local XQConfigs = require("xiaoqiang.common.XQConfigs")
function enableLanAP()
local uci = require("luci.model.uci").cursor()
local ipaddr = uci:get("network", "lan", "ipaddr")
XQFunction.setNetMode("apmode")
local newipaddr = uci:get("network", "lan", "ipaddr")
if newipaddr ~= ipaddr then
XQFunction.forkExec("sleep 4; ap_mode.sh open")
return newipaddr
else
return nil
end
end
function disableLanAP()
local uci = require("luci.model.uci").cursor()
local ipaddr = uci:get("network", "lan", "ipaddr")
XQFunction.setNetMode(nil)
os.execute("ap_mode.sh close")
XQFunction.forkExec("sleep 4; /etc/init.d/network restart")
return ipaddr
end