feature(wip): adds inputPriorities configuration property

This commit is contained in:
Jason DeVito
2023-09-12 17:10:25 -05:00
parent 58e019992a
commit 189c470603
2 changed files with 22 additions and 12 deletions

View File

@@ -10,7 +10,6 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_Core.Bridges;
using PepperDash_Essentials_DM;
using PepperDash_Essentials_DM.Config;
namespace PepperDash_Essentials_DM.Chassis
@@ -19,6 +18,7 @@ namespace PepperDash_Essentials_DM.Chassis
public class HdPsXxxController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback
{
private readonly HdPsXxx _chassis;
private byte[] _inputPriorityParams;
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
@@ -76,6 +76,12 @@ namespace PepperDash_Essentials_DM.Chassis
if (_chassis.NumberOfOutputs == 1)
AutoRouteFeedback = new BoolFeedback(() => _chassis.PriorityRouteOnFeedback.BoolValue);
if (props.InputPriorities != null)
{
_inputPriorityParams = new byte[_chassis.NumberOfInputs];
_inputPriorityParams = GetInputPriorities(props);
}
InputNames = props.Inputs;
SetupInputs(InputNames);
@@ -83,6 +89,12 @@ namespace PepperDash_Essentials_DM.Chassis
SetupOutputs(OutputNames);
}
// get input priorities
private byte[] GetInputPriorities(HdPsXxxPropertiesConfig props)
{
throw new NotImplementedException();
}
// input setup
private void SetupInputs(Dictionary<uint, string> dict)
{
@@ -175,13 +187,13 @@ namespace PepperDash_Essentials_DM.Chassis
OutputRouteNameFeedback.Add(new StringFeedback(name, () => output.VideoOutFeedback.NameFeedback.StringValue));
VideoOutputRouteFeedbacks.Add(new IntFeedback(name,
() => output.VideoOutFeedback == null ? 0 : (int) output.VideoOutFeedback.Number));
() => output.VideoOutFeedback == null ? 0 : (int)output.VideoOutFeedback.Number));
// TODO [ ] Investigate setting input priorities per output
// {{in1-priority-level}, {in2-priority-level}, .... {in6-priority-level}}
// default priority level input 1-4 ascending
//var priorities = new byte[] {1,2,3,4};
//output.OutputPort.InputPriorities(priorities);
// default priority level input 1-4 ascending
if (_inputPriorityParams != null && _inputPriorityParams.Count() > 0)
output.OutputPort.InputPriorities(_inputPriorityParams);
if (port.Port == null) continue;

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash_Essentials_DM.Config
{
@@ -11,18 +10,17 @@ namespace PepperDash_Essentials_DM.Config
public ControlPropertiesConfig Control { get; set; }
[JsonProperty("inputs")]
//public Dictionary<uint, InputPropertiesConfig> Inputs { get; set; }
public Dictionary<uint, string> Inputs { get; set; }
[JsonProperty("outputs")]
//public Dictionary<uint, InputPropertiesConfig> Outputs { get; set; }
public Dictionary<uint, string> Outputs { get; set; }
// "inputPriorities": "1,4,3,2"
[JsonProperty("inputPriorities")]
public string InputPriorities { get; set; }
public HdPsXxxPropertiesConfig()
{
//Inputs = new Dictionary<uint, InputPropertiesConfig>();
//Outputs = new Dictionary<uint, InputPropertiesConfig>();
Inputs = new Dictionary<uint, string>();
Outputs = new Dictionary<uint, string>();
}