Fixes for offline feedback for DM endpoints that don't provide offline feedback in the hardware definition. Adds offline and name feedback to joinMap for these devices.

This commit is contained in:
Alex Johnson
2022-08-12 09:26:09 -04:00
parent 5d51570018
commit ed335cc9ae
7 changed files with 149 additions and 59 deletions

View File

@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
public FeedbackCollection<Feedback> Feedbacks { get; private set; }
public BoolFeedback IsOnline { get; set; }
public BoolFeedback IsOnline { get; private set; }
public BoolFeedback IsRegistered { get; private set; }
public StringFeedback IpConnectionsText { get; private set; }

View File

@@ -1,8 +1,10 @@
using Crestron.SimplSharp.Ssh;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.DM
{
@@ -28,6 +30,30 @@ namespace PepperDash.Essentials.DM
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HDBaseTSink};
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new DmRmcControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmRmcControllerJoinMap>(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"));
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
}
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Rmc.ComPorts; } }
public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } }

View File

@@ -1,9 +1,11 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using Newtonsoft.Json;
namespace PepperDash.Essentials.DM
{
@@ -31,6 +33,30 @@ namespace PepperDash.Essentials.DM
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut};
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new DmRmcControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmRmcControllerJoinMap>(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"));
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
}
#region IIROutputPorts Members

View File

@@ -188,7 +188,7 @@ namespace PepperDash.Essentials.DM
#endregion
}
public abstract class DmHdBaseTControllerBase : CrestronGenericBaseDevice
public abstract class DmHdBaseTControllerBase : CrestronGenericBridgeableBaseDevice
{
protected HDBaseTBase Rmc;
@@ -342,12 +342,12 @@ namespace PepperDash.Essentials.DM
return null;
}
// Must use different constructor for DMPS4K types. No IPID
if (Global.ControlSystemIsDmps4kType)
if (Global.ControlSystemIsDmps4kType || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
{
var rmc = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
Debug.Console(0, "DM endpoint output {0} is for Dmps4k, changing online feedback to chassis", num);
rmc.IsOnline = dmps.OutputEndpointOnlineFeedbacks[num];
rmc.IsOnline.OutputChange += (currentDevice, args) =>
rmc.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue);
dmps.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{
foreach (var feedback in rmc.Feedbacks)
{
@@ -380,19 +380,20 @@ namespace PepperDash.Essentials.DM
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
chassis is DmMd128x128 || chassis is DmMd64x64
|| typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
{
var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
rmc.IsOnline = controller.OutputEndpointOnlineFeedbacks[num];
rmc.IsOnline.OutputChange += (currentDevice, args) =>
{
foreach (var feedback in rmc.Feedbacks)
rmc.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue);
controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{
if (feedback != null)
feedback.FireUpdate();
}
};
foreach (var feedback in rmc.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
return rmc;
}
return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
@@ -521,8 +522,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

@@ -6,6 +6,7 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using Newtonsoft.Json;
namespace PepperDash.Essentials.DM
{
@@ -20,14 +21,6 @@ namespace PepperDash.Essentials.DM
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort DmOut { get; private 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 override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
@@ -70,11 +63,34 @@ namespace PepperDash.Essentials.DM
HdmiIn.Port = Tx;
PreventRegistration = true;
var parentDev = DeviceManager.GetDeviceForKey(key);
var num = tx.DMInputOutput.Number;
if (parentDev is DmpsRoutingController)
{
var dmps = parentDev as DmpsRoutingController;
IsOnline.SetValueFunc(() => dmps.InputEndpointOnlineFeedbacks[num].BoolValue);
dmps.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
var joinMap = new HDBaseTTxControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HDBaseTTxControllerJoinMap>(joinMapSerialized);
this.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
}
#region IIROutputPorts Members

View File

@@ -221,37 +221,39 @@ namespace PepperDash.Essentials.DM
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis or DMPS, skip registration step in base class
if (hardware.DMInput != null || (Global.ControlSystemIsDmpsType && hardware.DMInput != null))
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
var parentDev = DeviceManager.GetDeviceForKey(key);
var num = hardware.DMInput.Number;
//If Dmps4K, change online feedback to chassis, tx feedback does not work
if (parentDev is DmpsRoutingController && Global.ControlSystemIsDmps4kType)
// if wired to a chassis or DMPS, skip registration step in base class
if (hardware.DMInput != null)
{
var dmps = parentDev as DmpsRoutingController;
Debug.Console(0, "DM endpoint input {0} is for Dmps4k, changing online feedback to chassis", num);
IsOnline = dmps.InputEndpointOnlineFeedbacks[num];
}
//If Cpu3 Chassis, change online feedback to chassis, tx feedback does not work
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
var chassis = controller.Chassis;
this.PreventRegistration = true;
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
var parentDev = DeviceManager.GetDeviceForKey(key);
var num = hardware.DMInput.Number;
//If Dmps4K, change online feedback to chassis, tx feedback does not work
if (parentDev is DmpsRoutingController && Global.ControlSystemIsDmps4kType)
{
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
IsOnline = controller.InputEndpointOnlineFeedbacks[num];
var dmps = parentDev as DmpsRoutingController;
Debug.Console(0, "DM endpoint input {0} is for Dmps4k, changing online feedback to chassis", num);
IsOnline.SetValueFunc(() => dmps.InputEndpointOnlineFeedbacks[num].BoolValue);
dmps.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
//If Cpu3 Chassis, change online feedback to chassis, tx feedback does not work
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
var chassis = controller.Chassis;
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
}
}

View File

@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json;
using PepperDash.Core;
@@ -18,7 +19,7 @@ namespace PepperDash.Essentials.DM
/// Controller class for suitable for HDBaseT transmitters
/// </summary>
[Description("Wrapper Class for HDBaseT devices based on HDTx3CB class")]
public class HDBaseTTxController: BasicDmTxControllerBase, IRoutingInputsOutputs, IComPorts
public class HDBaseTTxController : BasicDmTxControllerBase, IRoutingInputsOutputs, IComPorts
{
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
@@ -34,6 +35,21 @@ namespace PepperDash.Essentials.DM
InputPorts = new RoutingPortCollection<RoutingInputPort> { HdmiIn };
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { DmOut };
var parentDev = DeviceManager.GetDeviceForKey(key);
var num = tx.DMInputOutput.Number;
if (parentDev is DmpsRoutingController)
{
var dmps = parentDev as DmpsRoutingController;
IsOnline.SetValueFunc(() => dmps.InputEndpointOnlineFeedbacks[num].BoolValue);
dmps.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
}
#region IRoutingInputs Members
@@ -79,7 +95,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
}
#endregion
@@ -100,6 +116,10 @@ namespace PepperDash.Essentials.DM
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 6, JoinSpan = 1 },
new JoinMetadata { Description = "DM Tx Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
/// <summary>
/// Plugin device BridgeJoinMap constructor