Esempio n. 1
0
        void webSocket_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            var obj = (JsonObject)SimpleJson.SimpleJson.DeserializeObject(e.Message);

            //var obj = new JsonObject();
            //obj.
            if (obj == null) {
                return;
            }

            var tele = new Telemetry();
            tele.Name = (string)obj ["Name"];
            tele.SourceId = Int32.Parse(obj["SourceId"].ToString());
            tele.Value = float.Parse(obj["Value"].ToString());
            tele.Timestamp = DateTime.Parse((string)obj["TimeStamp"]);

            Database.Main.InsertTelemetryAsync(tele);

            Console.WriteLine(e.Message.ToString());
        }
Esempio n. 2
0
 public Task<bool> InsertTelemetryAsync(Telemetry tele)
 {
     return Task.Factory.StartNew<bool>(() => {
         return this.InsertTelemetry(tele);
     });
 }
Esempio n. 3
0
 public bool InsertTelemetry(Telemetry tele)
 {
     return this.Insert(tele, tele.GetType()) == 1;
 }