Exemplo n.º 1
0
        void wifiC_WifiConnected(object sender, EventArgs e)
        {
            //QUA CI VANNO LE COSE QUANDO E CONNESSO
            Debug.Print("Evento WiFi Connesso Ricevuto");
            #region Check connection
            /*Check connection*/
            //HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.it");
            //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            //if (response.StatusDescription == " OK")
            //{
            //    Debug.Print("Connect on internet");
            //}
            #endregion

            /*Set Data*/
            RealTimeClock.SetDateTime(Utilità.GetNetworkTime());


            /*Start Timer for syncronize time*/
            Utility.SetLocalTime(Utilità.GetNetworkTime());
            GT.Timer syncClock = new GT.Timer(1000 * 60 * 30);
            if (!syncClock.IsRunning)
            {
                syncClock.Tick += sincronizzazione_clock;
                syncClock.Start();
            }

            //solo prova perchè su mio pc non va broadcast!!!!!!!!!!!!!!!!!!!!
            client = new M2QTT_Wrapper("192.168.43.145", sqldb);
            /*Start Timer for send data*/
            GT.Timer t2min = new GT.Timer(2000 * 60);
            if (!t2min.IsRunning)
            {
                t2min.Tick += send_data;
                t2min.Start();
            }

            //FINO A QUA, DA TOGLIERE

            /*Find Broker IP*/
            //brokerIP broker = new brokerIP();
            //broker.IpObteined += b_IpObteined;
            //Thread scanIP = new Thread(broker.startListening);
            //scanIP.Start();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Synchronize time
 /// </summary>
 /// <param name="timer">Timer</param>
 private void sincronizzazione_clock(GT.Timer timer)
 {
     Utility.SetLocalTime(Utilità.GetNetworkTime());
     Debug.Print("SYNC");
     //RealTimeClock.SetDateTime(DateTime.Now);
 }