From fd3e8d81f8de22fc1dd34a36e2000fff871893fd Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 13:28:55 -0500 Subject: [PATCH 1/6] resolves #176 - Added IHasBasicTriListWithSmartObject to DgeController --- .../Endpoints/DGEs/DgeController.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs index 6b586ac3..86d05ba8 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs @@ -11,26 +11,29 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.DM.Endpoints.DGEs { /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts - { - public Dge100 DigitalGraphicsEngine { get; private set; } - - public DeviceConfig DeviceConfig { get; private set; } + public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + { + private readonly Dge100 _dge; + + public BasicTriListWithSmartObject Panel { get { return _dge; } } + + public DeviceConfig _dc; CrestronTouchpanelPropertiesConfig PropertiesConfig; public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) :base(key, name, device) { - DigitalGraphicsEngine = device; + _dge = device; - DeviceConfig = dc; + _dc = dc; PropertiesConfig = props; } @@ -39,12 +42,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public CrestronCollection ComPorts { - get { return DigitalGraphicsEngine.ComPorts; } + get { return _dge.ComPorts; } } public int NumberOfComPorts { - get { return DigitalGraphicsEngine.NumberOfComPorts; } + get { return _dge.NumberOfComPorts; } } #endregion @@ -53,12 +56,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public CrestronCollection IROutputPorts { - get { return DigitalGraphicsEngine.IROutputPorts; } + get { return _dge.IROutputPorts; } } public int NumberOfIROutputPorts { - get { return DigitalGraphicsEngine.NumberOfIROutputPorts; } + get { return _dge.NumberOfIROutputPorts; } } #endregion From 0b59dbe20de8b3640692319f260dbdd506c2044e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 14:20:15 -0500 Subject: [PATCH 2/6] Differentiation between Dge100 and DmDge200C --- .../{DgeController.cs => Dge100Controller.cs} | 14 +- .../Endpoints/DGEs/DmDge200CController.cs | 131 ++++++ .../Receivers/DmRmc200CController.cs | 2 +- .../Transmitters/DmTx201CController.cs | 6 +- .../Transmitters/DmTx201SController.cs | 411 ++++++++++++++++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 18 +- .../PepperDash_Essentials_DM.csproj | 4 +- 7 files changed, 567 insertions(+), 19 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/{DgeController.cs => Dge100Controller.cs} (76%) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs similarity index 76% rename from essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs rename to essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 86d05ba8..f157f92d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DgeController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject { private readonly Dge100 _dge; @@ -28,7 +28,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs CrestronTouchpanelPropertiesConfig PropertiesConfig; - public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) + public Dge100Controller(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) :base(key, name, device) { _dge = device; @@ -67,11 +67,11 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs #endregion } - public class DgeControllerFactory : EssentialsDeviceFactory + public class Dge100ControllerFactory : EssentialsDeviceFactory { - public DgeControllerFactory() + public Dge100ControllerFactory() { - TypeNames = new List() { "dge100", "dmdge200c" }; + TypeNames = new List() { "dge100" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) @@ -85,8 +85,6 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs Dge100 dgeDevice = null; if (typeName == "dge100") dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); - else if (typeName == "dmdge200c") - dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); if (dgeDevice == null) { @@ -94,7 +92,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs return null; } - var dgeController = new DgeController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + var dgeController = new Dge100Controller(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); return dgeController; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs new file mode 100644 index 00000000..26c1af03 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.UI; + +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using Crestron.SimplSharpPro.DeviceSupport; + +namespace PepperDash.Essentials.DM.Endpoints.DGEs +{ + /// + /// Wrapper class for DGE-100 and DM-DGE-200-C + /// + public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, + IHasBasicTriListWithSmartObject, IRoutingInputsOutputs + { + private readonly DmDge200C _dge; + + public BasicTriListWithSmartObject Panel { get { return _dge; } } + public RoutingInputPort DmIn { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } + + public RoutingPortCollection InputPorts + { + get; + private set; + } + + public RoutingPortCollection OutputPorts + { + get; + private set; + } + + + public DeviceConfig _dc; + + CrestronTouchpanelPropertiesConfig PropertiesConfig; + + public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) + : base(key, name, device) + { + _dge = device; + + _dc = dc; + + PropertiesConfig = props; + + DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.DmCat, 0, this); + HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this); + + + InputPorts = new RoutingPortCollection { DmIn }; + OutputPorts = new RoutingPortCollection { HdmiOut }; + + // Set Ports for CEC + HdmiOut.Port = _dge.HdmiOut; ; + + } + + #region IComPorts Members + + public CrestronCollection ComPorts + { + get { return _dge.ComPorts; } + } + + public int NumberOfComPorts + { + get { return _dge.NumberOfComPorts; } + } + + #endregion + + #region IIROutputPorts Members + + public CrestronCollection IROutputPorts + { + get { return _dge.IROutputPorts; } + } + + public int NumberOfIROutputPorts + { + get { return _dge.NumberOfIROutputPorts; } + } + + #endregion + + } + + public class DmDge200CControllerFactory : EssentialsDeviceFactory + { + public DmDge200CControllerFactory() + { + TypeNames = new List() { "dmdge200c" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); + + DmDge200C dgeDevice = null; + + if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DmDge200CController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + + return dgeController; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index 9beaaf42..27187bcd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM private readonly DmRmc200C _rmc; public RoutingInputPort DmIn { get; private set; } - public RoutingOutputPort HdmiOut { get; private set; } + public RoutingOutputPort HdmiOut { get; private set; } public RoutingPortCollection InputPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 54be5720..ed614829 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -21,9 +21,9 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { - public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + public DmTx201C Tx { get; private set; } // uses the 201S class as it is the base class for the 201C public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } public RoutingInputPortWithVideoStatuses VgaInput { get; private set; } @@ -92,7 +92,7 @@ namespace PepperDash.Essentials.DM /// /// /// - public DmTx201XController(string key, string name, DmTx201S tx) + public DmTx201CController(string key, string name, DmTx201C tx) : base(key, name, tx) { Tx = tx; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs new file mode 100644 index 00000000..23e93b5d --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -0,0 +1,411 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.DM.Config; + +namespace PepperDash.Essentials.DM +{ + // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; + + /// + /// Controller class for all DM-TX-201C/S/F transmitters + /// + public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + { + public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + + public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } + public RoutingInputPortWithVideoStatuses VgaInput { get; private set; } + public RoutingOutputPort DmOutput { get; private set; } + public RoutingOutputPort HdmiLoopOut { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback VideoSourceNumericFeedback { get; protected set; } + public IntFeedback AudioSourceNumericFeedback { get; protected set; } + public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } + public BoolFeedback VgaVideoSyncFeedback { get; protected set; } + + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public DmTx200Base.eSourceSelection ActualActiveVideoInput + { + get + { + if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog || + Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable) + return Tx.VideoSourceFeedback; + else // auto + { + if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Digital; + else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Analog; + else + return DmTx200Base.eSourceSelection.Disable; + } + } + } + + public RoutingPortCollection InputPorts + { + get + { + return new RoutingPortCollection + { + HdmiInput, + VgaInput, + AnyVideoInput + }; + } + } + + public RoutingPortCollection OutputPorts + { + get + { + return new RoutingPortCollection { DmOutput, HdmiLoopOut }; + } + } + + /// + /// + /// + /// + /// + /// + public DmTx201SController(string key, string name, DmTx201S 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.HdcpSupportOnFeedback.BoolValue) + return 1; + else + return 0; + }); + + HdmiVideoSyncFeedback = new BoolFeedback(() => + { + return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; + }); + + VgaVideoSyncFeedback = new BoolFeedback(() => + { + return (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 += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + + 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); + 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; + } + + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + + } + + public override bool CustomActivate() + { + Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); + Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); + + Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId); + Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (HdmiVideoSyncFeedback != null) + { + HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + if (VgaVideoSyncFeedback != null) + { + VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + /// + /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) + /// + /// + /// + /// + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (input) + { + case 0: + { + ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(HdmiInput.Selector, null, type); + break; + } + case 2: + { + ExecuteSwitch(VgaInput.Selector, null, type); + break; + } + case 3: + { + ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type); + break; + } + } + } + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) + Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector; + if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector; + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + { + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + } + + // ------------------------------ incomplete ----------------------------------------- + else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) + { + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + } + + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) + { + HdmiInHdcpCapabilityFeedback.FireUpdate(); + } + else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) + { + FreeRunEnabledFeedback.FireUpdate(); + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + switch (eventId) + { + case VideoAttributeEventIds.HdcpActiveFeedbackEventId: + inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HdcpStateFeedbackEventId: + inputPort.VideoStatus.HdcpStateFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId: + case VideoAttributeEventIds.VerticalResolutionFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.FramesPerSecondFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + } + } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 4fcc4742..9fe81c92 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -45,8 +45,10 @@ namespace PepperDash.Essentials.DM return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz100")) return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem)); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem)); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz202")) @@ -102,8 +104,10 @@ namespace PepperDash.Essentials.DM { if (typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz100")) @@ -123,8 +127,10 @@ namespace PepperDash.Essentials.DM { if (typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201")) - return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k100")) return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz100")) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 2c245384..7fc4f24d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -100,8 +100,10 @@ + + @@ -112,7 +114,7 @@ - + From 4c5b60bddb8b2dda7dbf1586d51ebecd80fd7cbd Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 14:55:12 -0500 Subject: [PATCH 3/6] Exposed ICEC to DGE Controller Classes --- .../Essentials_DM/Endpoints/DGEs/Dge100Controller.cs | 12 ++++++++++-- .../Endpoints/DGEs/DmDge200CController.cs | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index f157f92d..2780b7b1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.UI; +using Crestron.SimplSharpPro.UI; + +using Crestron.SimplSharpPro.DM; + using Newtonsoft.Json; @@ -18,7 +21,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject + public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec { private readonly Dge100 _dge; @@ -64,7 +67,12 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs get { return _dge.NumberOfIROutputPorts; } } + #endregion + + #region ICec Members + public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } #endregion + } public class Dge100ControllerFactory : EssentialsDeviceFactory diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 26c1af03..6aa153c5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -13,13 +13,15 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; + namespace PepperDash.Essentials.DM.Endpoints.DGEs { /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, - IHasBasicTriListWithSmartObject, IRoutingInputsOutputs + public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, + IHasBasicTriListWithSmartObject, IRoutingInputsOutputs, ICec { private readonly DmDge200C _dge; @@ -95,6 +97,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs #endregion + #region ICec Members + public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } + #endregion + } public class DmDge200CControllerFactory : EssentialsDeviceFactory From d11e0db14a95b84e74e79ddd3f36721e1e66700b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:28:00 -0500 Subject: [PATCH 4/6] Refactor obsolete comport instantiation method for DGE devices --- .../Config/Comm and IR/GenericComm.cs | 11 ++- .../Endpoints/DGEs/Dge100Controller.cs | 4 +- .../Endpoints/DGEs/DmDge200CController.cs | 95 ++++++------------- 3 files changed, 39 insertions(+), 71 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 86e59be2..74122905 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -27,7 +27,16 @@ namespace PepperDash.Essentials.Core { PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); - CommPort = CommFactory.CreateCommForDevice(config); + var commPort = CommFactory.CreateCommForDevice(config); + + //Fixing decision to require '-comPorts' in delcaration for DGE in order to get a device with comports included + if (commPort == null) + { + config.Key = config.Key + "-comPorts"; + commPort = CommFactory.CreateCommForDevice(config); + } + + CommPort = commPort; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 2780b7b1..19aba276 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -88,7 +88,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs var comm = CommFactory.GetControlPropertiesConfig(dc); var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); + Debug.Console(1, "Factory Attempting to create new DgeController Device"); Dge100 dgeDevice = null; if (typeName == "dge100") @@ -100,7 +100,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs return null; } - var dgeController = new Dge100Controller(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + var dgeController = new Dge100Controller(dc.Key, dc.Name, dgeDevice, dc, props); return dgeController; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 6aa153c5..26f6fc39 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -20,12 +20,10 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// - public class DmDge200CController : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, - IHasBasicTriListWithSmartObject, IRoutingInputsOutputs, ICec + public class DmDge200CController : Dge100Controller, IRoutingInputsOutputs { private readonly DmDge200C _dge; - public BasicTriListWithSmartObject Panel { get { return _dge; } } public RoutingInputPort DmIn { get; private set; } public RoutingOutputPort HdmiOut { get; private set; } @@ -42,19 +40,13 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs } - public DeviceConfig _dc; - CrestronTouchpanelPropertiesConfig PropertiesConfig; public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) - : base(key, name, device) + : base(key, name, device, dc, props) { _dge = device; - _dc = dc; - - PropertiesConfig = props; - DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, 0, this); HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, @@ -69,69 +61,36 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs } - #region IComPorts Members - - public CrestronCollection ComPorts + public class DmDge200CControllerFactory : EssentialsDeviceFactory { - get { return _dge.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _dge.NumberOfComPorts; } - } - - #endregion - - #region IIROutputPorts Members - - public CrestronCollection IROutputPorts - { - get { return _dge.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _dge.NumberOfIROutputPorts; } - } - - #endregion - - #region ICec Members - public Cec StreamCec { get { return _dge.HdmiOut.StreamCec; } } - #endregion - - } - - public class DmDge200CControllerFactory : EssentialsDeviceFactory - { - public DmDge200CControllerFactory() - { - TypeNames = new List() { "dmdge200c" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - var typeName = dc.Type.ToLower(); - var comm = CommFactory.GetControlPropertiesConfig(dc); - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - Debug.Console(1, "Factory Attempting to create new DgeControllerm Device"); - - DmDge200C dgeDevice = null; - - if (typeName == "dmdge200c") - dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); - - if (dgeDevice == null) + public DmDge200CControllerFactory() { - Debug.Console(1, "Unable to create DGE device"); - return null; + TypeNames = new List() { "dmdge200c" }; } - var dgeController = new DmDge200CController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props); + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + var typeName = dc.Type.ToLower(); + var comm = CommFactory.GetControlPropertiesConfig(dc); + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - return dgeController; + Debug.Console(1, "Factory Attempting to create new DgeController Device"); + + DmDge200C dgeDevice = null; + + if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DmDge200CController(dc.Key , dc.Name, dgeDevice, dc, props); + + return dgeController; + } } } } \ No newline at end of file From e581219e325c2af23453dbd34ee72c8640f85d80 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:29:34 -0500 Subject: [PATCH 5/6] --amend --- .../Essentials_DM/Endpoints/DGEs/DmDge200CController.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index 26f6fc39..d4539e53 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -39,9 +39,6 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs private set; } - - CrestronTouchpanelPropertiesConfig PropertiesConfig; - public DmDge200CController(string key, string name, DmDge200C device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) : base(key, name, device, dc, props) { From 4ef8e8cf1412e07853da62c4a66e58e8075b26bf Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 May 2020 15:31:03 -0500 Subject: [PATCH 6/6] --amend --- .../Essentials_DM/Endpoints/DGEs/Dge100Controller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 19aba276..4a335c39 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -27,7 +27,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public BasicTriListWithSmartObject Panel { get { return _dge; } } - public DeviceConfig _dc; + private DeviceConfig _dc; CrestronTouchpanelPropertiesConfig PropertiesConfig;