diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
index 5ad143c9..95967a72 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
@@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Core
{
///
///
- ///
- public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
+ ///
+ public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
{
public event SourceInfoChangeHandler CurrentSourceChange;
@@ -258,13 +258,14 @@ namespace PepperDash.Essentials.Core
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
- }
- }
+ }
+
+ }
///
///
- ///
- public abstract class TwoWayDisplayBase : DisplayBase
+ ///
+ public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback
{
public StringFeedback CurrentInputFeedback { get; private set; }
@@ -293,7 +294,20 @@ namespace PepperDash.Essentials.Core
Feedbacks.Add(CurrentInputFeedback);
- }
-
+ }
+
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ protected void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
+
}
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs
index 6c8d520b..85578c5d 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs
@@ -111,10 +111,87 @@ namespace PepperDash.Essentials.Core
IntFeedback AudioVideoSourceNumericFeedback { get; }
}
- ///
+
+ ///
+ /// Defines an IRmcRouting with a feedback event
+ ///
+ public interface ITxRoutingWithFeedback : ITxRouting
+ {
+ }
+
+ ///
+ /// Defines an IRmcRouting with a feedback event
+ ///
+ public interface IRmcRoutingWithFeedback : IRmcRouting
+ {
+ }
+
+ ///
/// Defines an IRoutingOutputs devices as being a source - the start of the chain
///
public interface IRoutingSource : IRoutingOutputs
{
}
+
+ ///
+ /// Defines an event structure for reporting output route data
+ ///
+ public interface IRoutingFeedback : IKeyName
+ {
+ event EventHandler NumericSwitchChange;
+ //void OnSwitchChange(RoutingNumericEventArgs e);
+ }
+
+ ///
+ /// Defines an IRoutingNumeric with a feedback event
+ ///
+ public interface IRoutingNumericWithFeedback : IRoutingNumeric, IRoutingFeedback
+ {
+ }
+
+ ///
+ /// Defines an IRouting with a feedback event
+ ///
+ public interface IRoutingWithFeedback : IRouting, IRoutingFeedback
+ {
+
+ }
+
+ public class RoutingNumericEventArgs : EventArgs
+ {
+
+ public uint? Output { get; set; }
+ public uint? Input { get; set; }
+
+ public eRoutingSignalType SigType { get; set; }
+ public RoutingInputPort InputPort { get; set; }
+ public RoutingOutputPort OutputPort { get; set; }
+
+ public RoutingNumericEventArgs(uint output, uint input, eRoutingSignalType sigType) : this(output, input, null, null, sigType)
+ {
+ }
+
+ public RoutingNumericEventArgs(RoutingOutputPort outputPort, RoutingInputPort inputPort,
+ eRoutingSignalType sigType)
+ : this(null, null, outputPort, inputPort, sigType)
+ {
+ }
+
+ public RoutingNumericEventArgs()
+ : this(null, null, null, null, 0)
+ {
+
+ }
+
+ public RoutingNumericEventArgs(uint? output, uint? input, RoutingOutputPort outputPort,
+ RoutingInputPort inputPort, eRoutingSignalType sigType)
+ {
+ OutputPort = outputPort;
+ InputPort = inputPort;
+
+ Output = output;
+ Input = input;
+ SigType = sigType;
+ }
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
index 709aa500..ce2204fe 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
@@ -17,7 +17,7 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM.AirMedia
{
[Description("Wrapper class for an AM-200 or AM-300")]
- public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumeric, IIROutputPorts, IComPorts
+ public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts
{
public AmX00 AirMedia { get; private set; }
@@ -29,6 +29,10 @@ namespace PepperDash.Essentials.DM.AirMedia
public RoutingPortCollection OutputPorts { get; private set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
public BoolFeedback IsInSessionFeedback { get; private set; }
public IntFeedback ErrorFeedback { get; private set; }
public IntFeedback NumberOfUsersConnectedFeedback { get; set; }
@@ -43,6 +47,7 @@ namespace PepperDash.Essentials.DM.AirMedia
public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
: base(key, name, device)
{
+
AirMedia = device;
DeviceConfig = dc;
@@ -53,21 +58,36 @@ namespace PepperDash.Essentials.DM.AirMedia
OutputPorts = new RoutingPortCollection();
InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this));
+ eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)
+ {
+ FeedbackMatchObject = 0
+ });
InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this));
+ eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)
+ {
+ FeedbackMatchObject = 1
+ });
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this));
+ eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)
+ {
+ FeedbackMatchObject = 2
+ });
InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this));
+ eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)
+ {
+ FeedbackMatchObject = 4
+ });
if (AirMedia is Am300)
{
InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this));
+ eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this)
+ {
+ FeedbackMatchObject = 3
+ });
}
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
@@ -153,6 +173,17 @@ namespace PepperDash.Essentials.DM.AirMedia
SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback.JoinNumber]);
}
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
+
void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{
if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId)
@@ -172,12 +203,20 @@ namespace PepperDash.Essentials.DM.AirMedia
void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{
if (args.EventId == AmX00.VideoOutFeedbackEventId)
+ {
VideoOutFeedback.FireUpdate();
+
+ var localInputPort =
+ InputPorts.FirstOrDefault(p => (int) p.FeedbackMatchObject == VideoOutFeedback.UShortValue);
+
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(),
+ localInputPort, eRoutingSignalType.AudioVideo));
+ }
else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId)
AutomaticInputRoutingEnabledFeedback.FireUpdate();
}
- void HdmiIn_StreamChange(Crestron.SimplSharpPro.DeviceSupport.Stream stream, Crestron.SimplSharpPro.DeviceSupport.StreamEventArgs args)
+ void HdmiIn_StreamChange(Stream stream, Crestron.SimplSharpPro.DeviceSupport.StreamEventArgs args)
{
if (args.EventId == DMInputEventIds.SourceSyncEventId)
HdmiVideoSyncDetectedFeedback.FireUpdate();
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs
index 1ac15263..abeba8d8 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs
@@ -21,12 +21,15 @@ namespace PepperDash.Essentials.DM {
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
///
- public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
+ public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; }
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
// Feedbacks for EssentialDM
public Dictionary VideoOutputFeedbacks { get; private set; }
public Dictionary AudioOutputFeedbacks { get; private set; }
@@ -287,6 +290,15 @@ namespace PepperDash.Essentials.DM {
}
}
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
void AddHdmiInBladePorts(uint number, ICec cecPort) {
@@ -377,7 +389,10 @@ namespace PepperDash.Essentials.DM {
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);
+ var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this)
+ {
+ FeedbackMatchObject = Chassis.Inputs[cardNum]
+ };
InputPorts.Add(inputPort);
}
@@ -385,19 +400,20 @@ namespace PepperDash.Essentials.DM {
///
/// Adds InputPort and sets Port as ICec object
///
- void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort) {
+ private void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType,
+ eRoutingPortConnectionType portType, ICec cecPort)
+ {
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 = Chassis.Inputs[cardNum]
+ };
- if (inputPort != null) {
- if (cecPort != null)
- inputPort.Port = cecPort;
+ if (cecPort != null)
+ inputPort.Port = cecPort;
- InputPorts.Add(inputPort);
- }
- else
- Debug.Console(2, this, "inputPort is null");
+ InputPorts.Add(inputPort);
}
@@ -407,7 +423,10 @@ namespace PepperDash.Essentials.DM {
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector) {
var portKey = string.Format("{0}--{1}", cardName, 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 = Chassis.Outputs[(uint)selector]
+ });
}
@@ -458,54 +477,84 @@ namespace PepperDash.Essentials.DM {
}
}
}
+
///
///
- void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
+ private void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
var output = args.Number;
- switch (args.EventId) {
- case DMOutputEventIds.VolumeEventId: {
- if (VolumeControls.ContainsKey(output)) {
- VolumeControls[args.Number].VolumeEventFromChassis();
- }
- break;
+ switch (args.EventId)
+ {
+ case DMOutputEventIds.VolumeEventId:
+ {
+ if (VolumeControls.ContainsKey(output))
+ {
+ VolumeControls[args.Number].VolumeEventFromChassis();
}
- case DMOutputEventIds.EndpointOnlineEventId: {
- Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
- if(Chassis.Outputs[output].Endpoint != null)
- Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}", args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
+ break;
+ }
+ case DMOutputEventIds.EndpointOnlineEventId:
+ {
+ Debug.Console(2, this,
+ "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}",
+ args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
+ if (Chassis.Outputs[output].Endpoint != null)
+ Debug.Console(2, this,
+ "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}",
+ args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.OnlineFeedbackEventId: {
- Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
- OutputEndpointOnlineFeedbacks[output].FireUpdate();
- break;
- }
- case DMOutputEventIds.VideoOutEventId: {
- if (Chassis.Outputs[output].VideoOutFeedback != null) {
- Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output);
- }
- if (VideoOutputFeedbacks.ContainsKey(output)) {
- VideoOutputFeedbacks[output].FireUpdate();
+ OutputEndpointOnlineFeedbacks[output].FireUpdate();
+ break;
+ }
+ case DMOutputEventIds.OnlineFeedbackEventId:
+ {
+ Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}",
+ args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
+ OutputEndpointOnlineFeedbacks[output].FireUpdate();
+ break;
+ }
+ case DMOutputEventIds.VideoOutEventId:
+ {
+
+ var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.Outputs[output].VideoOutFeedback.Number;
+
+ Debug.Console(2, this, "DMSwitchAudioVideo:{0} Routed Input:{1} Output:{2}'", this.Name,
+ inputNumber, output);
+
+ if (VideoOutputFeedbacks.ContainsKey(output))
+ {
+ var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
+ var localOutputPort =
+ OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == Chassis.Outputs[output]);
+
+
+ VideoOutputFeedbacks[output].FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(output,
+ inputNumber,
+ localOutputPort,
+ localInputPort,
+ eRoutingSignalType.AudioVideo));
- }
- if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) {
- OutputVideoRouteNameFeedbacks[output].FireUpdate();
- }
- break;
}
- case DMOutputEventIds.OutputNameEventId: {
- Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
- OutputNameFeedbacks[output].FireUpdate();
- break;
- }
- default: {
- Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
- break;
+ if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
+ {
+ OutputVideoRouteNameFeedbacks[output].FireUpdate();
}
+ break;
+ }
+ case DMOutputEventIds.OutputNameEventId:
+ {
+ Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
+ OutputNameFeedbacks[output].FireUpdate();
+ break;
+ }
+ default:
+ {
+ Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}",
+ args.Number, args.EventId);
+ break;
+ }
}
}
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
index 1e376950..428bb8bc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
@@ -20,12 +20,15 @@ namespace PepperDash.Essentials.DM
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
///
- [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
- public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
+ [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
+ public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
- public Switch Chassis { get; private set; }
+ public Switch Chassis { get; private set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
// Feedbacks for EssentialDM
public Dictionary VideoOutputFeedbacks { get; private set; }
@@ -187,7 +190,8 @@ namespace PepperDash.Essentials.DM
///
public DmChassisController(string key, string name, DmMDMnxn chassis)
: base(key, name, chassis)
- {
+ {
+
Chassis = chassis;
InputPorts = new RoutingPortCollection();
OutputPorts = new RoutingPortCollection();
@@ -737,7 +741,10 @@ 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 = Chassis.Inputs[cardNum]
+ };
InputPorts.Add(inputPort);
}
@@ -749,12 +756,15 @@ 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 = Chassis.Inputs[cardNum]
+ }; ;
if (cecPort != null)
inputPort.Port = cecPort;
- InputPorts.Add(inputPort);
+ InputPorts.Add(inputPort);
}
///
@@ -763,8 +773,11 @@ namespace PepperDash.Essentials.DM
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
{
var portKey = string.Format("{0}--{1}", cardName, portName);
- Debug.Console(2, this, "Adding output port '{0}'", portKey);
- OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
+ Debug.Console(2, this, "Adding output port '{0}'", portKey);
+ OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)
+ {
+ FeedbackMatchObject = Chassis.Outputs[(uint)selector]
+ });
}
///
@@ -774,12 +787,15 @@ namespace PepperDash.Essentials.DM
{
var portKey = string.Format("{0}--{1}", cardName, 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 = Chassis.Outputs[(uint)selector]
+ }; ;
if (cecPort != null)
outputPort.Port = cecPort;
- OutputPorts.Add(outputPort);
+ OutputPorts.Add(outputPort);
}
///
@@ -905,6 +921,17 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Chassis_DMInputChange: {0}", ex);
}
+ }
+
+ ///
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
}
///
@@ -938,30 +965,59 @@ namespace PepperDash.Essentials.DM
OutputEndpointOnlineFeedbacks[output].FireUpdate();
break;
}
- case DMOutputEventIds.VideoOutEventId:
+ case DMOutputEventIds.VideoOutEventId:
{
- if (Chassis.Outputs[output].VideoOutFeedback != null)
- Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output);
-
- if (VideoOutputFeedbacks.ContainsKey(output))
- VideoOutputFeedbacks[output].FireUpdate();
-
+
+ var inputNumber = Chassis.Outputs[output].VideoOutFeedback == null ? 0 : Chassis.
+ Outputs[output].VideoOutFeedback.Number;
+
+ Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, inputNumber, output);
+
+ if (VideoOutputFeedbacks.ContainsKey(output))
+ {
+ var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].VideoOutFeedback);
+ var localOutputPort =
+ OutputPorts.FirstOrDefault(p => (DMOutput) p.FeedbackMatchObject == Chassis.Outputs[output]);
+
+
+ VideoOutputFeedbacks[output].FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(output,
+ inputNumber,
+ localOutputPort,
+ localInputPort,
+ eRoutingSignalType.Video));
+ }
+
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
OutputVideoRouteNameFeedbacks[output].FireUpdate();
break;
}
- case DMOutputEventIds.AudioOutEventId:
- {
- if (Chassis.Outputs[output].AudioOutFeedback != null)
- Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output);
-
- if (AudioOutputFeedbacks.ContainsKey(output))
- AudioOutputFeedbacks[output].FireUpdate();
-
- if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
- OutputAudioRouteNameFeedbacks[output].FireUpdate();
-
+ case DMOutputEventIds.AudioOutEventId:
+ {
+ var inputNumber = Chassis.Outputs[output].AudioOutFeedback == null ? 0 : Chassis.
+ Outputs[output].AudioOutFeedback.Number;
+
+ Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, inputNumber, output);
+
+ if (AudioOutputFeedbacks.ContainsKey(output))
+ {
+ var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == Chassis.Outputs[output].AudioOutFeedback);
+ var localOutputPort =
+ OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == Chassis.Outputs[output]);
+
+
+ AudioOutputFeedbacks[output].FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(output,
+ inputNumber,
+ localOutputPort,
+ localInputPort,
+ eRoutingSignalType.Audio));
+ }
+
+ if (OutputAudioRouteNameFeedbacks.ContainsKey(output))
+ OutputAudioRouteNameFeedbacks[output].FireUpdate();
+
break;
}
case DMOutputEventIds.OutputNameEventId:
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs
index adf73bde..4a439d19 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs
@@ -19,10 +19,13 @@ using Feedback = PepperDash.Essentials.Core.Feedback;
namespace PepperDash.Essentials.DM
{
- public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback
+ public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumericWithFeedback, IHasFeedback
{
public CrestronControlSystem Dmps { get; set; }
- public ISystemControl SystemControl { get; private set; }
+ public ISystemControl SystemControl { get; private set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
// Feedbacks for EssentialDM
public Dictionary VideoOutputFeedbacks { get; private set; }
@@ -54,13 +57,25 @@ namespace PepperDash.Essentials.DM
///
/// Text that represents when an output has no source routed to it
///
- public string NoRouteText = "";
+ public string NoRouteText = "";
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
DmpsRoutingPropertiesConfig properties)
{
try
{
+
ISystemControl systemControl = null;
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
@@ -498,21 +513,26 @@ namespace PepperDash.Essentials.DM
AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming);
}
- }
-
-
- ///
- /// Adds InputPort
- ///
- 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);
- }
-
+ }
+
+
+ ///
+ /// Adds InputPort
+ ///
+ 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);
+ }
+
///
/// Adds InputPort and sets Port as ICec object
///
@@ -520,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);
- }
+ }
+
///
/// Builds the appropriate ports and calls the appropriate add port method
@@ -667,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]
+ });
}
///
@@ -677,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;
@@ -737,39 +768,74 @@ namespace PepperDash.Essentials.DM
{
OutputEndpointOnlineFeedbacks[output].FireUpdate();
}
- else if (args.EventId == DMOutputEventIds.VideoOutEventId)
- {
- if (outputCard != null && outputCard.VideoOutFeedback != null)
- {
- Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.VideoOutFeedback.Number, output);
- }
- if (VideoOutputFeedbacks.ContainsKey(output))
- {
- VideoOutputFeedbacks[output].FireUpdate();
- }
- if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
- {
- OutputVideoRouteNameFeedbacks[output].FireUpdate();
- }
- }
- else if (args.EventId == DMOutputEventIds.AudioOutEventId)
- {
- if (outputCard != null && outputCard.AudioOutFeedback != null)
- {
- Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.AudioOutFeedback.Number, output);
- }
- if (AudioOutputFeedbacks.ContainsKey(output))
- {
- AudioOutputFeedbacks[output].FireUpdate();
- }
- }
- else if (args.EventId == DMOutputEventIds.OutputNameEventId
- && OutputNameFeedbacks.ContainsKey(output))
- {
- Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
- OutputNameFeedbacks[output].FireUpdate();
- }
-
+ else if (args.EventId == DMOutputEventIds.VideoOutEventId)
+ {
+ 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,
+ 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,
+ localOutputPort, localInputPort, eRoutingSignalType.Video));
+ }
+ if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
+ {
+ OutputVideoRouteNameFeedbacks[output].FireUpdate();
+ }
+ }
+ 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,
+ outputCard.AudioOutFeedback.Number, output);
+
+ if (AudioOutputFeedbacks.ContainsKey(output))
+ {
+ 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))
+ {
+ Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
+ OutputNameFeedbacks[output].FireUpdate();
+ }
+
}
///
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs
index 1e33069a..b766ac3c 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs
@@ -16,11 +16,14 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM.Chassis
{
[Description("Wrapper class for all HdMdNxM4E switchers")]
- public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRoutingNumeric, IHasFeedback
+ public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
{
private HdMdNxM _Chassis;
private HdMd4x14kE _Chassis4x1;
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
public Dictionary InputNames { get; set; }
public Dictionary OutputNames { get; set; }
@@ -70,26 +73,34 @@ namespace PepperDash.Essentials.DM.Chassis
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{
- var inputName = InputNames[i];
- _Chassis.Inputs[i].Name.StringValue = inputName;
+ var index = i;
+ var inputName = InputNames[index];
+ _Chassis.Inputs[index].Name.StringValue = inputName;
InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, i, this));
- VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[i].VideoDetectedFeedback.BoolValue));
- InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[i].Name.StringValue));
- InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
+ eRoutingPortConnectionType.Hdmi, index, this)
+ {
+ FeedbackMatchObject = _Chassis.HdmiInputs[index]
+ });
+ VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
+ InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].Name.StringValue));
+ InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[index].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
}
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
{
- var outputName = OutputNames[i];
+ var index = i;
+ var outputName = OutputNames[index];
_Chassis.Outputs[i].Name.StringValue = outputName;
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, i, this));
- VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[i].VideoOutFeedback.Number));
- OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].Name.StringValue));
- OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue));
+ eRoutingPortConnectionType.Hdmi, index, this)
+ {
+ FeedbackMatchObject = _Chassis.HdmiOutputs[index]
+ });
+ VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
+ OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].Name.StringValue));
+ OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
}
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
@@ -102,6 +113,16 @@ namespace PepperDash.Essentials.DM.Chassis
#region Methods
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
public void EnableHdcp(uint port)
{
if (port > _Chassis.NumberOfInputs) return;
@@ -328,44 +349,45 @@ namespace PepperDash.Essentials.DM.Chassis
void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
{
- if (args.DeviceOnLine)
+ if (!args.DeviceOnLine) return;
+ for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{
- for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
- {
- _Chassis.Inputs[i].Name.StringValue = InputNames[i];
- }
- for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
- {
- _Chassis.Outputs[i].Name.StringValue = OutputNames[i];
- }
-
- foreach (var feedback in Feedbacks)
- {
- feedback.FireUpdate();
- }
+ _Chassis.Inputs[i].Name.StringValue = InputNames[i];
+ }
+ for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
+ {
+ _Chassis.Outputs[i].Name.StringValue = OutputNames[i];
+ }
+
+ foreach (var feedback in Feedbacks)
+ {
+ feedback.FireUpdate();
}
-
}
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
- if (args.EventId == DMOutputEventIds.VideoOutEventId)
+ if (args.EventId != DMOutputEventIds.VideoOutEventId) return;
+
+ for (var i = 0; i < VideoOutputRouteFeedbacks.Count; i++)
{
- foreach (var item in VideoOutputRouteFeedbacks)
- {
- item.FireUpdate();
- }
+ var index = i;
+ var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1].VideoOutFeedback);
+ var localOutputPort =
+ OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1]);
+
+
+ VideoOutputRouteFeedbacks[i].FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs((ushort)i, VideoOutputRouteFeedbacks[i].UShortValue, localOutputPort, localInputPort, eRoutingSignalType.AudioVideo));
}
}
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
{
- if (args.EventId == DMInputEventIds.VideoDetectedEventId)
+ if (args.EventId != DMInputEventIds.VideoDetectedEventId) return;
+ foreach (var item in VideoInputSyncFeedbacks)
{
- foreach (var item in VideoInputSyncFeedbacks)
- {
- item.FireUpdate();
- }
+ item.FireUpdate();
}
}
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs
index f0238936..21663e78 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs
@@ -13,7 +13,7 @@ using PepperDash.Core;
namespace PepperDash.Essentials.DM
{
[Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")]
- public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting,
+ public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRoutingWithFeedback,
IIROutputPorts, IComPorts, ICec
{
private readonly DmRmc4kzScalerC _rmc;
@@ -31,14 +31,34 @@ namespace PepperDash.Essentials.DM
public RoutingPortCollection OutputPorts { get; private set; }
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
+
public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc)
: base(key, name, rmc)
{
_rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.DmCat, 0, this);
+ eRoutingPortConnectionType.DmCat, 0, this)
+ {
+ FeedbackMatchObject = 1
+ };
HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, 0, this);
+ eRoutingPortConnectionType.Hdmi, 0, this)
+ {
+ FeedbackMatchObject = 2
+ };
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this);
@@ -55,12 +75,20 @@ namespace PepperDash.Essentials.DM
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
+ _rmc.OnlineStatusChange += _rmc_OnlineStatusChange;
+
// Set Ports for CEC
HdmiOut.Port = _rmc.HdmiOutput;
AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(_rmc.SelectedSourceFeedback));
}
+ private void _rmc_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ AudioVideoSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioVideoSourceNumericFeedback.UShortValue, eRoutingSignalType.AudioVideo));
+ }
+
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
@@ -71,7 +99,12 @@ namespace PepperDash.Essentials.DM
if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId)
{
+ var localInputPort =
+ InputPorts.FirstOrDefault(p => (int)p.FeedbackMatchObject == AudioVideoSourceNumericFeedback.UShortValue);
+
+
AudioVideoSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioVideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputPort, eRoutingSignalType.AudioVideo));
}
}
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
index fd0cf2c1..c638ecb6 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
@@ -1,4 +1,5 @@
-using System;
+using System;
+using System.Linq;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
@@ -17,7 +18,7 @@ namespace PepperDash.Essentials.DM
/// Controller class for all DM-TX-201C/S/F transmitters
///
[Description("Wrapper class for DM-TX-200-C")]
- public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
+ public class DmTx200Controller : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx200C2G Tx { get; private set; }
@@ -35,7 +36,21 @@ namespace PepperDash.Essentials.DM
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
- public IntFeedback VgaContrastFeedback { get; protected set; }
+ public IntFeedback VgaContrastFeedback { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
///
/// Helps get the "real" inputs, including when in Auto
@@ -85,14 +100,22 @@ namespace PepperDash.Essentials.DM
public DmTx200Controller(string key, string name, DmTx200C2G tx)
: base(key, name, tx)
{
- Tx = tx;
-
- HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
- VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
- eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ Tx = tx;
+
+ HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
+ DmTx200Base.eSourceSelection.Digital, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
+ };
+
+ VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
+ eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
+ };
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -195,12 +218,19 @@ namespace PepperDash.Essentials.DM
}
}
- void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
- {
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.AudioSourceFeedback);
+
+
ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
- AudioSourceNumericFeedback.FireUpdate();
-
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
}
public override bool CustomActivate()
@@ -303,14 +333,18 @@ namespace PepperDash.Essentials.DM
switch (id)
{
- case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
VideoSourceNumericFeedback.FireUpdate();
- ActiveVideoInputFeedback.FireUpdate();
+ ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
break;
- case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
- AudioSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
}
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
index a8fd2b46..623391dc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
@@ -4,6 +4,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
+using System.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -14,8 +15,8 @@ namespace PepperDash.Essentials.DM
///
/// Controller class for all DM-TX-201C/S/F transmitters
///
- [Description("Wrapper class for DM-TX-201-C")]
- public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
+ [Description("Wrapper class for DM-TX-201-C")]
+ public class DmTx201CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx201C Tx { get; private set; }
@@ -34,7 +35,20 @@ namespace PepperDash.Essentials.DM
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
- public IntFeedback VgaContrastFeedback { get; protected set; }
+ public IntFeedback VgaContrastFeedback { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
///
/// Helps get the "real" inputs, including when in Auto
@@ -89,14 +103,22 @@ namespace PepperDash.Essentials.DM
public DmTx201CController(string key, string name, DmTx201C tx)
: base(key, name, tx)
{
- Tx = tx;
-
- HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
- VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
- eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ Tx = tx;
+
+ HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
+ DmTx200Base.eSourceSelection.Digital, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
+ };
+
+ VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
+ eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
+ };
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -190,16 +212,23 @@ namespace PepperDash.Essentials.DM
VgaContrastFeedback.FireUpdate();
break;
}
- }
-
- void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
- {
- ActiveVideoInputFeedback.FireUpdate();
- VideoSourceNumericFeedback.FireUpdate();
- AudioSourceNumericFeedback.FireUpdate();
-
}
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
+
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
switch (args.EventId)
@@ -312,23 +341,26 @@ namespace PepperDash.Essentials.DM
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
- {
- var id = args.EventId;
+ {
+ var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
- ActiveVideoInputFeedback.FireUpdate();
+ ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
- }
+ }
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs
index 3b6ff16b..7c4b0d34 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs
@@ -4,6 +4,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
+using System.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.DM
/// Controller class for all DM-TX-201S/F transmitters
///
[Description("Wrapper class for DM-TX-201-S/F")]
- public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
+ public class DmTx201SController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx201S Tx { get; private set; }
@@ -36,6 +37,21 @@ namespace PepperDash.Essentials.DM
public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
+
///
/// Helps get the "real" inputs, including when in Auto
///
@@ -92,11 +108,19 @@ namespace PepperDash.Essentials.DM
Tx = tx;
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
+ DmTx200Base.eSourceSelection.Digital, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Digital
+ };
+
VgaInput = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, DmTx200Base.eSourceSelection.Analog, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
+ };
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -194,11 +218,18 @@ namespace PepperDash.Essentials.DM
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
+
+
ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate();
-
- }
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
@@ -319,17 +350,20 @@ namespace PepperDash.Essentials.DM
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
- }
+ }
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs
index 3938706d..f40da022 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.DM
using eVst = DmTx401C.eSourceSelection;
[Description("Wrapper class for DM-TX-401-C")]
- public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
+ public class DmTx401CController : DmTxControllerBase, ITxRoutingWithFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx401C Tx { get; private set; }
@@ -41,7 +41,21 @@ namespace PepperDash.Essentials.DM
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
- public IntFeedback VgaContrastFeedback { get; protected set; }
+ public IntFeedback VgaContrastFeedback { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
///
/// Helps get the "real" inputs, including when in Auto
@@ -104,20 +118,33 @@ namespace PepperDash.Essentials.DM
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.HDMI, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput))
+ {
+ FeedbackMatchObject = eVst.HDMI
+ };
DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.DisplayPort, this,
- VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput));
+ VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput))
+ {
+ FeedbackMatchObject = eVst.DisplayPort
+ };
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.VGA, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = eVst.VGA
+ };
CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = eVst.Composite
+ };
Tx.HdmiInput.InputStreamChange += HdmiInputStreamChangeEvent;
Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
@@ -286,6 +313,20 @@ namespace PepperDash.Essentials.DM
Tx.AudioSource = (eVst)inputSelector;
}
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.AudioSourceFeedback);
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
@@ -294,16 +335,20 @@ namespace PepperDash.Essentials.DM
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.AudioSourceFeedback);
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
- }
+ }
void VideoControls_ControlChange(object sender, GenericEventArgs args)
{
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs
index 42b42629..729744b9 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs
@@ -20,8 +20,8 @@ namespace PepperDash.Essentials.DM
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
- [Description("Wrapper class for DM-TX-4K-202-C")]
- public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback,
+ [Description("Wrapper class for DM-TX-4K-202-C")]
+ public class DmTx4k202CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4k202C Tx { get; private set; }
@@ -37,7 +37,21 @@ namespace PepperDash.Essentials.DM
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
- public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
+ public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
@@ -80,106 +94,121 @@ namespace PepperDash.Essentials.DM
{
return new RoutingPortCollection { DmOut, HdmiLoopOut };
}
- }
- public DmTx4k202CController(string key, string name, DmTx4k202C tx)
- : base(key, name, tx)
- {
- Tx = tx;
-
- HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
- HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
- () => ActualActiveVideoInput.ToString());
-
-
-
- Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
- Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
-
- Tx.BaseEvent += Tx_BaseEvent;
-
- VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
-
- AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
-
- HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
-
- HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
-
- HdcpStateFeedback =
- new IntFeedback(
- () =>
- tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
- ? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
- : (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
-
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
-
- Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
-
- Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualActiveVideoInput == eVst.Hdmi1
- && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
- || (ActualActiveVideoInput == eVst.Hdmi2
- && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
-
- HdcpStateFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == eVst.Hdmi1)
- return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
- if (ActualActiveVideoInput == eVst.Hdmi2)
- return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
- return "";
- },
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == eVst.Hdmi1)
- return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
- if (ActualActiveVideoInput == eVst.Hdmi2)
- return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
- return "";
- },
- VideoSyncFeedbackFunc = () =>
- (ActualActiveVideoInput == eVst.Hdmi1
- && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == eVst.Hdmi2
- && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
-
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
-
- DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmCat, null, this);
- HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, null, this);
-
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
- Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
-
- // Set Ports for CEC
- HdmiIn1.Port = Tx.HdmiInputs[1];
- HdmiIn2.Port = Tx.HdmiInputs[2];
- HdmiLoopOut.Port = Tx.HdmiOutput;
- DmOut.Port = Tx.DmOutput;
- }
-
-
-
+ }
+
+ public DmTx4k202CController(string key, string name, DmTx4k202C tx)
+ : base(key, name, tx)
+ {
+ Tx = tx;
+
+ HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
+ {
+ FeedbackMatchObject = eVst.Hdmi1
+ };
+ HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
+ {
+ FeedbackMatchObject = eVst.Hdmi2
+ };
+
+ ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
+ () => ActualActiveVideoInput.ToString());
+
+
+
+ Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
+ Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
+
+ Tx.BaseEvent += Tx_BaseEvent;
+
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
+
+ VideoSourceNumericFeedback = new IntFeedback(() => (int) Tx.VideoSourceFeedback);
+
+ AudioSourceNumericFeedback = new IntFeedback(() => (int) Tx.AudioSourceFeedback);
+
+ HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability",
+ () => (int) tx.HdmiInputs[1].HdcpCapabilityFeedback);
+
+ HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability",
+ () => (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
+
+ HdcpStateFeedback =
+ new IntFeedback(
+ () =>
+ tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
+ ? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
+ : (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
+
+ HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
+
+ Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
+
+ Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool) tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
+
+ var combinedFuncs = new VideoStatusFuncsWrapper
+ {
+ HdcpActiveFeedbackFunc = () =>
+ (ActualActiveVideoInput == eVst.Hdmi1
+ && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
+ || (ActualActiveVideoInput == eVst.Hdmi2
+ && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
+
+ HdcpStateFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == eVst.Hdmi1)
+ return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
+ if (ActualActiveVideoInput == eVst.Hdmi2)
+ return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
+ return "";
+ },
+
+ VideoResolutionFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == eVst.Hdmi1)
+ return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
+ if (ActualActiveVideoInput == eVst.Hdmi2)
+ return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
+ return "";
+ },
+ VideoSyncFeedbackFunc = () =>
+ (ActualActiveVideoInput == eVst.Hdmi1
+ && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == eVst.Hdmi2
+ && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
+
+ };
+
+ AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this,
+ combinedFuncs);
+
+ DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.DmCat, null, this);
+ HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.Hdmi, null, this);
+
+
+ AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
+ AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
+ AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
+ AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback,
+ HdmiIn2HdcpCapabilityFeedback,
+ Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
+
+ // Set Ports for CEC
+ HdmiIn1.Port = Tx.HdmiInputs[1];
+ HdmiIn2.Port = Tx.HdmiInputs[2];
+ HdmiLoopOut.Port = Tx.HdmiOutput;
+ DmOut.Port = Tx.DmOutput;
+ }
+
+
+
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
@@ -294,26 +323,43 @@ namespace PepperDash.Essentials.DM
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
- }
-
- void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
- {
- var id = args.EventId;
- Debug.Console(2, this, "EventId {0}", args.EventId);
-
- switch (id)
- {
- case EndpointTransmitterBase.VideoSourceFeedbackEventId:
- Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- ActiveVideoInputFeedback.FireUpdate();
- VideoSourceNumericFeedback.FireUpdate();
- ActiveVideoInputFeedback.FireUpdate();
- break;
- case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
- AudioSourceNumericFeedback.FireUpdate();
- break;
- }
+ }
+
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ switch (id)
+ {
+ case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
+ VideoSourceNumericFeedback.FireUpdate();
+ ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ break;
+ case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
+ break;
+ }
}
///
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
index dd91b0cc..3e716f60 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.DM
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-302-C")]
- public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
+ public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{
public DmTx4k302C Tx { get; private set; }
@@ -44,7 +44,21 @@ namespace PepperDash.Essentials.DM
public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
- public IntFeedback VgaContrastFeedback { get; protected set; }
+ public IntFeedback VgaContrastFeedback { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
///
/// Helps get the "real" inputs, including when in Auto
@@ -95,13 +109,24 @@ namespace PepperDash.Essentials.DM
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
+ {
+ FeedbackMatchObject = eVst.Hdmi1
+ };
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
+ {
+ FeedbackMatchObject = eVst.Hdmi2
+ };
+
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
- VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
+ VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
+ {
+ FeedbackMatchObject = eVst.Vga
+ };
+
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -110,6 +135,8 @@ namespace PepperDash.Essentials.DM
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
+
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
@@ -387,23 +414,42 @@ namespace PepperDash.Essentials.DM
break;
}
}
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
- }
+ }
///
/// Relays the input stream change to the appropriate RoutingInputPort.
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs
index 47c383ff..da1685cc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs
@@ -1,4 +1,6 @@
using Crestron.SimplSharpPro;
+using System;
+using System.Linq;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
@@ -12,9 +14,9 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
using eVst = eX02VideoSourceType;
- using eAst = eX02AudioSourceType;
-
- public class DmTx4kz202CController : DmTxControllerBase, ITxRouting,
+ using eAst = eX02AudioSourceType;
+
+ public class DmTx4kz202CController : DmTxControllerBase, ITxRoutingWithFeedback,
IIROutputPorts, IComPorts
{
public DmTx4kz202C Tx { get; private set; }
@@ -33,7 +35,21 @@ namespace PepperDash.Essentials.DM
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
- //public override ushort HdcpSupportCapability { get; protected set; }
+ //public override ushort HdcpSupportCapability { get; protected set; }
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+
+
///
/// Helps get the "real" inputs, including when in Auto
@@ -73,14 +89,21 @@ namespace PepperDash.Essentials.DM
public DmTx4kz202CController(string key, string name, DmTx4kz202C tx)
: base(key, name, tx)
{
- Tx = tx;
-
- HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
- HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
+ Tx = tx;
+
+ HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
+ {
+ FeedbackMatchObject = eVst.Hdmi1
+ };
+ HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
+ {
+ FeedbackMatchObject = eVst.Hdmi2
+ };
+
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -89,6 +112,7 @@ namespace PepperDash.Essentials.DM
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
@@ -282,27 +306,44 @@ namespace PepperDash.Essentials.DM
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
- }
-
- void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
- {
- var id = args.EventId;
- Debug.Console(2, this, "EventId {0}", args.EventId);
-
- switch (id)
- {
- case EndpointTransmitterBase.VideoSourceFeedbackEventId:
- Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- ActiveVideoInputFeedback.FireUpdate();
- VideoSourceNumericFeedback.FireUpdate();
- AudioSourceNumericFeedback.FireUpdate();
- ActiveVideoInputFeedback.FireUpdate();
- break;
- case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
- AudioSourceNumericFeedback.FireUpdate();
- break;
- }
+ }
+
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ switch (id)
+ {
+ case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
+ VideoSourceNumericFeedback.FireUpdate();
+ ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ break;
+ case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
+ break;
+ }
}
///
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
index aba7e83c..1e44396c 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
@@ -1,4 +1,6 @@
using Crestron.SimplSharpPro;
+using System;
+using System.Linq;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
@@ -15,8 +17,8 @@ namespace PepperDash.Essentials.DM
using eAst = eX02AudioSourceType;
- [Description("Wrapper class for DM-TX-4K-Z-302-C")]
- public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
+ [Description("Wrapper class for DM-TX-4K-Z-302-C")]
+ public class DmTx4kz302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4kz302C Tx { get; private set; }
@@ -37,7 +39,20 @@ namespace PepperDash.Essentials.DM
public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
- //public override ushort HdcpSupportCapability { get; protected set; }
+ //public override ushort HdcpSupportCapability { get; protected set; }
+
+ //IroutingNumericEvent
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ private void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
///
/// Helps get the "real" inputs, including when in Auto
@@ -83,13 +98,22 @@ namespace PepperDash.Essentials.DM
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
+ {
+ FeedbackMatchObject = eVst.Hdmi1
+ };
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
- VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
- DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
+ {
+ FeedbackMatchObject = eVst.Hdmi2
+ };
+ DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DisplayPort, eVst.DisplayPort, this,
- VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput));
+ VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput))
+ {
+ FeedbackMatchObject = eVst.DisplayPort
+ };
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
@@ -97,6 +121,7 @@ namespace PepperDash.Essentials.DM
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChange;
Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
@@ -293,23 +318,44 @@ namespace PepperDash.Essentials.DM
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
- }
-
- void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
- {
- var id = args.EventId;
- switch (id)
- {
- case EndpointTransmitterBase.VideoSourceFeedbackEventId:
- Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- VideoSourceNumericFeedback.FireUpdate();
- ActiveVideoInputFeedback.FireUpdate();
- break;
- case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
- AudioSourceNumericFeedback.FireUpdate();
- break;
- }
+ }
+
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ var localVideoInputPort =
+ InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ var localAudioInputPort =
+ InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ switch (id)
+ {
+ case EndpointTransmitterBase.VideoSourceFeedbackEventId:
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (eVst)p.Selector == Tx.VideoSourceFeedback);
+ Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
+ VideoSourceNumericFeedback.FireUpdate();
+ ActiveVideoInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
+ break;
+ case EndpointTransmitterBase.AudioSourceFeedbackEventId:
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (eAst)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
+ AudioSourceNumericFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
+ break;
+ }
}
///
diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
index b2de0f8f..b8525e1e 100644
--- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
+++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs
@@ -20,10 +20,12 @@ namespace PepperDash.Essentials.Devices.Displays
///
///
///
- public class SamsungMDC : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IInputDisplayPort1, IInputDisplayPort2,
+ public class SamsungMDC : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor, IInputDisplayPort1, IInputDisplayPort2,
IInputHdmi1, IInputHdmi2, IInputHdmi3, IInputHdmi4, IBridgeAdvanced
{
- public IBasicCommunication Communication { get; private set; }
+ public IBasicCommunication Communication { get; private set; }
+
+
public StatusMonitorBase CommunicationMonitor { get; private set; }
@@ -324,7 +326,10 @@ namespace PepperDash.Essentials.Devices.Displays
_IsMuted = newMute;
MuteFeedback.FireUpdate();
}
- }
+ }
+
+
+
///
///
@@ -335,7 +340,8 @@ namespace PepperDash.Essentials.Devices.Displays
if (newInput != null && newInput != _CurrentInputPort)
{
_CurrentInputPort = newInput;
- CurrentInputFeedback.FireUpdate();
+ CurrentInputFeedback.FireUpdate();
+ OnSwitchChange(new RoutingNumericEventArgs(null, _CurrentInputPort, eRoutingSignalType.AudioVideo));
}
}