mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
remvoes BasicDmTxControllerBase
ALL DmTx endpoints now inherit from DmTxControllerBase. If the actual endpoint is a DmHdBasedTEndPoint, it WON'T be bridged.
This commit is contained in:
@@ -4,12 +4,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.DM.Config;
|
using PepperDash.Essentials.DM.Config;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.DM
|
namespace PepperDash.Essentials.DM
|
||||||
@@ -23,7 +25,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="props"></param>
|
/// <param name="props"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
|
public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
|
||||||
{
|
{
|
||||||
// switch on type name... later...
|
// switch on type name... later...
|
||||||
|
|
||||||
@@ -141,26 +143,17 @@ namespace PepperDash.Essentials.DM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class BasicDmTxControllerBase : CrestronGenericBaseDevice
|
|
||||||
{
|
|
||||||
public BasicDmTxControllerBase(string key, string name, GenericBase hardware)
|
|
||||||
: base(key, name, hardware)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DmTxControllerBase : BasicDmTxControllerBase
|
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice
|
||||||
{
|
{
|
||||||
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
|
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
|
||||||
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
|
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
|
||||||
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
|
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
|
||||||
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
|
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
|
||||||
|
|
||||||
public DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
|
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
|
||||||
: base(key, name, hardware)
|
: base(key, name, hardware)
|
||||||
{
|
{
|
||||||
// if wired to a chassis, skip registration step in base class
|
// if wired to a chassis, skip registration step in base class
|
||||||
@@ -170,6 +163,161 @@ namespace PepperDash.Essentials.DM
|
|||||||
}
|
}
|
||||||
AddToFeedbackList(ActiveVideoInputFeedback);
|
AddToFeedbackList(ActiveVideoInputFeedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey,
|
||||||
|
EiscApi bridge)
|
||||||
|
{
|
||||||
|
var joinMap = new DmTxControllerJoinMap();
|
||||||
|
|
||||||
|
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
|
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (tx.Hardware is DmHDBasedTEndPoint)
|
||||||
|
{
|
||||||
|
Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]);
|
||||||
|
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]);
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||||
|
|
||||||
|
bool hdcpTypeSimple;
|
||||||
|
|
||||||
|
if (tx.Hardware is DmTx4kX02CBase)
|
||||||
|
hdcpTypeSimple = false;
|
||||||
|
else
|
||||||
|
hdcpTypeSimple = true;
|
||||||
|
|
||||||
|
if (tx is ITxRouting)
|
||||||
|
{
|
||||||
|
var txR = tx as ITxRouting;
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VideoInput,
|
||||||
|
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video));
|
||||||
|
trilist.SetUShortSigAction(joinMap.AudioInput,
|
||||||
|
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio));
|
||||||
|
|
||||||
|
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]);
|
||||||
|
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]);
|
||||||
|
|
||||||
|
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
|
||||||
|
{
|
||||||
|
var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
|
||||||
|
if (intFeedback != null)
|
||||||
|
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
|
||||||
|
{
|
||||||
|
var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
|
||||||
|
if (intFeedback != null)
|
||||||
|
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
|
||||||
|
{
|
||||||
|
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
|
||||||
|
|
||||||
|
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
|
||||||
|
{
|
||||||
|
var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
|
||||||
|
if (intFeedback != null)
|
||||||
|
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
|
||||||
|
{
|
||||||
|
var port = inputPort.Port as EndpointHdmiInput;
|
||||||
|
|
||||||
|
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var txFreeRun = tx as IHasFreeRun;
|
||||||
|
if (txFreeRun != null)
|
||||||
|
{
|
||||||
|
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]);
|
||||||
|
trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action<bool>(txFreeRun.SetFreeRunEnabled));
|
||||||
|
}
|
||||||
|
|
||||||
|
var txVga = tx as IVgaBrightnessContrastControls;
|
||||||
|
{
|
||||||
|
if (txVga == null) return;
|
||||||
|
|
||||||
|
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]);
|
||||||
|
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]);
|
||||||
|
|
||||||
|
trilist.SetUShortSigAction(joinMap.VgaBrightness, txVga.SetVgaBrightness);
|
||||||
|
trilist.SetUShortSigAction(joinMap.VgaContrast, txVga.SetVgaContrast);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
|
||||||
|
{
|
||||||
|
if (hdcpTypeSimple)
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
s =>
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOff();
|
||||||
|
}
|
||||||
|
else if (s > 0)
|
||||||
|
{
|
||||||
|
port.HdcpSupportOn();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trilist.SetUShortSigAction(join,
|
||||||
|
s =>
|
||||||
|
{
|
||||||
|
port.HdcpCapability = (eHdcpCapabilityType)s;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//public enum ePdtHdcpSupport
|
//public enum ePdtHdcpSupport
|
||||||
//{
|
//{
|
||||||
|
|||||||
Reference in New Issue
Block a user