From af913b9498053a58fe93d4e68643c82f89973821 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 12 Mar 2026 15:12:27 -0600 Subject: [PATCH] feat: add IHasDestinationList and IHasSourceList interfaces for room management --- .../Room/IHasDestinationList.cs | 14 +++++++++++++ .../Room/IHasSourceList.cs | 14 +++++++++++++ .../Routing/RoutingFeedbackManager.cs | 20 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs create mode 100644 src/PepperDash.Essentials.Core/Room/IHasSourceList.cs diff --git a/src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs b/src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs new file mode 100644 index 00000000..cf52d2d3 --- /dev/null +++ b/src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using PepperDash.Essentials.Core; + + +/// +/// Interface for rooms with a list of destinations +/// +interface IHasDestinationList +{ + /// + /// Gets the dictionary of destinations. + /// + Dictionary Destinations { get; } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Room/IHasSourceList.cs b/src/PepperDash.Essentials.Core/Room/IHasSourceList.cs new file mode 100644 index 00000000..33675add --- /dev/null +++ b/src/PepperDash.Essentials.Core/Room/IHasSourceList.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using PepperDash.Essentials.Core; + + +/// +/// Interface for rooms with a list of destinations +/// +interface IHasSourceList +{ + /// + /// Gets the list of sources. + /// + Dictionary SourceList { get; } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs b/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs index e37d2d57..e5d61bfd 100644 --- a/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs +++ b/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -230,6 +231,15 @@ namespace PepperDash.Essentials.Core.Routing return roomDefaultDisplay.DefaultDisplay.Key == destination.Key; } + if (r is IHasDestinationList roomDestinationList) + { + return roomDestinationList.Destinations.Any(d => + d.Value.Key == destination.Key + ); + } + + var destList = ConfigReader.ConfigObject.GetDestinationListForKey(r.DestinationListKey); + return false; } ); @@ -247,7 +257,15 @@ namespace PepperDash.Essentials.Core.Routing // Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key); - var sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey); + Dictionary sourceList = null; + + if (room is IHasSourceList roomWithSourceList) + { + sourceList = roomWithSourceList.SourceList; + } + else { + sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey); + } if (sourceList == null) {