Exemple #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());
        }
Exemple #2
0
 public Task<bool> InsertTelemetryAsync(Telemetry tele)
 {
     return Task.Factory.StartNew<bool>(() => {
         return this.InsertTelemetry(tele);
     });
 }
Exemple #3
0
 public Task <bool> InsertTelemetryAsync(Telemetry tele)
 {
     return(Task.Factory.StartNew <bool>(() => {
         return this.InsertTelemetry(tele);
     }));
 }
Exemple #4
0
 public bool InsertTelemetry(Telemetry tele)
 {
     return this.Insert(tele, tele.GetType()) == 1;
 }
Exemple #5
0
 public bool InsertTelemetry(Telemetry tele)
 {
     return(this.Insert(tele, tele.GetType()) == 1);
 }