diff --git a/src/PepperDash.Core/Comm/GenericTcpIpClient.cs b/src/PepperDash.Core/Comm/GenericTcpIpClient.cs
index 52670899..54298cc3 100644
--- a/src/PepperDash.Core/Comm/GenericTcpIpClient.cs
+++ b/src/PepperDash.Core/Comm/GenericTcpIpClient.cs
@@ -131,12 +131,6 @@ public class GenericTcpIpClient : Device, ISocketStatusWithStreamDebugging, IAut
///
public string ClientStatusText { get { return ClientStatus.ToString(); } }
- ///
- /// Ushort representation of client status
- ///
- [Obsolete]
- public ushort UClientStatus { get { return (ushort)ClientStatus; } }
-
///
/// Connection failure reason
///
diff --git a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs
index 03f7af0e..3e61bd80 100644
--- a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs
+++ b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core;
@@ -11,23 +12,22 @@ namespace PepperDash.Essentials.Core;
///
public class DestinationListItem
{
-
///
/// Gets or sets the key identifier for the sink device that this destination represents.
///
[JsonProperty("sinkKey")]
public string SinkKey { get; set; }
- private EssentialsDevice _sinkDevice;
+ private IRoutingSink _sinkDevice;
///
/// Gets the actual device instance for this destination.
/// Lazily loads the device from the DeviceManager using the SinkKey.
///
[JsonIgnore]
- public EssentialsDevice SinkDevice
+ public IRoutingSink SinkDevice
{
- get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as EssentialsDevice); }
+ get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as IRoutingSink); }
}
///
diff --git a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
index 7ffd711d..97ff9efe 100644
--- a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
+++ b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
@@ -43,17 +43,17 @@ public class SourceListItem
/// Returns the source Device for this, if it exists in DeviceManager
///
[JsonIgnore]
- public Device SourceDevice
+ public IRoutingSource SourceDevice
{
get
{
if (_SourceDevice == null)
- _SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device;
+ _SourceDevice = DeviceManager.GetDeviceForKey(SourceKey);
return _SourceDevice;
}
}
- private Device _SourceDevice;
+ private IRoutingSource _SourceDevice;
///
/// Gets either the source's Name or this AlternateName property, if
diff --git a/src/PepperDash.Essentials.Core/Fusion/IEssentialsRoomFusionController.cs b/src/PepperDash.Essentials.Core/Fusion/IEssentialsRoomFusionController.cs
index 564fa395..0efdf5e1 100644
--- a/src/PepperDash.Essentials.Core/Fusion/IEssentialsRoomFusionController.cs
+++ b/src/PepperDash.Essentials.Core/Fusion/IEssentialsRoomFusionController.cs
@@ -1236,11 +1236,14 @@ namespace PepperDash.Essentials.Core.Fusion
uint i = 0;
foreach (var kvp in setTopBoxes)
{
- TryAddRouteActionSigs(JoinMap.Display1SetTopBoxSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1SetTopBoxSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
- i++;
- if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots
+ if (kvp.Value.SourceDevice is Device device)
{
- break;
+ TryAddRouteActionSigs(JoinMap.Display1SetTopBoxSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1SetTopBoxSourceStart.JoinNumber + i, kvp.Key, device);
+ i++;
+ if (i > JoinMap.Display1SetTopBoxSourceStart.JoinSpan) // We only have five spots
+ {
+ break;
+ }
}
}
@@ -1248,11 +1251,14 @@ namespace PepperDash.Essentials.Core.Fusion
i = 0;
foreach (var kvp in discPlayers)
{
- TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
- i++;
- if (i > JoinMap.Display1DiscPlayerSourceStart.JoinSpan) // We only have five spots
+ if (kvp.Value.SourceDevice is Device device)
{
- break;
+ TryAddRouteActionSigs(JoinMap.Display1DiscPlayerSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1DiscPlayerSourceStart.JoinNumber + i, kvp.Key, device);
+ i++;
+ if (i > JoinMap.Display1DiscPlayerSourceStart.JoinSpan) // We only have five spots
+ {
+ break;
+ }
}
}
@@ -1260,11 +1266,14 @@ namespace PepperDash.Essentials.Core.Fusion
i = 0;
foreach (var kvp in laptops)
{
- TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, kvp.Value.SourceDevice);
- i++;
- if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots???
+ if (kvp.Value.SourceDevice is Device device)
{
- break;
+ TryAddRouteActionSigs(JoinMap.Display1LaptopSourceStart.AttributeName + " " + (i + 1), JoinMap.Display1LaptopSourceStart.JoinNumber + i, kvp.Key, device);
+ i++;
+ if (i > JoinMap.Display1LaptopSourceStart.JoinSpan) // We only have ten spots???
+ {
+ break;
+ }
}
}
@@ -1745,22 +1754,24 @@ namespace PepperDash.Essentials.Core.Fusion
return;
}
- var dev = info.SourceDevice;
- if (type == ChangeType.WillChange)
+ if (info.SourceDevice is Device dev)
{
- if (_sourceToFeedbackSigs.ContainsKey(dev))
+ if (type == ChangeType.WillChange)
{
- _sourceToFeedbackSigs[dev].BoolValue = false;
+ if (_sourceToFeedbackSigs.ContainsKey(dev))
+ {
+ _sourceToFeedbackSigs[dev].BoolValue = false;
+ }
}
- }
- else
- {
- if (_sourceToFeedbackSigs.ContainsKey(dev))
+ else
{
- _sourceToFeedbackSigs[dev].BoolValue = true;
+ if (_sourceToFeedbackSigs.ContainsKey(dev))
+ {
+ _sourceToFeedbackSigs[dev].BoolValue = true;
+ }
+ //var name = (room == null ? "" : room.Name);
+ CurrentRoomSourceNameSig.InputSig.StringValue = dev.Name;
}
- //var name = (room == null ? "" : room.Name);
- CurrentRoomSourceNameSig.InputSig.StringValue = info.SourceDevice.Name;
}
}
diff --git a/src/PepperDash.Essentials.Core/Room/Interfaces.cs b/src/PepperDash.Essentials.Core/Room/Interfaces.cs
index c0041a9a..fd55755a 100644
--- a/src/PepperDash.Essentials.Core/Room/Interfaces.cs
+++ b/src/PepperDash.Essentials.Core/Room/Interfaces.cs
@@ -28,18 +28,6 @@ public interface IHasDefaultDisplay
IRoutingSink DefaultDisplay { get; }
}
-///
-/// For rooms with multiple displays
-///
-[Obsolete("This interface is being deprecated in favor of using destination lists for routing to multiple displays.")]
-public interface IHasMultipleDisplays
-{
- ///
- /// A dictionary of displays in the room with the key being the type of display (presentation, calling, etc.) and the value being the display device
- ///
- Dictionary Displays { get; }
-}
-
///
/// For rooms with routing
///
diff --git a/src/PepperDash.Essentials.Core/Routing/ICurrentSources.cs b/src/PepperDash.Essentials.Core/Routing/ICurrentSources.cs
index a8940d08..eb575815 100644
--- a/src/PepperDash.Essentials.Core/Routing/ICurrentSources.cs
+++ b/src/PepperDash.Essentials.Core/Routing/ICurrentSources.cs
@@ -6,6 +6,7 @@ namespace PepperDash.Essentials.Core.Routing
///
/// The current sources for the room, keyed by eRoutingSignalType.
/// This allows for multiple sources to be tracked, such as audio and video.
+ /// Intended to be implemented on a DestinationListItem to provide access to the current sources for the room in its context.
///
///
/// This interface is used to provide access to the current sources in a room,
@@ -17,7 +18,7 @@ namespace PepperDash.Essentials.Core.Routing
/// Gets the current sources for the room, keyed by eRoutingSignalType.
/// This dictionary contains the current source for each signal type, such as audio, video, and control signals.
///
- Dictionary CurrentSources { get; }
+ Dictionary CurrentSources { get; }
///
/// Gets the current source keys for the room, keyed by eRoutingSignalType.
@@ -28,16 +29,51 @@ namespace PepperDash.Essentials.Core.Routing
///
/// Event raised when the current sources change.
///
- event EventHandler CurrentSourcesChanged;
+ event EventHandler CurrentSourcesChanged;
///
/// Sets the current source for a specific signal type.
/// This method updates the current source for the specified signal type and notifies any subscribers of the change.
///
/// The signal type to update.
- /// The key for the source list.
- /// The source list item to set as the current source.
- void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem);
+ /// The source device to set as the current source.
+ void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice);
+
}
-}
+
+
+ ///
+ /// Event arguments for the CurrentSourcesChanged event, providing details about the signal type and the previous and new sources.
+ ///
+ public class CurrentSourcesChangedEventArgs : EventArgs
+ {
+ ///
+ /// Gets the signal type for which the current source has changed.
+ ///
+ public eRoutingSignalType SignalType { get; }
+
+ ///
+ /// Gets the previous source for the signal type before the change occurred.
+ ///
+ public IRoutingSource PreviousSource { get; }
+
+ ///
+ /// Gets the new source for the signal type after the change occurred.
+ ///
+ public IRoutingSource NewSource { get; }
+
+ ///
+ /// Initializes a new instance of the CurrentSourcesChangedEventArgs class with the specified signal type, previous source, and new source.
+ ///
+ /// The signal type for which the current source has changed.
+ /// The previous source for the signal type before the change occurred.
+ /// The new source for the signal type after the change occurred.
+ public CurrentSourcesChangedEventArgs(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource newSource)
+ {
+ SignalType = signalType;
+ PreviousSource = previousSource;
+ NewSource = newSource;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Routing/IRoutingOutputs.cs b/src/PepperDash.Essentials.Core/Routing/IRoutingOutputs.cs
index da2f6362..702a2367 100644
--- a/src/PepperDash.Essentials.Core/Routing/IRoutingOutputs.cs
+++ b/src/PepperDash.Essentials.Core/Routing/IRoutingOutputs.cs
@@ -1,4 +1,5 @@
-using PepperDash.Core;
+using Newtonsoft.Json;
+using PepperDash.Core;
namespace PepperDash.Essentials.Core;
@@ -11,6 +12,7 @@ public interface IRoutingOutputs : IKeyed
///
/// Collection of Output Ports
///
+ [JsonProperty("outputPorts")]
RoutingPortCollection OutputPorts { get; }
}
diff --git a/src/PepperDash.Essentials.Core/Routing/IRoutingSink.cs b/src/PepperDash.Essentials.Core/Routing/IRoutingSink.cs
index b8af02d9..9426474a 100644
--- a/src/PepperDash.Essentials.Core/Routing/IRoutingSink.cs
+++ b/src/PepperDash.Essentials.Core/Routing/IRoutingSink.cs
@@ -1,3 +1,4 @@
+using PepperDash.Core;
using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core;
@@ -5,7 +6,7 @@ namespace PepperDash.Essentials.Core;
///
/// Defines the contract for IRoutingSink
///
-public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange
+public interface IRoutingSink : IRoutingInputs, IKeyName, ICurrentSources
{
}
@@ -20,10 +21,4 @@ public interface IRoutingSinkWithInputPort : IRoutingSink
RoutingInputPort CurrentInputPort { get; }
}
-///
-/// Interface for routing sinks that have access to the current source information.
-///
-public interface IRoutingSinkWithCurrentSources : IRoutingSink, ICurrentSources
-{
-}
diff --git a/src/PepperDash.Essentials.Core/Routing/IRoutingSinkWithFeedback.cs b/src/PepperDash.Essentials.Core/Routing/IRoutingSinkWithFeedback.cs
index 63f51953..d4f9c484 100644
--- a/src/PepperDash.Essentials.Core/Routing/IRoutingSinkWithFeedback.cs
+++ b/src/PepperDash.Essentials.Core/Routing/IRoutingSinkWithFeedback.cs
@@ -5,8 +5,9 @@
///
/// Defines the contract for IRoutingSinkWithFeedback
///
-public interface IRoutingSinkWithFeedback : IRoutingSinkWithSwitching
+public interface IRoutingSinkWithFeedback : IRoutingSink
{
-
}
+
+
diff --git a/src/PepperDash.Essentials.Core/Routing/IRoutingSource.cs b/src/PepperDash.Essentials.Core/Routing/IRoutingSource.cs
index 5eaaabf8..880d947f 100644
--- a/src/PepperDash.Essentials.Core/Routing/IRoutingSource.cs
+++ b/src/PepperDash.Essentials.Core/Routing/IRoutingSource.cs
@@ -1,8 +1,10 @@
-namespace PepperDash.Essentials.Core;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core;
///
/// Marker interface to identify a device that acts as the origin of a signal path ().
///
-public interface IRoutingSource : IRoutingOutputs
+public interface IRoutingSource : IRoutingOutputs, IKeyName
{
}
\ 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 152b245a..69f41d64 100644
--- a/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs
+++ b/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs
@@ -9,15 +9,15 @@ namespace PepperDash.Essentials.Core.Routing;
/// Manages routing feedback by subscribing to route changes on midpoint and sink devices,
/// tracing the route back to the original source, and updating the CurrentSourceInfo on sink devices.
///
-public class RoutingFeedbackManager: EssentialsDevice
+public class RoutingFeedbackManager : EssentialsDevice
{
///
/// Initializes a new instance of the class.
///
/// The unique key for this manager device.
/// The name of this manager device.
- public RoutingFeedbackManager(string key, string name): base(key, name)
- {
+ public RoutingFeedbackManager(string key, string name) : base(key, name)
+ {
AddPreActivationAction(SubscribeForMidpointFeedback);
AddPreActivationAction(SubscribeForSinkFeedback);
}
@@ -41,12 +41,12 @@ public class RoutingFeedbackManager: EssentialsDevice
///
private void SubscribeForSinkFeedback()
{
- var sinkDevices = DeviceManager.AllDevices.OfType();
+ var sinkDevices = DeviceManager.AllDevices.OfType();
- foreach (var device in sinkDevices)
- {
- device.InputChanged += HandleSinkUpdate;
- }
+ foreach (var device in sinkDevices)
+ {
+ device.InputChanged += HandleSinkUpdate;
+ }
}
///
@@ -59,7 +59,7 @@ public class RoutingFeedbackManager: EssentialsDevice
{
try
{
- var devices = DeviceManager.AllDevices.OfType();
+ var devices = DeviceManager.AllDevices.OfType();
foreach (var device in devices)
{
@@ -96,13 +96,13 @@ public class RoutingFeedbackManager: EssentialsDevice
///
/// The destination sink device to update.
/// The currently selected input port on the destination device.
- private void UpdateDestination(IRoutingSinkWithSwitching destination, RoutingInputPort inputPort)
- {
+ private void UpdateDestination(IRoutingSink destination, RoutingInputPort inputPort)
+ {
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Updating destination {destination} with inputPort {inputPort}", this,destination?.Key, inputPort?.Key);
- if(inputPort == null)
+ if (inputPort == null)
{
- Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "Destination {destination} has not reported an input port yet", this,destination.Key);
+ Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "Destination {destination} has not reported an input port yet", this, destination.Key);
return;
}
@@ -116,19 +116,10 @@ public class RoutingFeedbackManager: EssentialsDevice
if (firstTieLine == null)
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "No tieline found for inputPort {inputPort}. Clearing current source", this, inputPort);
-
- var tempSourceListItem = new SourceListItem
- {
- SourceKey = "$transient",
- Name = inputPort.Key,
- };
-
-
- destination.CurrentSourceInfo = tempSourceListItem; ;
- destination.CurrentSourceInfoKey = "$transient";
return;
}
- } catch (Exception ex)
+ }
+ catch (Exception ex)
{
Debug.LogMessage(ex, "Error getting first tieline: {Exception}", this, ex);
return;
@@ -136,6 +127,7 @@ public class RoutingFeedbackManager: EssentialsDevice
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Getting source for first TieLine {tieLine}", this, firstTieLine);
+
TieLine sourceTieLine;
try
{
@@ -145,91 +137,34 @@ public class RoutingFeedbackManager: EssentialsDevice
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "No route found to source for inputPort {inputPort}. Clearing current source", this, inputPort);
- var tempSourceListItem = new SourceListItem
- {
- SourceKey = "$transient",
- Name = "None",
- };
- destination.CurrentSourceInfo = tempSourceListItem;
- destination.CurrentSourceInfoKey = string.Empty;
+ destination.SetCurrentSource(sourceTieLine.Type, null);
+
+
return;
}
- } catch(Exception ex)
+ }
+ catch (Exception ex)
{
Debug.LogMessage(ex, "Error getting sourceTieLine: {Exception}", this, ex);
return;
}
- // Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found root TieLine {tieLine}", this, sourceTieLine);
-
- // Does not handle combinable scenarios or other scenarios where a display might be part of multiple rooms yet.
- var room = DeviceManager.AllDevices.OfType().FirstOrDefault((r) => {
- if(r is IHasMultipleDisplays roomMultipleDisplays)
- {
- return roomMultipleDisplays.Displays.Any(d => d.Value.Key == destination.Key);
- }
-
- if(r is IHasDefaultDisplay roomDefaultDisplay)
- {
- return roomDefaultDisplay.DefaultDisplay.Key == destination.Key;
- }
-
- return false;
- });
-
- if(room == null)
- {
- Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "No room found for display {destination}", this, destination.Key);
- return;
- }
-
- // Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key);
-
- var sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey);
-
- if (sourceList == null)
- {
- Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "No source list found for source list key {key}. Unable to find source for tieLine {sourceTieLine}", this, room.SourceListKey, sourceTieLine);
- return;
- }
-
- // Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found sourceList for room {room}", this, room.Key);
-
- var sourceListItem = sourceList.FirstOrDefault(sli => {
- //// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose,
- // "SourceListItem {sourceListItem}:{sourceKey} tieLine sourceport device key {sourcePortDeviceKey}",
- // this,
- // sli.Key,
- // sli.Value.SourceKey,
- // sourceTieLine.SourcePort.ParentDevice.Key);
-
- return sli.Value.SourceKey.Equals(sourceTieLine.SourcePort.ParentDevice.Key,StringComparison.InvariantCultureIgnoreCase);
- });
-
- var source = sourceListItem.Value;
- var sourceKey = sourceListItem.Key;
-
- if (source == null)
+ if (sourceTieLine.SourcePort.ParentDevice == null)
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "No source found for device {key}. Creating transient source for {destination}", this, sourceTieLine.SourcePort.ParentDevice.Key, destination);
- var tempSourceListItem = new SourceListItem
- {
- SourceKey = "$transient",
- Name = sourceTieLine.SourcePort.Key,
- };
+ destination.SetCurrentSource(sourceTieLine.Type, null);
- destination.CurrentSourceInfoKey = "$transient";
- destination.CurrentSourceInfo = tempSourceListItem;
return;
}
//Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Got Source {@source} with key {sourceKey}", this, source, sourceKey);
- destination.CurrentSourceInfoKey = sourceKey;
- destination.CurrentSourceInfo = source;
-
+ if (sourceTieLine.SourcePort.ParentDevice is IRoutingSource sourceDevice)
+ {
+ destination.SetCurrentSource(sourceTieLine.Type, sourceDevice);
+ }
}
///
@@ -249,13 +184,14 @@ public class RoutingFeedbackManager: EssentialsDevice
{
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "TieLine Source device {sourceDevice} is midpoint", this, midpoint);
- if(midpoint.CurrentRoutes == null || midpoint.CurrentRoutes.Count == 0)
+ if (midpoint.CurrentRoutes == null || midpoint.CurrentRoutes.Count == 0)
{
- Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "Midpoint {midpointKey} has no routes",this, midpoint.Key);
+ Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "Midpoint {midpointKey} has no routes", this, midpoint.Key);
return null;
}
- var currentRoute = midpoint.CurrentRoutes.FirstOrDefault(route => {
+ var currentRoute = midpoint.CurrentRoutes.FirstOrDefault(route =>
+ {
//Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Checking {route} against {tieLine}", this, route, tieLine);
return route.OutputPort != null && route.InputPort != null && route.OutputPort?.Key == tieLine.SourcePort.Key && route.OutputPort?.ParentDevice.Key == tieLine.SourcePort.ParentDevice.Key;
@@ -269,9 +205,11 @@ public class RoutingFeedbackManager: EssentialsDevice
//Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found currentRoute {currentRoute} through {midpoint}", this, currentRoute, midpoint);
- nextTieLine = TieLineCollection.Default.FirstOrDefault(tl => {
+ nextTieLine = TieLineCollection.Default.FirstOrDefault(tl =>
+ {
//Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Checking {route} against {tieLine}", tl.DestinationPort.Key, currentRoute.InputPort.Key);
- return tl.DestinationPort.Key == currentRoute.InputPort.Key && tl.DestinationPort.ParentDevice.Key == currentRoute.InputPort.ParentDevice.Key; });
+ return tl.DestinationPort.Key == currentRoute.InputPort.Key && tl.DestinationPort.ParentDevice.Key == currentRoute.InputPort.ParentDevice.Key;
+ });
if (nextTieLine != null)
{
@@ -292,13 +230,14 @@ public class RoutingFeedbackManager: EssentialsDevice
return tieLine;
}
- nextTieLine = TieLineCollection.Default.FirstOrDefault(tl => tl.DestinationPort.Key == tieLine.SourcePort.Key && tl.DestinationPort.ParentDevice.Key == tieLine.SourcePort.ParentDevice.Key );
+ nextTieLine = TieLineCollection.Default.FirstOrDefault(tl => tl.DestinationPort.Key == tieLine.SourcePort.Key && tl.DestinationPort.ParentDevice.Key == tieLine.SourcePort.ParentDevice.Key);
if (nextTieLine != null)
{
return GetRootTieLine(nextTieLine);
}
- } catch (Exception ex)
+ }
+ catch (Exception ex)
{
Debug.LogMessage(ex, "Error walking tieLines: {Exception}", this, ex);
return null;
diff --git a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs
index 9b8dd2e5..252e4dc4 100644
--- a/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs
+++ b/src/PepperDash.Essentials.Devices.Common/Audio/GenericAudioOut.cs
@@ -1,9 +1,10 @@
using System.Collections.Generic;
using PepperDash.Core;
+using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
-
+using PepperDash.Essentials.Core.Routing;
using Serilog.Events;
namespace PepperDash.Essentials.Devices.Common;
@@ -13,33 +14,19 @@ namespace PepperDash.Essentials.Devices.Common;
///
public class GenericAudioOut : EssentialsDevice, IRoutingSink
{
+ ///
public RoutingInputPort CurrentInputPort => AnyAudioIn;
- public event SourceInfoChangeHandler CurrentSourceChange;
- public string CurrentSourceInfoKey { get; set; }
- public SourceListItem CurrentSourceInfo
- {
- get
- {
- return _CurrentSourceInfo;
- }
- set
- {
- if (value == _CurrentSourceInfo) return;
+ ///
+ public Dictionary CurrentSources { get; private set; }
- var handler = CurrentSourceChange;
+ ///
+ public Dictionary CurrentSourceKeys { get; private set; }
- if (handler != null)
- handler(_CurrentSourceInfo, ChangeType.WillChange);
+ ///
+ public event System.EventHandler CurrentSourcesChanged;
- _CurrentSourceInfo = value;
-
- if (handler != null)
- handler(_CurrentSourceInfo, ChangeType.DidChange);
- }
- }
- SourceListItem _CurrentSourceInfo;
///
/// Gets or sets the AnyAudioIn
@@ -56,6 +43,66 @@ public class GenericAudioOut : EssentialsDevice, IRoutingSink
{
AnyAudioIn = new RoutingInputPort(RoutingPortNames.AnyAudioIn, eRoutingSignalType.Audio,
eRoutingPortConnectionType.LineAudio, null, this);
+
+ CurrentSources = new Dictionary
+ {
+ { eRoutingSignalType.Audio, null },
+ };
+
+ CurrentSourceKeys = new Dictionary
+ {
+ { eRoutingSignalType.Audio, string.Empty },
+ };
+ }
+
+ ///
+ public virtual void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice)
+ {
+ foreach (eRoutingSignalType type in System.Enum.GetValues(typeof(eRoutingSignalType)))
+ {
+ var flagValue = System.Convert.ToInt32(type);
+ // Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
+ // (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
+ if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
+ {
+ this.LogDebug("Skipping {type}", type);
+ continue;
+ }
+
+ this.LogDebug("setting {type}", type);
+
+ var previousSource = CurrentSources[type];
+
+ if (signalType.HasFlag(type))
+ {
+ UpdateCurrentSources(type, previousSource, sourceDevice);
+ }
+ }
+ }
+
+ private void UpdateCurrentSources(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource sourceDevice)
+ {
+ if (CurrentSources.ContainsKey(signalType))
+ {
+ CurrentSources[signalType] = sourceDevice;
+ }
+ else
+ {
+ CurrentSources.Add(signalType, sourceDevice);
+ }
+
+ // Update the current source key for the specified signal type
+ if (CurrentSourceKeys.ContainsKey(signalType))
+ {
+ CurrentSourceKeys[signalType] = sourceDevice.Key;
+ }
+ else
+ {
+ CurrentSourceKeys.Add(signalType, sourceDevice.Key);
+ }
+
+ // Raise the CurrentSourcesChanged event
+ CurrentSourcesChanged?.Invoke(this, new CurrentSourcesChangedEventArgs(signalType, previousSource, sourceDevice));
}
#region IRoutingInputs Members
@@ -116,13 +163,20 @@ public class GenericAudioOutWithVolume : GenericAudioOut, IHasVolumeDevice
}
+///
+/// Factory for creating GenericAudioOutWithVolume devices
+///
public class GenericAudioOutWithVolumeFactory : EssentialsDeviceFactory
{
+ ///
+ /// Constructor for GenericAudioOutWithVolumeFactory
+ ///
public GenericAudioOutWithVolumeFactory()
{
TypeNames = new List() { "genericaudiooutwithvolume" };
}
+ ///
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new GenericAudioOutWithVolumeFactory Device");
diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs
index fba36564..5f35e90a 100644
--- a/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs
+++ b/src/PepperDash.Essentials.Devices.Common/Displays/DisplayBase.cs
@@ -48,48 +48,20 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
///
public event InputChangedEventHandler InputChanged;
- ///
- /// Event that is raised when the current source information changes.
- ///
- public event SourceInfoChangeHandler CurrentSourceChange;
-
///
/// Gets or sets the CurrentSourceInfoKey
///
public string CurrentSourceInfoKey { get; set; }
- ///
- /// Gets or sets the current source information for the display.
- ///
- public SourceListItem CurrentSourceInfo
- {
- get
- {
- return _CurrentSourceInfo;
- }
- set
- {
- if (value == _CurrentSourceInfo) return;
-
- var handler = CurrentSourceChange;
-
- handler?.Invoke(_CurrentSourceInfo, ChangeType.WillChange);
-
- _CurrentSourceInfo = value;
-
- handler?.Invoke(_CurrentSourceInfo, ChangeType.DidChange);
- }
- }
- SourceListItem _CurrentSourceInfo;
///
- public Dictionary CurrentSources { get; private set; }
+ public Dictionary CurrentSources { get; private set; }
///
public Dictionary CurrentSourceKeys { get; private set; }
///
- public event EventHandler CurrentSourcesChanged;
+ public event EventHandler CurrentSourcesChanged;
///
/// Gets feedback indicating whether the display is currently cooling down after being powered off.
@@ -163,7 +135,7 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
InputPorts = new RoutingPortCollection();
- CurrentSources = new Dictionary
+ CurrentSources = new Dictionary
{
{ eRoutingSignalType.Audio, null },
{ eRoutingSignalType.Video, null },
@@ -388,7 +360,7 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
}
///
- public virtual void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
+ public virtual void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice)
{
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
{
@@ -403,35 +375,38 @@ public abstract class DisplayBase : EssentialsDevice, IDisplay, ICurrentSources,
this.LogDebug("setting {type}", type);
+ var previousSource = CurrentSources[type];
+
if (signalType.HasFlag(type))
{
- UpdateCurrentSources(type, sourceListKey, sourceListItem);
+ UpdateCurrentSources(type, previousSource, sourceDevice);
}
}
- // Raise the CurrentSourcesChanged event
- CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
}
- private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
+ private void UpdateCurrentSources(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource sourceDevice)
{
if (CurrentSources.ContainsKey(signalType))
{
- CurrentSources[signalType] = sourceListItem;
+ CurrentSources[signalType] = sourceDevice;
}
else
{
- CurrentSources.Add(signalType, sourceListItem);
+ CurrentSources.Add(signalType, sourceDevice);
}
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
- CurrentSourceKeys[signalType] = sourceListKey;
+ CurrentSourceKeys[signalType] = sourceDevice.Key;
}
else
{
- CurrentSourceKeys.Add(signalType, sourceListKey);
+ CurrentSourceKeys.Add(signalType, sourceDevice.Key);
}
+
+ // Raise the CurrentSourcesChanged event
+ CurrentSourcesChanged?.Invoke(this, new CurrentSourcesChangedEventArgs(signalType, previousSource, sourceDevice));
}
}
diff --git a/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs b/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs
index cdf214bf..46507a98 100644
--- a/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs
+++ b/src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs
@@ -14,14 +14,14 @@ namespace PepperDash.Essentials.Devices.Common.Generic;
///
public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputPort, ICurrentSources
{
- ///
- public Dictionary CurrentSources { get; private set; }
+ ///
+ public Dictionary CurrentSources { get; private set; }
- ///
- public Dictionary CurrentSourceKeys { get; private set; }
+ ///
+ public Dictionary CurrentSourceKeys { get; private set; }
- ///
- public event EventHandler CurrentSourcesChanged;
+ ///
+ public event EventHandler CurrentSourcesChanged;
///
/// Initializes a new instance of the GenericSink class
@@ -36,7 +36,7 @@ public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputP
InputPorts.Add(inputPort);
- CurrentSources = new Dictionary
+ CurrentSources = new Dictionary
{
{ eRoutingSignalType.Audio, null },
{ eRoutingSignalType.Video, null },
@@ -49,36 +49,55 @@ public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputP
};
}
- ///
- public void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
- {
- foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
- {
- var flagValue = Convert.ToInt32(type);
- // Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
- // (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
- if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
- {
- this.LogDebug("Skipping {type}", type);
- continue;
- }
+ ///
+ public virtual void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice)
+ {
+ foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
+ {
+ var flagValue = Convert.ToInt32(type);
+ // Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
+ // (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
+ if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
+ {
+ this.LogDebug("Skipping {type}", type);
+ continue;
+ }
- this.LogDebug("setting {type}", type);
+ this.LogDebug("setting {type}", type);
- if (signalType.HasFlag(type))
- {
- UpdateCurrentSources(type, sourceListKey, sourceListItem);
- }
- }
- // Raise the CurrentSourcesChanged event
- CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
- }
+ var previousSource = CurrentSources[type];
- private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
- {
- CurrentSources[signalType] = sourceListItem;
- CurrentSourceKeys[signalType] = sourceListKey;
- }
+ if (signalType.HasFlag(type))
+ {
+ UpdateCurrentSources(type, previousSource, sourceDevice);
+ }
+ }
+ }
+
+ private void UpdateCurrentSources(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource sourceDevice)
+ {
+ if (CurrentSources.ContainsKey(signalType))
+ {
+ CurrentSources[signalType] = sourceDevice;
+ }
+ else
+ {
+ CurrentSources.Add(signalType, sourceDevice);
+ }
+
+ // Update the current source key for the specified signal type
+ if (CurrentSourceKeys.ContainsKey(signalType))
+ {
+ CurrentSourceKeys[signalType] = sourceDevice.Key;
+ }
+ else
+ {
+ CurrentSourceKeys.Add(signalType, sourceDevice.Key);
+ }
+
+ // Raise the CurrentSourcesChanged event
+ CurrentSourcesChanged?.Invoke(this, new CurrentSourcesChangedEventArgs(signalType, previousSource, sourceDevice));
+ }
///
/// Gets or sets the InputPorts
diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs
index 2dd2b0d2..54a9d989 100644
--- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs
+++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/BlueJeansPc.cs
@@ -1,8 +1,11 @@
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using PepperDash.Core;
+using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
+using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Sources;
using Serilog.Events;
@@ -22,10 +25,19 @@ public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSink
///
/// The currently active input port, which for this device is always AnyVideoIn
- /// This is used by the routing system to determine where to route video sources when this device is a destination
+ /// This is used by the routing system to determine where to route video sources when this device is a destination
///
public RoutingInputPort CurrentInputPort => AnyVideoIn;
+ ///
+ public Dictionary CurrentSources { get; private set; }
+
+ ///
+ public Dictionary CurrentSourceKeys { get; private set; }
+
+ ///
+ public event EventHandler CurrentSourcesChanged;
+
#region IRoutingInputs Members
///
@@ -47,15 +59,77 @@ public class BlueJeansPc : InRoomPc, IRunRouteAction, IRoutingSink
{
(AnyVideoIn = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this))
};
+
+ CurrentSources = new Dictionary
+ {
+ { eRoutingSignalType.Audio, null },
+ { eRoutingSignalType.Video, null },
+ };
+
+ CurrentSourceKeys = new Dictionary
+ {
+ { eRoutingSignalType.Audio, string.Empty },
+ { eRoutingSignalType.Video, string.Empty },
+ };
+ }
+
+ ///
+ public virtual void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice)
+ {
+ foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
+ {
+ var flagValue = Convert.ToInt32(type);
+ // Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
+ // (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
+ if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
+ {
+ this.LogDebug("Skipping {type}", type);
+ continue;
+ }
+
+ this.LogDebug("setting {type}", type);
+
+ var previousSource = CurrentSources[type];
+
+ if (signalType.HasFlag(type))
+ {
+ UpdateCurrentSources(type, previousSource, sourceDevice);
+ }
+ }
+ }
+
+ private void UpdateCurrentSources(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource sourceDevice)
+ {
+ if (CurrentSources.ContainsKey(signalType))
+ {
+ CurrentSources[signalType] = sourceDevice;
+ }
+ else
+ {
+ CurrentSources.Add(signalType, sourceDevice);
+ }
+
+ // Update the current source key for the specified signal type
+ if (CurrentSourceKeys.ContainsKey(signalType))
+ {
+ CurrentSourceKeys[signalType] = sourceDevice.Key;
+ }
+ else
+ {
+ CurrentSourceKeys.Add(signalType, sourceDevice.Key);
+ }
+
+ // Raise the CurrentSourcesChanged event
+ CurrentSourcesChanged?.Invoke(this, new CurrentSourcesChangedEventArgs(signalType, previousSource, sourceDevice));
}
#region IRunRouteAction Members
///
/// Runs a route action for the specified route key and source list key. Optionally, a callback can be provided to be executed upon successful completion.
- ///
- ///
- ///
+ ///
+ ///
+ ///
public void RunRouteAction(string routeKey, string sourceListKey)
{
RunRouteAction(routeKey, sourceListKey, null);
diff --git a/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs b/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs
index 942832f3..9cc4c1d8 100644
--- a/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs
+++ b/src/PepperDash.Essentials.Devices.Common/SoftCodec/GenericSoftCodec.cs
@@ -1,6 +1,9 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using PepperDash.Core;
+using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Routing;
using Serilog.Events;
namespace PepperDash.Essentials.Devices.Common.SoftCodec;
@@ -27,6 +30,15 @@ public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWi
}
}
+ ///
+ public Dictionary CurrentSources { get; private set; }
+
+ ///
+ public Dictionary CurrentSourceKeys { get; private set; }
+
+ ///
+ public event System.EventHandler CurrentSourcesChanged;
+
///
/// Initializes a new instance of the class
///
@@ -49,6 +61,18 @@ public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWi
InputPorts.Add(inputPort);
}
+ CurrentSources = new Dictionary
+ {
+ { eRoutingSignalType.Audio, null },
+ { eRoutingSignalType.Video, null },
+ };
+
+ CurrentSourceKeys = new Dictionary
+ {
+ { eRoutingSignalType.Audio, string.Empty },
+ { eRoutingSignalType.Video, string.Empty },
+ };
+
if (!props.HasCameraInputs)
{
return;
@@ -62,6 +86,56 @@ public class GenericSoftCodec : EssentialsDevice, IRoutingSource, IRoutingSinkWi
}
}
+ ///
+ public virtual void SetCurrentSource(eRoutingSignalType signalType, IRoutingSource sourceDevice)
+ {
+ foreach (eRoutingSignalType type in System.Enum.GetValues(typeof(eRoutingSignalType)))
+ {
+ var flagValue = System.Convert.ToInt32(type);
+ // Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
+ // (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
+ if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
+ {
+ this.LogDebug("Skipping {type}", type);
+ continue;
+ }
+
+ this.LogDebug("setting {type}", type);
+
+ var previousSource = CurrentSources[type];
+
+ if (signalType.HasFlag(type))
+ {
+ UpdateCurrentSources(type, previousSource, sourceDevice);
+ }
+ }
+ }
+
+ private void UpdateCurrentSources(eRoutingSignalType signalType, IRoutingSource previousSource, IRoutingSource sourceDevice)
+ {
+ if (CurrentSources.ContainsKey(signalType))
+ {
+ CurrentSources[signalType] = sourceDevice;
+ }
+ else
+ {
+ CurrentSources.Add(signalType, sourceDevice);
+ }
+
+ // Update the current source key for the specified signal type
+ if (CurrentSourceKeys.ContainsKey(signalType))
+ {
+ CurrentSourceKeys[signalType] = sourceDevice.Key;
+ }
+ else
+ {
+ CurrentSourceKeys.Add(signalType, sourceDevice.Key);
+ }
+
+ // Raise the CurrentSourcesChanged event
+ CurrentSourcesChanged?.Invoke(this, new CurrentSourcesChangedEventArgs(signalType, previousSource, sourceDevice));
+ }
+
///
/// Gets or sets the InputPorts
///
diff --git a/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CurrentSourcesMessenger.cs b/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CurrentSourcesMessenger.cs
index a7c4614b..e2c1473d 100644
--- a/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CurrentSourcesMessenger.cs
+++ b/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CurrentSourcesMessenger.cs
@@ -69,7 +69,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
///
public class CurrentSourcesStateMessage : DeviceStateMessageBase
{
-
///
/// Gets or sets the CurrentSourceKey
///
@@ -81,6 +80,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Gets or sets the CurrentSource
///
[JsonProperty("currentSources")]
- public Dictionary CurrentSources { get; set; }
+ public Dictionary CurrentSources { get; set; }
}
}
diff --git a/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/IRunRouteActionMessenger.cs b/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/IRunRouteActionMessenger.cs
index d5038d91..42c7c9cd 100644
--- a/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/IRunRouteActionMessenger.cs
+++ b/src/PepperDash.Essentials.MobileControl.Messengers/Messengers/IRunRouteActionMessenger.cs
@@ -1,7 +1,5 @@
using System;
-using Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
@@ -17,29 +15,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
///
public IRunRouteAction RoutingDevice { get; private set; }
+ ///
+ /// Initializes a new instance of the RunRouteActionMessenger class
+ ///
+ /// The key.
+ /// The routing device.
+ /// The message path.
+ ///
public RunRouteActionMessenger(string key, IRunRouteAction routingDevice, string messagePath)
: base(key, messagePath, routingDevice as IKeyName)
{
RoutingDevice = routingDevice ?? throw new ArgumentNullException("routingDevice");
-
-
- if (RoutingDevice is IRoutingSink routingSink)
- {
- routingSink.CurrentSourceChange += RoutingSink_CurrentSourceChange;
- }
- }
-
- private void RoutingSink_CurrentSourceChange(SourceListItem info, ChangeType type)
- {
- SendRoutingFullMessageObject();
}
+ ///
protected override void RegisterActions()
{
- AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject(id));
-
- AddAction("/routingStatus", (id, content) => SendRoutingFullMessageObject(id));
-
AddAction("/source", (id, content) =>
{
var c = content.ToObject();
@@ -55,41 +46,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
RoutingDevice.RunRouteAction(c.SourceListItemKey, sourceListKey);
});
- if (RoutingDevice is IRoutingSink sinkDevice)
- {
- sinkDevice.CurrentSourceChange += (o, a) => SendRoutingFullMessageObject();
- }
- }
-
- ///
- /// Helper method to update full status of the routing device
- ///
- private void SendRoutingFullMessageObject(string id = null)
- {
- if (RoutingDevice is IRoutingSink sinkDevice)
- {
- var sourceKey = sinkDevice.CurrentSourceInfoKey;
-
- if (string.IsNullOrEmpty(sourceKey))
- sourceKey = "none";
-
- PostStatusMessage(new RoutingStateMessage
- {
- SelectedSourceKey = sourceKey
- });
- }
}
}
- ///
- /// Represents a RoutingStateMessage
- ///
- public class RoutingStateMessage : DeviceStateMessageBase
- {
- ///
- /// Gets or sets the SelectedSourceKey
- ///
- [JsonProperty("selectedSourceKey")]
- public string SelectedSourceKey { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.MobileControl/RoomBridges/MobileControlEssentialsRoomBridge.cs b/src/PepperDash.Essentials.MobileControl/RoomBridges/MobileControlEssentialsRoomBridge.cs
index 742251db..c486010d 100644
--- a/src/PepperDash.Essentials.MobileControl/RoomBridges/MobileControlEssentialsRoomBridge.cs
+++ b/src/PepperDash.Essentials.MobileControl/RoomBridges/MobileControlEssentialsRoomBridge.cs
@@ -719,29 +719,6 @@ namespace PepperDash.Essentials.RoomBridges
}
}
- if (room is IHasDefaultDisplay defDisplayRoom)
- {
- this.LogVerbose("Getting default display config");
- configuration.DefaultDisplayKey = defDisplayRoom.DefaultDisplay.Key;
- configuration.Destinations.Add(eSourceListItemDestinationTypes.defaultDisplay, defDisplayRoom.DefaultDisplay.Key);
- }
-
- if (room is IHasMultipleDisplays multiDisplayRoom)
- {
- this.LogVerbose("Getting multiple display config");
-
- if (multiDisplayRoom.Displays == null)
- {
- this.LogVerbose("Displays collection is null");
- }
- else
- {
- this.LogVerbose("Displays collection exists");
-
- configuration.Destinations = multiDisplayRoom.Displays.ToDictionary(kv => kv.Key, kv => kv.Value.Key);
- }
- }
-
if (room is IHasAccessoryDevices accRoom)
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Information, "Getting accessory devices config", this);
@@ -1015,13 +992,6 @@ namespace PepperDash.Essentials.RoomBridges
[JsonProperty("defaultDisplayKey", NullValueHandling = NullValueHandling.Ignore)]
public string DefaultDisplayKey { get; set; }
- ///
- /// Gets or sets the destinations dictionary keyed by destination type
- ///
- [JsonProperty("destinations", NullValueHandling = NullValueHandling.Ignore)]
- public Dictionary Destinations { get; set; }
-
-
///
/// Gets or sets the EnvironmentalDevices
///
@@ -1106,7 +1076,6 @@ namespace PepperDash.Essentials.RoomBridges
///
public RoomConfiguration()
{
- Destinations = new Dictionary();
EnvironmentalDevices = new List();
SourceList = new Dictionary();
TouchpanelKeys = new List();