From ed468add2c5c994c6383a0d4c6e18bdef38c63cc Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 8 Nov 2019 12:30:49 -0700 Subject: [PATCH] Refactored for source change handler updates --- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 15 ++-- PepperDashEssentials/Devices/Amplifier.cs | 26 +++++++ ...sentialsDualDisplayRoomPropertiesConfig.cs | 2 - .../EssentialsNDisplayRoomPropertiesConfig.cs | 13 +++- .../Room/Types/EssentialsDualDisplayRoom.cs | 76 +++++++++++-------- .../Room/Types/EssentialsHuddleSpaceRoom.cs | 8 +- .../Room/Types/EssentialsHuddleVtc1Room.cs | 8 +- .../Room/Types/EssentialsNDisplayRoomBase.cs | 9 --- .../UI/SubpageReferenceListSourceItem.cs | 2 +- .../EssentialsHuddlePanelAvFunctionsDriver.cs | 3 +- ...entialsHuddleVtc1PanelAvFunctionsDriver.cs | 5 +- .../UIDrivers/SmartObjectRoomsList.cs | 2 +- .../Devices/SourceListItem.cs | 15 ++++ .../Display/BasicIrDisplay.cs | 2 +- .../Display/DisplayBase.cs | 25 +++++- ...lsHuddleSpaceFusionSystemControllerBase.cs | 4 +- .../Room/Interfaces.cs | 2 + .../Routing/RoutingInterfaces.cs | 8 +- .../Audio/GenericAudioOut.cs | 26 +++++++ 19 files changed, 178 insertions(+), 73 deletions(-) diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index c5a9fcbf..a55dbdee 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -334,7 +334,7 @@ namespace PepperDash.Essentials } - void Room_CurrentSingleSourceChange(EssentialsRoomBase room, PepperDash.Essentials.Core.SourceListItem info, ChangeType type) + void Room_CurrentSingleSourceChange(PepperDash.Essentials.Core.SourceListItem info, ChangeType type) { /* Example message * { @@ -395,11 +395,14 @@ namespace PepperDash.Essentials if (dev is ITransport) (dev as ITransport).LinkActions(Parent); - var srcRm = room as IHasCurrentSourceInfoChange; - PostStatusMessage(new - { - selectedSourceKey = srcRm.CurrentSourceInfoKey - }); + var srcRm = Room as IHasCurrentSourceInfoChange; + if (srcRm != null) + { + PostStatusMessage(new + { + selectedSourceKey = srcRm.CurrentSourceInfoKey + }); + } } } } diff --git a/PepperDashEssentials/Devices/Amplifier.cs b/PepperDashEssentials/Devices/Amplifier.cs index bed85856..20d8efa0 100644 --- a/PepperDashEssentials/Devices/Amplifier.cs +++ b/PepperDashEssentials/Devices/Amplifier.cs @@ -12,6 +12,32 @@ namespace PepperDash.Essentials { public class Amplifier : Device, IRoutingSinkNoSwitching { + public event SourceInfoChangeHandler CurrentSourceChange; + + public string CurrentSourceInfoKey { get; set; } + public SourceListItem CurrentSourceInfo + { + get + { + return _CurrentSourceInfo; + } + set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSourceChange; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; + public RoutingInputPort AudioIn { get; private set; } public Amplifier(string key, string name) diff --git a/PepperDashEssentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs b/PepperDashEssentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs index 6abafc24..949e1212 100644 --- a/PepperDashEssentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsDualDisplayRoomPropertiesConfig.cs @@ -11,7 +11,5 @@ namespace PepperDash.Essentials.Room.Config public class EssentialsDualDisplayRoomPropertiesConfig : EssentialsNDisplayRoomPropertiesConfig { - public const string LeftDisplayId = "leftDisplay"; - public const string RightDisplayId = "rightDisplay"; } } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs b/PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs index b72dd9b9..bb6623aa 100644 --- a/PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsNDisplayRoomPropertiesConfig.cs @@ -4,6 +4,9 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; +using PepperDash.Core; +using PepperDash.Essentials.Core; + using Newtonsoft.Json; namespace PepperDash.Essentials.Room.Config @@ -18,13 +21,19 @@ namespace PepperDash.Essentials.Room.Config [JsonProperty("defaultVideoBehavior")] public string DefaultVideoBehavior { get; set; } [JsonProperty("displays")] - public Dictionary Displays { get; set; } + public Dictionary Displays { get; set; } public EssentialsNDisplayRoomPropertiesConfig() { - Displays = new Dictionary(); + Displays = new Dictionary(); } } + public class DisplayItem : IKeyName + { + public string Key { get; set; } + public string Name { get; set; } + } + } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs index 8477682b..79a5f7df 100644 --- a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs @@ -44,8 +44,8 @@ namespace PepperDash.Essentials.Room.Types /// public BoolFeedback IsSharingFeedback { get; private set; } - IRoutingSinkWithSwitching LeftDisplay { get; private set; } - IRoutingSinkWithSwitching RightDisplay { get; private set; } + public IRoutingSinkWithSwitching LeftDisplay { get; private set; } + public IRoutingSinkWithSwitching RightDisplay { get; private set; } protected override Func OnFeedbackFunc @@ -171,19 +171,25 @@ namespace PepperDash.Essentials.Room.Types PropertiesConfig = JsonConvert.DeserializeObject (config.Properties.ToString()); - var leftDispKey = PropertiesConfig.Displays[EssentialsDualDisplayRoomPropertiesConfig.LeftDisplayId]; + var leftDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.leftDisplay]; + if (leftDisp != null) + { - if (!string.IsNullOrEmpty(leftDispKey)) - LeftDisplay = DeviceManager.GetDeviceForKey(leftDispKey) as IRoutingSinkWithSwitching; - else - Debug.Console(0, this, "Unable to get LeftDisplay for Room"); + if (!string.IsNullOrEmpty(leftDisp.Key)) + LeftDisplay = DeviceManager.GetDeviceForKey(leftDisp.Key) as IRoutingSinkWithSwitching; + else + Debug.Console(0, this, "Unable to get LeftDisplay for Room"); + } - var rightDispKey = PropertiesConfig.Displays[EssentialsDualDisplayRoomPropertiesConfig.RightDisplayId]; + var rightDisp = PropertiesConfig.Displays[eSourceListItemDestinationTypes.rightDisplay]; + if (rightDisp != null) + { - if (!string.IsNullOrEmpty(rightDispKey)) - LeftDisplay = DeviceManager.GetDeviceForKey(rightDispKey) as IRoutingSinkWithSwitching; - else - Debug.Console(0, this, "Unable to get LeftDisplay for Room"); + if (!string.IsNullOrEmpty(rightDisp.Key)) + LeftDisplay = DeviceManager.GetDeviceForKey(rightDisp.Key) as IRoutingSinkWithSwitching; + else + Debug.Console(0, this, "Unable to get LeftDisplay for Room"); + } VideoCodec = DeviceManager.GetDeviceForKey(PropertiesConfig.VideoCodecKey) as PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; @@ -428,12 +434,12 @@ namespace PepperDash.Essentials.Room.Types LastSourceKey = routeKey; } - else - CurrentSourceInfoKey = null; + //else + // CurrentSourceInfoKey = null; // hand off the individual routes to this helper foreach (var route in item.RouteList) - DoRouteItem(route); + DoRouteItem(route, item, routeKey); // Start usage timer on routed source var usageNewSource = item.SourceDevice as IUsageTracking; @@ -451,8 +457,7 @@ namespace PepperDash.Essentials.Room.Types if (string.IsNullOrEmpty(item.VolumeControlKey) || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) volDev = DefaultVolumeControls; - else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - volDev = DefaultDisplay as IBasicVolumeControls; + // Or a specific device, probably rarely used. else { @@ -489,14 +494,17 @@ namespace PepperDash.Essentials.Room.Types // store the name and UI info for routes if (item.SourceKey == "$off") { - CurrentSourceInfoKey = routeKey; - CurrentSourceInfo = null; - } - else if (item.SourceKey != null) - { - CurrentSourceInfoKey = routeKey; - CurrentSourceInfo = item; + LeftDisplay.CurrentSourceInfoKey = routeKey; + LeftDisplay.CurrentSourceInfo = null; + RightDisplay.CurrentSourceInfoKey = routeKey; + RightDisplay.CurrentSourceInfo = null; } + //else if (item.SourceKey != null) + //{ + // if(item.RouteList + // CurrentSourceInfoKey = routeKey; + // CurrentSourceInfo = item; + //} OnFeedback.FireUpdate(); @@ -518,7 +526,7 @@ namespace PepperDash.Essentials.Room.Types /// /// /// - void DoRouteItem(SourceRouteListItem route) + void DoRouteItem(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey) { // if there is a $defaultAll on route, run two separate if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) @@ -530,10 +538,10 @@ namespace PepperDash.Essentials.Room.Types SourceKey = route.SourceKey, Type = eRoutingSignalType.Video }; - DoRoute(tempVideo); + DoRoute(tempVideo, sourceItem, sourceItemKey); } else - DoRoute(route); + DoRoute(route, sourceItem, sourceItemKey); } /// @@ -541,14 +549,16 @@ namespace PepperDash.Essentials.Room.Types /// /// /// - bool DoRoute(SourceRouteListItem route) + bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey) { IRoutingSinkNoSwitching dest = null; if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) dest = DefaultAudioDevice as IRoutingSinkNoSwitching; - else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) - dest = DefaultDisplay; + else if (route.DestinationKey.Equals(LeftDisplay.Key, StringComparison.OrdinalIgnoreCase)) + dest = LeftDisplay; + else if (route.DestinationKey.Equals(RightDisplay.Key, StringComparison.OrdinalIgnoreCase)) + dest = RightDisplay; else dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; @@ -561,6 +571,9 @@ namespace PepperDash.Essentials.Room.Types if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) { dest.ReleaseRoute(); + + + if (dest is IPower) (dest as IPower).PowerOff(); } @@ -573,6 +586,9 @@ namespace PepperDash.Essentials.Room.Types return false; } dest.ReleaseAndMakeRoute(source, route.Type); + + dest.CurrentSourceInfoKey = sourceItemKey; + dest.CurrentSourceInfo = sourceItem; } return true; } diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index 650a0eb5..e4b503c3 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -119,7 +119,7 @@ namespace PepperDash.Essentials public SourceListItem CurrentSourceInfo { get { return _CurrentSourceInfo; } - private set + set { if (value == _CurrentSourceInfo) return; @@ -129,7 +129,7 @@ namespace PepperDash.Essentials (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.WillChange); + handler(_CurrentSourceInfo, ChangeType.WillChange); _CurrentSourceInfo = value; @@ -137,12 +137,12 @@ namespace PepperDash.Essentials if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.DidChange); + handler( _CurrentSourceInfo, ChangeType.DidChange); } } SourceListItem _CurrentSourceInfo; - public string CurrentSourceInfoKey { get; private set; } + public string CurrentSourceInfoKey { get; set; } public EssentialsHuddleSpaceRoom(DeviceConfig config) : base(config) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index d37119f4..c8e867a4 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -157,7 +157,7 @@ namespace PepperDash.Essentials public SourceListItem CurrentSourceInfo { get { return _CurrentSourceInfo; } - private set + set { if (value == _CurrentSourceInfo) return; @@ -167,7 +167,7 @@ namespace PepperDash.Essentials (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.WillChange); + handler(_CurrentSourceInfo, ChangeType.WillChange); _CurrentSourceInfo = value; @@ -175,12 +175,12 @@ namespace PepperDash.Essentials if (_CurrentSourceInfo != null && _CurrentSourceInfo.SourceDevice is IInUseTracking) (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); if (handler != null) - handler(this, _CurrentSourceInfo, ChangeType.DidChange); + handler(_CurrentSourceInfo, ChangeType.DidChange); } } SourceListItem _CurrentSourceInfo; - public string CurrentSourceInfoKey { get; private set; } + public string CurrentSourceInfoKey { get; set; } /// /// "codecOsd" diff --git a/PepperDashEssentials/Room/Types/EssentialsNDisplayRoomBase.cs b/PepperDashEssentials/Room/Types/EssentialsNDisplayRoomBase.cs index 21130cc7..677c4048 100644 --- a/PepperDashEssentials/Room/Types/EssentialsNDisplayRoomBase.cs +++ b/PepperDashEssentials/Room/Types/EssentialsNDisplayRoomBase.cs @@ -21,22 +21,13 @@ namespace PepperDash.Essentials.Room.Types { //public event SourceInfoChangeHandler CurrentSingleSourceChange; - public Dictionary Displays { get; protected set; } public EssentialsNDisplayRoomBase(DeviceConfig config) : base (config) { - Displays = new Dictionary(); var propertiesConfig = JsonConvert.DeserializeObject(config.Properties.ToString()); - foreach (var display in propertiesConfig.Displays) - { - var displayDevice = DeviceManager.GetDeviceForKey(display.Value) as IRoutingSinkWithSwitching; - - if (displayDevice != null) - Displays.Add(display.Key, displayDevice); - } } } } \ No newline at end of file diff --git a/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs b/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs index 8479d1e1..3e1869cc 100644 --- a/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs +++ b/PepperDashEssentials/UI/SubpageReferenceListSourceItem.cs @@ -29,7 +29,7 @@ namespace PepperDash.Essentials room.CurrentSourceChange += room_CurrentSourceInfoChange; } - void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type) + void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type) { if (type == ChangeType.WillChange && info == SourceItem) ClearFeedback(); diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index fca0dd71..144fafb4 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -1064,8 +1064,7 @@ namespace PepperDash.Essentials /// /// Handles source change /// - void CurrentRoom_SourceInfoChange(EssentialsRoomBase room, - SourceListItem info, ChangeType change) + void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change) { if (change == ChangeType.WillChange) DisconnectSource(info); diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index de831b8c..57e68010 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -1050,7 +1050,7 @@ namespace PepperDash.Essentials /// /// /// - void CurrentRoom_CurrentSingleSourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type) + void CurrentRoom_CurrentSingleSourceChange(SourceListItem info, ChangeType type) { if (_CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _CurrentRoom.CurrentSourceInfo != null) TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = _CurrentRoom.CurrentSourceInfo.PreferredName; @@ -1363,8 +1363,7 @@ namespace PepperDash.Essentials /// /// Handles source change /// - void CurrentRoom_SourceInfoChange(EssentialsRoomBase room, - SourceListItem info, ChangeType change) + void CurrentRoom_SourceInfoChange(SourceListItem info, ChangeType change) { if (change == ChangeType.WillChange) DisconnectSource(info); diff --git a/PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs b/PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs index 60ccf96a..e43abc09 100644 --- a/PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs +++ b/PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs @@ -68,7 +68,7 @@ namespace PepperDash.Essentials parent.SetItemButtonAction(index, buttonAction); } - void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type) + void room_CurrentSourceInfoChange(SourceListItem info, ChangeType type) { UpdateItem(info); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs index 86c940d3..efa2b2ad 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs @@ -95,6 +95,9 @@ namespace PepperDash.Essentials.Core [JsonProperty("disableRoutedSharing")] public bool DisableRoutedSharing { get; set; } + [JsonProperty("destinations")] + public List Destinations { get; set; } + public SourceListItem() { Icon = "Blank"; @@ -112,4 +115,16 @@ namespace PepperDash.Essentials.Core [JsonProperty("type")] public eRoutingSignalType Type { get; set; } } + + /// + /// Defines the valid destination types for SourceListItems in a room + /// + public enum eSourceListItemDestinationTypes + { + defaultDisplay, + leftDisplay, + rightDisplay, + programAudio, + codecContent + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index b724366f..3ffd0bf4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core { - public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling, IRoutingSinkWithSwitching + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IPower, IWarmingCooling { public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 8b3b6191..98659ab2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -20,8 +20,29 @@ namespace PepperDash.Essentials.Core { public event SourceInfoChangeHandler CurrentSourceChange; - public string CurrentSourceInfoKey { get; protected set; } - public SourceListItem CurrentSourceInfo { get; protected set; } + public string CurrentSourceInfoKey { get; set; } + public SourceListItem CurrentSourceInfo + { + get + { + return _CurrentSourceInfo; + } + set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSourceChange; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; public BoolFeedback PowerIsOnFeedback { get; protected set; } public BoolFeedback IsCoolingDownFeedback { get; protected set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index a00b38b7..ef5634aa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -1387,7 +1387,7 @@ namespace PepperDash.Essentials.Core.Fusion /// /// Event handler for when room source changes /// - protected void Room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type) + protected void Room_CurrentSourceInfoChange(SourceListItem info, ChangeType type) { // Handle null. Nothing to do when switching from or to null if (info == null || info.SourceDevice == null) @@ -1403,7 +1403,7 @@ namespace PepperDash.Essentials.Core.Fusion { if (SourceToFeedbackSigs.ContainsKey(dev)) SourceToFeedbackSigs[dev].BoolValue = true; - var name = (room == null ? "" : room.Name); + //var name = (room == null ? "" : room.Name); CurrentRoomSourceNameSig.InputSig.StringValue = info.SourceDevice.Name; } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs index e0d042a2..745f161d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Interfaces.cs @@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Core void RunRouteAction(string routeKey); void RunRouteAction(string routeKey, Action successCallback); + + } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index af8612d2..118bdc0a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -15,7 +15,7 @@ namespace PepperDash.Essentials.Core /// /// The handler type for a Room's SourceInfoChange /// - public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type); + public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type); //******************************************************************************************* @@ -26,8 +26,8 @@ namespace PepperDash.Essentials.Core /// public interface IHasCurrentSourceInfoChange { - string CurrentSourceInfoKey { get; } - SourceListItem CurrentSourceInfo { get; } + string CurrentSourceInfoKey { get; set; } + SourceListItem CurrentSourceInfo { get; set; } event SourceInfoChangeHandler CurrentSourceChange; } @@ -52,7 +52,7 @@ namespace PepperDash.Essentials.Core /// /// For fixed-source endpoint devices /// - public interface IRoutingSinkNoSwitching : IRoutingInputs + public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange { } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs index d9ba06cf..d89a36fc 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Audio/GenericAudioOut.cs @@ -15,6 +15,32 @@ namespace PepperDash.Essentials.Devices.Common /// public class GenericAudioOut : Device, IRoutingSinkNoSwitching { + public event SourceInfoChangeHandler CurrentSourceChange; + + public string CurrentSourceInfoKey { get; set; } + public SourceListItem CurrentSourceInfo + { + get + { + return _CurrentSourceInfo; + } + set + { + if (value == _CurrentSourceInfo) return; + + var handler = CurrentSourceChange; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.WillChange); + + _CurrentSourceInfo = value; + + if (handler != null) + handler(_CurrentSourceInfo, ChangeType.DidChange); + } + } + SourceListItem _CurrentSourceInfo; + public RoutingInputPort AnyAudioIn { get; private set; } public GenericAudioOut(string key, string name)