Merge branch 'feature/ecs-1139' into feature/ecs-1140

# Conflicts:
#	PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
#	essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
This commit is contained in:
Neil Dorin
2019-08-15 21:07:16 -06:00
3 changed files with 197 additions and 30 deletions

View File

@@ -5,6 +5,8 @@ using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
@@ -47,26 +49,69 @@ namespace PepperDash.Essentials.Bridges
if (dmChassis.TxDictionary.ContainsKey(ioSlot)) if (dmChassis.TxDictionary.ContainsKey(ioSlot))
{ {
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var TxKey = dmChassis.TxDictionary[ioSlot]; var txKey = dmChassis.TxDictionary[ioSlot];
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var txDevice = basicTxDevice as DmTxControllerBase;
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps || dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps) || dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
{ {
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); 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 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)) 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<ushort>(s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
}));
}
else
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
port.HdcpReceiveCapability = (eHdcpCapabilityType)s;
}));
}
}
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
{
if (hdcpTypeSimple)
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
if (s == 0)
{
port.HdcpSupportOff();
}
else if (s > 0)
{
port.HdcpSupportOn();
}
}));
}
else
{
trilist.SetUShortSigAction(join,
new Action<ushort>(s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
}));
}
}
public class DmChassisControllerJoinMap : JoinMapBase public class DmChassisControllerJoinMap : JoinMapBase
{ {
public uint IsOnline { get; set; } //Digital
public uint SystemId { get; set; } public uint SystemId { get; set; }
public uint OutputVideo { get; set; } public uint IsOnline { get; set; }
public uint OutputAudio { get; set; }
public uint OutputUsb { get; set; } public uint OutputUsb { get; set; }
public uint InputUsb { get; set; } public uint InputUsb { get; set; }
public uint VideoSyncStatus { 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 InputNames { get; set; }
public uint OutputNames { get; set; } public uint OutputNames { get; set; }
public uint OutputCurrentVideoInputNames { get; set; } public uint OutputCurrentVideoInputNames { get; set; }
public uint OutputCurrentAudioInputNames { get; set; } public uint OutputCurrentAudioInputNames { get; set; }
public uint InputCurrentResolution { 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() public DmChassisControllerJoinMap()
{ {
SystemId = 10; SystemId = 10;
//Digital
IsOnline = 11; IsOnline = 11;
VideoSyncStatus = 100; //101-299
InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899
TxAdvancedIsPresent = 1000; //1001-1199
//Analog
OutputVideo = 100; //101-299 OutputVideo = 100; //101-299
OutputAudio = 300; //301-499 OutputAudio = 300; //301-499
OutputUsb = 500; //501-699 OutputUsb = 500; //501-699
InputUsb = 700; //701-899 InputUsb = 700; //701-899
VideoSyncStatus = 100; //101-299 VideoSyncStatus = 100; //101-299
HdcpSupportState = 1000; //1001-1199
HdcpSupportCapability = 1200; //1201-1399
//Serial
InputNames = 100; //101-299 InputNames = 100; //101-299
OutputNames = 300; //301-499 OutputNames = 300; //301-499
OutputCurrentVideoInputNames = 2000; //2001-2199 OutputCurrentVideoInputNames = 2000; //2001-2199
@@ -136,8 +253,9 @@ namespace PepperDash.Essentials.Bridges
InputCurrentResolution = 2400; // 2401-2599 InputCurrentResolution = 2400; // 2401-2599
InputEndpointOnline = 500; //501-699 InputEndpointOnline = 500; //501-699
OutputEndpointOnline = 700; //701-899 OutputEndpointOnline = 700; //701-899
//HdcpSupport = 1000; //1001-1199 HdcpSupportState = 1000; //1001-1199
//HdcpSupportCapability = 1200; //1201-1399 HdcpSupportCapability = 1200; //1201-1399
} }
@@ -159,8 +277,8 @@ namespace PepperDash.Essentials.Bridges
InputCurrentResolution = InputCurrentResolution + joinOffset; InputCurrentResolution = InputCurrentResolution + joinOffset;
InputEndpointOnline = InputEndpointOnline + joinOffset; InputEndpointOnline = InputEndpointOnline + joinOffset;
OutputEndpointOnline = OutputEndpointOnline + joinOffset; OutputEndpointOnline = OutputEndpointOnline + joinOffset;
//HdcpSupport = HdcpSupport + joinOffset; HdcpSupportState = HdcpSupportState + joinOffset;
//HdcpSupportCapability = HdcpSupportCapability + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset;
} }
} }
} }

View File

@@ -30,7 +30,7 @@ namespace PepperDash.Essentials.Bridges
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); 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; bool hdcpTypeSimple;

View File

@@ -42,6 +42,11 @@ namespace PepperDash.Essentials.DM
public BoolFeedback SystemIdBusyFeedback { get; private set; } public BoolFeedback SystemIdBusyFeedback { get; private set; }
public Dictionary<uint, IntFeedback> InputCardHdcpCapabilityFeedbacks { get; private set; }
public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; }
// Need a couple Lists of generic Backplane ports // Need a couple Lists of generic Backplane ports
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; } public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; } public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
@@ -164,6 +169,9 @@ namespace PepperDash.Essentials.DM
SystemIdFeebdack = new IntFeedback(() => { return Chassis.SystemIdFeedback.UShortValue; }); SystemIdFeebdack = new IntFeedback(() => { return Chassis.SystemIdFeedback.UShortValue; });
SystemIdBusyFeedback = new BoolFeedback(() => { return Chassis.SystemIdBusy.BoolValue; }); SystemIdBusyFeedback = new BoolFeedback(() => { return Chassis.SystemIdBusy.BoolValue; });
InputCardHdcpCapabilityFeedbacks = new Dictionary<uint, IntFeedback>();
InputCardHdcpCapabilityTypes = new Dictionary<uint, eHdcpCapabilityType>();
for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) 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; }); InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; });
OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[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) { 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); Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break; break;
@@ -618,15 +659,17 @@ namespace PepperDash.Essentials.DM
InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break; break;
} }
case DMInputEventIds.VideoDetectedEventId: { case DMInputEventIds.VideoDetectedEventId:
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); {
VideoInputSyncFeedbacks[args.Number].FireUpdate(); Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
break; VideoInputSyncFeedbacks[args.Number].FireUpdate();
break;
} }
case DMInputEventIds.InputNameEventId: { case DMInputEventIds.InputNameEventId:
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); {
InputNameFeedbacks[args.Number].FireUpdate(); Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
break; InputNameFeedbacks[args.Number].FireUpdate();
break;
} }
case DMInputEventIds.UsbRoutedToEventId: case DMInputEventIds.UsbRoutedToEventId:
{ {
@@ -634,6 +677,12 @@ namespace PepperDash.Essentials.DM
UsbInputRoutedToFeebacks[args.Number].FireUpdate(); UsbInputRoutedToFeebacks[args.Number].FireUpdate();
break; break;
} }
case DMInputEventIds.HdcpCapabilityFeedbackEventId:
{
Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number);
InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate();
break;
}
default: default:
{ {
Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId); Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);