OpenWrt_Luci_Lua/1_1.mi_Lua/xiaoqiang/module/XQAPModule.lua

26 lines
829 B
Lua
Raw Permalink Normal View History

2015-06-28 06:39:56 +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