From d5b90cfbd7c99551c5d3b382c49c2152d37aa64d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 8 May 2024 08:37:25 -0500 Subject: [PATCH] fix: correct build issues --- .../Display/DisplayBase.cs | 5 ++- .../Room/Interfaces.cs | 6 +--- .../Audio/GenericAudioOut.cs | 2 ++ .../Generic/GenericSink.cs | 2 ++ .../SoftCodec/BlueJeansPc.cs | 8 +++-- .../SoftCodec/GenericSoftCodec.cs | 35 +++++++++++++++---- 6 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs index 60089651..2e5a2ed1 100644 --- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs +++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs @@ -18,6 +18,7 @@ namespace PepperDash.Essentials.Core public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; + public event InputChangedEventHandler InputChanged; public string CurrentSourceInfoKey { get; set; } public SourceListItem CurrentSourceInfo @@ -94,7 +95,9 @@ namespace PepperDash.Essentials.Core } } - public abstract void ExecuteSwitch(object selector); + public RoutingInputPort CurrentInputPort => throw new NotImplementedException(); + + public abstract void ExecuteSwitch(object selector); protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) diff --git a/src/PepperDash.Essentials.Core/Room/Interfaces.cs b/src/PepperDash.Essentials.Core/Room/Interfaces.cs index eb0b6f25..a8d9c2a9 100644 --- a/src/PepperDash.Essentials.Core/Room/Interfaces.cs +++ b/src/PepperDash.Essentials.Core/Room/Interfaces.cs @@ -41,9 +41,7 @@ namespace PepperDash.Essentials.Core { void RunRouteAction(string routeKey, string sourceListKey); - void RunRouteAction(string routeKey, string sourceListKey, Action successCallback); - - RoutingFeedbackManager RoutingFeedbackManager { get; } + void RunRouteAction(string routeKey, string sourceListKey, Action successCallback); } /// @@ -52,8 +50,6 @@ namespace PepperDash.Essentials.Core public interface IRunDirectRouteAction { void RunDirectRoute(string sourceKey, string destinationKey, eRoutingSignalType type = eRoutingSignalType.AudioVideo); - - RoutingFeedbackManager RoutingFeedbackManager { get; } } /// diff --git a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs index e9eeb5b5..207c04be 100644 --- a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs +++ b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs @@ -18,6 +18,8 @@ namespace PepperDash.Essentials.Devices.Common /// public class GenericAudioOut : EssentialsDevice, IRoutingSink { + public RoutingInputPort CurrentInputPort => AnyAudioIn; + public event SourceInfoChangeHandler CurrentSourceChange; public string CurrentSourceInfoKey { get; set; } diff --git a/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs b/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs index 940a519e..de7d5174 100644 --- a/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs +++ b/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs @@ -44,6 +44,8 @@ namespace PepperDash.Essentials.Devices.Common.Generic } } + public RoutingInputPort CurrentInputPort => InputPorts[0]; + public event SourceInfoChangeHandler CurrentSourceChange; } diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs index 4dcb663a..52c8d1eb 100644 --- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs +++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs @@ -17,6 +17,8 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec public RoutingInputPort AnyVideoIn { get; private set; } + public RoutingInputPort CurrentInputPort => AnyVideoIn; + #region IRoutingInputs Members public RoutingPortCollection InputPorts { get; private set; } @@ -26,8 +28,10 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec public BlueJeansPc(string key, string name) : base(key, name) { - InputPorts = new RoutingPortCollection(); - InputPorts.Add(AnyVideoIn = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this)); + InputPorts = new RoutingPortCollection + { + (AnyVideoIn = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this)) + }; } #region IRunRouteAction Members diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs index a4155692..ae7acca1 100644 --- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs +++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs @@ -2,17 +2,26 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Routing; using Serilog.Events; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace PepperDash.Essentials.Devices.Common.SoftCodec { - public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSink + public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWithSwitching { + private RoutingInputPort _currentInputPort; + public RoutingInputPort CurrentInputPort { + get => _currentInputPort; + set + { + _currentInputPort = value; + + InputChanged?.Invoke(this, _currentInputPort); + } + } + public GenericSoftCodec(string key, string name, GenericSoftCodecProperties props) : base(key, name) { InputPorts = new RoutingPortCollection(); @@ -27,7 +36,7 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec for(var i = 1; i<= props.ContentInputCount; i++) { - var inputPort = new RoutingInputPort($"{Key}-contentInput{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this); + var inputPort = new RoutingInputPort($"{Key}-contentInput{i}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, $"contentInput{i}", this); InputPorts.Add(inputPort); } @@ -39,7 +48,7 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec for(var i = 1; i <=props.CameraInputCount; i++) { - var cameraPort = new RoutingInputPort($"{Key}-cameraInput{i}", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); + var cameraPort = new RoutingInputPort($"{Key}-cameraInput{i}", eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, $"cameraInput{i}", this); InputPorts.Add(cameraPort); } @@ -74,6 +83,20 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec SourceListItem _CurrentSourceInfo; public event SourceInfoChangeHandler CurrentSourceChange; + public event InputChangedEventHandler InputChanged; + + public void ExecuteSwitch(object inputSelector) + { + var inputPort = InputPorts.FirstOrDefault(p => p.Selector == inputSelector); + + if(inputPort == null) + { + Debug.LogMessage(LogEventLevel.Warning, "No input port found for selector {inputSelector}", inputSelector); + return; + } + + CurrentInputPort = inputPort; + } } public class GenericSoftCodecProperties