Efforts to debug exceptions thrown on bridge string sigs 101-108 and 301-308

This commit is contained in:
Neil Dorin
2019-07-29 16:32:39 -06:00
parent 1acb3a20c5
commit bdf3e2054f
4 changed files with 131 additions and 76 deletions

View File

@@ -221,16 +221,23 @@ namespace PepperDash.Essentials.Bridges
/// <param name="args"></param> /// <param name="args"></param>
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{ {
if (Debug.Level >= 1) try
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); {
var uo = args.Sig.UserObject; if (Debug.Level >= 1)
Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
if (uo is Action<bool>) var uo = args.Sig.UserObject;
(uo as Action<bool>)(args.Sig.BoolValue); Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
else if (uo is Action<ushort>) if (uo is Action<bool>)
(uo as Action<ushort>)(args.Sig.UShortValue); (uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<string>) else if (uo is Action<ushort>)
(uo as Action<string>)(args.Sig.StringValue); (uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
}
catch (Exception e)
{
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
}
} }
} }

View File

@@ -27,6 +27,8 @@ namespace PepperDash.Essentials.Bridges
// Link up outputs // Link up outputs
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++) for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++)
{ {
Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i);
var ioSlot = i; var ioSlot = i;
//if (dmpsRouter.TxDictionary.ContainsKey(ioSlot)) //if (dmpsRouter.TxDictionary.ContainsKey(ioSlot))
@@ -45,14 +47,21 @@ namespace PepperDash.Essentials.Bridges
// // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); // // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
//} //}
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); if(dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null)
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); //if(dmpsRouter.InputNameFeedbacks[ioSlot] != null)
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); // dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
if(dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null)
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
} }
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++) for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++)
{ {
Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i);
var ioSlot = i; var ioSlot = i;
// Control // Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
@@ -67,12 +76,18 @@ namespace PepperDash.Essentials.Bridges
//} //}
// Feedback // Feedback
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); if(dmpsRouter.VideoOutputFeedbacks[ioSlot] != null)
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null)
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); //if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); // dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
if (dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
if (dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot] != null)
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
if (dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot] != null)
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
} }
} }

View File

@@ -172,7 +172,7 @@ namespace PepperDash.Essentials.DM
return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue; return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
}); });
InputNameFeedbacks[tempX] = new StringFeedback(() => { InputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Inputs[tempX].NameFeedback.StringValue != null) if (Chassis.Inputs[tempX].NameFeedback != null)
{ {
return Chassis.Inputs[tempX].NameFeedback.StringValue; return Chassis.Inputs[tempX].NameFeedback.StringValue;
} }
@@ -182,7 +182,7 @@ namespace PepperDash.Essentials.DM
} }
}); });
OutputNameFeedbacks[tempX] = new StringFeedback(() => { OutputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Outputs[tempX].NameFeedback.StringValue != null) if (Chassis.Outputs[tempX].NameFeedback != null)
{ {
return Chassis.Outputs[tempX].NameFeedback.StringValue; return Chassis.Outputs[tempX].NameFeedback.StringValue;
} }

View File

@@ -106,18 +106,6 @@ namespace PepperDash.Essentials.DM
InputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>(); InputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
OutputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>(); OutputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
// Default to EnableAudioBreakaway
//if (SystemControl.EnableAudioBreakawayFeedback != null && !SystemControl.EnableAudioBreakawayFeedback.BoolValue)
//{
// Debug.Console(1, this, "Enabling Audio Breakaway");
// SystemControl.EnableAudioBreakaway.BoolValue = true;
//}
//if(!SystemControl.VideoEnter.BoolValue)
// SystemControl.VideoEnter.BoolValue = true;
//if(!SystemControl.AudioEnter.BoolValue)
// SystemControl.AudioEnter.BoolValue = true;
Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count); Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count);
Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count); Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count);
@@ -174,8 +162,9 @@ namespace PepperDash.Essentials.DM
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() => OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
{ {
if (outputCard.NameFeedback.StringValue != null) if (outputCard.NameFeedback != null)
{ {
Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue);
return outputCard.NameFeedback.StringValue; return outputCard.NameFeedback.StringValue;
} }
else else
@@ -186,7 +175,7 @@ namespace PepperDash.Essentials.DM
OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
{ {
if (outputCard.VideoOutFeedback != null) if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
{ {
return outputCard.VideoOutFeedback.NameFeedback.StringValue; return outputCard.VideoOutFeedback.NameFeedback.StringValue;
} }
@@ -197,7 +186,7 @@ namespace PepperDash.Essentials.DM
}); });
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
{ {
if (outputCard.AudioOutFeedback != null) if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
{ {
return outputCard.AudioOutFeedback.NameFeedback.StringValue; return outputCard.AudioOutFeedback.NameFeedback.StringValue;
} }
@@ -230,18 +219,24 @@ namespace PepperDash.Essentials.DM
{ {
InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; }); InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; });
VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() => if (inputCard.VideoDetectedFeedback != null)
{ {
return inputCard.VideoDetectedFeedback.BoolValue; VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() =>
}); {
return inputCard.VideoDetectedFeedback.BoolValue;
});
}
InputNameFeedbacks[inputCard.Number] = new StringFeedback(() => InputNameFeedbacks[inputCard.Number] = new StringFeedback(() =>
{ {
if (inputCard.NameFeedback.StringValue != null) if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue))
{ {
return inputCard.NameFeedback.StringValue; Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue);
return inputCard.NameFeedback.StringValue;
} }
else else
{ {
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number, inputCard.NameFeedback.StringValue);
return ""; return "";
} }
}); });
@@ -482,6 +477,14 @@ namespace PepperDash.Essentials.DM
OutputPorts.Add(outputPort); OutputPorts.Add(outputPort);
} }
/// <summary>
///
/// </summary>
void AddVolumeControl(uint number, Audio.Output audio)
{
VolumeControls.Add(number, new DmCardAudioOutputController(audio));
}
void Dmps_DMInputChange(Switch device, DMInputEventArgs args) void Dmps_DMInputChange(Switch device, DMInputEventArgs args)
{ {
//Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString()); //Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString());
@@ -523,7 +526,8 @@ namespace PepperDash.Essentials.DM
{ {
VolumeControls[args.Number].VolumeEventFromChassis(); VolumeControls[args.Number].VolumeEventFromChassis();
} }
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId) else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
&& OutputEndpointOnlineFeedbacks.ContainsKey(output))
{ {
OutputEndpointOnlineFeedbacks[output].FireUpdate(); OutputEndpointOnlineFeedbacks[output].FireUpdate();
} }
@@ -553,11 +557,12 @@ namespace PepperDash.Essentials.DM
AudioOutputFeedbacks[output].FireUpdate(); AudioOutputFeedbacks[output].FireUpdate();
} }
} }
else if (args.EventId == DMOutputEventIds.OutputNameEventId) //else if (args.EventId == DMOutputEventIds.OutputNameEventId
{ // && OutputNameFeedbacks.ContainsKey(output))
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output); //{
OutputNameFeedbacks[output].FireUpdate(); // Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
} // OutputNameFeedbacks[output].FireUpdate();
//}
} }
@@ -579,40 +584,68 @@ namespace PepperDash.Essentials.DM
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType) public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
{ {
Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType); try
{
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
var output = Convert.ToUInt32(outputSelector);
// Check to see if there's an off timer waiting on this and if so, cancel var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var key = new PortNumberType(output, sigType); var output = Convert.ToUInt32(outputSelector);
if (input == 0)
{ if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs)
StartOffTimer(key);
}
else
{
if (RouteOffTimers.ContainsKey(key))
{ {
Debug.Console(2, this, "{0} cancelling route off due to new source", output); // Check to see if there's an off timer waiting on this and if so, cancel
RouteOffTimers[key].Stop(); var key = new PortNumberType(output, sigType);
RouteOffTimers.Remove(key); if (input == 0)
{
StartOffTimer(key);
}
else if (key.Number > 0)
{
if (RouteOffTimers.ContainsKey(key))
{
Debug.Console(2, this, "{0} cancelling route off due to new source", output);
RouteOffTimers[key].Stop();
RouteOffTimers.Remove(key);
}
}
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
if (inCard != null)
{
// NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE
if (sigType != eRoutingSignalType.Audio)
{
var outputCard = Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase;
//SystemControl.VideoEnter.BoolValue = true;
if (outputCard != null && outputCard.VideoOut != null)
outputCard.VideoOut = inCard;
}
if (sigType != eRoutingSignalType.Video)
{
var outputCard = Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase;
if (outputCard != null && outputCard.AudioOut != null)
outputCard.AudioOut = inCard;
}
}
else
{
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
}
}
else
{
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, outputSelector);
} }
} }
catch (Exception e)
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
// NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE
if (sigType != eRoutingSignalType.Audio)
{ {
//SystemControl.VideoEnter.BoolValue = true; Debug.Console(1, this, "Error executing switch: {0}", e);
(Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase).VideoOut = inCard;
}
if (sigType != eRoutingSignalType.Video)
{
//SystemControl.AudioEnter.BoolValue = true;
(Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase).AudioOut = inCard;
} }
} }