Additional progress after initial testing. Having issues iterating CrestronControlSystem.SwitcherInputs/Outputs collections.

This commit is contained in:
Neil Dorin
2019-07-24 22:44:39 -06:00
parent dc8d0e25d5
commit a3887510df
3 changed files with 60 additions and 16 deletions

View File

@@ -356,8 +356,22 @@ namespace PepperDash.Essentials
public void LoadDevices()
{
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
// Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
@@ -373,7 +387,7 @@ namespace PepperDash.Essentials
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
continue;
}

View File

@@ -49,14 +49,12 @@ namespace PepperDash.Essentials.DM
Dictionary<PortNumberType, CTimer> RouteOffTimers = new Dictionary<PortNumberType, CTimer>();
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
string type, DmpsRoutingPropertiesConfig properties)
DmpsRoutingPropertiesConfig properties)
{
try
{
ISystemControl systemControl = null;
type = type.ToLower();
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
if (systemControl == null)
@@ -90,8 +88,8 @@ namespace PepperDash.Essentials.DM
: base(key, name)
{
Dmps = Global.ControlSystem;
SystemControl = systemControl;
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
VolumeControls = new Dictionary<uint, DmCardAudioOutputController>();
@@ -112,13 +110,27 @@ namespace PepperDash.Essentials.DM
Dmps.DMOutputChange +=new DMOutputEventHandler(Dmps_DMOutputChange);
// Default to EnableAudioBreakaway
SystemControl.EnableAudioBreakaway.BoolValue = true;
//SystemControl.EnableAudioBreakaway. = true;
for (uint x = 1; x <= Dmps.NumberOfSwitcherOutputs; x++)
Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.NumberOfSwitcherInputs);
Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.NumberOfSwitcherOutputs);
uint tempX = 1;
foreach (var card in Dmps.SwitcherOutputs)
{
var tempX = x;
Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType);
Card.Dmps3OutputBase outputCard = Dmps.SwitcherOutputs[tempX] as Card.Dmps3OutputBase;
var outputCard = card as Card.Dmps3OutputBase;
//}
//for (uint x = 1; x <= Dmps.NumberOfSwitcherOutputs; x++)
//{
//var tempX = x;
//Card.Dmps3OutputBase outputCard = Dmps.SwitcherOutputs[tempX] as Card.Dmps3OutputBase;
if (outputCard != null)
{
@@ -170,15 +182,25 @@ namespace PepperDash.Essentials.DM
OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return outputCard.EndpointOnlineFeedback; });
AddOutputCard(tempX, outputCard);
AddOutputCard(tempX, outputCard);
tempX++;
}
}
for (uint x = 1; x <= Dmps.NumberOfSwitcherInputs; x++)
{
var tempX = x;
tempX = 1;
DMInput inputCard = Dmps.SwitcherInputs[tempX] as DMInput;
foreach (var card in Dmps.SwitcherInputs)
{
var inputCard = card as DMInput;
Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType);
//for (uint x = 1; x <= Dmps.NumberOfSwitcherInputs; x++)
//{
// var tempX = x;
// DMInput inputCard = Dmps.SwitcherInputs[tempX] as DMInput;
if (inputCard != null)
{
@@ -200,6 +222,8 @@ namespace PepperDash.Essentials.DM
}
});
}
AddInputCard(tempX, inputCard);
}
}
@@ -388,7 +412,7 @@ namespace PepperDash.Essentials.DM
{
case (DMInputEventIds.OnlineFeedbackEventId):
{
Debug.Console(2, this, "DMINput OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
}

View File

@@ -19,6 +19,12 @@ namespace PepperDash.Essentials.DM.Config
[JsonProperty("outputNames")]
public Dictionary<uint, string> OutputNames { get; set; }
public DmpsRoutingPropertiesConfig()
{
InputNames = new Dictionary<uint, string>();
OutputNames = new Dictionary<uint, string>();
}
}