Beispiel #1
0
        public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
            : base(key, name)
        {
            IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
            DeviceManager.AddDevice(IrPort);

            PowerIsOnFeedback.OutputChange += (o, a) => {
                Debug.Console(2, this, "Power on={0}", _PowerIsOn);
                if (_PowerIsOn)
                {
                    StartWarmingTimer();
                }
                else
                {
                    StartCoolingTimer();
                }
            };
            IsWarmingUpFeedback.OutputChange   += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
            IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);

            InputPorts.AddRange(new RoutingPortCollection <RoutingInputPort>
            {
                new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
                new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
                new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
                new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
                new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
                new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
                new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                     eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
            });
        }
Beispiel #2
0
        /// <summary>
        /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
        /// </summary>
        public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
        {
            var irControllerKey = devConf.Key + "-ir";

            if (devConf.Properties == null)
            {
                Debug.Console(0, "[{0}] WARNING: Device config does not include properties.  IR will not function.", devConf.Key);
                return(new IrOutputPortController(irControllerKey, null, ""));
            }

            var control = devConf.Properties["control"];

            if (control == null)
            {
                var c = new IrOutputPortController(irControllerKey, null, "");
                Debug.Console(0, c, "WARNING: Device config does not include control properties.  IR will not function");
                return(c);
            }

            var            portDevKey = control.Value <string>("controlPortDevKey");
            var            portNum    = control.Value <uint>("controlPortNumber");
            IIROutputPorts irDev      = null;

            if (portDevKey == null)
            {
                var c = new IrOutputPortController(irControllerKey, null, "");
                Debug.Console(0, c, "WARNING: control properties is missing ir device");
                return(c);
            }

            if (portNum == 0)
            {
                var c = new IrOutputPortController(irControllerKey, null, "");
                Debug.Console(0, c, "WARNING: control properties is missing ir port number");
                return(c);
            }

            if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) ||
                portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
            {
                irDev = Global.ControlSystem;
            }
            else
            {
                irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
            }

            if (irDev == null)
            {
                var c = new IrOutputPortController(irControllerKey, null, "");
                Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
                return(c);
            }

            if (portNum <= irDev.NumberOfIROutputPorts)             // success!
            {
                return(new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
                                                  IrDriverPathPrefix + control["irFile"].Value <string>()));
            }
            else
            {
                var c = new IrOutputPortController(irControllerKey, null, "");
                Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
                              portDevKey, portNum);
                return(c);
            }
        }