mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2024-11-24 06:10:11 +00:00
26 lines
829 B
Lua
26 lines
829 B
Lua
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 |