Merge pull request #242 from PepperDash/hotfix/dm-tx-chassis-bridge-fix

Add BasicDmTxControllerBase back
This commit is contained in:
Andrew Welker
2020-06-11 09:49:19 -06:00
committed by GitHub
5 changed files with 373 additions and 374 deletions

View File

@@ -10,7 +10,7 @@ PepperDash Essentials is an open source Crestron framework that can be configure
Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other. Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other.
## Minimum Requirements ## Minimum Requirements
- Essentials Framework runs on any Crestron 3-series processor or Crestron's VC-4 platform. - Essentials Framework runs on any Crestron 3-series processor, **4-series** processor or Crestron's VC-4 platform.
- To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required. - To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required.
- Crestron's Simpl# Plugin is also required (must be obtained from Crestron). - Crestron's Simpl# Plugin is also required (must be obtained from Crestron).

View File

@@ -609,7 +609,7 @@ namespace PepperDash.Essentials.DM {
{ {
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot]; var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase; var advancedTxDevice = basicTxDevice as DmTxControllerBase;

View File

@@ -1163,9 +1163,9 @@ namespace PepperDash.Essentials.DM
{ {
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot]; var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice; var advancedTxDevice = basicTxDevice as DmTxControllerBase;
if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps

View File

@@ -3,16 +3,16 @@
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
using eVst = eX02VideoSourceType; using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType; using eAst = eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-100-C-1G")] public class DmTx4k100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs,
public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
public DmTx4K100C1G Tx { get; private set; } public DmTx4K100C1G Tx { get; private set; }
@@ -73,9 +73,7 @@ namespace PepperDash.Essentials.DM
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
LinkDmTxToApi(this, trilist, joinMap, bridge);
} }
#region IIROutputPorts Members #region IIROutputPorts Members
@@ -91,7 +89,5 @@ namespace PepperDash.Essentials.DM
#region ICec Members #region ICec Members
public Cec StreamCec { get { return Tx.StreamCec; } } public Cec StreamCec { get { return Tx.StreamCec; } }
#endregion #endregion
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
} }
} }

View File

@@ -1,361 +1,364 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; 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.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 Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config; using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
public class DmTxHelper public class DmTxHelper
{ {
/// <summary> /// <summary>
/// A factory method for various DmTxControllers /// A factory method for various DmTxControllers
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="props"></param> /// <param name="props"></param>
/// <returns></returns> /// <returns></returns>
public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) 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(); typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16); //uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt; var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower(); var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor") if (pKey == "processor")
{ {
// Catch constructor failures, mainly dues to IPID // Catch constructor failures, mainly dues to IPID
try try
{ {
if(typeName.StartsWith("dmtx200")) if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem)); return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem)); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem)); return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem)); return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem)); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem)); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem)); return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem)); return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key); Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
} }
} }
else else
{ {
var parentDev = DeviceManager.GetDeviceForKey(pKey); var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch)) if (!(parentDev is IDmSwitch))
{ {
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey); key, pKey);
return null; return null;
} }
// Get the Crestron chassis and link stuff up // Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch); var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis; var chassis = switchDev.Chassis;
var num = props.ParentInputNumber; var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs) if (num <= 0 || num > chassis.NumberOfInputs)
{ {
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range", Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num); key, num);
return null; return null;
} }
else else
{ {
var controller = (parentDev as IDmSwitch); var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key); controller.TxDictionary.Add(num, key);
} }
// Catch constructor failures, mainly dues to IPID // Catch constructor failures, mainly dues to IPID
try try
{ {
// Must use different constructor for CPU3 chassis types. No IPID // Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps|| chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64) chassis is DmMd128x128 || chassis is DmMd64x64)
{ {
if (typeName.StartsWith("dmtx200")) if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num])); return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num])); return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num])); return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100")) if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num])); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num])); return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num])); return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
} }
else else
{ {
if (typeName.StartsWith("dmtx200")) if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num])); return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num])); return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100")) if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num])); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num])); return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num])); return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
} }
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
} }
} }
return null; return null;
} }
} }
/// <summary> public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
/// {
/// </summary> protected BasicDmTxControllerBase(string key, string name, GenericBase hardware)
[Description("Wrapper class for all DM-TX variants")] : base(key, name, hardware)
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice {
{
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; } /// <summary>
///
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) /// </summary>
: base(key, name, hardware) [Description("Wrapper class for all DM-TX variants")]
{ public abstract class DmTxControllerBase : BasicDmTxControllerBase
// if wired to a chassis, skip registration step in base class {
if (hardware.DMInput != null) public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
{ public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
this.PreventRegistration = true; public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
} public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
AddToFeedbackList(ActiveVideoInputFeedback);
} protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware) {
{ // if wired to a chassis, skip registration step in base class
} if (hardware.DMInput != null)
{
protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey) this.PreventRegistration = true;
{ }
var joinMap = new DmTxControllerJoinMap(joinStart); AddToFeedbackList(ActiveVideoInputFeedback);
}
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
if (!string.IsNullOrEmpty(joinMapSerialized)) {
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized); }
return joinMap; protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey)
} {
var joinMap = new DmTxControllerJoinMap(joinStart);
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{ var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (tx.Hardware is DmHDBasedTEndPoint)
{ if (!string.IsNullOrEmpty(joinMapSerialized))
Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
return;
} return joinMap;
}
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); {
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]); Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);
bool hdcpTypeSimple; tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
if (tx.Hardware is DmTx4kX02CBase)
hdcpTypeSimple = false; bool hdcpTypeSimple;
else
hdcpTypeSimple = true; if (tx.Hardware is DmTx4kX02CBase)
hdcpTypeSimple = false;
if (tx is ITxRouting) else
{ hdcpTypeSimple = true;
var txR = tx as ITxRouting;
if (tx is ITxRouting)
trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber, {
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)); var txR = tx as ITxRouting;
trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)); trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video));
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]); trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber,
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]); i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio));
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]);
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]);
if (txR.InputPorts[DmPortName.HdmiIn] != null)
{ trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
var inputPort = txR.InputPorts[DmPortName.HdmiIn];
if (txR.InputPorts[DmPortName.HdmiIn] != null)
if (tx.Feedbacks["HdmiInHdcpCapability"] != null) {
{ var inputPort = txR.InputPorts[DmPortName.HdmiIn];
var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null) if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); {
} var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null)
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
{ }
var port = inputPort.Port as EndpointHdmiInput;
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); {
} var port = inputPort.Port as EndpointHdmiInput;
}
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
if (txR.InputPorts[DmPortName.HdmiIn1] != null) }
{ }
var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
if (txR.InputPorts[DmPortName.HdmiIn1] != null)
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null) {
{ var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
if (intFeedback != null) if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); {
} var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
if (intFeedback != null)
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
{ }
var port = inputPort.Port as EndpointHdmiInput;
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); {
} var port = inputPort.Port as EndpointHdmiInput;
}
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
if (txR.InputPorts[DmPortName.HdmiIn2] != null) }
{ }
var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
if (txR.InputPorts[DmPortName.HdmiIn2] != null)
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null) {
{ var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
if (intFeedback != null) if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); {
} var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
if (intFeedback != null)
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
{ }
var port = inputPort.Port as EndpointHdmiInput;
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist); {
} var port = inputPort.Port as EndpointHdmiInput;
}
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist);
} }
}
var txFreeRun = tx as IHasFreeRun;
if (txFreeRun != null) }
{
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]); var txFreeRun = tx as IHasFreeRun;
trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled); if (txFreeRun != null)
} {
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]);
var txVga = tx as IVgaBrightnessContrastControls; trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled);
{ }
if (txVga == null) return;
var txVga = tx as IVgaBrightnessContrastControls;
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]); {
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]); if (txVga == null) return;
trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness); txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]);
trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast); txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]);
}
} trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness);
trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast);
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) }
{ }
if (hdcpTypeSimple)
{ private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
trilist.SetUShortSigAction(join, {
s => if (hdcpTypeSimple)
{ {
if (s == 0) trilist.SetUShortSigAction(join,
{ s =>
port.HdcpSupportOff(); {
} if (s == 0)
else if (s > 0) {
{ port.HdcpSupportOff();
port.HdcpSupportOn(); }
} else if (s > 0)
}); {
} port.HdcpSupportOn();
else }
{ });
trilist.SetUShortSigAction(join, }
s => else
{ {
port.HdcpCapability = (eHdcpCapabilityType)s; trilist.SetUShortSigAction(join,
}); s =>
} {
} port.HdcpCapability = (eHdcpCapabilityType)s;
} });
}
public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase> }
{ }
public DmTxControllerFactory()
{ public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase>
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", {
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" }; public DmTxControllerFactory()
} {
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
public override EssentialsDevice BuildDevice(DeviceConfig dc) "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
{ }
var type = dc.Type.ToLower();
public override EssentialsDevice BuildDevice(DeviceConfig dc)
Debug.Console(1, "Factory Attempting to create new DM-TX Device"); {
var type = dc.Type.ToLower();
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString()); Debug.Console(1, "Factory Attempting to create new DM-TX Device");
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
} var props = JsonConvert.DeserializeObject
} <PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
} }
}
}