public override void InitializeSystem() { try { // Currently only runs on DMPS architecture if (this.SystemControl == null) { // Eventually we'll handle external switchers, too ErrorLog.Error("Sorry, this program only runs on DMPS3 processors!"); } else { var control = this.SystemControl as Dmps3SystemControl; control.SystemPowerOn(); // Samsung MDC = 9600 baud, 8 data bits, no parity, 1 stop bit var displayComSettings = new ComPort.ComPortSpec(); displayComSettings.Protocol = ComPort.eComProtocolType.ComspecProtocolRS232; displayComSettings.BaudRate = ComPort.eComBaudRates.ComspecBaudRate9600; displayComSettings.DataBits = ComPort.eComDataBits.ComspecDataBits8; displayComSettings.Parity = ComPort.eComParityType.ComspecParityNone; displayComSettings.StopBits = ComPort.eComStopBits.ComspecStopBits1; displayComSettings.HardwareHandShake = ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone; displayComSettings.SoftwareHandshake = ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone; // Assume DM transmitter is connected to DM input 6 _source[0] = this.SwitcherInputs[6] as DMInput; _tx1 = new DmTx200C2G(0x14, _source[0]); _tx1.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler((input, args) => tx_InputStreamChange(0, input, args)); _tx1.VgaInput.InputStreamChange += new EndpointInputStreamChangeEventHandler((input, args) => tx_InputStreamChange(0, input, args)); // Assume DM transmitter is connected to DM input 7 _source[1] = this.SwitcherInputs[7] as DMInput; _tx2 = new DmTx200C2G(0x15, _source[1]); _tx2.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler((input, args) => tx_InputStreamChange(1, input, args)); _tx2.VgaInput.InputStreamChange += new EndpointInputStreamChangeEventHandler((input, args) => tx_InputStreamChange(1, input, args)); // Assume DM roombox is connected to DM output 3 _rmc1 = new DmRmcScalerC(0x16, this.SwitcherOutputs[3] as DMOutput); _rmc1.ComPorts[1].SetComPortSpec(displayComSettings); } } catch (Exception e) { ErrorLog.Error("Error in InitializeSystem: {0}", e.StackTrace); } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="tx"></param> public DmTx200Controller(string key, string name, DmTx200C2G 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 += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); Tx.BaseEvent += Tx_BaseEvent; Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); VideoSourceNumericFeedback = new IntFeedback(() => { return((int)Tx.VideoSourceFeedback); }); AudioSourceNumericFeedback = new IntFeedback(() => { return((int)Tx.AudioSourceFeedback); }); HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) { return(1); } else { return(0); } }); HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), HdcpStateFeedbackFunc = () => { if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) { return(tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString()); } return(""); }, VideoResolutionFeedbackFunc = () => { if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) { return(tx.HdmiInput.VideoAttributes.GetVideoResolutionString()); } if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) { return(tx.VgaInput.VideoAttributes.GetVideoResolutionString()); } return(""); }, 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); AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback); // Set Ports for CEC HdmiInput.Port = Tx.HdmiInput; VgaInput.Port = Tx.VgaInput; DmOutput.Port = Tx.DmOutput; }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="tx"></param> public DmTx200Controller(string key, string name, DmTx200C2G 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 += Tx_OnlineStatusChange; VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; HdmiVideoSyncFeedback = new BoolFeedback(() => tx.HdmiInput.SyncDetectedFeedback.BoolValue); VgaVideoSyncFeedback = new BoolFeedback(() => 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; 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); 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; DmOutput.Port = Tx.DmOutput; }