Removes redundant check for DMPS-4K type. Property exists elsewhere

This commit is contained in:
Alex Johnson
2022-06-14 10:23:51 -04:00
parent 60b6cea697
commit b26e1b97aa
2 changed files with 19 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ namespace PepperDash.Essentials.Core
public static class DeviceManager public static class DeviceManager
{ {
public static event EventHandler<EventArgs> AllDevicesActivated; public static event EventHandler<EventArgs> AllDevicesActivated;
public static event EventHandler<EventArgs> AllDevicesRegistered;
private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection(); private static readonly CCriticalSection DeviceCriticalSection = new CCriticalSection();
private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true); private static readonly CEvent AllowAddDevicesCEvent = new CEvent(false, true);
@@ -57,6 +58,8 @@ namespace PepperDash.Essentials.Core
{ {
try try
{ {
OnAllDevicesRegistered();
DeviceCriticalSection.Enter(); DeviceCriticalSection.Enter();
AddDeviceEnabled = false; AddDeviceEnabled = false;
// PreActivate all devices // PreActivate all devices
@@ -129,6 +132,15 @@ namespace PepperDash.Essentials.Core
} }
} }
private static void OnAllDevicesRegistered()
{
var handler = AllDevicesRegistered;
if (handler != null)
{
handler(null, new EventArgs());
}
}
/// <summary> /// <summary>
/// Calls activate on all Device class items /// Calls activate on all Device class items
/// </summary> /// </summary>

View File

@@ -27,9 +27,6 @@ namespace PepperDash.Essentials.DM
public ISystemControl SystemControl { get; private set; } public ISystemControl SystemControl { get; private set; }
public bool? EnableRouting { get; private set; } public bool? EnableRouting { get; private set; }
//Check if DMPS is a DMPS3-4K type for endpoint creation
public bool Dmps4kType { get; private set; }
//IroutingNumericEvent //IroutingNumericEvent
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange; public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
@@ -130,7 +127,6 @@ namespace PepperDash.Essentials.DM
{ {
case eSystemControlType.Dmps34K150CSystemControl: case eSystemControlType.Dmps34K150CSystemControl:
SystemControl = systemControl as Dmps34K150CSystemControl; SystemControl = systemControl as Dmps34K150CSystemControl;
Dmps4kType = true;
SystemPowerOnFeedback = new BoolFeedback(() => { return true; }); SystemPowerOnFeedback = new BoolFeedback(() => { return true; });
SystemPowerOffFeedback = new BoolFeedback(() => { return false; }); SystemPowerOffFeedback = new BoolFeedback(() => { return false; });
break; break;
@@ -139,13 +135,11 @@ namespace PepperDash.Essentials.DM
case eSystemControlType.Dmps34K300CSystemControl: case eSystemControlType.Dmps34K300CSystemControl:
case eSystemControlType.Dmps34K350CSystemControl: case eSystemControlType.Dmps34K350CSystemControl:
SystemControl = systemControl as Dmps34K300CSystemControl; SystemControl = systemControl as Dmps34K300CSystemControl;
Dmps4kType = true;
SystemPowerOnFeedback = new BoolFeedback(() => { return true; }); SystemPowerOnFeedback = new BoolFeedback(() => { return true; });
SystemPowerOffFeedback = new BoolFeedback(() => { return false; }); SystemPowerOffFeedback = new BoolFeedback(() => { return false; });
break; break;
default: default:
SystemControl = systemControl as Dmps3SystemControl; SystemControl = systemControl as Dmps3SystemControl;
Dmps4kType = false;
SystemPowerOnFeedback = new BoolFeedback(() => SystemPowerOnFeedback = new BoolFeedback(() =>
{ {
return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue; return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue;
@@ -156,7 +150,7 @@ namespace PepperDash.Essentials.DM
}); });
break; break;
} }
Debug.Console(1, this, "DMPS Type = {0}, 4K Type = {1}", systemControl.SystemControlType, Dmps4kType); Debug.Console(1, this, "DMPS Type = {0}, 4K Type = {1}", systemControl.SystemControlType, Global.ControlSystemIsDmps4kType);
InputPorts = new RoutingPortCollection<RoutingInputPort>(); InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>(); OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
@@ -406,7 +400,7 @@ namespace PepperDash.Essentials.DM
private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap)
{ {
if (Dmps4kType) if (Global.ControlSystemIsDmps4kType)
{ {
//DMPS-4K audio inputs 1-5 are aux inputs //DMPS-4K audio inputs 1-5 are aux inputs
for (uint i = 1; i <= 5; i++) for (uint i = 1; i <= 5; i++)
@@ -427,12 +421,12 @@ namespace PepperDash.Essentials.DM
trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
} }
if (InputNameFeedbacks.ContainsKey(ioSlot) && InputNameFeedbacks[ioSlot] != null) if (InputNameFeedbacks.ContainsKey(ioSlot) && InputNameFeedbacks[ioSlot] != null)
{ {
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputVideoNames.JoinNumber + ioSlotJoin]); InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputVideoNames.JoinNumber + ioSlotJoin]);
if (Dmps4kType) if (Global.ControlSystemIsDmps4kType)
{ {
//DMPS-4K Audio Inputs are offset by 5 //DMPS-4K Audio Inputs are offset by 5
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + ioSlotJoin + 5]); InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + ioSlotJoin + 5]);