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) {