From 8ccbed6d812c55da7d4182794368624bfb6a87fe Mon Sep 17 00:00:00 2001 From: Maxim Batourine Date: Sat, 16 Jan 2021 22:57:45 -0500 Subject: [PATCH 1/2] Add hdbasettx device --- .../Endpoints/Transmitters/DmTxHelpers.cs | 10 +- .../Transmitters/HDBaseTTxController.cs | 113 ++++++++++++++++++ 2 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index fd80ac1f..4d8e41f6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -122,7 +122,9 @@ namespace PepperDash.Essentials.DM return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx401")) return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num])); - } + if (typeName.StartsWith("hdbasettx")) + return new HDBaseTTxController(key, name, new HDTx3CB(chassis.Inputs[num])); + } else { if (typeName.StartsWith("dmtx200")) @@ -145,7 +147,9 @@ namespace PepperDash.Essentials.DM return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx401")) return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num])); - } + if (typeName.StartsWith("hdbasettx")) + return new HDBaseTTxController(key, name, new HDTx3CB(ipid, chassis.Inputs[num])); + } } catch (Exception e) { @@ -355,7 +359,7 @@ namespace PepperDash.Essentials.DM public DmTxControllerFactory() { TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", - "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" }; + "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g", "hdbasettx" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs new file mode 100644 index 00000000..800da2a9 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs @@ -0,0 +1,113 @@ +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.DM.Endpoints.Transmitters; +using Newtonsoft.Json; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.DM +{ + /// + /// Controller class for suitable for HDBaseT transmitters + /// + [Description("Wrapper Class for HDBaseT devices based on HDTx3CB class")] + public class HDBaseTTxController: BasicDmTxControllerBase, IRoutingInputsOutputs, IComPorts + { + public RoutingInputPort HdmiIn { get; private set; } + public RoutingOutputPort DmOut { get; private set; } + + public HDBaseTTxController(string key, string name, HDTx3CB tx) + : base(key, name, tx) + { + HdmiIn = new RoutingInputPort(DmPortName.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this) { Port = tx }; + + DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); + + InputPorts = new RoutingPortCollection { HdmiIn }; + OutputPorts = new RoutingPortCollection { DmOut }; + } + + #region IRoutingInputs Members + + public RoutingPortCollection InputPorts { get; private set; } + + #endregion + + #region IRoutingOutputs Members + + public RoutingPortCollection OutputPorts { get; private set; } + + #endregion + + #region IComPorts Members + + public CrestronCollection ComPorts { get { return (Hardware as HDTx3CB).ComPorts; } } + public int NumberOfComPorts { get { return (Hardware as HDTx3CB).NumberOfComPorts; } } + + #endregion + + #region CrestronBridgeableBaseDevice abstract overrides + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new HDBaseTTxControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + this.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + + } + + #endregion + } + + public class HDBaseTTxControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete( + new JoinData + { + JoinNumber = 1, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "HDBaseT device online feedback", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + /// + /// Plugin device BridgeJoinMap constructor + /// + /// This will be the join it starts on the EISC bridge + public HDBaseTTxControllerJoinMap(uint joinStart) + : base(joinStart, typeof(HDBaseTTxControllerJoinMap)) + { + } + } +} \ No newline at end of file From 6d66c5adee5208fc410af8b81870f6dc18a1a9ae Mon Sep 17 00:00:00 2001 From: Maxim Batourine Date: Mon, 18 Jan 2021 13:16:19 -0500 Subject: [PATCH 2/2] add HDBaseTTxController to project file --- .../Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index b1ea1b42..63b20c98 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -108,6 +108,7 @@ +