Wifi configured
This commit is contained in:
parent
34bec501ca
commit
989d8b263a
@ -10,7 +10,9 @@ import org.luaj.vm2.lib.jse.JsePlatform;
|
|||||||
|
|
||||||
import de.c3ma.ollo.mockup.DoFileFunction;
|
import de.c3ma.ollo.mockup.DoFileFunction;
|
||||||
import de.c3ma.ollo.mockup.ESP8266File;
|
import de.c3ma.ollo.mockup.ESP8266File;
|
||||||
|
import de.c3ma.ollo.mockup.ESP8266Net;
|
||||||
import de.c3ma.ollo.mockup.ESP8266Node;
|
import de.c3ma.ollo.mockup.ESP8266Node;
|
||||||
|
import de.c3ma.ollo.mockup.ESP8266Time;
|
||||||
import de.c3ma.ollo.mockup.ESP8266Tmr;
|
import de.c3ma.ollo.mockup.ESP8266Tmr;
|
||||||
import de.c3ma.ollo.mockup.ESP8266Uart;
|
import de.c3ma.ollo.mockup.ESP8266Uart;
|
||||||
import de.c3ma.ollo.mockup.ESP8266Wifi;
|
import de.c3ma.ollo.mockup.ESP8266Wifi;
|
||||||
@ -40,6 +42,8 @@ public class WS2812Simulation implements LuaSimulation {
|
|||||||
globals.load(espFile);
|
globals.load(espFile);
|
||||||
globals.load(espNode);
|
globals.load(espNode);
|
||||||
globals.load(new ESP8266Wifi());
|
globals.load(new ESP8266Wifi());
|
||||||
|
globals.load(new ESP8266Net());
|
||||||
|
globals.load(new ESP8266Time());
|
||||||
globals.set("dofile", doFile);
|
globals.set("dofile", doFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -26,8 +26,15 @@ public class ESP8266Wifi extends TwoArgFunction {
|
|||||||
env.checkglobals();
|
env.checkglobals();
|
||||||
final LuaTable wifi = new LuaTable();
|
final LuaTable wifi = new LuaTable();
|
||||||
wifi.set("setmode", new SetModeFunction());
|
wifi.set("setmode", new SetModeFunction());
|
||||||
wifi.set("ap", new ApFunction());
|
final LuaTable ap = new LuaTable();
|
||||||
|
ap.set("config", new ConfigFunction());
|
||||||
|
wifi.set("ap", ap);
|
||||||
|
final LuaTable sta = new LuaTable();
|
||||||
|
sta.set("status", new StatusFunction());
|
||||||
|
sta.set("getip", new GetIpFunction());
|
||||||
|
wifi.set("sta", sta);
|
||||||
wifi.set("SOFTAP", "SOFTAP");
|
wifi.set("SOFTAP", "SOFTAP");
|
||||||
|
wifi.set("STATION", "STATION");
|
||||||
env.set("wifi", wifi);
|
env.set("wifi", wifi);
|
||||||
env.get("package").get("loaded").set("wifi", wifi);
|
env.get("package").get("loaded").set("wifi", wifi);
|
||||||
return wifi;
|
return wifi;
|
||||||
@ -44,19 +51,6 @@ public class ESP8266Wifi extends TwoArgFunction {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApFunction extends TwoArgFunction {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LuaValue call(LuaValue modname, LuaValue env) {
|
|
||||||
final LuaTable ap = new LuaTable();
|
|
||||||
ap.set("config", new ConfigFunction());
|
|
||||||
env.set("ap", ap);
|
|
||||||
env.get("package").get("loaded").set("wifi.ap", ap);
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ConfigFunction extends OneArgFunction {
|
private class ConfigFunction extends OneArgFunction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,4 +60,22 @@ public class ESP8266Wifi extends TwoArgFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class StatusFunction extends ZeroArgFunction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LuaValue call() {
|
||||||
|
return LuaValue.valueOf(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GetIpFunction extends ZeroArgFunction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LuaValue call() {
|
||||||
|
return LuaValue.valueOf("127.0.0.1");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user