コード例 #1
0
        // Properties


        //Constructors
        public DmpxTS(DmTx201C DmTX201C)
        {
            try
            {
                dmTx201C = DmTX201C;
                dmTx201C.Register();
                dmTx201C.BaseEvent += new BaseEventHandler(dmTx201C_BaseEvent);
                CrestronConsole.PrintLine("DM TX Registration Status is" + dmTx201C.Registered);
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("DMTX201 Registration error is: " + e);
            }
        }
コード例 #2
0
        public override void InitializeSystem()
        {
            ComPort.ComPortSpec displayComSpec = new ComPort.ComPortSpec {
                BaudRate          = ComPort.eComBaudRates.ComspecBaudRate9600,
                DataBits          = ComPort.eComDataBits.ComspecDataBits8,
                Parity            = ComPort.eComParityType.ComspecParityNone,
                StopBits          = ComPort.eComStopBits.ComspecStopBits1,
                SoftwareHandshake = ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone,
                HardwareHandShake = ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone
            };

            try
            {
                if (this.SupportsEthernet)
                {
                    _dmRx     = new Am300(0x15, this);
                    _display  = new Display(_dmRx.ComPorts[1], displayComSpec);
                    _switcher = new AirMediaSwitcher(_dmRx);
                    if (_dmRx.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
                    {
                        ErrorLog.Error("Unable to register {0} on IP ID {1}!", _dmRx.Name, _dmRx.ID);
                    }

                    _dmTx = new DmTx201C(0x14, this);
                    _dmTx.HdmiInput.InputStreamChange += OnLaptopHDMI;
                    _dmTx.VgaInput.InputStreamChange  += OnLaptopVGA;
                    if (_dmTx.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
                    {
                        ErrorLog.Error("Unable to register {0} on IP ID {1}!", _dmTx.Name, _dmTx.ID);
                    }
                }

                if (this.SupportsCresnet)
                {
                    _occSensor = new GlsOdtCCn(0x97, this);
                    _occupancy = new RoomOccupancy(_occSensor, 15 * 60 * 60);   // 15 minutes
                    _occupancy.RoomOccupied = TurnSystemOn;
                    _occupancy.RoomVacant   = TurnSystemOff;
                    if (_occSensor.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
                    {
                        ErrorLog.Error("Unable to register {0} on Cresnet ID {1}!", _occSensor.Name, _occSensor.ID);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
            }
        }
コード例 #3
0
        public static Device Create(JToken devToken)
        {
            Device dev = null;

            try
            {
                var devType = devToken.Value <string>("type");
                var devKey  = devToken.Value <string>("key");
                var devName = devToken.Value <string>("name");
                // Catch all 200 series TX
                var devprops = devToken["properties"];
                var ipId     = Convert.ToUInt32(devprops.Value <string>("ipId"), 16);
                var parent   = devprops.Value <string>("parent");
                if (parent == null)
                {
                    parent = "controlSystem";
                }

                if (devType.StartsWith("DmTx2", StringComparison.OrdinalIgnoreCase))
                {
                    DmTx201C tx;
                    if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
                    {
                        tx = new DmTx201C(ipId, Global.ControlSystem);
                        //dev = new DmTx201SBasicController(devKey, devName, tx);
                    }
                }
                else if (devType.StartsWith("DmRmc", StringComparison.OrdinalIgnoreCase))
                {
                    DmRmc100C rmc;
                    if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase))
                    {
                        rmc = new DmRmc100C(ipId, Global.ControlSystem);
                        //dev = new DmRmcBaseController(devKey, devName, rmc);
                    }
                }
                else
                {
                    FactoryHelper.HandleUnknownType(devToken, devType);
                }
            }
            catch (Exception e)
            {
                FactoryHelper.HandleDeviceCreationError(devToken, e);
            }
            return(dev);
        }
コード例 #4
0
        public override void InitializeSystem()
        {
            try
            {
                if (SupportsSwitcherOutputs)
                {
                    try
                    {
                        dmVideoRouting  = new dmpsVideoRouting(SwitcherInputs, SwitcherOutputs, this.SystemControl as Dmps3SystemControl, SwitcherOutputs[(uint)eDmps3200cOutputs.Hdmi] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3HdmiOutput, SwitcherInputs[(uint)eDmps3200cInputs.Dm] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3DmInput);
                        DMOutputChange += new Crestron.SimplSharpPro.DM.DMOutputEventHandler(dmVideoRouting.DMOutputChange);
                        DMSystemChange += new DMSystemEventHandler(dmVideoRouting.DMSystemChange);
                        DMInputChange  += new DMInputEventHandler(dmVideoRouting.DMInputChange);
                        dmVideoRouting.DMPSVideoEvent      += new dmpsVideoRouting.DMPSVideoOutChangeEventhandler(dmVideoRouting_DMPSVideoEvent);
                        dmVideoRouting.DMPSVideoSyncChange += new dmpsVideoRouting.DMPSVideoSyncChangeEvent(dmVideoRouting_DMPSVideoSyncChange);
                        dmVideoRouting.DMPSDmInputChange   += new dmpsVideoRouting.DMPSDmInputChangeEvent(dmVideoRouting_DMPSDmInputChange);
                        dmVideoRouting.DMPSHDMIChange      += new dmpsVideoRouting.DMPSHDMiMuteChangeEvene(dmVideoRouting_DMPSHDMIChange);


                        dmAudioControl  = new dmpsAudioControls(SwitcherOutputs[(uint)eDmps3200cOutputs.Program] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3ProgramOutput, SwitcherInputs);
                        DMOutputChange += new DMOutputEventHandler(dmAudioControl.DMOutputChange);
                        dmAudioControl.AudioLevelChange  += new dmpsAudioControls.AudioLevelChangeEvent(dmAudioControl_AudioLevelChange);
                        dmAudioControl.AudioSourceChange += new dmpsAudioControls.AudioSourceChangeEvent(dmAudioControl_AudioSourceChange);
                        dmAudioControl.AmpMixerChange    += new dmpsAudioControls.AmpMixerChangeEvent(dmAudioControl_AmpMixerChange);
                        dmAudioControl.AmpPowerChange    += new dmpsAudioControls.AmpPowerChangeEvent(dmAudioControl_AmpPowerChange);

                        DmTx201C _dmTX201c = new DmTx201C(0x08, SwitcherInputs[(uint)eDmps3200cInputs.Dm] as DMInput);
                        dmTX = new DmpxTS(_dmTX201c);
                        dmTX.DmTXAudioChangeEvent += new DmpxTS.DmTxAudioChangeEventHandler(dmTX_DmTXAudioChangeEvent);
                        dmTX.DmTXVideoChangeEvent += new DmpxTS.DmTxVideoChangeEventHandler(dmTX_DmTXVideoChangeEvent);
                    }
                    catch (Exception e)
                    {
                        CrestronConsole.PrintLine("Error is SwitcherOutputs Constructor is: " + e);
                    }
                }

                uiLogic = new TouchPanel();
                uiLogic.AnalogChangeEvent  += new TouchPanel.AnalogChangeEventHandler(uiLogic_AnalogChangeEvent);
                uiLogic.DigitalChangeEvent += new TouchPanel.DigitalChangeEventHandler(uiLogic_DigitalChangeEvent);

                userInterface            = new Tsw760(0x03, this);
                userInterface.SigChange += new SigEventHandler(uiLogic.userInterface_SigChange);
                userInterface.Register();
                CrestronConsole.PrintLine("Touchpanel Registration Feedback is: " + userInterface.Registered);

                dmGeneralControl = new dmps3200General(this);
                dmGeneralControl.DMPS3FrontpanelChange += new dmps3200General.DMPS3FrontPanelEventHandler(dmGeneralControl_DMPS3FrontpanelChange);
                dmGeneralControl.DMPS3PowerEventChange += new dmps3200General.DMPSSystemPowerEventHandler(dmGeneralControl_DMPS3PowerEventChange);

                dmRelays = new DMPSRelays(this);
                dmRelays.RelayChangeEvent += new DMPSRelays.RelayChangeEventHandler(dmRelays_RelayChangeEvent);

                dmIo = new DMPSIOS(this);
                dmIo.IOChangeEvent += new DMPSIOS.IOChangeEventHandler(dmIo_IOChangeEvent);

                dmVideoRouting.HDMIMute(true);
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
            }
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="name"></param>
        /// <param name="tx"></param>
        public DmTx201CController(string key, string name, DmTx201C tx)
            : base(key, name, tx)
        {
            Tx = tx;

            HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
                                                              eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
                                                              VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
            VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
                                                             eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
                                                             VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));

            ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
                                                          () => ActualActiveVideoInput.ToString());

            Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
            Tx.VgaInput.InputStreamChange  += VgaInputOnInputStreamChange;
            Tx.BaseEvent          += Tx_BaseEvent;
            Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange);

            VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);

            AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);

            HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
                                                           (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));

            HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);

            VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);

            FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);

            VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);

            VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);

            tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;

            HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

            var combinedFuncs = new VideoStatusFuncsWrapper
            {
                HdcpActiveFeedbackFunc = () =>
                                         (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital &&
                                          tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),

                HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ?
                                        tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",

                VideoResolutionFeedbackFunc = () =>
                {
                    if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
                    {
                        return(tx.HdmiInput.VideoAttributes.GetVideoResolutionString());
                    }
                    return(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ?
                           tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "");
                },

                VideoSyncFeedbackFunc = () =>
                                        (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital &&
                                         tx.HdmiInput.SyncDetectedFeedback.BoolValue) ||
                                        (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog &&
                                         tx.VgaInput.SyncDetectedFeedback.BoolValue) ||
                                        (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto &&
                                         (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
            };

            AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
                                                                  eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);

            DmOutput    = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this);
            HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, null, this);

            AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
                              AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
                              AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
                              AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback,
                              VgaVideoSyncFeedback);

            // Set Ports for CEC
            HdmiInput.Port   = Tx.HdmiInput;
            VgaInput.Port    = Tx.VgaInput;
            HdmiLoopOut.Port = Tx.HdmiOutput;
            DmOutput.Port    = Tx.DmOutput;
        }