feature: enhance 4K DM Endpoint HDCP functionality

feature: add bridge join to report number of HDCP inputs

feature: Resolve #1088

feature: Resolve #1089
This commit is contained in:
Trevor Payne
2023-04-14 11:41:32 -05:00
parent 8965752025
commit 55ad92e2f6
12 changed files with 1187 additions and 886 deletions

View File

@@ -36,6 +36,28 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete AudioVideoSource = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC Audio Video Source Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("HdcpSupportCapability")]
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC HDCP Support Capability", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
[JoinName("Port1HdcpState")]
public JoinDataComplete Port1HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 3, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC Port 1 (DM) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("Port2HdcpState")]
public JoinDataComplete Port2HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
new JoinMetadata { Description = "DM TX Port 2 (HDMI) HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("HdmiInputSync")]
public JoinDataComplete HdmiInputSync = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
new JoinMetadata { Description = "DM RMC HDMI Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("HdcpInputPortCount")]
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
@@ -50,7 +72,8 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
protected DmRmcControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
protected DmRmcControllerJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}

View File

@@ -68,6 +68,11 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete Port3HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
new JoinMetadata { Description = "DM TX Port 3 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("HdcpInputPortCount")]
public JoinDataComplete HdcpInputPortCount = new JoinDataComplete(new JoinData { JoinNumber = 9, JoinSpan = 1 },
new JoinMetadata { Description = "Number of Input Ports that support HDCP", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
@@ -83,7 +88,8 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
protected DmTxControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
protected DmTxControllerJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_DM
{
public interface IHasDmInHdcpSet
{
void SetDmInHdcpState(eHdcpCapabilityType hdcpState);
}
public interface IHasDmInHdcpGet
{
IntFeedback DmInHdcpStateFeedback { get; }
}
public interface IHasDmInHdcp : IHasDmInHdcpGet, IHasDmInHdcpSet
{
eHdcpCapabilityType DmInHdcpCapability { get; }
}
public interface IHasHdmiInHdcpSet
{
void SetHdmiInHdcpState(eHdcpCapabilityType hdcpState);
}
public interface IHasHdmiInHdcpGet
{
IntFeedback HdmiInHdcpStateFeedback { get; }
}
public interface IHasHdmiInHdcp : IHasHdmiInHdcpGet, IHasHdmiInHdcpSet
{
eHdcpCapabilityType HdmiInHdcpCapability { get; }
}
public interface IHasHdmiIn1HdcpSet
{
void SetHdmiIn1HdcpState(eHdcpCapabilityType hdcpState);
}
public interface IHasHdmiIn1HdcpGet
{
IntFeedback HdmiIn1HdcpStateFeedback { get; }
}
public interface IHasHdmiIn1Hdcp : IHasHdmiIn1HdcpGet, IHasHdmiIn1HdcpSet
{
eHdcpCapabilityType HdmiIn1HdcpCapability { get; }
}
public interface IHasHdmiIn2HdcpSet
{
void SetHdmiIn2HdcpState(eHdcpCapabilityType hdcpState);
}
public interface IHasHdmiIn2HdcpGet
{
IntFeedback HdmiInIn2HdcpStateFeedback { get; }
}
public interface IHasHdmi2InHdcp : IHasHdmiIn2HdcpGet, IHasHdmiIn2HdcpSet
{
eHdcpCapabilityType Hdmi2InHdcpCapability { get; }
}
public interface IHasDisplayPortInHdcpGet
{
IntFeedback DisplayPortInHdcpStateFeedback { get; }
}
public interface IHasDisplayPortInHdcpSet
{
void SetDisplayPortInHdcpState(eHdcpCapabilityType hdcpState);
}
public interface IHasDisplayPortInHdcp : IHasDisplayPortInHdcpGet, IHasDisplayPortInHdcpSet
{
eHdcpCapabilityType DisplayPortInHdcpCapability { get; }
}
}

View File

@@ -1,196 +1,220 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_DM;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
[Description("Wrapper Class for DM-RMC-4K-SCALER-C")]
public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts
{
private readonly DmRmc4kScalerC _rmc;
public RoutingInputPort DmIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
public RoutingOutputPort BalancedAudioOut { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
/// <summary>
/// Make a Crestron RMC and put it in here
/// </summary>
public DmRmc4kScalerCController(string key, string name, DmRmc4kScalerC rmc)
: base(key, name, rmc)
{
_rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, 0, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
BalancedAudioOut = new RoutingOutputPort(DmPortName.BalancedAudioOut, eRoutingSignalType.Audio,
eRoutingPortConnectionType.LineAudio, null, this);
MuteFeedback = new BoolFeedback(() => false);
VolumeLevelFeedback = new IntFeedback("MainVolumeLevelFeedback", () =>
rmc.AudioOutput.VolumeFeedback.UShortValue);
EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut, BalancedAudioOut};
VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
// Set Ports for CEC
HdmiOut.Port = _rmc.HdmiOutput;
}
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
{
VideoOutputResolutionFeedback.FireUpdate();
}
}
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{
switch (args.EventId)
{
case ConnectedDeviceEventIds.ManufacturerEventId:
EdidManufacturerFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.NameEventId:
EdidNameFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.PreferredTimingEventId:
EdidPreferredTimingFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.SerialNumberEventId:
EdidSerialNumberFeedback.FireUpdate();
break;
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return _rmc.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return _rmc.ComPorts; } }
public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
#endregion
#region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
#endregion
#region IRelayPorts Members
public int NumberOfRelayPorts
{
get { return _rmc.NumberOfRelayPorts; }
}
public CrestronCollection<Relay> RelayPorts
{
get { return _rmc.RelayPorts; }
}
#endregion
#region IBasicVolumeWithFeedback Members
public BoolFeedback MuteFeedback
{
get;
private set;
}
/// <summary>
/// Not implemented
/// </summary>
public void MuteOff()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
/// <summary>
/// Not implemented
/// </summary>
public void MuteOn()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
public void SetVolume(ushort level)
{
_rmc.AudioOutput.Volume.UShortValue = level;
}
public IntFeedback VolumeLevelFeedback
{
get;
private set;
}
#endregion
#region IBasicVolumeControls Members
/// <summary>
/// Not implemented
/// </summary>
public void MuteToggle()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
public void VolumeDown(bool pressRelease)
{
if (pressRelease)
SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 0, 4000);
else
_rmc.AudioOutput.Volume.StopRamp();
}
public void VolumeUp(bool pressRelease)
{
if (pressRelease)
SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 65535, 4000);
else
_rmc.AudioOutput.Volume.StopRamp();
}
#endregion
}
public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts, IHasDmInHdcp
{
private readonly DmRmc4kScalerC _rmc;
public RoutingInputPort DmIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
public RoutingOutputPort BalancedAudioOut { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
public EndpointDmInputStreamWithCec DmInput { get; private set; }
public IntFeedback DmInHdcpStateFeedback { get; private set; }
/// <summary>
/// Make a Crestron RMC and put it in here
/// </summary>
public DmRmc4kScalerCController(string key, string name, DmRmc4kScalerC rmc)
: base(key, name, rmc)
{
_rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, 0, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
BalancedAudioOut = new RoutingOutputPort(DmPortName.BalancedAudioOut, eRoutingSignalType.Audio,
eRoutingPortConnectionType.LineAudio, null, this);
MuteFeedback = new BoolFeedback(() => false);
VolumeLevelFeedback = new IntFeedback("MainVolumeLevelFeedback", () =>
rmc.AudioOutput.VolumeFeedback.UShortValue);
EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
InputPorts = new RoutingPortCollection<RoutingInputPort> { DmIn };
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, BalancedAudioOut };
VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
DmInHdcpStateFeedback = new IntFeedback("DmInHdcpCapability",
() => (int)_rmc.DmInput.HdcpCapabilityFeedback);
AddToFeedbackList(DmInHdcpStateFeedback);
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
// Set Ports for CEC
HdmiOut.Port = _rmc.HdmiOutput;
}
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
{
VideoOutputResolutionFeedback.FireUpdate();
}
}
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{
switch (args.EventId)
{
case ConnectedDeviceEventIds.ManufacturerEventId:
EdidManufacturerFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.NameEventId:
EdidNameFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.PreferredTimingEventId:
EdidPreferredTimingFeedback.FireUpdate();
break;
case ConnectedDeviceEventIds.SerialNumberEventId:
EdidSerialNumberFeedback.FireUpdate();
break;
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return _rmc.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return _rmc.ComPorts; } }
public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
#endregion
#region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
#endregion
#region IRelayPorts Members
public int NumberOfRelayPorts
{
get { return _rmc.NumberOfRelayPorts; }
}
public CrestronCollection<Relay> RelayPorts
{
get { return _rmc.RelayPorts; }
}
#endregion
#region IBasicVolumeWithFeedback Members
public BoolFeedback MuteFeedback
{
get;
private set;
}
/// <summary>
/// Not implemented
/// </summary>
public void MuteOff()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
/// <summary>
/// Not implemented
/// </summary>
public void MuteOn()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
public void SetVolume(ushort level)
{
_rmc.AudioOutput.Volume.UShortValue = level;
}
public IntFeedback VolumeLevelFeedback
{
get;
private set;
}
#endregion
#region IBasicVolumeControls Members
/// <summary>
/// Not implemented
/// </summary>
public void MuteToggle()
{
Debug.Console(2, this, "DM Endpoint {0} does not have a mute function", Key);
}
public void VolumeDown(bool pressRelease)
{
if (pressRelease)
SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 0, 4000);
else
_rmc.AudioOutput.Volume.StopRamp();
}
public void VolumeUp(bool pressRelease)
{
if (pressRelease)
SigHelper.RampTimeScaled(_rmc.AudioOutput.Volume, 65535, 4000);
else
_rmc.AudioOutput.Volume.StopRamp();
}
#endregion
public eHdcpCapabilityType DmInHdcpCapability
{
get { return eHdcpCapabilityType.Hdcp2_2Support; }
}
public void SetDmInHdcpState(eHdcpCapabilityType hdcpState)
{
if (_rmc == null) return;
_rmc.DmInput.HdcpCapability = hdcpState;
}
}
}

View File

@@ -5,8 +5,9 @@ using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Bridges;
using PepperDash_Essentials_DM;
namespace PepperDash.Essentials.DM
{
/// <summary>
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.DM
/// </summary>
[Description("Wrapper Class for DM-RMC-4K-SCALER-C-DSP")]
public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts
IIROutputPorts, IComPorts, ICec, IRelayPorts, IHasDmInHdcp
{
private readonly DmRmc4kScalerCDsp _rmc;
@@ -25,7 +26,12 @@ namespace PepperDash.Essentials.DM
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
public EndpointDmInputStreamWithCec DmInput { get; private set; }
public IntFeedback DmInHdcpStateFeedback { get; private set; }
/// <summary>
/// Make a Crestron RMC and put it in here
@@ -51,7 +57,13 @@ namespace PepperDash.Essentials.DM
EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
DmInHdcpStateFeedback = new IntFeedback("DmInHdcpCapability",
() => (int) _rmc.DmInput.HdcpCapabilityFeedback);
AddToFeedbackList(DmInHdcpStateFeedback);
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut, BalancedAudioOut};
@@ -190,6 +202,18 @@ namespace PepperDash.Essentials.DM
_rmc.AudioOutput.Volume.StopRamp();
}
#endregion
#endregion
public eHdcpCapabilityType DmInHdcpCapability
{
get { return eHdcpCapabilityType.Hdcp2_2Support; }
}
public void SetDmInHdcpState(eHdcpCapabilityType hdcpState)
{
if (_rmc == null) return;
_rmc.DmInput.HdcpCapability = hdcpState;
}
}
}

View File

@@ -9,12 +9,13 @@ using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Core;
using PepperDash_Essentials_DM;
namespace PepperDash.Essentials.DM
{
[Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")]
public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRoutingWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts
IIROutputPorts, IComPorts, ICec, IRelayPorts, IHasDmInHdcp, IHasHdmiInHdcp
{
private readonly DmRmc4kzScalerC _rmc;
@@ -22,6 +23,13 @@ namespace PepperDash.Essentials.DM
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
public IntFeedback DmInHdcpStateFeedback { get; private set; }
public IntFeedback HdmiInHdcpStateFeedback { get; private set; }
public BoolFeedback HdmiVideoSyncFeedback { get; private set; }
/// <summary>
/// The value of the current video source for the HDMI output on the receiver
/// </summary>
@@ -42,13 +50,13 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
}
}
public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc)
: base(key, name, rmc)
{
_rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, 0, this)
{
@@ -62,6 +70,16 @@ namespace PepperDash.Essentials.DM
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
HdmiInHdcpStateFeedback = new IntFeedback("HdmiInHdcpCapability",
() => (int)_rmc.HdmiIn.HdcpCapabilityFeedback);
DmInHdcpStateFeedback = new IntFeedback("DmInHdcpCapability",
() => (int)_rmc.DmInput.HdcpCapabilityFeedback);
HdmiVideoSyncFeedback = new BoolFeedback("HdmiInVideoSync",
() => _rmc.HdmiIn.SyncDetectedFeedback.BoolValue);
AddToFeedbackList(HdmiInHdcpStateFeedback, DmInHdcpStateFeedback, HdmiVideoSyncFeedback);
EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
@@ -69,11 +87,13 @@ namespace PepperDash.Essentials.DM
VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn, HdmiIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut};
InputPorts = new RoutingPortCollection<RoutingInputPort> { DmIn, HdmiIn };
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut };
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
_rmc.HdmiIn.InputStreamChange += InputStreamChangeEvent;
_rmc.DmInput.InputStreamChange += InputStreamChangeEvent;
_rmc.OnlineStatusChange += _rmc_OnlineStatusChange;
@@ -83,6 +103,20 @@ namespace PepperDash.Essentials.DM
AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(_rmc.SelectedSourceFeedback));
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == _rmc.HdmiIn) HdmiInHdcpStateFeedback.FireUpdate();
if (inputStream == _rmc.DmInput) DmInHdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == _rmc.HdmiIn) HdmiVideoSyncFeedback.FireUpdate();
break;
}
}
private void _rmc_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
AudioVideoSourceNumericFeedback.FireUpdate();
@@ -181,5 +215,31 @@ namespace PepperDash.Essentials.DM
}
#endregion
public eHdcpCapabilityType DmInHdcpCapability
{
get { return eHdcpCapabilityType.Hdcp2_2Support; }
}
public void SetDmInHdcpState(eHdcpCapabilityType hdcpState)
{
if (_rmc == null) return;
_rmc.DmInput.HdcpCapability = hdcpState;
}
public eHdcpCapabilityType HdmiInHdcpCapability
{
get { return eHdcpCapabilityType.Hdcp2_2Support; }
}
public void SetHdmiInHdcpState(eHdcpCapabilityType hdcpState)
{
if (_rmc == null) return;
_rmc.HdmiIn.HdcpCapability = hdcpState;
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Cards;
@@ -11,11 +12,12 @@ using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.DeviceInfo;
using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_DM;
namespace PepperDash.Essentials.DM
{
[Description("Wrapper class for all DM-RMC variants")]
public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice, IDeviceInfoProvider
public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice, IDeviceInfoProvider
{
private const int CtpPort = 41795;
private readonly EndpointReceiverBase _rmc; //kept here just in case. Only property or method on this class that's not device-specific is the DMOutput that it's attached to.
@@ -27,15 +29,15 @@ namespace PepperDash.Essentials.DM
public StringFeedback EdidSerialNumberFeedback { get; protected set; }
protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
: base(key, name, device)
: base(key, name, device)
{
_rmc = device;
// if wired to a chassis, skip registration step in base class
// if wired to a chassis, skip registration step in base class
PreventRegistration = _rmc.DMOutput != null;
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
DeviceInfo = new DeviceInfo();
IsOnline.OutputChange += (currentDevice, args) => { if (args.BoolValue) UpdateDeviceInfo(); };
@@ -73,19 +75,80 @@ namespace PepperDash.Essentials.DM
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming.JoinNumber]);
if (rmc.EdidSerialNumberFeedback != null)
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber.JoinNumber]);
//If the device is an DM-RMC-4K-Z-SCALER-C
var routing = rmc as IRmcRouting;
var routing = rmc as IRoutingInputsOutputs;
trilist.UShortInput[joinMap.HdcpInputPortCount.JoinNumber].UShortValue = (ushort)(routing == null
? 1
: routing.InputPorts.Count);
if (routing == null)
{
return;
}
var hdcpCapability = eHdcpCapabilityType.HdcpSupportOff;
if (routing.InputPorts[DmPortName.HdmiIn] != null)
{
var hdmiInHdcp = routing as IHasHdmiInHdcp;
if (hdmiInHdcp != null)
{
if (rmc.Feedbacks["HdmiInHdcpCapability"] != null)
{
var intFeedback = rmc.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
}
if (rmc.Feedbacks["HdmiInVideoSync"] != null)
{
var boolFeedback = rmc.Feedbacks["HdmiInVideoSync"] as BoolFeedback;
if (boolFeedback != null)
boolFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiInputSync.JoinNumber]);
}
hdcpCapability = hdmiInHdcp.HdmiInHdcpCapability > hdcpCapability
? hdmiInHdcp.HdmiInHdcpCapability
: hdcpCapability;
if (routing.AudioVideoSourceNumericFeedback != null)
routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]);
trilist.SetUShortSigAction(joinMap.Port1HdcpState.JoinNumber, a => hdmiInHdcp.SetHdmiInHdcpState((eHdcpCapabilityType)a));
}
}
if (routing.InputPorts[DmPortName.DmIn] != null)
{
var dmInHdcp = rmc as IHasDmInHdcp;
trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
if (dmInHdcp != null)
{
if (rmc.Feedbacks["DmInHdcpCapability"] != null)
{
var intFeedback = rmc.Feedbacks["DmInHdcpCapability"] as IntFeedback;
if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port2HdcpState.JoinNumber]);
}
hdcpCapability = dmInHdcp.DmInHdcpCapability > hdcpCapability
? dmInHdcp.DmInHdcpCapability
: hdcpCapability;
trilist.SetUShortSigAction(joinMap.Port2HdcpState.JoinNumber, a => dmInHdcp.SetDmInHdcpState((eHdcpCapabilityType)a));
}
}
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)hdcpCapability;
trilist.UShortInput[joinMap.HdcpInputPortCount.JoinNumber].UShortValue = (ushort)routing.InputPorts.Count;
var routingWithFeedback = routing as IRmcRouting;
if (routingWithFeedback == null) return;
if (routingWithFeedback.AudioVideoSourceNumericFeedback != null)
routingWithFeedback.AudioVideoSourceNumericFeedback.LinkInputSig(
trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]);
trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber,
a => routingWithFeedback.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
}
#region Implementation of IDeviceInfoProvider
@@ -143,13 +206,13 @@ namespace PepperDash.Essentials.DM
return;
}
if (args.Text.ToLower().Contains("host"))
{
DeviceInfo.HostName = args.Text.Split(':')[1].Trim();
tcpClient.SendText("maca\r\n");
return;
}
@@ -202,17 +265,17 @@ namespace PepperDash.Essentials.DM
}
}
public class DmRmcHelper
{
private static readonly Dictionary<string, Func<string, string, uint, CrestronGenericBaseDevice>> ProcessorFactoryDict;
private static readonly Dictionary<string, Func<string, string, DMOutput, CrestronGenericBaseDevice>> ChassisCpu3Dict;
public class DmRmcHelper
{
private static readonly Dictionary<string, Func<string, string, uint, CrestronGenericBaseDevice>> ProcessorFactoryDict;
private static readonly Dictionary<string, Func<string, string, DMOutput, CrestronGenericBaseDevice>> ChassisCpu3Dict;
private static readonly Dictionary<string, Func<string, string, uint, DMOutput, CrestronGenericBaseDevice>>
ChassisDict;
private static readonly Dictionary<string, Func<string, string, uint, DMOutput, CrestronGenericBaseDevice>>
ChassisDict;
static DmRmcHelper()
{
ProcessorFactoryDict = new Dictionary<string, Func<string, string, uint, CrestronGenericBaseDevice>>
static DmRmcHelper()
{
ProcessorFactoryDict = new Dictionary<string, Func<string, string, uint, CrestronGenericBaseDevice>>
{
{"dmrmc100c", (k, n, i) => new DmRmcX100CController(k, n, new DmRmc100C(i, Global.ControlSystem))},
{"dmrmc100s", (k, n, i) => new DmRmc100SController(k, n, new DmRmc100S(i, Global.ControlSystem))},
@@ -306,34 +369,34 @@ namespace PepperDash.Essentials.DM
{"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(i, d))}
};
}
/// <summary>
/// A factory method for various DmRmcControllers
/// </summary>
/// <param name="key">device key. Used to uniquely identify device</param>
/// <param name="name">device name</param>
/// <param name="typeName">device type name. Used to retrived the correct device</param>
/// <param name="props">Config from config file</param>
/// <returns></returns>
public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props)
{
typeName = typeName.ToLower();
var ipid = props.Control.IpIdInt;
/// <summary>
/// A factory method for various DmRmcControllers
/// </summary>
/// <param name="key">device key. Used to uniquely identify device</param>
/// <param name="name">device name</param>
/// <param name="typeName">device type name. Used to retrived the correct device</param>
/// <param name="props">Config from config file</param>
/// <returns></returns>
public static CrestronGenericBaseDevice GetDmRmcController(string key, string name, string typeName, DmRmcPropertiesConfig props)
{
typeName = typeName.ToLower();
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
var pKey = props.ParentDeviceKey.ToLower();
// Non-DM-chassis endpoints
return pKey == "processor" ? GetDmRmcControllerForProcessor(key, name, typeName, ipid) : GetDmRmcControllerForChassis(key, name, typeName, props, pKey, ipid);
}
// Non-DM-chassis endpoints
return pKey == "processor" ? GetDmRmcControllerForProcessor(key, name, typeName, ipid) : GetDmRmcControllerForChassis(key, name, typeName, props, pKey, ipid);
}
private static CrestronGenericBaseDevice GetDmRmcControllerForChassis(string key, string name, string typeName,
DmRmcPropertiesConfig props, string pKey, uint ipid)
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
private static CrestronGenericBaseDevice GetDmRmcControllerForChassis(string key, string name, string typeName,
DmRmcPropertiesConfig props, string pKey, uint ipid)
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
CrestronGenericBaseDevice rx;
bool useChassisForOfflineFeedback = false;
if (parentDev is DmpsRoutingController)
{
if (parentDev is DmpsRoutingController)
{
var dmps = parentDev as DmpsRoutingController;
//Check that the input is within range of this chassis' possible inputs
var num = props.ParentOutputNumber;
@@ -348,9 +411,9 @@ namespace PepperDash.Essentials.DM
if (Global.ControlSystemIsDmps4kType)
{
rx = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
useChassisForOfflineFeedback = true;
useChassisForOfflineFeedback = true;
}
else
else
{
rx = GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber);
if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
@@ -372,7 +435,7 @@ namespace PepperDash.Essentials.DM
};
}
return rx;
}
}
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
@@ -385,7 +448,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range",
key, num);
return null;
}
}
controller.RxDictionary.Add(num, key);
// Catch constructor failures, mainly dues to IPID
try
@@ -434,31 +497,31 @@ namespace PepperDash.Essentials.DM
key, pKey);
return null;
}
}
}
private static CrestronGenericBaseDevice GetDmRmcControllerForCpu2Chassis(string key, string name, string typeName,
uint ipid, Switch chassis, uint num, IKeyed parentDev)
{
Func<string, string, uint, DMOutput, CrestronGenericBaseDevice> handler;
if (ChassisDict.TryGetValue(typeName.ToLower(), out handler))
{
return handler(key, name, ipid, chassis.Outputs[num]);
}
Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key);
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForCpu2Chassis(string key, string name, string typeName,
uint ipid, Switch chassis, uint num, IKeyed parentDev)
{
Func<string, string, uint, DMOutput, CrestronGenericBaseDevice> handler;
if (ChassisDict.TryGetValue(typeName.ToLower(), out handler))
{
return handler(key, name, ipid, chassis.Outputs[num]);
}
Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key);
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForCpu3Chassis(string key, string name, string typeName,
Switch chassis, uint num, IKeyed parentDev)
{
Func<string, string, DMOutput, CrestronGenericBaseDevice> cpu3Handler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out cpu3Handler))
{
return cpu3Handler(key, name, chassis.Outputs[num]);
}
Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key);
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForCpu3Chassis(string key, string name, string typeName,
Switch chassis, uint num, IKeyed parentDev)
{
Func<string, string, DMOutput, CrestronGenericBaseDevice> cpu3Handler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out cpu3Handler))
{
return cpu3Handler(key, name, chassis.Outputs[num]);
}
Debug.Console(0, "Cannot create DM-RMC of type '{0}' with parent device {1}", typeName, parentDev.Key);
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName,
uint ipid, DmpsRoutingController controller, uint num)
@@ -482,49 +545,49 @@ namespace PepperDash.Essentials.DM
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps4k(string key, string name, string typeName,
DmpsRoutingController controller, uint num)
{
Func<string, string, DMOutput, CrestronGenericBaseDevice> dmps4kHandler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmps4kHandler))
{
var output = controller.Dmps.SwitcherOutputs[num] as DMOutput;
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps4k(string key, string name, string typeName,
DmpsRoutingController controller, uint num)
{
Func<string, string, DMOutput, CrestronGenericBaseDevice> dmps4kHandler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmps4kHandler))
{
var output = controller.Dmps.SwitcherOutputs[num] as DMOutput;
if (output != null)
{
return dmps4kHandler(key, name, output);
}
Debug.Console(0, Debug.ErrorLogLevel.Error,
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS-4K chassis. Output is not a DM Output.",
typeName, num);
return null;
}
if (output != null)
{
return dmps4kHandler(key, name, output);
}
Debug.Console(0, Debug.ErrorLogLevel.Error,
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS-4K chassis. Output is not a DM Output.",
typeName, num);
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS-4K chassis", typeName, num);
return null;
}
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForProcessor(string key, string name, string typeName, uint ipid)
{
try
{
Func<string, string, uint, CrestronGenericBaseDevice> handler;
private static CrestronGenericBaseDevice GetDmRmcControllerForProcessor(string key, string name, string typeName, uint ipid)
{
try
{
Func<string, string, uint, CrestronGenericBaseDevice> handler;
if (ProcessorFactoryDict.TryGetValue(typeName.ToLower(), out handler))
{
return handler(key, name, ipid);
}
Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName);
if (ProcessorFactoryDict.TryGetValue(typeName.ToLower(), out handler))
{
return handler(key, name, ipid);
}
Debug.Console(0, "Cannot create DM-RMC of type: '{0}'", typeName);
return null;
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
return null;
}
}
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
return null;
}
}
}
public class DmRmcControllerFactory : EssentialsDeviceFactory<DmRmcControllerBase>
{
@@ -544,7 +607,7 @@ namespace PepperDash.Essentials.DM
var props = JsonConvert.DeserializeObject
<DmRmcPropertiesConfig>(dc.Properties.ToString());
return DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props);
return DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props);
}
}

View File

@@ -1,42 +1,42 @@
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.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;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
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.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;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-202-C")]
public class DmTx4k202CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4k202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { 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 HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public class DmTx4k202CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4k202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { 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 HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//IroutingNumericEvent
@@ -50,50 +50,50 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
}
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
}
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4k202CController(string key, string name, DmTx4k202C tx, bool preventRegistration)
@@ -127,28 +127,23 @@ namespace PepperDash.Essentials.DM
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
VideoSourceNumericFeedback = new IntFeedback(() => (int) Tx.VideoSourceFeedback);
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int) Tx.AudioSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability",
() => (int) tx.HdmiInputs[1].HdcpCapabilityFeedback);
() => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability",
() => (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
() => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
HdcpStateFeedback = new IntFeedback(() => (int)HdcpSupportCapability);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
@@ -210,120 +205,120 @@ namespace PepperDash.Essentials.DM
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, 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)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
{
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (type)
{
case eRoutingSignalType.Video:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eAst)inputSelector;
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, 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)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
{
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (type)
{
case eRoutingSignalType.Video:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eAst)inputSelector;
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
}
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
@@ -361,62 +356,62 @@ namespace PepperDash.Essentials.DM
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(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;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(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;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -17,22 +17,22 @@ using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-302-C")]
public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx4k302C Tx { get; private set; }
public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx4k302C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
@@ -60,78 +60,78 @@ namespace PepperDash.Essentials.DM
}
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return eVst.Vga;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return eVst.Vga;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
VgaIn,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4k302CController(string key, string name, DmTx4k302C tx, bool preventRegistration)
: base(key, name, tx)
{
Tx = tx;
: base(key, name, tx)
{
Tx = tx;
PreventRegistration = preventRegistration;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
{
FeedbackMatchObject = eVst.Hdmi1
};
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
{
FeedbackMatchObject = eVst.Hdmi1
};
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
{
FeedbackMatchObject = eVst.Hdmi2
};
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = eVst.Vga
};
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
Tx.BaseEvent += Tx_BaseEvent;
@@ -145,15 +145,10 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
HdcpStateFeedback = new IntFeedback(() => (int)HdcpSupportCapability);
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
@@ -168,46 +163,46 @@ namespace PepperDash.Essentials.DM
tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : "";
},
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == eVst.Vga ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Vga
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
};
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == eVst.Vga ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Vga
&& tx.VgaInput.SyncDetectedFeedback.BoolValue)
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
};
DmOut = 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);
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = 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,
@@ -221,7 +216,7 @@ namespace PepperDash.Essentials.DM
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput;
}
}
void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
@@ -254,21 +249,21 @@ namespace PepperDash.Essentials.DM
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
@@ -329,60 +324,60 @@ namespace PepperDash.Essentials.DM
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(VgaIn.Selector, null, type);
break;
}
{
ExecuteSwitch(VgaIn.Selector, null, type);
break;
}
case 4:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AudioIn, null, type);
break;
}
{
ExecuteSwitch(eAst.AudioIn, null, type);
break;
}
case 4:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
@@ -453,54 +448,54 @@ namespace PepperDash.Essentials.DM
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return;
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(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;
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(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;
}
}
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -133,9 +133,9 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
DisplayPortInHdcpCapabilityFeedback = new IntFeedback("DisplayPortHdcpCapability",
() => (int) tx.DisplayPortInput.HdcpCapabilityFeedback);
() => (int)tx.DisplayPortInput.HdcpCapabilityFeedback);
/*
HdcpStateFeedback =
new IntFeedback(
@@ -146,13 +146,18 @@ namespace PepperDash.Essentials.DM
*/
//yeah this is gross - but it's the quickest way to do this...
/*
HdcpStateFeedback = new IntFeedback(() => {
var states = new[] {(int) tx.DisplayPortInput.HdcpCapabilityFeedback, (int) tx.HdmiInputs[1].HdcpCapabilityFeedback, (int) tx.HdmiInputs[2].HdcpCapabilityFeedback};
return states.Max();
});
*/
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
// I feel like we have had this as a misnomer for so long, that it really needed to be fixed
// All we were doing was reporting the best of the current statuses - not the actual capability of the device.
HdcpStateFeedback = new IntFeedback(() => (int)HdcpSupportCapability);
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
@@ -269,41 +274,41 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(DisplayPortIn.Selector, null, type);
break;
}
case 4:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
default:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(DisplayPortIn.Selector, null, type);
break;
}
case 4:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
default:
{
Debug.Console(2, this, "Unable to execute numeric switch to input {0}", input);
break;
}
}
}
}
@@ -424,7 +429,7 @@ namespace PepperDash.Essentials.DM
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }

View File

@@ -18,8 +18,8 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM
{
public class DmTxHelper
{
public class DmTxHelper
{
public static BasicDmTxControllerBase GetDmTxForChassisWithoutIpId(string key, string name, string typeName, DMInput dmInput)
{
@@ -77,31 +77,31 @@ namespace PepperDash.Essentials.DM
return null;
}
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
/// <summary>
/// A factory method for various DmTxControllers
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
{
// switch on type name... later...
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmtx200"))
{
// Catch constructor failures, mainly dues to IPID
try
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx4k202"))
@@ -112,36 +112,36 @@ namespace PepperDash.Essentials.DM
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem), false);
if (typeName.StartsWith("dmtx401"))
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem), false);
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
return null;
}
}
var parentDev = DeviceManager.GetDeviceForKey(pKey);
DMInput dmInput;
BasicDmTxControllerBase tx;
bool useChassisForOfflineFeedback = false;
if (parentDev is DmChassisController)
if (parentDev is DmChassisController)
{
// Get the Crestron chassis and link stuff up
var switchDev = (parentDev as DmChassisController);
var chassis = switchDev.Chassis;
var switchDev = (parentDev as DmChassisController);
var chassis = switchDev.Chassis;
//Check that the input is within range of this chassis' possible inputs
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
switchDev.TxDictionary.Add(num, key);
dmInput = chassis.Inputs[num];
@@ -164,7 +164,7 @@ namespace PepperDash.Essentials.DM
if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
{
useChassisForOfflineFeedback = true;
}
}
}
if (useChassisForOfflineFeedback)
{
@@ -180,7 +180,7 @@ namespace PepperDash.Essentials.DM
return null;
}
}
else if(parentDev is DmpsRoutingController)
else if (parentDev is DmpsRoutingController)
{
// Get the DMPS chassis and link stuff up
var dmpsDev = (parentDev as DmpsRoutingController);
@@ -209,7 +209,7 @@ namespace PepperDash.Essentials.DM
try
{
if(Global.ControlSystemIsDmps4kType)
if (Global.ControlSystemIsDmps4kType)
{
tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput);
useChassisForOfflineFeedback = true;
@@ -220,7 +220,7 @@ namespace PepperDash.Essentials.DM
if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
{
useChassisForOfflineFeedback = true;
}
}
}
if (useChassisForOfflineFeedback)
{
@@ -234,16 +234,16 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device for dmps: {1}", key, e);
return null;
}
}
}
else
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey);
return null;
}
}
}
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey);
return null;
}
}
}
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
{
@@ -254,21 +254,21 @@ namespace PepperDash.Essentials.DM
}
}
/// <summary>
///
/// </summary>
/// <summary>
///
/// </summary>
[Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
public IntFeedback HdcpStateFeedback { get; protected set; }
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
AddToFeedbackList(ActiveVideoInputFeedback);
IsOnline.OutputChange += (currentDevice, args) =>
@@ -279,11 +279,12 @@ namespace PepperDash.Essentials.DM
feedback.FireUpdate();
}
};
}
}
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
{
}
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware)
: base(key, name, hardware)
{
}
protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey)
{
@@ -297,8 +298,8 @@ namespace PepperDash.Essentials.DM
return joinMap;
}
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
@@ -308,7 +309,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);
@@ -411,9 +412,22 @@ namespace PepperDash.Essentials.DM
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port3HdcpState.JoinNumber, trilist);
}
}
var hdcpInputPortCount =
(ushort)
txR.InputPorts.Where(
x => (x.Type == eRoutingSignalType.Video) || (x.Type == eRoutingSignalType.AudioVideo))
.Where(
x =>
(x.ConnectionType == eRoutingPortConnectionType.DmCat) ||
(x.ConnectionType == eRoutingPortConnectionType.Hdmi) ||
(x.ConnectionType == eRoutingPortConnectionType.DisplayPort))
.ToList().Count();
trilist.SetUshort(joinMap.HdcpInputPortCount.JoinNumber, hdcpInputPortCount);
}
var txFreeRun = tx as IHasFreeRun;
@@ -462,20 +476,20 @@ namespace PepperDash.Essentials.DM
}
}
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointDisplayPortInput port, uint join,
BasicTriList trilist)
{
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointDisplayPortInput port, uint join,
BasicTriList trilist)
{
trilist.SetUShortSigAction(join,
s =>
{
port.HdcpCapability = (eHdcpCapabilityType) s;
});
trilist.SetUShortSigAction(join,
s =>
{
port.HdcpCapability = (eHdcpCapabilityType)s;
});
}
}
}
}
public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase>
{

View File

@@ -105,6 +105,7 @@
<Compile Include="Chassis\HdMdNxM4kEBridgeableController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="Endpoints\EndpointInterfaces.cs" />
<Compile Include="Endpoints\DGEs\DgeJoinMap.cs" />
<Compile Include="Endpoints\DGEs\DmDge200CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" />