Esempio n. 1
0
        void ethernet_NetworkUp(GTM.Module.NetworkModule sender,
                              GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Connected to network.");
            Debug.Print("IP address: " + ethernet.NetworkSettings.IPAddress);
            string ipAddress = ethernet.NetworkSettings.IPAddress;
            systemip = ipAddress;
            WebServer.StartLocalServer(ipAddress, 80);
            display.SimpleGraphics.Clear();
            SetupWindow("Climate Control Monitor", 10);
            SetupWindow("Enter this into PC application:", 50);
            RedSetupWindow(systemip, 70);
            SetupWindow("Please use the user guide to help you", 90);
            SetupWindow("Access this device online at: ",130);
            RedSetupWindow(systemip + "/view", 150);

            webEventtemperature = WebServer.SetupWebEvent("gettemp");
            webEventtemperature.WebEventReceived += new WebEvent.ReceivedWebEventHandler(webEventtemperature_WebEventReceived);

            webEventhumidity = WebServer.SetupWebEvent("gethumid");
            webEventhumidity.WebEventReceived += new WebEvent.ReceivedWebEventHandler(webEventhumidity_WebEventReceived);

            webEventlight = WebServer.SetupWebEvent("getlight");
            webEventlight.WebEventReceived += new WebEvent.ReceivedWebEventHandler(webEventlight_WebEventReceived);
            authentication = WebServer.SetupWebEvent("authenticate");
            authentication.WebEventReceived += new WebEvent.ReceivedWebEventHandler(authenticatesystem_WebEventReceived);
            view = WebServer.SetupWebEvent("view");
            view.WebEventReceived += new WebEvent.ReceivedWebEventHandler(view_WebEventReceived);

            Debug.Print("web event setup success");
        }
Esempio n. 2
0
        void camera_BitmapStreamed(GTM.GHIElectronics.Camera sender, Bitmap bitmap)
        {
            //320*240

            displayT35.SimpleGraphics.DisplayImage(bitmap, 0, 0);
            detectionMove(bitmap);
        }
Esempio n. 3
0
        public static void initWifiConnection(GTM.GHIElectronics.WiFi_RS21 wifi, string wlanName, string wlanPassword)
        {
            Debug.Print("connecting to: " + wlanName);
            if (wifi.Interface.IsOpen)
            {
                Debug.Print("interface was open");
            }
            else
            {
                Debug.Print("interface was not open");
                wifi.Interface.Open();
            }

            wifi.Interface.WirelessConnectivityChanged +=
                new WiFiRS9110.WirelessConnectivityChangedEventHandler((s, e) =>
            {
                Debug.Print("wifi conn changed!");
                if (e.IsConnected) { Debug.Print("WIFI (" + wlanName + ") connected!"); }
                else { Debug.Print("WIFI (" + wlanName + ") disconnected.."); }
            });

            wifi.DebugPrintEnabled = true;
            wifi.UseDHCP();

            GHI.Premium.Net.WiFiNetworkInfo info = new WiFiNetworkInfo();
            info.SSID = wlanName;
            info.SecMode = GHI.Premium.Net.SecurityMode.WPA2;
            info.networkType = GHI.Premium.Net.NetworkType.AccessPoint;

            wifi.Interface.Join(info, wlanPassword);
            wifi.UseThisNetworkInterface();
        }
Esempio n. 4
0
        void ethernet_J11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network up!");
            Debug.Print("IP Address: " + ethernet_J11D.NetworkSettings.IPAddress.ToString());

            // Configure TimeService settings.
            TimeServiceSettings settings = new TimeServiceSettings();
            settings.ForceSyncAtWakeUp = true;
            settings.RefreshTime = 1800;    // in seconds.

            IPAddress[] address = Dns.GetHostEntry("ntp.nasa.gov").AddressList;
            if (address != null && address.Length > 0)
                settings.PrimaryServer = address[0].GetAddressBytes();

            address = Dns.GetHostEntry("pool.ntp.org").AddressList;
            if (address != null && address.Length > 0)
                settings.AlternateServer = address[0].GetAddressBytes();

            TimeService.Settings = settings;
            TimeService.Start();

            WebServer.StartLocalServer(ethernet_J11D.NetworkSettings.IPAddress.ToString(), 80);
            GetReading = WebServer.SetupWebEvent("getreading");
            GetReading.WebEventReceived += new WebEvent.ReceivedWebEventHandler(GetReading_WebEventReceived);

            GetLog = WebServer.SetupWebEvent("getlog");
            GetLog.WebEventReceived += new WebEvent.ReceivedWebEventHandler(GetLog_WebEventReceived);

            ClearLog = WebServer.SetupWebEvent("clearlog");
            ClearLog.WebEventReceived += new WebEvent.ReceivedWebEventHandler(ClearLog_WebEventReceived);

            temperatureHumidity.RequestMeasurement();
        }
Esempio n. 5
0
 /// <summary>
 /// An event which is fired when the network is up, turns the status led blue, starts a http server operation on port 80
 /// Creates the web event bio, acessed via http://192.168.1.22:80/bio and its response handler 
 /// </summary>
 /// <param name="sender">The network module that fired the event</param>
 /// <param name="state">The state the network module was in</param>
 void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     led.TurnBlue();
     WebServer.StartLocalServer(ethernet.NetworkSettings.IPAddress, 80);
     //http://192.168.1.22:80/bio
     SendBioFeedback = WebServer.SetupWebEvent("bio");
     SendBioFeedback.WebEventReceived += new WebEvent.ReceivedWebEventHandler(SendBioFeedback_WebEventReceived);
 }
Esempio n. 6
0
 void ethernetJ11D_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     timer.Stop();
     this.btn_inicio.Enabled = false;
     text.Text = "No Network";
     Glide.MainWindow = iniciarWindow;
     Debug.Print("Desactivado");
 }
        public SensorProximidad(GTM.GHIElectronics.Extender extender)
        {
            salida = extender.CreateDigitalOutput(GT.Socket.Pin.Four,false);
            entrada = extender.CreateAnalogInput(GT.Socket.Pin.Three);
            timer.Tick += timer_Tick;

            //TODO: Inicializar el sensor
        }
Esempio n. 8
0
        void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            this.btn_inicio.Enabled = true;
            text.Text = ethernetJ11D.NetworkSettings.IPAddress;
            Glide.MainWindow = iniciarWindow;

            Debug.Print("Activado");
        }
Esempio n. 9
0
 void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     led.TurnGreen();
     string ipAddress = ethernet.NetworkSettings.IPAddress;
     WebServer.StartLocalServer(ipAddress, 80);
     sayHello = WebServer.SetupWebEvent("hello");
     sayHello.WebEventReceived += new WebEvent.ReceivedWebEventHandler(sayHello_WebEventReceived);
 }
Esempio n. 10
0
 void ethernetJ11D_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     Debug.Print("Desconectado");
     btn_inicio.Text = "Iniciar";
     btn_inicio.Enabled = false;
     texto.Text = "No Network";
     timer.Stop();
     Glide.MainWindow = iniciarWindow;
 }
Esempio n. 11
0
        void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            btn_inicio.Enabled = true;

            ip=ethernetJ11D.NetworkSettings.IPAddress;
            texto.Text = ip;
            Debug.Print("Conectado");
            Glide.MainWindow = iniciarWindow;
        }
Esempio n. 12
0
 public SensorProximidad(GTM.GHIElectronics.Extender extender)
 {
     //TODO: Inicializar el sensor
     input = extender.CreateAnalogInput(GT.Socket.Pin.Three);
     output = extender.CreateDigitalOutput(GT.Socket.Pin.Five, false);
     timer = new GT.Timer(1000);
     timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
     //timer.Start();
 }
Esempio n. 13
0
        public Controller(Model model, Ranger ranger, GTM.GHIElectronics.Button thresholdButton)
        {
            this.model = model;

            this.ranger = ranger;
            ranger.MeasurementComplete += new Microsoft.SPOT.EventHandler(ranger_MeasurementComplete);

            this.thresholdButton = thresholdButton;
            thresholdButton.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(thresholdButton_ButtonPressed);
        }
Esempio n. 14
0
        private GT.Timer timer; // every second (1000ms)

        #endregion Fields

        #region Constructors

        public SensorProximidad(GTM.GHIElectronics.Extender extender)
        {
            //TODO: Inicializar el sensor

            entrada = extender.CreateAnalogInput(GT.Socket.Pin.Three);
            salida = extender.CreateDigitalOutput(GT.Socket.Pin.Five, false);
            timer = new GT.Timer(1000);
            timer.Tick += timer_Tick;
            estado = Estado.Ninguno;
        }
Esempio n. 15
0
        private void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network Up!");

            txtAddress.TextContent = "IP Address: " + ethernet.NetworkSettings.IPAddress + ", port 8080";

            SocketServer server = new SocketServer(8080);
            server.DataReceived += new DataReceivedEventHandler(server_DataReceived);
            server.Start();
        }
Esempio n. 16
0
        //Navigate to start screen after button component is pressed after finishing the game
        void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
        {
            if (isGameOver)
            {
                Glide.MainWindow = mainWindow;
                isGameOver = false;
                isGameScreen = false;

                winMasterMind.getGameWindow().Dispose();

            }
        }
Esempio n. 17
0
        void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
        {
            _speedFactor = distance_US3.GetDistanceInCentimeters(1);

            for (int i = 0; i < _speedFactor; i++)
            {
                tunes.AddNote(new tunes.MusicNote(tunes.Tone.C4, 100));
                tunes.AddNote(new tunes.MusicNote(tunes.Tone.Rest, 50));
            }

            //if (_speedFactor > 10) _speedFactor = 10;
            //QueueHappyBirthdayTones();
            tunes.Play();
        }
Esempio n. 18
0
 void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
 {
     if (button.IsLedOn) //check if button is “on"
     {
         camera.StopStreaming(); //stop streaming
         button.TurnLedOff(); //mark button as "off"
     }
     else
     {
         if (camera.CameraReady)
         {
             camera.StartStreaming(mBitmap); //start streaming
             //fillColores();
             button.TurnLedOn(); //mark button as "on"
         }
     }
 }
Esempio n. 19
0
        void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("IP:" + ethernet.NetworkSettings.IPAddress.ToString());

            Gadgeteer.Networking.WebServer.StartLocalServer(ethernet.NetworkSettings.IPAddress, 80);

            foreach (string s in sender.NetworkSettings.DnsAddresses)
                Debug.Print("Dns:" + s);

            hello = Gadgeteer.Networking.WebServer.SetupWebEvent("hello");
            hello.WebEventReceived += new WebEvent.ReceivedWebEventHandler(hello_WebEventReceived);

            takePicture = Gadgeteer.Networking.WebServer.SetupWebEvent("takepicture");
            takePicture.WebEventReceived += new WebEvent.ReceivedWebEventHandler(takePicture_WebEventReceived);

            seePicture = Gadgeteer.Networking.WebServer.SetupWebEvent("seepicture");
            seePicture.WebEventReceived += new WebEvent.ReceivedWebEventHandler(seePicture_WebEventReceived);
        }
Esempio n. 20
0
        public static void Init(GTM.GHIElectronics.Display_HD44780 display)
        {
            version = "1.0";
            sensorVoltage = 4.80D;
            mvpermm = sensorVoltage / 512D;
            if (display_HD44780 == null)
            {
                display_HD44780 = display;
            }

            if (extender == null)
            {
                extender = new GTM.GHIElectronics.Extender(3);
            }

            if (sensors == null)
            {
                sensors = new AnalogInput[3];
            }

            if (sensors[0] == null)
                sensors[0] = extender.SetupAnalogInput(GT.Socket.Pin.Three);
            if (sensors[1] == null)
                sensors[1] = extender.SetupAnalogInput(GT.Socket.Pin.Four);
            if (sensors[2] == null)
                sensors[2] = extender.SetupAnalogInput(GT.Socket.Pin.Five);

            if (sensorTimer == null)
            {
                sensorTimer = new GT.Timer(500);
                sensorTimer.Tick += new GT.Timer.TickEventHandler(sensorTimer_Tick);
            }

            if (modem == null)
            {
                modem = new Sim900Modem(2);
            }

            Display("ozlo, llc " + version, "");
        }
Esempio n. 21
0
 void ethernetJ11D_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     Debug.Print("Desconectado");
     //texto.Text = "No Network";
     timer.Stop();
     btn_news.Enabled = false;
     btn_temperature.Enabled = false;
 }
Esempio n. 22
0
 private void usbHost_MouseConnected(GTM.GHIElectronics.UsbHost sender, USBH_Mouse mouse)
 {
     _mouse = mouse;
     _mouse.MouseDown += new USBH_MouseEventHandler(_mouse_MouseDown);
     _mouse.MouseWheel += new USBH_MouseEventHandler(_mouse_MouseWheel);
 }
Esempio n. 23
0
 /// <summary>
 /// An event which is fired when the network is down, turns the status led red
 /// </summary>
 /// <param name="sender">The network module that fired the event</param>
 /// <param name="state">The state in which the network module is in</param>
 void ethernet_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     led.TurnRed();
 }
Esempio n. 24
0
 private void sdCard_SDCardMounted(GTM.GHIElectronics.SDCard sender, GT.StorageDevice SDCard)
 {
     InitialiseModel(SDCard);
 }
Esempio n. 25
0
 void ethernet_J11D_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     Debug.Print("Network down!");
 }
Esempio n. 26
0
 void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     ip = ethernetJ11D.NetworkSettings.IPAddress;
     //texto.Text = ip;
     tiempox();
     btn_news.Enabled = true;
     btn_temperature.Enabled = true;
     pantalla = pantallaTiempo;
 }
Esempio n. 27
0
        private void NetworkUpCallback(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Event : Network Up. Waiting for IP address attribution.");

            bool ready = waitForIpAttribution();
            if (ready)
            {
                Mainboard.SetDebugLED(true);
                mainTimer.Start();
            }
            else
            {
                Connect();
            }
        }
Esempio n. 28
0
        private void NetworkDownCallback(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Event: Network Down. Trying to reconnect.");

            mainTimer.Stop();
            Mainboard.SetDebugLED(false);
            Connect();
        }
 private void cellularRadio_NetworkDown(GTM.Module.NetworkModule sender,
     GTM.Module.NetworkModule.NetworkState state)
 {
     switch (state)
     {
         case GTM.Module.NetworkModule.NetworkState.Down:
             Debug.Print("Network Down Event - Down");
             break;
         case GTM.Module.NetworkModule.NetworkState.Up:
             Debug.Print("Network Down Event - Up");
             break;
     }
 }
        private void cellularRadio_NetworkUp(GTM.Module.NetworkModule sender,
            GTM.Module.NetworkModule.NetworkState state)
        {
            switch (state)
            {
                case GTM.Module.NetworkModule.NetworkState.Down:
                    Debug.Print("Network Up Event - Down");
                    _timer.Stop();
                    break;
                case GTM.Module.NetworkModule.NetworkState.Up:
                    Debug.Print("Network Up Event - Up " + cellularRadio.NetworkInterface.IPAddress);

                    if (cellularRadio.NetworkInterface.IPAddress != "0.0.0.0")
                    {
                        //have a PPP connection and valid IP address
                        Debug.Print("IP Address: " + cellularRadio.NetworkInterface.IPAddress);
                        Debug.Print("Gateway Address: " + cellularRadio.NetworkInterface.GatewayAddress);
                        foreach (var dns in cellularRadio.NetworkInterface.DnsAddresses)
                        {
                            Debug.Print("DNS Address: " + dns);
                        }

                        // get Internet Time using NTP
                        NTPTime("time.windows.com", -360);
                        Debug.Print("Time: " + DateTime.Now);

                        // Initialize AMQP _connection with Azure Event Hub
                        InitAMQPconnection();

                        //start collecting and sending data to Azure.
                        _timer.Start();
                    }
                    break;
            }
        }