diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 6c8d520b..c70743e1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -111,10 +111,70 @@ namespace PepperDash.Essentials.Core IntFeedback AudioVideoSourceNumericFeedback { get; } } - /// + + /// + /// Defines an IRmcRouting with a feedback event + /// + public interface ITxRoutingWithFeedback : ITxRouting, IRoutingNumericFeedback + { + } + + /// + /// Defines an IRmcRouting with a feedback event + /// + public interface IRmcRoutingWithFeedback : IRmcRouting, IRoutingNumericFeedback + { + } + + /// /// 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 IRoutingNumericFeedback : IKeyName + { + event EventHandler NumericSwitchChange; + void OnSwitchChange(RoutingNumericEventArgs e); + } + + /// + /// Defines an IRoutingNumeric with a feedback event + /// + public interface IRoutingNumericWithFeedback : IRoutingNumeric, IRoutingNumericFeedback + { + } + + public class RoutingNumericEventArgs : EventArgs + { + private readonly uint _output; + private readonly uint _input; + private readonly eRoutingSignalType _sigType; + + public uint Output + { + get { return _output; } + } + + public uint Input + { + get { return _input; } + } + + public eRoutingSignalType SigType + { + get { return _sigType; } + } + + public RoutingNumericEventArgs(uint output, uint input, eRoutingSignalType sigType) + { + _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..116a4af0 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,9 @@ 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; } @@ -153,6 +156,16 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + + void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) { if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId) @@ -172,7 +185,10 @@ namespace PepperDash.Essentials.DM.AirMedia void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) { if (args.EventId == AmX00.VideoOutFeedbackEventId) + { VideoOutFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, eRoutingSignalType.AudioVideo)); + } else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId) AutomaticInputRoutingEnabledFeedback.FireUpdate(); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 1e376950..65cfd50a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -20,13 +20,16 @@ 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; } + //IroutingNumericEvent + public event EventHandler NumericSwitchChange; + // Feedbacks for EssentialDM public Dictionary VideoOutputFeedbacks { get; private set; } public Dictionary AudioOutputFeedbacks { get; private set; } @@ -905,6 +908,15 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); } /// @@ -938,27 +950,35 @@ namespace PepperDash.Essentials.DM 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(); + case DMOutputEventIds.VideoOutEventId: + { + if (Chassis.Outputs[output].VideoOutFeedback == null) return; + 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(); + OnSwitchChange(new RoutingNumericEventArgs(output, Chassis.Outputs[output].VideoOutFeedback.Number, 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(); + case DMOutputEventIds.AudioOutEventId: + { + if (Chassis.Outputs[output].AudioOutFeedback == null) return; + 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(); + OnSwitchChange(new RoutingNumericEventArgs(output, Chassis.Outputs[output].VideoOutFeedback.Number, eRoutingSignalType.Audio)); + } + if (OutputAudioRouteNameFeedbacks.ContainsKey(output)) OutputAudioRouteNameFeedbacks[output].FireUpdate(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index adf73bde..3db892ac 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,7 +57,17 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + public static DmpsRoutingController GetDmpsRoutingController(string key, string name, DmpsRoutingPropertiesConfig properties) @@ -737,39 +750,43 @@ 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 || outputCard.VideoOutFeedback == null) return; + + Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, + outputCard.VideoOutFeedback.Number, output); + + if (VideoOutputFeedbacks.ContainsKey(output)) + { + VideoOutputFeedbacks[output].FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(output, VideoOutputFeedbacks[output].UShortValue, 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)); + } + } + 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..75f8f73b 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; } @@ -102,6 +105,15 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + public void EnableHdcp(uint port) { if (port > _Chassis.NumberOfInputs) return; @@ -328,44 +340,39 @@ 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(); - } + VideoOutputRouteFeedbacks[i].FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs((ushort)i, VideoOutputRouteFeedbacks[i].UShortValue, 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..db9f5012 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,6 +31,19 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + + public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc) : base(key, name, rmc) { @@ -55,12 +68,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 || @@ -72,6 +93,7 @@ namespace PepperDash.Essentials.DM if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId) { AudioVideoSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioVideoSourceNumericFeedback.UShortValue, 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..ab4396d5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -17,7 +17,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 +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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + /// /// Helps get the "real" inputs, including when in Auto @@ -199,7 +212,10 @@ namespace PepperDash.Essentials.DM { ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); - AudioSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); + } @@ -306,11 +322,13 @@ namespace PepperDash.Essentials.DM case EndpointTransmitterBase.VideoSourceFeedbackEventId: Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, 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..d39d2eb6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -14,8 +14,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 +34,19 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } /// /// Helps get the "real" inputs, including when in Auto @@ -196,8 +208,9 @@ namespace PepperDash.Essentials.DM { ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); - AudioSourceNumericFeedback.FireUpdate(); - + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); } private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) @@ -323,10 +336,12 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); break; } } 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..bfd3a890 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -15,7 +15,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 +36,19 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + + /// /// Helps get the "real" inputs, including when in Auto /// @@ -197,7 +210,8 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); AudioSourceNumericFeedback.FireUpdate(); - + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); } private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) @@ -323,10 +337,12 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); break; } } 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..03fcafa5 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,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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + /// /// Helps get the "real" inputs, including when in Auto @@ -118,6 +131,7 @@ namespace PepperDash.Essentials.DM 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 +300,17 @@ namespace PepperDash.Essentials.DM Tx.AudioSource = (eVst)inputSelector; } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, + eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, + eRoutingSignalType.Audio)); + } + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { var id = args.EventId; @@ -297,10 +322,12 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); VideoSourceNumericFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); break; } } 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..c2d6c09c 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,20 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; } @@ -102,6 +115,8 @@ namespace PepperDash.Essentials.DM Tx.BaseEvent += Tx_BaseEvent; + Tx.OnlineStatusChange +=Tx_OnlineStatusChange; + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); @@ -294,6 +309,17 @@ namespace PepperDash.Essentials.DM if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); break; } + } + + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, + eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, + eRoutingSignalType.Audio)); } void Tx_BaseEvent(GenericBase device, BaseEventArgs args) @@ -307,11 +333,13 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, 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..e719fc28 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,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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + /// /// Helps get the "real" inputs, including when in Auto @@ -110,6 +123,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,6 +402,16 @@ namespace PepperDash.Essentials.DM break; } } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, + eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, + eRoutingSignalType.Audio)); + } void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { @@ -397,10 +422,12 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); VideoSourceNumericFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); break; } } 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..2f0ac6ef 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,5 @@ using Crestron.SimplSharpPro; +using System; //using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; @@ -12,9 +13,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 +34,20 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } + + /// /// Helps get the "real" inputs, including when in Auto @@ -89,6 +103,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,8 +297,20 @@ namespace PepperDash.Essentials.DM if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); break; } - } - + } + + private void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, + eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, + eRoutingSignalType.Audio)); + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { var id = args.EventId; @@ -296,11 +323,13 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate(); AudioSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, 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..5dd8d6cb 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,5 @@ using Crestron.SimplSharpPro; +using System; //using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; @@ -15,8 +16,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 +38,19 @@ 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 + public void OnSwitchChange(RoutingNumericEventArgs e) + { + if (NumericSwitchChange != null) NumericSwitchChange(this, e); + } /// /// Helps get the "real" inputs, including when in Auto @@ -97,6 +110,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,7 +307,19 @@ namespace PepperDash.Essentials.DM if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); break; } - } + } + + private void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, + eRoutingSignalType.Video)); + OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, + eRoutingSignalType.Audio)); + } + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { @@ -303,11 +329,13 @@ namespace PepperDash.Essentials.DM case EndpointTransmitterBase.VideoSourceFeedbackEventId: Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Video)); break; case EndpointTransmitterBase.AudioSourceFeedbackEventId: Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, eRoutingSignalType.Audio)); break; } }