Fixes online feedback for DM endpoints that are attached to a 3 series DM chassis or a DMPS-4K unit.

This commit is contained in:
Alex Johnson
2022-06-14 10:43:29 -04:00
parent 50e9a7935f
commit 1a5d4896e1
6 changed files with 155 additions and 63 deletions

View File

@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public FeedbackCollection<Feedback> Feedbacks { get; private set; } public FeedbackCollection<Feedback> Feedbacks { get; private set; }
public BoolFeedback IsOnline { get; private set; } public BoolFeedback IsOnline { get; set; }
public BoolFeedback IsRegistered { get; private set; } public BoolFeedback IsRegistered { get; private set; }
public StringFeedback IpConnectionsText { get; private set; } public StringFeedback IpConnectionsText { get; private set; }
@@ -73,11 +73,14 @@ namespace PepperDash.Essentials.Core
{ {
//Debug.Console(1, this, " Does not require registration. Skipping"); //Debug.Console(1, this, " Does not require registration. Skipping");
var response = Hardware.RegisterWithLogging(Key); if (Hardware.Registerable && !Hardware.Registered)
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{ {
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); var response = Hardware.RegisterWithLogging(Key);
return false; if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
} }
IsRegistered.FireUpdate(); IsRegistered.FireUpdate();
@@ -86,7 +89,10 @@ namespace PepperDash.Essentials.Core
{ {
AddPostActivationAction(() => AddPostActivationAction(() =>
{ {
var response = Hardware.RegisterWithLogging(Key); if (Hardware.Registerable && !Hardware.Registered)
{
var response = Hardware.RegisterWithLogging(Key);
}
IsRegistered.FireUpdate(); IsRegistered.FireUpdate();
}); });

View File

@@ -47,16 +47,23 @@ namespace PepperDash.Essentials.DM
{ {
get get
{ {
if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto) try
return InputCard.VideoSourceFeedback;
else // auto
{ {
if (InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue) if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto)
return eDmps3InputVideoSource.Hdmi; return InputCard.VideoSourceFeedback;
else if (InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue) else // auto
return eDmps3InputVideoSource.Vga; {
else if (InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
return eDmps3InputVideoSource.Bnc; return eDmps3InputVideoSource.Hdmi;
else if (InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue)
return eDmps3InputVideoSource.Vga;
else
return eDmps3InputVideoSource.Bnc;
}
}
catch
{
return eDmps3InputVideoSource.Bnc;
} }
} }
} }

View File

@@ -861,6 +861,7 @@ namespace PepperDash.Essentials.DM
void Dmps_DMInputChange(Switch device, DMInputEventArgs args) void Dmps_DMInputChange(Switch device, DMInputEventArgs args)
{ {
Debug.Console(2, this, "DMInputChange Input: {0} EventId: {1}", args.Number, args.EventId.ToString());
try try
{ {
switch (args.EventId) switch (args.EventId)
@@ -871,6 +872,12 @@ namespace PepperDash.Essentials.DM
InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break; break;
} }
case (DMInputEventIds.EndpointOnlineEventId):
{
Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
}
case (DMInputEventIds.VideoDetectedEventId): case (DMInputEventIds.VideoDetectedEventId):
{ {
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
@@ -916,6 +923,11 @@ namespace PepperDash.Essentials.DM
{ {
OutputEndpointOnlineFeedbacks[output].FireUpdate(); OutputEndpointOnlineFeedbacks[output].FireUpdate();
} }
else if (args.EventId == DMOutputEventIds.EndpointOnlineEventId
&& OutputEndpointOnlineFeedbacks.ContainsKey(output))
{
OutputEndpointOnlineFeedbacks[output].FireUpdate();
}
else if (args.EventId == DMOutputEventIds.VideoOutEventId) else if (args.EventId == DMOutputEventIds.VideoOutEventId)
{ {
if (outputCard != null && outputCard.VideoOutFeedback != null) if (outputCard != null && outputCard.VideoOutFeedback != null)

View File

@@ -323,7 +323,7 @@ namespace PepperDash.Essentials.DM.Chassis
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = "DM Switcher"; trilist.StringInput[joinMap.Name.JoinNumber].StringValue = this.Name;
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{ {

View File

@@ -30,14 +30,15 @@ namespace PepperDash.Essentials.DM
: base(key, name, device) : base(key, name, device)
{ {
_rmc = device; _rmc = device;
// if wired to a chassis, skip registration step in base class // if wired to a chassis, skip registration step in base class
PreventRegistration = _rmc.DMOutput != null; PreventRegistration = _rmc.DMOutput != null;
AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback); AddToFeedbackList(VideoOutputResolutionFeedback, EdidManufacturerFeedback, EdidSerialNumberFeedback, EdidNameFeedback, EdidPreferredTimingFeedback);
DeviceInfo = new DeviceInfo(); DeviceInfo = new DeviceInfo();
_rmc.OnlineStatusChange += (currentDevice, args) => { if (args.DeviceOnLine) UpdateDeviceInfo(); }; IsOnline.OutputChange += (currentDevice, args) => { if (args.BoolValue) UpdateDeviceInfo(); };
} }
protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
@@ -60,7 +61,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = rmc.Name; trilist.StringInput[joinMap.Name.JoinNumber].StringValue = rmc.Name;
if (rmc.VideoOutputResolutionFeedback != null) if (rmc.VideoOutputResolutionFeedback != null)
rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution.JoinNumber]); rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution.JoinNumber]);
@@ -330,53 +331,84 @@ namespace PepperDash.Essentials.DM
var parentDev = DeviceManager.GetDeviceForKey(pKey); var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (parentDev is DmpsRoutingController) if (parentDev is DmpsRoutingController)
{ {
if ((parentDev as DmpsRoutingController).Dmps4kType) var dmps = parentDev as DmpsRoutingController;
//Check that the input is within range of this chassis' possible inputs
var num = props.ParentOutputNumber;
Debug.Console(1, "Creating DMPS device '{0}'. Output number '{1}'.", key, num);
if (num <= 0 || num > dmps.Dmps.SwitcherOutputs.Count)
{ {
return GetDmRmcControllerForDmps4k(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber); Debug.Console(0, "Cannot create DMPS device '{0}'. Output number '{1}' is out of range",
key, num);
return null;
} }
else // Must use different constructor for DMPS4K types. No IPID
if (Global.ControlSystemIsDmps4kType)
{ {
return GetDmRmcControllerForDmps(key, name, typeName, ipid, parentDev as DmpsRoutingController, props.ParentOutputNumber); var rmc = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
Debug.Console(0, "DM endpoint output {0} is for Dmps4k, changing online feedback to chassis", num);
rmc.IsOnline = dmps.OutputEndpointOnlineFeedbacks[num];
rmc.IsOnline.OutputChange += (currentDevice, args) =>
{
foreach (var feedback in rmc.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
return rmc;
} }
return GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber);
} }
if (!(parentDev is IDmSwitch)) else if (parentDev is DmChassisController)
{ {
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", var controller = parentDev as DmChassisController;
key, pKey); var chassis = controller.Chassis;
return null; var num = props.ParentOutputNumber;
} Debug.Console(1, "Creating DM Chassis device '{0}'. Output number '{1}'.", key, num);
var chassis = (parentDev as IDmSwitch).Chassis; if (num <= 0 || num > chassis.NumberOfOutputs)
var num = props.ParentOutputNumber; {
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range",
if (num <= 0 || num > chassis.NumberOfOutputs) key, num);
{ return null;
Debug.Console(0, "Cannot create DM device '{0}'. Output number '{1}' is out of range", }
key, num); controller.RxDictionary.Add(num, key);
return null; // Catch constructor failures, mainly dues to IPID
} try
{
var controller = parentDev as IDmSwitch; // Must use different constructor for CPU3 chassis types. No IPID
controller.RxDictionary.Add(num, key); if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
// Catch constructor failures, mainly dues to IPID chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
try chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
{ chassis is DmMd128x128 || chassis is DmMd64x64)
// Must use different constructor for CPU3 chassis types. No IPID {
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || rmc.IsOnline = controller.OutputEndpointOnlineFeedbacks[num];
chassis is DmMd128x128 || chassis is DmMd64x64) rmc.IsOnline.OutputChange += (currentDevice, args) =>
{ {
return GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); foreach (var feedback in rmc.Feedbacks)
} {
if (feedback != null)
return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); feedback.FireUpdate();
} }
catch (Exception e) };
{ return rmc;
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); }
return null; return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
} }
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
return null;
}
}
else
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis or DMPS.",
key, pKey);
return null;
}
} }
private static CrestronGenericBaseDevice GetDmRmcControllerForCpu2Chassis(string key, string name, string typeName, private static CrestronGenericBaseDevice GetDmRmcControllerForCpu2Chassis(string key, string name, string typeName,

View File

@@ -137,7 +137,7 @@ namespace PepperDash.Essentials.DM
try try
{ {
// Must use different constructor for CPU3 or DMPS3-4K types. No IPID // Must use different constructor for CPU3 or DMPS3-4K types. No IPID
if (isCpu3 || Global.ControlSystemIsDmps4kType) if (isCpu3 || (parentDev is DmpsRoutingController && Global.ControlSystemIsDmps4kType))
{ {
if (typeName.StartsWith("dmtx200")) if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(dmInput)); return new DmTx200Controller(key, name, new DmTx200C2G(dmInput));
@@ -145,7 +145,7 @@ namespace PepperDash.Essentials.DM
return new DmTx201CController(key, name, new DmTx201C(dmInput)); return new DmTx201CController(key, name, new DmTx201C(dmInput));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(dmInput)); return new DmTx201SController(key, name, new DmTx201S(dmInput));
if (typeName.StartsWith("dmtx4k100")) if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(dmInput)); return new DmTx4k100Controller(key, name, new DmTx4K100C1G(dmInput));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(dmInput)); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(dmInput));
@@ -153,7 +153,7 @@ namespace PepperDash.Essentials.DM
return new DmTx4k202CController(key, name, new DmTx4k202C(dmInput)); return new DmTx4k202CController(key, name, new DmTx4k202C(dmInput));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(dmInput)); return new DmTx4kz202CController(key, name, new DmTx4kz202C(dmInput));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(dmInput)); return new DmTx4k302CController(key, name, new DmTx4k302C(dmInput));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(dmInput)); return new DmTx4kz302CController(key, name, new DmTx4kz302C(dmInput));
@@ -228,6 +228,41 @@ namespace PepperDash.Essentials.DM
} }
AddToFeedbackList(ActiveVideoInputFeedback); AddToFeedbackList(ActiveVideoInputFeedback);
var parentDev = DeviceManager.GetDeviceForKey(key);
var num = hardware.DMInput.Number;
//If Dmps4K, change online feedback to chassis, tx feedback does not work
if (parentDev is DmpsRoutingController && Global.ControlSystemIsDmps4kType)
{
var dmps = parentDev as DmpsRoutingController;
Debug.Console(0, "DM endpoint input {0} is for Dmps4k, changing online feedback to chassis", num);
IsOnline = dmps.InputEndpointOnlineFeedbacks[num];
}
//If Cpu3 Chassis, change online feedback to chassis, tx feedback does not work
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
var chassis = controller.Chassis;
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
IsOnline = controller.InputEndpointOnlineFeedbacks[num];
}
}
IsOnline.OutputChange += (currentDevice, args) =>
{
foreach (var feedback in Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
} }
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware) protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)