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>
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(uo as Action<ushort>)(args.Sig.UShortValue);
else if (uo is Action<string>)
(uo as Action<string>)(args.Sig.StringValue);
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
(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
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++)
{
Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i);
var ioSlot = i;
//if (dmpsRouter.TxDictionary.ContainsKey(ioSlot))
@@ -44,15 +46,22 @@ namespace PepperDash.Essentials.Bridges
//{
// // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
//}
if(dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null)
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
//if(dmpsRouter.InputNameFeedbacks[ioSlot] != null)
// dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
if(dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null)
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
}
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++)
{
Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i);
var ioSlot = i;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
@@ -67,12 +76,18 @@ namespace PepperDash.Essentials.Bridges
//}
// Feedback
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
if(dmpsRouter.VideoOutputFeedbacks[ioSlot] != null)
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null)
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
//if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null)
// 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;
});
InputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Inputs[tempX].NameFeedback.StringValue != null)
if (Chassis.Inputs[tempX].NameFeedback != null)
{
return Chassis.Inputs[tempX].NameFeedback.StringValue;
}
@@ -182,7 +182,7 @@ namespace PepperDash.Essentials.DM
}
});
OutputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Outputs[tempX].NameFeedback.StringValue != null)
if (Chassis.Outputs[tempX].NameFeedback != null)
{
return Chassis.Outputs[tempX].NameFeedback.StringValue;
}

View File

@@ -106,18 +106,6 @@ namespace PepperDash.Essentials.DM
InputEndpointOnlineFeedbacks = 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 Outputs Present.", Dmps.SwitcherOutputs.Count);
@@ -174,8 +162,9 @@ namespace PepperDash.Essentials.DM
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;
}
else
@@ -186,7 +175,7 @@ namespace PepperDash.Essentials.DM
OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
{
if (outputCard.VideoOutFeedback != null)
if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
{
return outputCard.VideoOutFeedback.NameFeedback.StringValue;
}
@@ -197,7 +186,7 @@ namespace PepperDash.Essentials.DM
});
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
{
if (outputCard.AudioOutFeedback != null)
if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
{
return outputCard.AudioOutFeedback.NameFeedback.StringValue;
}
@@ -230,18 +219,24 @@ namespace PepperDash.Essentials.DM
{
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(() =>
{
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
{
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number, inputCard.NameFeedback.StringValue);
return "";
}
});
@@ -482,6 +477,14 @@ namespace PepperDash.Essentials.DM
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)
{
//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();
}
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId)
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
&& OutputEndpointOnlineFeedbacks.ContainsKey(output))
{
OutputEndpointOnlineFeedbacks[output].FireUpdate();
}
@@ -553,11 +557,12 @@ namespace PepperDash.Essentials.DM
AudioOutputFeedbacks[output].FireUpdate();
}
}
else if (args.EventId == DMOutputEventIds.OutputNameEventId)
{
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
OutputNameFeedbacks[output].FireUpdate();
}
//else if (args.EventId == DMOutputEventIds.OutputNameEventId
// && OutputNameFeedbacks.ContainsKey(output))
//{
// Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
// OutputNameFeedbacks[output].FireUpdate();
//}
}
@@ -579,41 +584,69 @@ namespace PepperDash.Essentials.DM
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
var output = Convert.ToUInt32(outputSelector);
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
if (input == 0)
{
StartOffTimer(key);
}
else
{
if (RouteOffTimers.ContainsKey(key))
Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
var output = Convert.ToUInt32(outputSelector);
if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs)
{
Debug.Console(2, this, "{0} cancelling route off due to new source", output);
RouteOffTimers[key].Stop();
RouteOffTimers.Remove(key);
// Check to see if there's an off timer waiting on this and if so, cancel
var key = new PortNumberType(output, sigType);
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);
}
}
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
// NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE
if (sigType != eRoutingSignalType.Audio)
catch (Exception e)
{
//SystemControl.VideoEnter.BoolValue = true;
(Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase).VideoOut = inCard;
Debug.Console(1, this, "Error executing switch: {0}", e);
}
if (sigType != eRoutingSignalType.Video)
{
//SystemControl.AudioEnter.BoolValue = true;
(Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase).AudioOut = inCard;
}
}
#endregion