diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index 597eec0f..20d5303c 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -5,6 +5,8 @@ using System.Text; using Crestron.SimplSharp; 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; @@ -47,26 +49,69 @@ namespace PepperDash.Essentials.Bridges if (dmChassis.TxDictionary.ContainsKey(ioSlot)) { Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); - var TxKey = dmChassis.TxDictionary[ioSlot]; - var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; + var txKey = dmChassis.TxDictionary[ioSlot]; + var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase; + + var txDevice = basicTxDevice as DmTxControllerBase; + if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps || dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps || dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps) { dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); } - else if (TxDevice != null) + else { - TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + if (txDevice != null) + { + txDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + } + } + + if(basicTxDevice != null && txDevice == null) + trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; + + + if (txDevice != null) + { + txDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + } + else + { + var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; + if(inputPort != null) + { + var hdmiInPort = inputPort.Port; + + if (hdmiInPort != null) + { + if (hdmiInPort is HdmiInputWithCEC) + { + var hdmiInPortWCec = hdmiInPort as HdmiInputWithCEC; + + if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown) + { + SetHdcpCapabilityAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); + } + + dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); + + trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot]; + } + } + } } - // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u))); - // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]); - // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability; } else { - // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); + dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}-hdmiIn", ioSlot)].Port as EndpointHdmiInput; + + if (inputPort != null) + { + //trilist.SetUShortSigAction((joinMap.HdcpSupport + ioSlot), u => + } } if (dmChassis.RxDictionary.ContainsKey(ioSlot)) { @@ -99,36 +144,108 @@ namespace PepperDash.Essentials.Bridges } } + static void SetHdcpCapabilityAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist) + { + if (hdcpTypeSimple) + { + trilist.SetUShortSigAction(join, + new Action(s => + { + if (s == 0) + { + port.HdcpSupportOff(); + } + else if (s > 0) + { + port.HdcpSupportOn(); + } + })); + } + else + { + trilist.SetUShortSigAction(join, + new Action(s => + { + port.HdcpReceiveCapability = (eHdcpCapabilityType)s; + })); + } + } + + static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) + { + if (hdcpTypeSimple) + { + trilist.SetUShortSigAction(join, + new Action(s => + { + if (s == 0) + { + port.HdcpSupportOff(); + } + else if (s > 0) + { + port.HdcpSupportOn(); + } + })); + } + else + { + trilist.SetUShortSigAction(join, + new Action(s => + { + port.HdcpCapability = (eHdcpCapabilityType)s; + })); + } + } public class DmChassisControllerJoinMap : JoinMapBase { - public uint IsOnline { get; set; } + //Digital public uint SystemId { get; set; } - public uint OutputVideo { get; set; } - public uint OutputAudio { get; set; } + public uint IsOnline { get; set; } public uint OutputUsb { get; set; } public uint InputUsb { get; set; } public uint VideoSyncStatus { get; set; } + public uint InputEndpointOnline { get; set; } + public uint OutputEndpointOnline { get; set; } + public uint TxAdvancedIsPresent { get; set; } // indicates that there is an attached transmitter that should be bridged to be interacted with + + //Analog + public uint OutputVideo { get; set; } + public uint OutputAudio { get; set; } + public uint HdcpSupportState { get; set; } + public uint HdcpSupportCapability { get; set; } + + //SErial public uint InputNames { get; set; } public uint OutputNames { get; set; } public uint OutputCurrentVideoInputNames { get; set; } public uint OutputCurrentAudioInputNames { get; set; } public uint InputCurrentResolution { get; set; } - public uint InputEndpointOnline { get; set; } - public uint OutputEndpointOnline { get; set; } - //public uint HdcpSupport { get; set; } - //public uint HdcpSupportCapability { get; set; } + public DmChassisControllerJoinMap() { SystemId = 10; + //Digital IsOnline = 11; + VideoSyncStatus = 100; //101-299 + InputEndpointOnline = 500; //501-699 + OutputEndpointOnline = 700; //701-899 + TxAdvancedIsPresent = 1000; //1001-1199 + + //Analog OutputVideo = 100; //101-299 OutputAudio = 300; //301-499 OutputUsb = 500; //501-699 InputUsb = 700; //701-899 VideoSyncStatus = 100; //101-299 + HdcpSupportState = 1000; //1001-1199 + HdcpSupportCapability = 1200; //1201-1399 + + + //Serial InputNames = 100; //101-299 OutputNames = 300; //301-499 OutputCurrentVideoInputNames = 2000; //2001-2199 @@ -136,8 +253,9 @@ namespace PepperDash.Essentials.Bridges InputCurrentResolution = 2400; // 2401-2599 InputEndpointOnline = 500; //501-699 OutputEndpointOnline = 700; //701-899 - //HdcpSupport = 1000; //1001-1199 - //HdcpSupportCapability = 1200; //1201-1399 + HdcpSupportState = 1000; //1001-1199 + HdcpSupportCapability = 1200; //1201-1399 + } @@ -159,8 +277,8 @@ namespace PepperDash.Essentials.Bridges InputCurrentResolution = InputCurrentResolution + joinOffset; InputEndpointOnline = InputEndpointOnline + joinOffset; OutputEndpointOnline = OutputEndpointOnline + joinOffset; - //HdcpSupport = HdcpSupport + joinOffset; - //HdcpSupportCapability = HdcpSupportCapability + joinOffset; + HdcpSupportState = HdcpSupportState + joinOffset; + HdcpSupportCapability = HdcpSupportCapability + joinOffset; } } } diff --git a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs index 26a6a939..906e189c 100644 --- a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs @@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Bridges tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); - //tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportCapability]); + trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; bool hdcpTypeSimple; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index f3815858..a9db3344 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -41,6 +41,11 @@ namespace PepperDash.Essentials.DM public IntFeedback SystemIdFeebdack { get; private set; } public BoolFeedback SystemIdBusyFeedback { get; private set; } + + public Dictionary InputCardHdcpCapabilityFeedbacks { get; private set; } + + public Dictionary InputCardHdcpCapabilityTypes { get; private set; } + // Need a couple Lists of generic Backplane ports public RoutingPortCollection InputPorts { get; private set; } @@ -164,6 +169,9 @@ namespace PepperDash.Essentials.DM SystemIdFeebdack = new IntFeedback(() => { return Chassis.SystemIdFeedback.UShortValue; }); SystemIdBusyFeedback = new BoolFeedback(() => { return Chassis.SystemIdBusy.BoolValue; }); + InputCardHdcpCapabilityFeedbacks = new Dictionary(); + InputCardHdcpCapabilityTypes = new Dictionary(); + for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) { @@ -235,6 +243,38 @@ namespace PepperDash.Essentials.DM InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; }); OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[tempX].EndpointOnlineFeedback; }); + + InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => + { + var inputCard = Chassis.Inputs[tempX]; + + if (inputCard.Card is DmcHd) + { + InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport; + + if ((inputCard.Card as DmcHd).HdmiInput.HdcpSupportOnFeedback.BoolValue) + return 1; + else + return 0; + } + else if (inputCard.Card is DmcHdDsp) + { + InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport; + + if ((inputCard.Card as DmcHdDsp).HdmiInput.HdcpSupportOnFeedback.BoolValue) + return 1; + else + return 0; + } + else if (inputCard.Card is Dmc4kHdBase) + { + InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support; + + return (int)(inputCard.Card as Dmc4kHdBase).HdmiInput.HdcpReceiveCapability; + } + else + return 0; + }); } } @@ -607,7 +647,8 @@ namespace PepperDash.Essentials.DM { switch (args.EventId) { - case DMInputEventIds.EndpointOnlineEventId: { + case DMInputEventIds.EndpointOnlineEventId: + { Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback); InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); break; @@ -618,15 +659,17 @@ namespace PepperDash.Essentials.DM InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); break; } - case DMInputEventIds.VideoDetectedEventId: { - Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); - VideoInputSyncFeedbacks[args.Number].FireUpdate(); - break; + case DMInputEventIds.VideoDetectedEventId: + { + Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); + VideoInputSyncFeedbacks[args.Number].FireUpdate(); + break; } - case DMInputEventIds.InputNameEventId: { - Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); - InputNameFeedbacks[args.Number].FireUpdate(); - break; + case DMInputEventIds.InputNameEventId: + { + Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); + InputNameFeedbacks[args.Number].FireUpdate(); + break; } case DMInputEventIds.UsbRoutedToEventId: { @@ -634,6 +677,12 @@ namespace PepperDash.Essentials.DM UsbInputRoutedToFeebacks[args.Number].FireUpdate(); break; } + case DMInputEventIds.HdcpCapabilityFeedbackEventId: + { + Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number); + InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); + break; + } default: { Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);