Esempio n. 1
0
        private void TimerCallback(object state)
        {
            TriggerTimerMap map = state as TriggerTimerMap;

            if (map == null)
            {
                throw new Exception("Map state unknown");
            }

            DeactivateOutput(map.DeviceId);
            _triggerTimers.Remove(map);
            map.TriggerTimer.Dispose();
        }
Esempio n. 2
0
        public override void TriggerOutput(string deviceId, int durationMs)
        {
            if (new Guid(deviceId) == Constants.Output1)
            {
                ActivateOutput(deviceId);

                Container.EventManager.NewEvent(deviceId, EventId.OutputActivated);

                TriggerTimerMap map = new TriggerTimerMap()
                {
                    DeviceId = deviceId
                };
                map.TriggerTimer = new Timer(TimerCallback, map, durationMs, Timeout.Infinite);
                _triggerTimers.Add(map);
                return;
            }
            throw new MIPDriverException("Device does not support Output commands");
        }