Ejemplo n.º 1
0
        public static void Main()
        {
            var wifi = new NeonWifiDevice();

            wifi.Connect(SSID, PASSWD);

            var sntp = new SntpClient(wifi, "time1.google.com");

            sntp.SetTime();

            MobileServiceClient msc = new MobileServiceClient(wifi, azureMobileAppUri, null, AzureAppKey);
            IMobileServiceTable tab = msc.GetTable("environment_measures");

            // Test a dummy insert for now
            MeasurementRow row    = new MeasurementRow();
            string         result = tab.Insert(row);

            Debug.Print(DateTime.Now.ToString("T") + " " + result);

            bool state    = true;
            int  iCounter = 0;

            while (true)
            {
                Hardware.UserLed.Write(state);
                state = !state;
                if (++iCounter == 10)
                {
                    Debug.Print("Current UTC time : " + DateTime.UtcNow);
                    iCounter = 0;
                }
                Thread.Sleep(500);
            }
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            var wifi = new NeonWifiDevice();

            //wifi.EnableDebugOutput = true;
            //wifi.EnableVerboseOutput = true;

            wifi.Booted += WifiOnBooted;  // or you can wait on the wifi.IsInitializedEvent

            wifi.Connect(SSID, PASSWD);

            var sntp = new SntpClient(wifi, "time1.google.com");

            sntp.SetTime();

            MobileServiceClient msc = new MobileServiceClient(wifi, ak16Uri, null, AzureAppKey);
            IMobileServiceTable tab = msc.GetTable("environment_measures");

            //try
            //{
            // Test a dummy insert for now
            MeasurementRow row = new MeasurementRow();

            row.DateTimeStamp = DateTime.Now;
            row.where         = "here"; //Resources.GetString(Resources.StringResources.VanWie);
            row.what          = "nothing";
            row.value         = -1f;
            row.uom           = " ";
            string surprise = tab.Insert(row); // Failing on this line

            Debug.Print(DateTime.Now.ToString("T") + " " + surprise);

            bool state    = true;
            int  iCounter = 0;

            while (true)
            {
                Hardware.UserLed.Write(state);
                state = !state;
                if (++iCounter == 10)
                {
                    Debug.Print("Current UTC time : " + DateTime.UtcNow);
                    iCounter = 0;
                }
                Thread.Sleep(500);
            }
        }