mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
refactor: routing interfaces and implementations to support current sources
- Updated ICurrentSources interface to use IRoutingSource instead of SourceListItem. - Introduced CurrentSourcesChangedEventArgs for detailed event notifications. - Modified IRoutingOutputs and IRoutingSource interfaces to include JSON properties for serialization. - Enhanced IRoutingSink and related interfaces to implement ICurrentSources for better source management. - Refactored RoutingFeedbackManager to utilize new current source handling. - Updated GenericAudioOut, GenericSink, and BlueJeansPc classes to implement new current source logic. - Adjusted MobileControl messengers to accommodate changes in current source handling. - Removed deprecated destination handling in MobileControlEssentialsRoomBridge.
This commit is contained in:
parent
43a9661e08
commit
b4d53dbe0e
19 changed files with 439 additions and 350 deletions
|
|
@ -69,7 +69,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class CurrentSourcesStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentSourceKey
|
||||
/// </summary>
|
||||
|
|
@ -81,6 +80,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// Gets or sets the CurrentSource
|
||||
/// </summary>
|
||||
[JsonProperty("currentSources")]
|
||||
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; set; }
|
||||
public Dictionary<eRoutingSignalType, IRoutingSource> CurrentSources { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// </summary>
|
||||
public IRunRouteAction RoutingDevice { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RunRouteActionMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="routingDevice">The routing device.</param>
|
||||
/// <param name="messagePath">The message path.</param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||
|
||||
AddAction("/routingStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||
|
||||
AddAction("/source", (id, content) =>
|
||||
{
|
||||
var c = content.ToObject<SourceSelectMessageContent>();
|
||||
|
|
@ -55,41 +46,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
RoutingDevice.RunRouteAction(c.SourceListItemKey, sourceListKey);
|
||||
});
|
||||
|
||||
if (RoutingDevice is IRoutingSink sinkDevice)
|
||||
{
|
||||
sinkDevice.CurrentSourceChange += (o, a) => SendRoutingFullMessageObject();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to update full status of the routing device
|
||||
/// </summary>
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RoutingStateMessage
|
||||
/// </summary>
|
||||
public class RoutingStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the SelectedSourceKey
|
||||
/// </summary>
|
||||
[JsonProperty("selectedSourceKey")]
|
||||
public string SelectedSourceKey { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue