Exemple #1
0
        void b_IpObteined(object sender, EventArgs e)
        {
            Debug.Print("Evento IP Broker Ottenuto Ricevuto");
            /*Inizialize Client MQTT*/
            //client.Disconnect();
            client = new M2QTT_Wrapper(broker.ToString(), sqldb);

            /*Start Timer for send data*/
            GT.Timer t2min = new GT.Timer(500 * 60);
            t2min.Tick += send_data;
            t2min.Start();
        }
Exemple #2
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();
        }