Example #1
0
        public Auditorium(ASystem system, RoomConfig config) : base(system, config)
        {
            if (((AuditoriumSystem)system).BlindsProcessorEIC == null)
            {
                ((AuditoriumSystem)system).BlindsProcessorEIC =
                    new ThreeSeriesTcpIpEthernetIntersystemCommunications(0x0a, "30.92.1.185", system.ControlSystem);
                ((AuditoriumSystem)system).BlindsProcessorEIC.Register();
            }
            var eic = ((AuditoriumSystem)system).BlindsProcessorEIC;

            switch (Id)
            {
            case 1:
                _blindRelays[1] = new UpDownRelays(eic.BooleanInput[1], eic.BooleanInput[2],
                                                   UpDownRelayModeType.Momentary);
                _blindRelays[2] = new UpDownRelays(eic.BooleanInput[3], eic.BooleanInput[4],
                                                   UpDownRelayModeType.Momentary);
                break;

            case 2:
                _blindRelays[1] = new UpDownRelays(system.ControlSystem.RelayPorts[1],
                                                   system.ControlSystem.RelayPorts[2], UpDownRelayModeType.Momentary);
                _blindRelays[2] = new UpDownRelays(system.ControlSystem.RelayPorts[3],
                                                   system.ControlSystem.RelayPorts[4], UpDownRelayModeType.Momentary);
                foreach (var relays in _blindRelays.Values)
                {
                    relays.Register();
                }
                break;
            }
        }
        public MultiPurpose(ASystem system, RoomConfig config)
            : base(system, config)
        {
            var eic = ((AuditoriumSystem)system).BlindsProcessorEIC;

            _blindRelays[1] = new UpDownRelays(eic.BooleanInput[5], eic.BooleanInput[6],
                                               UpDownRelayModeType.Momentary);
            _blindRelays[2] = new UpDownRelays(eic.BooleanInput[7], eic.BooleanInput[8],
                                               UpDownRelayModeType.Momentary);
        }
Example #3
0
 protected ElectricScreen(UpDownRelays relays)
 {
     _relays = relays;
 }
Example #4
0
 protected ElectricScreen(UpDownRelays relays, IDeviceWithPower display)
     : this(relays)
 {
     display.PowerStatusChange += display_PowerStatusChange;
 }
Example #5
0
        protected ARoom(ASystem system, RoomConfig config)
            : base(system)
        {
            try
            {
                _config = config;
                Debug.WriteInfo("Loading Room Config", "Room {0} \"{1}\"", config.Id, config.Name);

                Name = string.IsNullOrEmpty(config.Name) ? string.Format("Room {0}", Id) : config.Name;

                DivisibleRoomType = config.DivisibleRoomType;

                SystemSwitcher = system.Switcher;

                if (system.Dsp != null)
                {
                    system.Dsp.HasIntitialized += DspOnHasIntitialized;
                }

                if (SystemSwitcher != null)
                {
                    SystemSwitcher.InputStatusChanged += SwitcherOnInputStatusChanged;
                }

                try
                {
                    if (config.Displays == null)
                    {
                        config.Displays = new List <DisplayConfig>();
                    }
                    foreach (var displayConfig in config.Displays
                             .Where(d => d.Enabled)
                             .OrderBy(d => d.Id))
                    {
                        Debug.WriteInfo("Loading Display Config", "{0} {1}", displayConfig.DisplayType,
                                        displayConfig.DeviceAddressString);

                        switch (displayConfig.DisplayType)
                        {
                        case DisplayType.Samsung:
                            if (SystemSwitcher != null && displayConfig.DeviceConnectionType == DeviceConnectionType.Serial)
                            {
                                var comports =
                                    SystemSwitcher.GetEndpointForOutput(displayConfig.SwitcherOutputIndex) as
                                    IComPorts;
                                new ADisplay(this,
                                             new SamsungDisplay(displayConfig.Name, 1,
                                                                new SamsungDisplayComPortHandler(comports.ComPorts[1])), displayConfig);
                            }
                            else
                            {
                                new ADisplay(this,
                                             new SamsungDisplay(displayConfig.Name, 1,
                                                                new SamsungDisplaySocket(displayConfig.DeviceAddressString)), displayConfig);
                            }
                            break;

                        case DisplayType.CrestronConnected:
                            var proj = new ADisplay(this,
                                                    new CrestronConnectedDisplay(displayConfig.DeviceAddressNumber, system.ControlSystem,
                                                                                 displayConfig.Name), displayConfig);
                            if (displayConfig.UsesRelaysForScreenControl && SystemSwitcher != null)
                            {
                                var relayEndpoint =
                                    SystemSwitcher.GetEndpointForOutput(displayConfig.SwitcherOutputIndex) as
                                    IRelayPorts;
                                if (relayEndpoint == null)
                                {
                                    CloudLog.Error("Could not get relays for projector");
                                    break;
                                }
                                var relays = new UpDownRelays(relayEndpoint.RelayPorts[2],
                                                              relayEndpoint.RelayPorts[1], UpDownRelayModeType.Momentary);
                                relays.Register();
                                proj.SetScreenController(relays);
                            }
                            break;

                        default:
                            new ADisplay(this, null, displayConfig);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    CloudLog.Error("Error setting up displays in Room {0}, {1}", Id, e.Message);
                }

                if (config.Sources != null)
                {
                    foreach (var sourceConfig in config.Sources
                             .Where(s => s.Enabled)
                             .OrderBy(s => s.Id))
                    {
                        try
                        {
                            ASource source;
                            switch (sourceConfig.SourceType)
                            {
                            case SourceType.PC:
                                source = new PCSource(this, sourceConfig);
                                break;

                            case SourceType.IPTV:
                                source = new TVSource(this, sourceConfig);
                                break;

                            default:
                                source = new GenericSource(this, sourceConfig);
                                break;
                            }

                            if (!String.IsNullOrEmpty(sourceConfig.GroupName))
                            {
                                source.AddToGroup(sourceConfig.GroupName);
                            }
                        }
                        catch (Exception e)
                        {
                            CloudLog.Error("Error setting up source \"{0}\" in Room {1}, {2}", sourceConfig.Name, Id,
                                           e.Message);
                        }
                    }
                }

                foreach (var source in Sources.Cast <ASource>())
                {
                    if (source.Type == SourceType.Laptop)
                    {
                        source.VideoStatusChangeDetected += LaptopSourceOnVideoDetected;
                    }
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }