You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
StationCfg = {} |
|
IpCfg = {} |
|
|
|
function AutoLink() |
|
wifi.setmode(wifi.STATION) |
|
StationCfg.ssid="DF2" |
|
StationCfg.pwd="wodepasstne?" |
|
StationCfg.save=true |
|
wifi.sta.config(StationCfg) |
|
wifi.sta.connect() |
|
end |
|
|
|
--mobile setting ap and passwd |
|
function AutoLinkByMobile() |
|
wifi.setmode(wifi.STATIONAP) |
|
wifi.ap.config({ssid="MyPersonalSSID", auth=wifi.OPEN}) |
|
enduser_setup.manual(true) |
|
enduser_setup.start( |
|
function() |
|
print("Connected to WiFi as:" .. wifi.sta.getip()) |
|
end, |
|
function(err, str) |
|
print("enduser_setup: Err #" .. err .. ": " .. str) |
|
end |
|
) |
|
print("init endUserServer") |
|
end |
|
|
|
|
|
--GetAPList |
|
-- function Listap(t) |
|
-- for k,v in pairs(t) do |
|
-- print(k.." : "..v) |
|
-- end |
|
-- end |
|
-- wifi.sta.getap(Listap) |
|
|
|
function SetIP(ipAddress,netmask,gateway) |
|
IpCfg = { |
|
ip = ipAddress, |
|
netmask = netmask, |
|
gateway = gateway |
|
} |
|
wifi.sta.setip(IpCfg) |
|
end |
|
--SetIP("192.168.1.115","255.255.255.0","192.168.1.1")
|
|
|