void ClearLog_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     if (VerifySDCard())
     {
         lock (LockObject)
         {
             using (StreamWriter sw = new StreamWriter(rootDir + fileName))
             {
                 sw.WriteLine(string.Empty);
             }
         }
     }
     responder.Respond("Log cleared.");
 }
Exemple #2
0
        void seePicture_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            if (pic != null)
            {
                Bitmap b = new Bitmap(320, 240);
                b.DrawLine(Colors.Red, 20, 0, 0, 319, 239);
                byte[] buff = new byte[320 * 240 * 3 + 54];
                GHIElectronics.NETMF.System.Util.BitmapToBMPFile(b.GetBitmap(), 320, 240, buff);

                GT.Picture picture = new GT.Picture(buff, GT.Picture.PictureEncoding.BMP);

                responder.Respond(picture);
            }
            else
                responder.Respond("Take picture first");
        }
Exemple #3
0
 /// <summary>
 /// The response event for http://192.168.1.22:80/bio,
 /// Serialisese the bpm from the latest reading to a string, converts it to a byte array and passes it to the responder
 /// </summary>
 /// <param name="path">http://192.168.1.22:80/bio</param>
 /// <param name="method">Enum that represents the supported http methods, i.e. post, get, delete, put</param>
 /// <param name="responder">An object which responds to the request</param>
 void SendBioFeedback_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     string content = CurrentReading.SerialiseBpm();
     byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
     responder.Respond(bytes, "text/html");
 }
 void GetLog_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     if (VerifySDCard())
     {
         using (StreamReader sr = new StreamReader(rootDir + fileName))
         {
             string text = sr.ReadToEnd();
             responder.Respond(text);
         }
     }
     else
         responder.Respond("No SD card detected.");
 }
 void GetReading_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     responder.Respond(GetNewReadings());
 }
Exemple #6
0
        void toggleCapture_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            captureOn = !(captureOn);

            string content = "<html><body><h1>" + getCaptureMode() + "</h1></body></html>";
            byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
            responder.Respond(bytes, "text/html");

            if (captureOn) multicolorLed.BlinkRepeatedly(GT.Color.Red);
            else           multicolorLed.BlinkRepeatedly(GT.Color.Green);
        }
Exemple #7
0
 void getVersion_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     string content = "<html><body><h1>Version 1.0!</h1>"+getCaptureMode() + "</body></html>";
     byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
     responder.Respond(bytes, "text/html");
 }
Exemple #8
0
 void empty_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     responder.Respond("This is a RoboHome module and should be accessed using the API");
 }
Exemple #9
0
 void state_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     responder.Respond(sensorState);
 }
Exemple #10
0
 void sayHello_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     string content = "<html><body><h1>Hello World!!</h1></body></html>";
     byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
     responder.Respond(bytes, "text/html");
 }
 void authenticatesystem_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     string content = "<html><body><h1>connectionsuccessfulrunprogram</h1></body></html>";
     byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
     responder.Respond(bytes, "text/html");
 }
 void webEventtemperature_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     string content = "<html><body><h1>" + temperature + "</h1></body></html>";
     byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
     responder.Respond(bytes, "text/html");
 }
        void view_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            led.TurnWhite();
            Thread.Sleep(2000);
            led.TurnOff();

            Debug.Print("View page requested");
            TimeSpan time = GetMachineTime;
            new DateTime(time.Ticks).ToString("HH:mm:ss");
               string content = "<html><title>Web Access</title><center><h1>Room Climate Monitor Web Access</center></h1><body></br></br></br>This is the web page for the Room Climate Control Monitor on IP" + systemip  + ".</br></br>Currently the following values are detected: </br></br>Temperature: " + temperature.ToString() + "'c</br></br>Humidity: " + relativeHumidity + "</br></br>Percentage Light(Higher is Lighter): "+ lightpercentage + "%</br></br>Values change every few seconds but require the page to be refreshed for them to be updated.</br></br>Time: " + DateTime.Now + " </br></br></br>IP: " + systemip + "</br>Subnet Mask: " + ethernet.Interface.NetworkInterface.SubnetMask + "</br>Gateway: " + ethernet.Interface.NetworkInterface.GatewayAddress + "</br></br></br></br><center>Hosted on the .Net Gadgeteer Platform</center></body></html>" ;
            byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
            responder.Respond(bytes, "text/html");
        }
Exemple #14
0
 void takePicture_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     responder.Respond("Taking picture");
     camera.TakePicture();
 }
Exemple #15
0
 void hello_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
     Debug.Print("Hello world");
     responder.Respond("Hello world");
 }
Exemple #16
0
        void sketch_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            Bitmap bitmap = background.Bitmap;
            byte[] buff = new byte[bitmap.Width * bitmap.Height * 3 + 54];
            Util.BitmapToBMPFile(bitmap.GetBitmap(), bitmap.Width, bitmap.Height, buff);

            GT.Picture picture = new GT.Picture(buff, GT.Picture.PictureEncoding.BMP);
            responder.Respond(picture);
        }