mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 18:24:50 +00:00
Expanded the event to include RoutingPorts
Triggers for events are now based on FeedbackMatchObject
This commit is contained in:
@@ -25,7 +25,7 @@ namespace PepperDash.Essentials.DM
|
||||
public ISystemControl SystemControl { get; private set; }
|
||||
|
||||
//IroutingNumericEvent
|
||||
public event EventHandler NumericSwitchChange;
|
||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
|
||||
// Feedbacks for EssentialDM
|
||||
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||
@@ -65,7 +65,8 @@ namespace PepperDash.Essentials.DM
|
||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||
{
|
||||
if (NumericSwitchChange != null) NumericSwitchChange(this, e);
|
||||
var newEvent = NumericSwitchChange;
|
||||
if (newEvent != null) newEvent(this, e);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +75,7 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ISystemControl systemControl = null;
|
||||
|
||||
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
|
||||
@@ -511,21 +513,26 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds InputPort
|
||||
/// </summary>
|
||||
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
|
||||
{
|
||||
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds InputPort
|
||||
/// </summary>
|
||||
private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
|
||||
eRoutingPortConnectionType portType)
|
||||
{
|
||||
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
|
||||
};
|
||||
;
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds InputPort and sets Port as ICec object
|
||||
/// </summary>
|
||||
@@ -533,13 +540,18 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
|
||||
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherInputs[cardNum]
|
||||
};
|
||||
;
|
||||
|
||||
if (cecPort != null)
|
||||
inputPort.Port = cecPort;
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builds the appropriate ports and calls the appropriate add port method
|
||||
@@ -680,7 +692,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -690,7 +705,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this)
|
||||
{
|
||||
FeedbackMatchObject = Dmps.SwitcherOutputs[cardNum]
|
||||
};
|
||||
|
||||
if (cecPort != null)
|
||||
outputPort.Port = cecPort;
|
||||
@@ -752,15 +770,22 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.VideoOutEventId)
|
||||
{
|
||||
if (outputCard == null || outputCard.VideoOutFeedback == null) return;
|
||||
if (outputCard == null) return;
|
||||
|
||||
var outputFeedbackIndex = outputCard.VideoOutFeedback == null ? 0 : outputCard.VideoOutFeedback.Number;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name,
|
||||
outputCard.VideoOutFeedback.Number, output);
|
||||
outputFeedbackIndex, output);
|
||||
|
||||
if (VideoOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
var localInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DMInput) p.FeedbackMatchObject == outputCard.VideoOutFeedback);
|
||||
var localOutputPort = OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == outputCard);
|
||||
|
||||
VideoOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output, VideoOutputFeedbacks[output].UShortValue, eRoutingSignalType.Video));
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output, VideoOutputFeedbacks[output].UShortValue,
|
||||
localOutputPort, localInputPort, eRoutingSignalType.Video));
|
||||
}
|
||||
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
|
||||
{
|
||||
@@ -769,6 +794,7 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.AudioOutEventId)
|
||||
{
|
||||
/*
|
||||
if (outputCard == null || outputCard.AudioOutFeedback == null) return;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
|
||||
@@ -779,6 +805,29 @@ namespace PepperDash.Essentials.DM
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output, AudioOutputFeedbacks[output].UShortValue, eRoutingSignalType.Audio));
|
||||
}
|
||||
*/
|
||||
|
||||
if (outputCard == null) return;
|
||||
|
||||
var outputFeedbackIndex = outputCard.AudioOutFeedback == null ? 0 : outputCard.VideoOutFeedback.Number;
|
||||
|
||||
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
|
||||
outputFeedbackIndex, output);
|
||||
|
||||
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||
{
|
||||
var localInputPort =
|
||||
InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == outputCard.AudioOutFeedback);
|
||||
var localOutputPort = OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == outputCard);
|
||||
|
||||
AudioOutputFeedbacks[output].FireUpdate();
|
||||
OnSwitchChange(new RoutingNumericEventArgs(output, AudioOutputFeedbacks[output].UShortValue,
|
||||
localOutputPort, localInputPort, eRoutingSignalType.Audio));
|
||||
}
|
||||
if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
|
||||
{
|
||||
OutputAudioRouteNameFeedbacks[output].FireUpdate();
|
||||
}
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.OutputNameEventId
|
||||
&& OutputNameFeedbacks.ContainsKey(output))
|
||||
|
||||
Reference in New Issue
Block a user