Compare commits

...

1 Commits

2 changed files with 452 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,34 @@ 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;
}
//else
//{
// OutputNames.Add(1, "Output");
//}
VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>(); VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>();
VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>(); VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>();
@@ -63,12 +88,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++)

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;
@@ -47,10 +48,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