Ejemplo n.º 1
0
        public DeviceMessage(string messageType, string deviceId, IEnumerable <DeviceEvent> events)
        {
            this.MessageType = messageType;
            this.DeviceId    = deviceId;
            this.Events      = new List <DeviceEvent>();

            foreach (DeviceEvent evnt in events)
            {
                this.Events.Add(evnt.DeepClone());
            }

            DeviceEvent firstEvent = events.FirstOrDefault();

            this.Timestamp = (DateTimeOffset)firstEvent.Timestamp;
        }
Ejemplo n.º 2
0
 public void AddEvent(DeviceEvent evt)
 {
     this.Events.Add(evt);
 }
        private static JObject SerializeEvent(DeviceEvent deviceEvent)
        {
            JObject jsonObj = JObject.FromObject(deviceEvent);

            return(jsonObj);
        }