private void DigitalstromEventReceived(DssEvent dsEvent)
        {
            _logger.LogInformation($"{DateTime.Now} Received DSS Event: name '{dsEvent.Name}' zone '{dsEvent.Properties.ZoneID}' group '{dsEvent.Properties.GroupID}' scene '{dsEvent.Properties.SceneID}'");

            if (!(_persistenceQueue?.TryAdd(dsEvent) ?? false))
            {
                _logger.LogError($"{DateTime.Now} Exception in Digitalstrom Event Subscriber Service: could not enqueue dss event!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// See <see cref="IDssEventProcessorPlugin.WriteToEventStream(DssEvent)"/>
        /// </summary>
        public void WriteToEventStream(DssEvent dsEvent)
        {
            if (_eventStream is null)
            {
                return;
            }

            _eventStream.WriteEvent(dsEvent);
            _hasChanges = true;
        }
Esempio n. 3
0
        private void HandleDssCallSceneEvent(DssEvent dssEvent)
        {
            var props = dssEvent.Properties;

            if (props is null)
            {
                return;
            }

            this[props.ZoneID, props.GroupID].ValueInternal = props.SceneID;
        }
Esempio n. 4
0
        /// <summary>
        /// See <see cref="IDssEventProcessorPlugin.HasDuplicate(DssEvent, int)"/>
        /// </summary>
        public bool HasDuplicate(DssEvent dsEvent, int milliseconds)
        {
            var lastEvent = _eventStream.LastOrDefault();

            if (lastEvent == null)
            {
                return(false);
            }

            return(lastEvent.TimestampUtc.AddMilliseconds(milliseconds) > dsEvent.TimestampUtc &&
                   lastEvent.Properties.ZoneID == dsEvent.Properties.ZoneID &&
                   lastEvent.Properties.GroupID == dsEvent.Properties.GroupID &&
                   lastEvent.Properties.SceneID == dsEvent.Properties.SceneID);
        }