Exemple #1
0
        public void Start(HttpServer server, SimpleJsonListener json, SimpleTemplate templateDemo)
        {
            _ws           = server;
            _json         = json;
            _templateDemo = templateDemo;

            _ws.AddPath("/demoLED.html", ProcessDemoLED);

            _LEDControl.LoadString(_ws.HttpRootManager.ReadToByte(_privatePath + "/templateLED.html"));
            _LEDControl["ledOn"] = new TemplateAction()
            {
                Pattern = "LEDON"
            };
            _LEDControl["ledOff"] = new TemplateAction()
            {
                Pattern = "LEDOFF"
            };

            _templateDemo["maualLed"] = new TemplateAction()
            {
                Pattern = "MANUALLED", Data = "Off"
            };

            _ws.HttpRootManager.AddExtensionTemplateData("shtml", "manualLed", new TemplateAction()
            {
                Pattern = "MANUALLED", Data = "Off"
            });

            _json.AddData("MaualLed", "Off");

            //_ports._debug = true;
        }
        public void Start(HttpServer server, SimpleJsonListener json, SimpleTemplate templateDemo)
        {
            _ws           = server;
            _json         = json;
            _templateDemo = templateDemo;

            _ws.AddPath("/demoTimer.html", ProcessTimer);

            _timerControl.LoadString(_ws.HttpRootManager.ReadToByte(_privatePath + "/templateTimer.html"));
            _timerControl["timerOn"] = new TemplateAction()
            {
                Pattern = "TIMERON"
            };
            _timerControl["timerOff"] = new TemplateAction()
            {
                Pattern = "TIMEROFF"
            };

            _templateDemo["led"] = new TemplateAction()
            {
                Pattern = "LED", Data = "Off"
            };
            _templateDemo["timer"] = new TemplateAction()
            {
                Pattern = "TIMER", Data = "Off"
            };

            _json.AddData("Timer", "Off");
            _json.AddData("Led", "Off");

            _ws.HttpRootManager.AddExtensionTemplateData("shtml", "led", new TemplateAction()
            {
                Pattern = "LED", Data = "Off"
            });
            _ws.HttpRootManager.AddExtensionTemplateData("shtml", "timer", new TemplateAction()
            {
                Pattern = "TIMER", Data = "Off"
            });

            _ws.AddTimer("TestTimer", 10000, TimerEvent);

            //_ports._debug = true;
        }