private HashEntry[] CreateEventNode(DiMap map, DiFlag flag)
 {
     HashEntry[] result = new HashEntry[]
     {
         new HashEntry("DocumentAddress", map.DocumentAddress),
         new HashEntry("EventName", map.Description),
         new HashEntry("IsEvent", map.Event),
         new HashEntry("Level", map.Level),
         new HashEntry("Description", flag.BitName),
         new HashEntry("BitValue", (int)flag.BitValue),
         new HashEntry("Status", flag.IsActivate(map.Value))
     };
     return(result);
 }
Ejemplo n.º 2
0
        public Task PublishEvent(string DeviceId, int GroupCode, ushort BitValue, EventStatus status, CancellationToken token)
        {
            DiMap target_map = diMaps.FirstOrDefault(x => x.)
                               EventModel record = new EventModel();

            record.UnixTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
            record.DeviceId      = this.DeviceId = DeviceId;
            record.SiteId        = SiteId;
            record.Status        = status;
            record.Detail        = map;
            string message = JsonConvert.SerializeObject(record);

            return(base.PublishMessageAsync(message, token));
        }