Compare commits

...

3 Commits

Author SHA1 Message Date
Andrew Welker
00f4635cec chore: Mark non-bridgeable class obsolete
Also add a debug message to give the new type to use.
2021-07-30 10:44:26 -06:00
Andrew Welker
d61401c9a9 fix: Remove reference to DMOutput name sig
the HD-MD series of switchers appears to not populate the Name sig of the DMOutput, leading to a NullSig exception when attempting to set output names. This is probably because those names can't be set on the device itself, but some experimentation with hardware may be required to determine that completely.
2021-07-30 10:30:32 -06:00
Jason DeVito
7af8f0d087 Updates to HdMdNxM4kEController.cs to implement regex pattern in place of substring on input definitions. Updated HdMdNxM4kEBridgeableController.cs to handle exception when constructing the device. 2021-07-29 17:19:54 -05:00
2 changed files with 450 additions and 420 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json; using Newtonsoft.Json;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
@@ -46,10 +47,30 @@ namespace PepperDash.Essentials.DM.Chassis
: base(key, name, chassis) : base(key, name, chassis)
{ {
_Chassis = chassis; _Chassis = chassis;
var _props = props;
if (props == null)
{
Debug.Console(1, this, "HdMdNx4keBridgeableController properties are null, failed to build the device");
return;
}
if (props.Inputs != null)
{
foreach (var kvp in props.Inputs)
{
Debug.Console(0, this, "props.Inputs: {0}-{1}", kvp.Key, kvp.Value);
}
InputNames = props.Inputs; InputNames = props.Inputs;
}
if (props.Outputs != null)
{
foreach (var kvp in props.Outputs)
{
Debug.Console(0, this, "props.Outputs: {0}-{1}", kvp.Key, kvp.Value);
}
OutputNames = props.Outputs; OutputNames = props.Outputs;
}
VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>(); VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>();
VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>(); VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>();
@@ -63,12 +84,13 @@ namespace PepperDash.Essentials.DM.Chassis
InputPorts = new RoutingPortCollection<RoutingInputPort>(); InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>(); OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
DeviceNameFeedback.Add(new StringFeedback(this.Name, () => this.Name)); var deviceName = string.IsNullOrEmpty(this.Name) ? name : this.Name;
DeviceNameFeedback.Add(new StringFeedback(deviceName, () => deviceName));
if (_Chassis.NumberOfInputs == 1) if (_Chassis.NumberOfInputs == 1)
{ {
_Chassis4x1 = _Chassis as HdMd4x14kE; _Chassis4x1 = _Chassis as HdMd4x14kE;
AutoRouteFeedback.Add(new BoolFeedback(this.Name + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue)); AutoRouteFeedback.Add(new BoolFeedback(deviceName + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue));
} }
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
@@ -91,7 +113,7 @@ namespace PepperDash.Essentials.DM.Chassis
{ {
var index = i; var index = i;
var outputName = OutputNames[index]; var outputName = OutputNames[index];
_Chassis.Outputs[i].Name.StringValue = outputName; //_Chassis.Outputs[i].Name.StringValue = outputName;
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo, OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, index, this) eRoutingPortConnectionType.Hdmi, index, this)
@@ -99,12 +121,12 @@ namespace PepperDash.Essentials.DM.Chassis
FeedbackMatchObject = _Chassis.HdmiOutputs[index] FeedbackMatchObject = _Chassis.HdmiOutputs[index]
}); });
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number)); VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].Name.StringValue)); OutputNameFeedbacks.Add(new StringFeedback(outputName, () => OutputNames[index]));
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue)); OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
} }
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); _Chassis.DMInputChange += Chassis_DMInputChange;
_Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); _Chassis.DMOutputChange += Chassis_DMOutputChange;
AddPostActivationAction(AddFeedbackCollections); AddPostActivationAction(AddFeedbackCollections);
} }
@@ -328,9 +350,9 @@ namespace PepperDash.Essentials.DM.Chassis
OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]); OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]);
} }
_Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange); _Chassis.OnlineStatusChange += Chassis_OnlineStatusChange;
trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => trilist.OnlineStatusChange += (d, args) =>
{ {
if (args.DeviceOnLine) if (args.DeviceOnLine)
{ {
@@ -339,7 +361,7 @@ namespace PepperDash.Essentials.DM.Chassis
feedback.FireUpdate(); feedback.FireUpdate();
} }
} }
}); };
} }

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -13,6 +14,7 @@ using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM.Chassis namespace PepperDash.Essentials.DM.Chassis
{ {
[Obsolete("Please use HdMdNxM4kEBridgeable Controller")]
public class HdMdNxM4kEController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting public class HdMdNxM4kEController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting
{ {
public HdMdNxM Chassis { get; private set; } public HdMdNxM Chassis { get; private set; }
@@ -31,6 +33,7 @@ namespace PepperDash.Essentials.DM.Chassis
HdMdNxM4kEPropertiesConfig props) HdMdNxM4kEPropertiesConfig props)
: base(key, name, chassis) : base(key, name, chassis)
{ {
Debug.Console(0, this, "Type hdmd4x14ke is obsolete. Please use hdmd4x14ke-bridgeable");
Chassis = chassis; Chassis = chassis;
// logical ports // logical ports
@@ -47,10 +50,15 @@ namespace PepperDash.Essentials.DM.Chassis
// physical settings // physical settings
if (props != null && props.Inputs != null) if (props != null && props.Inputs != null)
{ {
var inputRegex = new Regex(@"(?<InputNum>\d)", RegexOptions.IgnoreCase);
foreach (var kvp in props.Inputs) foreach (var kvp in props.Inputs)
{ {
// strip "hdmiIn" // get numnbers from key and convert to int
var inputNum = Convert.ToUInt32(kvp.Key.Substring(6)); //var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
var inputMatch = inputRegex.Match(kvp.Key);
if (inputMatch == null) continue;
var inputNum = Convert.ToUInt32(inputMatch.Groups["InputNum"].Value);
var port = chassis.HdmiInputs[inputNum].HdmiInputPort; var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
// set hdcp disables // set hdcp disables