void TempHumidityWebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { Debug.Print("Temp&Humidity web event from " + responder.ClientEndpoint + " - response " + this.response); responder.Respond(this.webResponse); }
void RelayWebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { this.relay_X1.Enabled = !this.relay_X1.Enabled; Debug.Print("Relay web event from " + responder.ClientEndpoint + " - response " + this.response); responder.Respond(this.webResponse); }
void RelayWebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { Debug.Print("Relay web event from " + responder.ClientEndpoint + " - response " + this.response); responder.Respond(this.webResponse); int amount = 1; if (responder.UrlParameters.Count > 0) { string a = responder.UrlParameters["amount"].ToString(); amount = Int32.Parse(a); } this.FireLight(amount); }
void WebcamEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { if (!hgd.ConnectedToHomeNetwork) { responder.Respond("Security error: not on home network"); return; } responders.Add(responder); camera.StartStreamingBitmaps(lastBitmap); webcamStreamStopTime = GT.Timer.GetMachineTime() + WebcamStreamTime; Debug.Print("Received webcam request - " + responders.Count + " client in queue"); }
void LedWebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { byte r = 0, g = 0, b = 0; int time = 0; try { string rstring = responder.GetParameterValueFromURL("r"); string gstring = responder.GetParameterValueFromURL("g"); string bstring = responder.GetParameterValueFromURL("b"); string timestring = responder.GetParameterValueFromURL("t"); if (rstring != null && rstring != "") { try { int rint = int.Parse(rstring); if (rint >= 0 && rint <= 255) { r = (byte)rint; } } catch { } } if (gstring != null && gstring != "") { try { int gint = int.Parse(gstring); if (gint >= 0 && gint <= 255) { g = (byte)gint; } } catch { } } if (bstring != null && bstring != "") { try { int bint = int.Parse(bstring); if (bint >= 0 && bint <= 255) { b = (byte)bint; } } catch { } } if (timestring != null && timestring != "") { try { time = int.Parse(timestring); if (time < 0) { time = 0; } } catch { } } } catch { } TimeSpan duration = new TimeSpan(0, 0, time); RemoteControlLedEndTime = GT.Timer.GetMachineTime() + duration; GT.Timer rcEndTimer = new GT.Timer(duration); rcEndTimer.Behavior = GT.Timer.BehaviorType.RunOnce; rcEndTimer.Tick += (t) => hgd.SetLed(); rcEndTimer.Start(); multicolorLed.TurnColor(new GT.Color(r, g, b)); responder.Respond("Setting LED to r=" + r + " g=" + g + " b=" + b + " for t=" + time + " secs"); }
void MoistureWebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { string response = "{ \"DeviceId\" : \"" + hgd.IdentifierString + "\", \"moisture\" : " + moistureSensor.GetMoistureReading() + "}"; Debug.Print("Moisture web event from " + responder.ClientEndpoint + " - response " + response); responder.Respond(response); }
void Program_WebEventReceived(string path, HomeOSGadgeteer.Networking.WebServer.HttpMethod method, HomeOSGadgeteer.Networking.Responder responder) { //throw new NotImplementedException(); //this.relay_X1.Enabled = !this.relay_X1.Enabled; //Reboot(); //if (this.relay_X1) //{ // this.relay_X1.TurnOff(); //} //else //{ // this.relay_X1.TurnOn(); //} //ok = !ok; //this.relay_X1.TurnOn(); responder.Respond("OK"); }