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,20 +73,26 @@ namespace PepperDash.Essentials.Core
{ {
//Debug.Console(1, this, " Does not require registration. Skipping"); //Debug.Console(1, this, " Does not require registration. Skipping");
if (Hardware.Registerable && !Hardware.Registered)
{
var response = Hardware.RegisterWithLogging(Key); var response = Hardware.RegisterWithLogging(Key);
if (response != eDeviceRegistrationUnRegistrationResponse.Success) if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{ {
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false; return false;
} }
}
IsRegistered.FireUpdate(); IsRegistered.FireUpdate();
} }
else else
{ {
AddPostActivationAction(() => AddPostActivationAction(() =>
{
if (Hardware.Registerable && !Hardware.Registered)
{ {
var response = Hardware.RegisterWithLogging(Key); var response = Hardware.RegisterWithLogging(Key);
}
IsRegistered.FireUpdate(); IsRegistered.FireUpdate();
}); });

View File

@@ -46,6 +46,8 @@ namespace PepperDash.Essentials.DM
public eDmps3InputVideoSource ActualVideoInput public eDmps3InputVideoSource ActualVideoInput
{ {
get get
{
try
{ {
if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto) if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto)
return InputCard.VideoSourceFeedback; return InputCard.VideoSourceFeedback;
@@ -59,6 +61,11 @@ namespace PepperDash.Essentials.DM
return eDmps3InputVideoSource.Bnc; return eDmps3InputVideoSource.Bnc;
} }
} }
catch
{
return eDmps3InputVideoSource.Bnc;
}
}
} }
public virtual RoutingPortCollection<RoutingInputPort> InputPorts public virtual RoutingPortCollection<RoutingInputPort> InputPorts

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,6 +30,7 @@ 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;
@@ -37,7 +38,7 @@ namespace PepperDash.Essentials.DM
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,24 +331,40 @@ 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);
else
{
return GetDmRmcControllerForDmps(key, name, typeName, ipid, parentDev as DmpsRoutingController, props.ParentOutputNumber);
}
}
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null; return null;
} }
// Must use different constructor for DMPS4K types. No IPID
var chassis = (parentDev as IDmSwitch).Chassis; if (Global.ControlSystemIsDmps4kType)
{
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);
}
else if (parentDev is DmChassisController)
{
var controller = parentDev as DmChassisController;
var chassis = controller.Chassis;
var num = props.ParentOutputNumber; var num = props.ParentOutputNumber;
Debug.Console(1, "Creating DM Chassis device '{0}'. Output number '{1}'.", key, num);
if (num <= 0 || num > chassis.NumberOfOutputs) if (num <= 0 || num > chassis.NumberOfOutputs)
{ {
@@ -355,8 +372,6 @@ namespace PepperDash.Essentials.DM
key, num); key, num);
return null; return null;
} }
var controller = parentDev as IDmSwitch;
controller.RxDictionary.Add(num, key); controller.RxDictionary.Add(num, key);
// Catch constructor failures, mainly dues to IPID // Catch constructor failures, mainly dues to IPID
try try
@@ -367,9 +382,19 @@ namespace PepperDash.Essentials.DM
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64) chassis is DmMd128x128 || chassis is DmMd64x64)
{ {
return GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
rmc.IsOnline = controller.OutputEndpointOnlineFeedbacks[num];
rmc.IsOnline.OutputChange += (currentDevice, args) =>
{
foreach (var feedback in rmc.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
return rmc;
} }
return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
} }
catch (Exception e) catch (Exception e)
@@ -378,6 +403,13 @@ namespace PepperDash.Essentials.DM
return null; 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,
uint ipid, Switch chassis, uint num, IKeyed parentDev) uint ipid, Switch chassis, uint num, IKeyed parentDev)

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));
@@ -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)