private void Subscriber_MessageReceived(object sender, string e) { Observations.ObservationMessage om = JsonConvert.DeserializeObject <Observations.ObservationMessage>(e); if (om != null) { MessageReceived?.Invoke(this, om); } }
public void Publish(Observation Observation) { var message = new Observations.ObservationMessage() { Sender = Caspara.DeviceName, Topic = Caspara.DeviceName + ".OBSERVATION." + Observation.ID, Observation = Observation }; var msg = JsonConvert.SerializeObject(message); Client.Publish(message.Topic, msg); }
private void MessageService_MessageReceived(object sender, Observations.ObservationMessage e) { Console.WriteLine(Caspara.DeviceName + " Received -> " + e.Observation.ID + "-" + e.Observation.Name + "-" + e.Observation.Value.GetValue()); }
public void Publish(Observations.ObservationMessage Message) { var msg = JsonConvert.SerializeObject(Message); Client.Publish(Message.Topic, msg); }