mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Waits to return InitializeSystem until devices are registered. Adds DMPS system power on/off to device bridge.
This commit is contained in:
@@ -46,6 +46,13 @@ namespace PepperDash.Essentials
|
|||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
_startTimer = new CTimer(StartSystem,StartupTime);
|
_startTimer = new CTimer(StartSystem,StartupTime);
|
||||||
|
ushort count = 0;
|
||||||
|
while (!DeviceManager.AllDevicesActivatedFb && count < 60)
|
||||||
|
{
|
||||||
|
//Wait for devices to register before returning, as required by DMPS. Max wait is 60 seconds.
|
||||||
|
CrestronEnvironment.Sleep(1000);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartSystem(object obj)
|
private void StartSystem(object obj)
|
||||||
@@ -361,10 +368,7 @@ namespace PepperDash.Essentials
|
|||||||
if(propertiesConfig == null)
|
if(propertiesConfig == null)
|
||||||
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
|
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
|
||||||
|
|
||||||
bool dmps4kType = this.ControllerPrompt.IndexOf("4k", StringComparison.OrdinalIgnoreCase) > -1;
|
DeviceManager.AddDevice(DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig));
|
||||||
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig, dmps4kType);
|
|
||||||
|
|
||||||
DeviceManager.AddDevice(dmpsRoutingController);
|
|
||||||
}
|
}
|
||||||
else if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1)
|
else if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
|
[JoinName("SystemPowerOn")]
|
||||||
|
public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("SystemPowerOff")]
|
||||||
|
public JoinDataComplete SystemPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "DMPS System Power Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
[JoinName("VideoSyncStatus")]
|
[JoinName("VideoSyncStatus")]
|
||||||
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
|
||||||
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
@@ -61,5 +69,5 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,9 +28,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(Devices.Values); } }
|
public static List<IKeyed> AllDevices { get { return new List<IKeyed>(Devices.Values); } }
|
||||||
|
|
||||||
public static bool AddDeviceEnabled;
|
public static bool AddDeviceEnabled;
|
||||||
|
public static bool AllDevicesActivatedFb;
|
||||||
|
|
||||||
public static void Initialize(CrestronControlSystem cs)
|
public static void Initialize(CrestronControlSystem cs)
|
||||||
{
|
{
|
||||||
|
AllDevicesActivatedFb = false;
|
||||||
AddDeviceEnabled = true;
|
AddDeviceEnabled = true;
|
||||||
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
@@ -122,6 +124,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
private static void OnAllDevicesActivated()
|
private static void OnAllDevicesActivated()
|
||||||
{
|
{
|
||||||
|
AllDevicesActivatedFb = true;
|
||||||
var handler = AllDevicesActivated;
|
var handler = AllDevicesActivated;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
//IroutingNumericEvent
|
//IroutingNumericEvent
|
||||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||||
|
|
||||||
|
//Feedback for DMPS System Power
|
||||||
|
public BoolFeedback SystemPowerOnFeedback { get; private set; }
|
||||||
|
public BoolFeedback SystemPowerOffFeedback { get; private set; }
|
||||||
|
|
||||||
// Feedbacks for EssentialDM
|
// Feedbacks for EssentialDM
|
||||||
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||||
@@ -76,7 +80,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
|
|
||||||
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
|
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
|
||||||
DmpsRoutingPropertiesConfig properties, bool dmps4kType)
|
DmpsRoutingPropertiesConfig properties)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -87,7 +91,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = new DmpsRoutingController(key, name, systemControl, dmps4kType)
|
var controller = new DmpsRoutingController(key, name, systemControl)
|
||||||
{
|
{
|
||||||
InputNames = properties.InputNames,
|
InputNames = properties.InputNames,
|
||||||
OutputNames = properties.OutputNames
|
OutputNames = properties.OutputNames
|
||||||
@@ -113,13 +117,31 @@ namespace PepperDash.Essentials.DM
|
|||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="chassis"></param>
|
/// <param name="chassis"></param>
|
||||||
public DmpsRoutingController(string key, string name, ISystemControl systemControl, bool dmps4kType)
|
public DmpsRoutingController(string key, string name, ISystemControl systemControl)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
|
|
||||||
Dmps = Global.ControlSystem;
|
Dmps = Global.ControlSystem;
|
||||||
SystemControl = systemControl;
|
|
||||||
Dmps4kType = dmps4kType;
|
switch (name.Replace("-", "").Replace("c", "").Replace("C", ""))
|
||||||
|
{
|
||||||
|
case "dmps34k50":
|
||||||
|
case "dmps34k100":
|
||||||
|
case "dmps34k150":
|
||||||
|
SystemControl = systemControl as Dmps34K150CSystemControl;
|
||||||
|
Dmps4kType = true;
|
||||||
|
break;
|
||||||
|
case "dmps34k200":
|
||||||
|
case "dmps34k250":
|
||||||
|
case "dmps34k300":
|
||||||
|
case "dmps34k350":
|
||||||
|
SystemControl = systemControl as Dmps34K300CSystemControl;
|
||||||
|
Dmps4kType = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SystemControl = systemControl as Dmps3SystemControl;
|
||||||
|
Dmps4kType = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||||
@@ -127,6 +149,29 @@ namespace PepperDash.Essentials.DM
|
|||||||
TxDictionary = new Dictionary<uint, string>();
|
TxDictionary = new Dictionary<uint, string>();
|
||||||
RxDictionary = new Dictionary<uint, string>();
|
RxDictionary = new Dictionary<uint, string>();
|
||||||
|
|
||||||
|
SystemPowerOnFeedback = new BoolFeedback(() =>
|
||||||
|
{
|
||||||
|
if (SystemControl is Dmps3SystemControl)
|
||||||
|
{
|
||||||
|
return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
SystemPowerOffFeedback = new BoolFeedback(() =>
|
||||||
|
{
|
||||||
|
if (SystemControl is Dmps3SystemControl)
|
||||||
|
{
|
||||||
|
return ((Dmps3SystemControl)SystemControl).SystemPowerOffFeedBack.BoolValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||||
AudioOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
AudioOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||||
VideoInputSyncFeedbacks = new Dictionary<uint, BoolFeedback>();
|
VideoInputSyncFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||||
@@ -158,6 +203,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
// Subscribe to events
|
// Subscribe to events
|
||||||
Dmps.DMInputChange += Dmps_DMInputChange;
|
Dmps.DMInputChange += Dmps_DMInputChange;
|
||||||
Dmps.DMOutputChange += Dmps_DMOutputChange;
|
Dmps.DMOutputChange += Dmps_DMOutputChange;
|
||||||
|
Dmps.DMSystemChange += Dmps_DMSystemChange;
|
||||||
|
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
@@ -195,6 +241,22 @@ namespace PepperDash.Essentials.DM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetPowerOn(bool a)
|
||||||
|
{
|
||||||
|
if (SystemControl is Dmps3SystemControl)
|
||||||
|
{
|
||||||
|
((Dmps3SystemControl)SystemControl).SystemPowerOn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPowerOff(bool a)
|
||||||
|
{
|
||||||
|
if (SystemControl is Dmps3SystemControl)
|
||||||
|
{
|
||||||
|
((Dmps3SystemControl)SystemControl).SystemPowerOff();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
{
|
{
|
||||||
var joinMap = new DmpsRoutingControllerJoinMap(joinStart);
|
var joinMap = new DmpsRoutingControllerJoinMap(joinStart);
|
||||||
@@ -215,9 +277,22 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
//Link up system
|
||||||
|
trilist.SetBoolSigAction(joinMap.SystemPowerOn.JoinNumber, SetPowerOn);
|
||||||
|
trilist.SetBoolSigAction(joinMap.SystemPowerOff.JoinNumber, SetPowerOff);
|
||||||
|
if (SystemPowerOnFeedback != null)
|
||||||
|
{
|
||||||
|
SystemPowerOnFeedback.LinkInputSig(
|
||||||
|
trilist.BooleanInput[joinMap.SystemPowerOn.JoinNumber]);
|
||||||
|
}
|
||||||
|
if (SystemPowerOffFeedback != null)
|
||||||
|
{
|
||||||
|
SystemPowerOffFeedback.LinkInputSig(
|
||||||
|
trilist.BooleanInput[joinMap.SystemPowerOff.JoinNumber]);
|
||||||
|
}
|
||||||
|
|
||||||
// Link up outputs
|
// Link up outputs
|
||||||
LinkInputsToApi(trilist, joinMap);
|
LinkInputsToApi(trilist, joinMap);
|
||||||
|
|
||||||
LinkOutputsToApi(trilist, joinMap);
|
LinkOutputsToApi(trilist, joinMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,6 +899,23 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dmps_DMSystemChange(Switch device, DMSystemEventArgs args)
|
||||||
|
{
|
||||||
|
switch (args.EventId)
|
||||||
|
{
|
||||||
|
case DMSystemEventIds.SystemPowerOnEventId:
|
||||||
|
{
|
||||||
|
SystemPowerOnFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DMSystemEventIds.SystemPowerOffEventId:
|
||||||
|
{
|
||||||
|
SystemPowerOffFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -891,7 +983,6 @@ namespace PepperDash.Essentials.DM
|
|||||||
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
|
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
|
||||||
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
|
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
|
||||||
{
|
{
|
||||||
|
|
||||||
output.VideoOut = input;
|
output.VideoOut = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,7 +1006,6 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
|
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
|
||||||
{
|
{
|
||||||
|
|
||||||
output.USBRoutedTo = input;
|
output.USBRoutedTo = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user