示例#1
0
 void tmrIdleTimer_Tick(GT.Timer timer)
 {
     tmrIdleTimer.Stop();
     window.Background = new SolidColorBrush(GT.Color.Black);
     currentTime       = timeMgr.UpdatedTime;
     window.Child      = ViewManager.IdleTimeView;
 }
示例#2
0
        void keyboardIcona_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            button.TurnLedOn();
            button.ButtonPressed += button_ButtonPressed;
            HideButtons();
            displayTE35.SimpleGraphics.DisplayImage(istrKey, 0, 0);
            Thread.Sleep(2000);
            canvas.Children.Clear();
            canvas.Children.Add(numericKey);
            canvas.Children.Add(username);
            Canvas.SetBottom(username, 15);
            Canvas.SetLeft(username, 0);
            canvas.Children.Add(usernameValue);
            Canvas.SetBottom(usernameValue, 15);
            Canvas.SetLeft(usernameValue, 80);


            canvas.Children.Add(pin);
            Canvas.SetBottom(pin, 15);
            Canvas.SetLeft(pin, 200);
            canvas.Children.Add(pinValue);
            Canvas.SetBottom(pinValue, 15);
            Canvas.SetLeft(pinValue, 235);

            numericKey.TouchDown += numericKey_TouchDown;
        }
示例#3
0
 /**
  * This method send periodic keep alive to server
  */
 private void keepAlive(GT.Timer timer)
 {
     Debug.Print("Keep Alive !");
     servertime += 35000;
     try
     {
         var data = proxy.keepAlive(new keepAlive()
         {
             myMacAddress  = myMac,
             mycurrentTime = servertime,
             port          = int.Parse(connectionInfo[1]),
         });
     }
     catch (SocketException e)
     {
         if (timer_keepAlive.IsRunning)
         {
             timer_keepAlive.Stop();
         }
         if (setupComplete)
         {
             if (!throw_allarm)
             {
                 ThrowAllarm();
             }
         }
     }
 }
示例#4
0
 void timeOutTimer_Tick(GT.Timer timer)      //called when specified time has elapsed
 {
     if (timeOutTimer.IsRunning)
     {
         displayMessage("No response received within time", true);
         authInProgress = false;
     }
     timeOutTimer.Stop();
 }
示例#5
0
        private void network_down(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            gestioneC.annullaConnessione();

            timer.Stop();
            ledStrip.TurnAllLedsOff();
            ledStrip.TurnLedOn(5);
            ledStrip.TurnLedOn(6);
            //stampo a video un messaggio di errrore (Connessione assente!!!)
        }
示例#6
0
 private void GoToMenu(object sender)
 {
     lock (myLock)//per finire draw main e solo dopo andare a menu
     {
         timerMain.Tick -= DrawMainWindow;
         timerMain.Stop();
         //Thread.Sleep(navigation_delay);
         DrawMenu();
         return;
     }
 }
示例#7
0
 private void ThrowAllarm()
 {
     camera.StopStreaming();
     throw_allarm = true;
     StopAllarm   = false;
     timer_getimage.Stop();
     Thread.Sleep(500);
     camera.StopStreaming();
     buzzer.Start();
     timer_allarm       = new GT.Timer(300);
     timer_allarm.Tick += allarm_Tick;
     timer_allarm.Start();
 }
示例#8
0
 private void resetAll(object sender)
 {
     lock (myLock)//altrimenti puo provare lanciare thread mentre tolgo handler
     {
         timerSend.Tick        -= sendData;
         timerMain.Tick        -= DrawMainWindow;
         timerRetryServer.Tick -= RetryServer;
         ResetNoAlarm.Tick     -= ActivateAlarm;
         timerMain.Stop();
         timerRetryServer.Stop();
         timerSend.Stop();
         ResetNoAlarm.Stop();
         Mainboard.PostInit();
         ShowConnectionWindow();
     }
 }
示例#9
0
        void setTimerInterval(int newIntervalPosition)
        {
            intervalPosition = newIntervalPosition;
            TimeSpan interval = new TimeSpan(0, 0, 0, 0, intervals[intervalPosition] * 1000);

            if (timer != null)
            {
                timer.Stop();
            }
            else
            {
                timer       = new GT.Timer(interval);
                timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            }

            if (intervalPosition == 0)
            {
                DisplayMessage("Camera Off");
            }
            else
            {
                timer.Interval = interval;
                timer.Start();

                DisplayMessage("Interval Set to: " + intervals[intervalPosition] + " seconds");
            }
        }
示例#10
0
        void hideMessage_Tick(GT.Timer timer)
        {
            timer.Stop();

            label.Visibility        = Visibility.Collapsed;
            imageDisplay.Visibility = Visibility.Visible;
        }
示例#11
0
        void start(GT.Timer timer)
        {
            t.Stop();

            if (!wifi_RS21.Interface.IsOpen)
            {
                wifi_RS21.Interface.Open();
            }
            if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
            {
                wifi_RS21.Interface.NetworkInterface.EnableDhcp();
            }

            // to use hold the network to connect to
            //GHI.Premium.Net.WiFiNetworkInfo[] info = null;
            wifi_RS21.NetworkDown += new GT.Modules.Module.NetworkModule.NetworkEventHandler(wifi_NetworkDown);
            wifi_RS21.NetworkUp   += new GT.Modules.Module.NetworkModule.NetworkEventHandler(wifi_NetworkUp);
            wifi_RS21.Interface.NetworkAddressChanged += Interface_NetworkAddressChanged;

            wifi_RS21.UseDHCP();
            GHI.Premium.Net.WiFiNetworkInfo[] info = null;
            info = wifi_RS21.Interface.Scan("AndroidNexus");

            wifi_RS21.Interface.Join(info[0], "17533355k");
        }
示例#12
0
        private void sendAuthRequest(string scannedRFID, GT.Picture capturedImage)
        {
            /* Code for sending rfid and picture to webserver */
            if (ethernetJ11D.IsNetworkUp)
            {
                string jsonString = getJsonString(scannedRFID, capturedImage);
                //displayText("JSON string: " + jsonString);
                Debug.Print("JSON string: " + jsonString);
                displayText("Network up. Trying to send authentication request..");

                POSTContent jsonContent = POSTContent.CreateTextBasedContent(jsonString);
                var         req         = HttpHelper.CreateHttpPostRequest(webserverUrl, jsonContent, "application/json");

                //var req = HttpHelper.CreateHttpGetRequest("http://192.168.1.2:8008/DEMOService/prova");
                req.ResponseReceived += new HttpRequest.ResponseHandler(req_ResponseReceived);
                req.SendRequest();
                displayText("Request sended!");
            }
            else
            {
                string jsonString = getJsonString(scannedRFID, capturedImage);
                //displayText("JSON string: " + jsonString);
                displayText("Authentication failed because network is down");
            }

            authInProgress = false;
            timeOutTimer.Stop();
        }
示例#13
0
        public void t_Tick(GT.Timer timer)
        {
            timer.Stop();

            update_hotspots();
            connect_to_hotspot("oram_2.4Ghz", "theAardvarkDidIt");
            get("http://oram.ca", req_ResponseReceived);
        }
 public void StopSampling()
 {
     //TODO: Desactivar el LED infrarrojo y detener el muestreo del foto-transistor
     timer.Stop();
     this.dig_out.Write(false);
     this.anag_in.IsActive = false;
     actual = false;
 }
示例#15
0
 private void Login_TouchDown(object sender, TouchEventArgs e)
 {
     tmrObjectDetect.Stop();
     tmrUpdateTime.Stop();
     loginMenu.Visibility    = Visibility.Hidden;
     numberCanvas.Visibility = Visibility.Visible;
     Debug.Print("Please Log In...");
 }
示例#16
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;
 }
示例#17
0
        // Relay Start Timer
        void RelayStartTimer_Tick(GT.Timer timer)
        {
            Relay.DisableRelay(2);
            Relay.DisableRelay(4);

            RelayStartTimer.Stop();
            RelayStopTimer.Start();
        }
示例#18
0
        public void StopSampling()
        {
            salida.Write(false);
            Debug.Print("Apagado");
            timer.Stop();

            //Estado = ESTADO.APAGADO;
        }
示例#19
0
 private void wakedt_Tick(Gadgeteer.Timer timer)
 {
     lock (_lock)
     {
         //_RIBar.Write(true);
         _wakedt.Stop();
     }
 }
示例#20
0
 void start(GT.Timer timer)
 {
     Debug.Print("timer start");
     t.Stop();
     button.ButtonPressed        += button_ButtonPressed;
     blueT.DeviceInquired        += blueT_DeviceInquired;
     blueT.DataReceived          += blueT_DataReceived;
     blueT.BluetoothStateChanged += blueT_BluetoothStateChanged;
 }
示例#21
0
        private void SpegniAllarme()
        {
            timer_allarm.Stop();
            StopAllarm       = true;
            buzzer.Frequency = 0.1;
            buzzer.Stop();

            return;
        }
示例#22
0
        void touchScreen_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            String str = "touch detected at: " + e.Touches[0].X + "x" + e.Touches[0].Y;

            Debug.Print(str);
            console.TextContent = str;
            timer.Start();
        }
示例#23
0
 private void keepConnectionAliveTimerTick(GT.Timer timer)
 {
     if (!IsRegisteredToNetwork())
     {
         timer.Stop();
         this.displayFailedConnectToNetworkError();
         GT.Timer networkConnectionTimer = new GT.Timer(NETWORK_CONNECTION_TICK_TIME);
         networkConnectionTimer.Tick += networkConnectionTimer_Tick;
         networkConnectionTimer.Start();
     }
 }
示例#24
0
        private void DoorClosed(Button sender, Button.ButtonState state)
        {
            authorizedAccess = false;
            doorOpen         = false;

            pinWindow.SetText("Door closed");
            DebugOnly.Print("Door closed!");

            // Stop timer
            unlockTimerRunning = false;
            unlockedTimer.Stop();

            // Log if there is a pending error
            if (pendingUnlockError)
            {
                pendingUnlockError = false;
                DebugOnly.Print("Door finally closed");
                DataHelper.AddLog(new Log(Log.TypeError, "Door finally closed"));
            }
        }
示例#25
0
        private void sendAuthRequest(string scannedRFID, GT.Picture capturedImage)
        {
            /* Code for sending rfid and picture to webserver */
            if (true /*ethernetJ11D.IsNetworkUp*/)
            {
                string jsonString = getJsonString(scannedRFID, capturedImage);

                /*POSTContent jsonContent = POSTContent.CreateTextBasedContent(jsonString);
                 * var req = HttpHelper.CreateHttpPostRequest(webserverUrl, jsonContent, "application/json");
                 * req.ResponseReceived += new HttpRequest.ResponseHandler(req_ResponseReceived);
                 * req.SendRequest();
                 */
            }
            else
            {
                Debug.Print("Authentication failed because network is down");
            }

            authInProgress = false;
            timeOutTimer.Stop();
        }
示例#26
0
        /**
         * This method is triggered when the button is pressed.
         */
        private void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
        {
            Debug.Print("Button pressed!");
            button.ButtonPressed -= button_ButtonPressed;
            streaming             = false;
            camera.StopStreaming();
            camera.StopStreaming();
            timer_joystick.Stop();
            WindowsManager.showWindowLoadingStatic();
            Thread.Sleep(200);

            if (NetworkUp)
            {
                initServer();
            }
            else
            {
                Debug.Print("Network_Down!!!");
                WindowsManager.showWindowNetworkDown();
            }
        }
示例#27
0
        // Network Up
        void wifi_RS21_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            if (NetworkTimer.IsRunning == true)
            {
                NetworkTimer.Stop();

                // IP = wifi_RS21.NetworkSettings.IPAddress;
                Debug.Print("Network Initialized. IP: " + IP);

                // Enable Sockets Communications
                EnableSockets();
            }
        }
示例#28
0
 void button_ButtonPressed(Button sender, Button.ButtonState state)
 {
     if (!timerStarted)
     {
         dataReadTimer.Start();
         timerStarted = true;
     }
     else
     {
         dataReadTimer.Stop();
         timerStarted = false;
     }
 }
示例#29
0
        private void _glitchdt_Tick(Gadgeteer.Timer timer)
        {
            lock (_lock)
            {
                _glitchdt.Stop();

                if (isAsleep != _isAsleepLastSent)
                {
                    _isAsleepLastSent = isAsleep;
                    OnPowerStateChangedEvent(this, _isAsleepLastSent);
                }
            }
        }
示例#30
0
        void timer_Tick(GT.Timer timer)
        {
            timer.Stop();
            timer.Interval = _targetTelemetryInterval;

            OBDIIReader.OBDIIData obdiiData = null;
            if (this.OBDReader.InitializeObd())
            {
                obdiiData = this.OBDReader.ReadObdIIData();
                UpdateDisplay(obdiiData);
            }

#if !MF_EMULATOR
            this.temperatureHumidity.RequestMeasurement();
#endif

#if SB
            if (this.TimeHelper.UpdateTime())
            {
                GetDeviceProvisioningInfo();
                if (this.SBSender == null)
                {
                    // TODO: Provision SB credentials properly
                    this.SBSender = new AmqpSender(this, this.deviceInfo.baseUri, this.deviceInfo.keyName, this.deviceInfo.keyValue, this.deviceInfo.OutboxEntity);
                    this.SBSender.StartSender();
#if !OrderedMessagingDemo
                    if (this.SBReceiver == null)
                    {
                        // TODO Use the AMQP session and connection of the sender to minimize socket usage/SSL overhead on both client and service
                        this.SBReceiver = new AmqpReceiver(this, this.deviceInfo.baseUri, this.deviceInfo.keyName, this.deviceInfo.keyValue, this.deviceInfo.InboxEntity, OnMessageCallback);
                        //this.SBReceiver = new AmqpReceiver(this, this.SBSender, this.deviceInfo.InboxEntity, OnMessageCallback);

                        this.SBReceiver.SenderForLatencies   = this.SBSender;
                        this.SBReceiver.DeviceIdForLatencies = this.deviceInfo.DeviceId.ToString();
                        this.SBReceiver.Start();
                    }
#endif
                }
                else
                {
                    SendOBDToSB(obdiiData);

                    if (this._lastDeviceTemperatureHumidityTimestamp > DateTime.MinValue)
                    {
                        SendTemperatureToDB(this.deviceInfo.DeviceId, this._lastDeviceTemperatureHumidityTimestamp, this._lastDeviceTemperature, this._lastDeviceHumidity);
                    }
                }
            }
#endif
            timer.Start();
        }
示例#31
0
 void continuousTimer_Tick(Timer timer)
 {
     if (!continuousMeasurement)
     {
         timer.Stop();
         return;
     }
     RequestMeasurement();
 }
示例#32
0
 private void TimerTick(Timer timer)
 {
     timer.Stop();
     if (_imageDisplay.Background == null) { return; }
     _message.Visibility = Visibility.Collapsed;
     _imageDisplay.Visibility = Visibility.Visible;
 }
示例#33
0
        Boolean coffeeMachineOn()
        {
            Debug.Print("Setting coffeeMachine ON");
            // set state of the device
            coffeeMachineState = CoffeeMachineState.ON;

            // This is needed as the the command may come from orchestrator.js, end hence is run in different thread!
            //Program.BeginInvoke(new DispatcherOperationCallback(delegate
            //{
                onBtnBorder.Background = selectedONAndLoadedBackgroundBrush;
                offBtnBorder.Background = unselectedBackgroundBrush;
                loadedBtnBorder.Background = unselectedBackgroundBrush;

                timeUntilCoffeeReady = COFFEE_MAKE_TIME;
                timeUntilCoffeeReadyTimer = new GT.Timer(1000);
                timeUntilCoffeeReadyTimer.Tick += new GT.Timer.TickEventHandler((timer) =>
                {
                    if (timeUntilCoffeeReady == 0)
                        timerText.TextContent = "coffee ready";
                    else
                        timerText.TextContent = "" + timeUntilCoffeeReady;
                    timeUntilCoffeeReady -= 1;
                    if (timeUntilCoffeeReady < 0) { timeUntilCoffeeReadyTimer.Stop(); }
                });
                timeUntilCoffeeReadyTimer.Start();

                // the actual functionality
                coffeeRelay.TurnOff();

            //    return null;
            //}), "");

            return true;
        }
示例#34
0
        private void ZombieTwitForm()
        {
            var tweets = new[]{
                                    @"@zombieHunter Zombies are coming!"
                                    , @"@zombieHunter Zombies are getting closer!"
                                    , @"@zombieHunter THEY'RE HERE!!!"
                                    , @"@zombieHunter Send the Gadgets!!!"
                                    , @"@zombieHunter Tell my wife and kids..."
                                    , @"@zombieHunter ...I'll eat them later!"
                                };

            var frm = new Form("zombie twit");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Twit", _fntHuge, frm.Width / 2 - 100, 50) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            // Add a listbox
            var lb = new Listbox("lb1", _fntArialBold11, frm.Width / 2 - 200, frm.Height / 2 - 100, 400, 200, null);
            pnl.AddControl(lb);

            TinkrCore.ActiveContainer = frm;

            byte lastTweet = 0;
            var timer = new GT.Timer(2000);
            timer.Tick += timer1 =>
                              {
                                  if(lastTweet >= tweets.Length)
                                  {
                                      timer.Stop();
                                      return;
                                  }
                                  //lb.InsertAt(tweets[lastTweet++], 1);
                                  lb.AddItem(tweets[lastTweet++]);
                              };
            timer.Start();
        }