mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: Refactor routing interfaces and feedback mechanisms
- Removed ITxRouting and ITxRoutingWithFeedback interfaces as they were redundant. - Updated RouteDescriptor and RouteSwitchDescriptor to use new feedback interfaces. - Modified RoutingFeedbackManager to utilize IRoutingSinkWithFeedback and IRoutingMidpointWithFeedback. - Adjusted GenericAudioOut, BlueJeansPc, and other device classes to implement new feedback interfaces. - Introduced new messenger classes for IRoutingSinkWithFeedback and IRoutingMidpointWithFeedback. - Cleaned up unused messenger interfaces and consolidated routing logic. - Updated MobileControlEssentialsRoomBridge to remove dependency on IHasCurrentSourceInfoChange.
This commit is contained in:
parent
b9dcec587d
commit
f64b595fd7
46 changed files with 324 additions and 872 deletions
|
|
@ -155,10 +155,10 @@ namespace PepperDash.Essentials.Core;
|
|||
}
|
||||
|
||||
|
||||
var inputsOutputs = dev as IRoutingInputsOutputs;
|
||||
var inputsOutputs = dev as IRoutingMidpoint;
|
||||
if (inputsOutputs == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
|
||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingMidpoint, failed to get CEC port called '{1}'",
|
||||
config.ControlPortDevKey, config.ControlPortName);
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace PepperDash.Essentials.Core
|
|||
/// <summary>
|
||||
/// Identifies a device that contains audio zones
|
||||
/// </summary>
|
||||
public interface IAudioZones : IRouting
|
||||
public interface IAudioZones : IRoutingMidpointWithFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the collection of audio zones
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
|||
/// It is designed to be implemented by devices that require these capabilities,
|
||||
/// such as projectors, displays, and other visual output devices.
|
||||
/// </summary>
|
||||
public interface IDisplay : IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking, IKeyName
|
||||
public interface IDisplay : IHasFeedback, IRoutingSinkWithFeedback, IHasPowerControl, IWarmingCooling, IUsageTracking, IKeyName
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@ public class DestinationListItem
|
|||
[JsonProperty("sinkKey")]
|
||||
public string SinkKey { get; set; }
|
||||
|
||||
private IRoutingSink _sinkDevice;
|
||||
private IRoutingSinkWithFeedback _sinkDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the actual device instance for this destination.
|
||||
/// Lazily loads the device from the DeviceManager using the SinkKey.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IRoutingSink SinkDevice
|
||||
public IRoutingSinkWithFeedback SinkDevice
|
||||
{
|
||||
get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as IRoutingSink); }
|
||||
get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as IRoutingSinkWithFeedback); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public interface IHasDefaultDisplay
|
|||
/// <summary>
|
||||
/// The default display for the room, used for presentation routing and other default routes
|
||||
/// </summary>
|
||||
IRoutingSink DefaultDisplay { get; }
|
||||
IRoutingSinkWithFeedback DefaultDisplay { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -465,8 +465,8 @@ public static class Extensions
|
|||
IndexTieLines();
|
||||
}
|
||||
|
||||
var sinks = DeviceManager.AllDevices.OfType<IRoutingInputs>().Where(d => !(d is IRoutingInputsOutputs));
|
||||
var sources = DeviceManager.AllDevices.OfType<IRoutingOutputs>().Where(d => !(d is IRoutingInputsOutputs));
|
||||
var sinks = DeviceManager.AllDevices.OfType<IRoutingInputs>().Where(d => !(d is IRoutingMidpoint));
|
||||
var sources = DeviceManager.AllDevices.OfType<IRoutingOutputs>().Where(d => !(d is IRoutingMidpoint));
|
||||
|
||||
foreach (var sink in sinks)
|
||||
{
|
||||
|
|
@ -544,7 +544,7 @@ public static class Extensions
|
|||
/// <param name="routeTable">The RouteDescriptor being populated as the route is discovered</param>
|
||||
/// <returns>true if source is hit</returns>
|
||||
private static bool GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source,
|
||||
RoutingOutputPort outputPortToUse, List<IRoutingInputsOutputs> alreadyCheckedDevices,
|
||||
RoutingOutputPort outputPortToUse, List<IRoutingMidpoint> alreadyCheckedDevices,
|
||||
eRoutingSignalType signalType, int cycle, RouteDescriptor routeTable, RoutingInputPort destinationPort, RoutingOutputPort sourcePort)
|
||||
{
|
||||
cycle++;
|
||||
|
|
@ -608,16 +608,16 @@ public static class Extensions
|
|||
|
||||
// No direct tie? Run back out on the inputs' attached devices...
|
||||
// Only the ones that are routing devices
|
||||
var midpointTieLines = destinationTieLines.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);
|
||||
var midpointTieLines = destinationTieLines.Where(t => t.SourcePort.ParentDevice is IRoutingMidpoint);
|
||||
|
||||
//Create a list for tracking already checked devices to avoid loops, if it doesn't already exist from previous iteration
|
||||
if (alreadyCheckedDevices == null)
|
||||
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
|
||||
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
|
||||
alreadyCheckedDevices = new List<IRoutingMidpoint>();
|
||||
alreadyCheckedDevices.Add(destination as IRoutingMidpoint);
|
||||
|
||||
foreach (var tieLine in midpointTieLines)
|
||||
{
|
||||
var midpointDevice = tieLine.SourcePort.ParentDevice as IRoutingInputsOutputs;
|
||||
var midpointDevice = tieLine.SourcePort.ParentDevice as IRoutingMidpoint;
|
||||
|
||||
// Check if this previous device has already been walked
|
||||
if (alreadyCheckedDevices.Contains(midpointDevice))
|
||||
|
|
@ -659,12 +659,12 @@ public static class Extensions
|
|||
|
||||
// we have a route on corresponding inputPort. *** Do the route ***
|
||||
|
||||
if (destination is IRoutingSink)
|
||||
if (destination is IRoutingSinkWithFeedback)
|
||||
{
|
||||
// it's a sink device
|
||||
routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort));
|
||||
}
|
||||
else if (destination is IRouting)
|
||||
else if (destination is IRoutingMidpointWithFeedback)
|
||||
{
|
||||
routeTable.Routes.Add(new RouteSwitchDescriptor(outputPortToUse, goodInputPort));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate for SourceInfoChangeHandler
|
||||
/// </summary>
|
||||
public delegate void SourceInfoChangeHandler(SourceListItem info, ChangeType type);
|
||||
//*******************************************************************************************
|
||||
// Interfaces
|
||||
|
||||
/// <summary>
|
||||
/// For rooms with a single presentation source, change event
|
||||
/// </summary>
|
||||
[Obsolete("Use ICurrentSources instead")]
|
||||
public interface IHasCurrentSourceInfoChange
|
||||
{
|
||||
/// <summary>
|
||||
/// The key for the current source info, used to look up the source in the SourceList
|
||||
/// </summary>
|
||||
string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current source info for the room, used to look up the source in the SourceList
|
||||
/// </summary>
|
||||
SourceListItem CurrentSourceInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Event that is raised when the current source info changes.
|
||||
/// This is used to notify the system of changes to the current source info.
|
||||
/// The event handler receives the new source info and the type of change that occurred.
|
||||
/// </summary>
|
||||
event SourceInfoChangeHandler CurrentSourceChange;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IMatrixRouting
|
||||
/// </summary>
|
||||
public interface IMatrixRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the input slots
|
||||
/// </summary>
|
||||
Dictionary<string, IRoutingInputSlot> InputSlots { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the output slots
|
||||
/// </summary>
|
||||
Dictionary<string, IRoutingOutputSlot> OutputSlots { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Routes the specified input slot to the specified output slot for the specified signal type
|
||||
/// </summary>
|
||||
/// <param name="inputSlotKey">key of the input slot</param>
|
||||
/// <param name="outputSlotKey">key of the output slot</param>
|
||||
/// <param name="type">signal type</param>
|
||||
void Route(string inputSlotKey, string outputSlotKey, eRoutingSignalType type);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRmcRouting
|
||||
/// </summary>
|
||||
public interface IRmcRouting : IRoutingNumeric
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback for the current Audio/Video source as a number
|
||||
/// </summary>
|
||||
IntFeedback AudioVideoSourceNumericFeedback { get; }
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRmcRouting with a feedback event
|
||||
/// </summary>
|
||||
public interface IRmcRoutingWithFeedback : IRmcRouting
|
||||
{
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a midpoint device as have internal routing. Any devices in the middle of the
|
||||
/// signal chain, that do switching, must implement this for routing to work otherwise
|
||||
/// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough
|
||||
/// device.
|
||||
/// </summary>
|
||||
public interface IRouting : IRoutingInputsOutputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a switch on the device
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">input selector</param>
|
||||
/// <param name="outputSelector">output selector</param>
|
||||
/// <param name="signalType">type of signal</param>
|
||||
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using PepperDash.Core;
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingFeedback
|
||||
/// </summary>
|
||||
public interface IRoutingFeedback : IKeyName
|
||||
{
|
||||
/// <summary>
|
||||
/// Event raised when a numeric switch changes
|
||||
/// </summary>
|
||||
event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||
//void OnSwitchChange(RoutingNumericEventArgs e);
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core.Routing;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingInputSlot
|
||||
/// </summary>
|
||||
public interface IRoutingInputSlot : IRoutingSlot, IOnline, IVideoSync
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Tx device key
|
||||
/// </summary>
|
||||
string TxDeviceKey { get; }
|
||||
}
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingInputsOutputs
|
||||
/// </summary>
|
||||
public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs
|
||||
{
|
||||
}
|
||||
|
||||
10
src/PepperDash.Essentials.Core/Routing/IRoutingMidpoint.cs
Normal file
10
src/PepperDash.Essentials.Core/Routing/IRoutingMidpoint.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a midpoint (passthrough) device that has both input and output routing ports
|
||||
/// but does not perform active switching. For switching midpoints, see <see cref="IRoutingMidpointWithFeedback"/>.
|
||||
/// </summary>
|
||||
public interface IRoutingMidpoint : IRoutingInputs, IRoutingOutputs
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for RouteChangedEventHandler.
|
||||
/// </summary>
|
||||
/// <param name="midpoint">The routing device where the change occurred.</param>
|
||||
/// <param name="newRoute">A descriptor of the new route that was established.</param>
|
||||
public delegate void RouteChangedEventHandler(IRoutingMidpointWithFeedback midpoint, RouteSwitchDescriptor newRoute);
|
||||
|
||||
/// <summary>
|
||||
/// Defines a midpoint device that performs active switching and provides feedback about its current routes.
|
||||
/// Combines the capabilities of the former IRouting, IRoutingWithFeedback, and IRoutingWithClear interfaces.
|
||||
/// </summary>
|
||||
public interface IRoutingMidpointWithFeedback : IRoutingMidpoint
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a switch on the device.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">Input selector.</param>
|
||||
/// <param name="outputSelector">Output selector.</param>
|
||||
/// <param name="signalType">Type of signal.</param>
|
||||
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
|
||||
|
||||
/// <summary>
|
||||
/// Clears a route to an output.
|
||||
/// </summary>
|
||||
/// <param name="outputSelector">Output to clear.</param>
|
||||
/// <param name="signalType">Signal type to clear.</param>
|
||||
void ClearRoute(object outputSelector, eRoutingSignalType signalType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list describing the currently active routes on this device.
|
||||
/// </summary>
|
||||
List<RouteSwitchDescriptor> CurrentRoutes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when a route changes on this device.
|
||||
/// </summary>
|
||||
event RouteChangedEventHandler RouteChanged;
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingNumeric
|
||||
/// </summary>
|
||||
public interface IRoutingNumeric : IRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a numeric switch on the device
|
||||
/// </summary>
|
||||
/// <param name="input">input selector</param>
|
||||
/// <param name="output">output selector</param>
|
||||
/// <param name="type">type of signal</param>
|
||||
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRoutingNumeric with a feedback event
|
||||
/// </summary>
|
||||
public interface IRoutingNumericWithFeedback : IRoutingNumeric, IRoutingFeedback
|
||||
{
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingOutputSlot
|
||||
/// </summary>
|
||||
public interface IRoutingOutputSlot : IRoutingSlot
|
||||
{
|
||||
/// <summary>
|
||||
/// Event raised when output slot changes
|
||||
/// </summary>
|
||||
event EventHandler OutputSlotChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Rx device key
|
||||
/// </summary>
|
||||
string RxDeviceKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current routes
|
||||
/// </summary>
|
||||
Dictionary<eRoutingSignalType, IRoutingInputSlot> CurrentRoutes { get; }
|
||||
}
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingSink
|
||||
/// </summary>
|
||||
public interface IRoutingSink : IRoutingInputs, IKeyName, ICurrentSources
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For fixed-source endpoint devices with an input port
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithInputPort : IRoutingSink
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current input port for this routing sink.
|
||||
/// </summary>
|
||||
RoutingInputPort CurrentInputPort { get; }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,12 +1,37 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingSinkWithFeedback
|
||||
/// Delegate for InputChangedEventHandler.
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithFeedback : IRoutingSink
|
||||
/// <param name="destination">The sink device that changed input.</param>
|
||||
/// <param name="currentPort">The new input port selected on the sink device.</param>
|
||||
public delegate void InputChangedEventHandler(IRoutingSinkWithFeedback destination, RoutingInputPort currentPort);
|
||||
|
||||
/// <summary>
|
||||
/// Defines a routing sink (endpoint) device that can switch inputs and provides feedback.
|
||||
/// Consolidates the former IRoutingSink, IRoutingSinkWithInputPort, IRoutingSinkWithSwitching,
|
||||
/// IRoutingSinkWithSwitchingWithInputPort, and IRoutingSinkWithFeedback interfaces.
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithFeedback : IRoutingInputs, IKeyName, ICurrentSources
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a switch on the device.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">Input selector.</param>
|
||||
void ExecuteSwitch(object inputSelector);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current input port for this routing sink.
|
||||
/// </summary>
|
||||
RoutingInputPort CurrentInputPort { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when the input changes.
|
||||
/// </summary>
|
||||
event InputChangedEventHandler InputChanged;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for InputChangedEventHandler
|
||||
/// </summary>
|
||||
public delegate void InputChangedEventHandler(IRoutingSinkWithSwitching destination, RoutingInputPort currentPort);
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingSinkWithSwitching
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithSwitching : IRoutingSink
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a switch on the device
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">input selector</param>
|
||||
void ExecuteSwitch(object inputSelector);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingSinkWithSwitchingWithInputPort
|
||||
/// </summary>
|
||||
public interface IRoutingSinkWithSwitchingWithInputPort : IRoutingSinkWithSwitching, IRoutingSinkWithInputPort
|
||||
{
|
||||
/// <summary>
|
||||
/// Event raised when the input changes
|
||||
/// </summary>
|
||||
event InputChangedEventHandler InputChanged;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IRoutingSlot
|
||||
/// </summary>
|
||||
public interface IRoutingSlot:IKeyName
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the slot number
|
||||
/// </summary>
|
||||
int SlotNumber { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported signal types
|
||||
/// </summary>
|
||||
eRoutingSignalType SupportedSignalTypes { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a routing device (<see cref="IRouting"/>) that supports explicitly clearing a route on an output.
|
||||
/// </summary>
|
||||
public interface IRoutingWithClear : IRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Clears a route to an output, however a device needs to do that
|
||||
/// </summary>
|
||||
/// <param name="outputSelector">Output to clear</param>
|
||||
/// <param name="signalType">signal type to clear</param>
|
||||
void ClearRoute(object outputSelector, eRoutingSignalType signalType);
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list describing the currently active routes on this device.
|
||||
/// </summary>
|
||||
/// <param name="midpoint">The routing device where the change occurred.</param>
|
||||
/// <param name="newRoute">A descriptor of the new route that was established.</param>
|
||||
/// <summary>
|
||||
/// Delegate for RouteChangedEventHandler
|
||||
/// </summary>
|
||||
public delegate void RouteChangedEventHandler(IRoutingWithFeedback midpoint, RouteSwitchDescriptor newRoute);
|
||||
/// <summary>
|
||||
/// Defines a routing device (<see cref="IRouting"/>) that provides feedback about its current routes.
|
||||
/// </summary>
|
||||
public interface IRoutingWithFeedback : IRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list describing the currently active routes on this device.
|
||||
/// </summary>
|
||||
List<RouteSwitchDescriptor> CurrentRoutes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when a route changes on this device.
|
||||
/// </summary>
|
||||
event RouteChangedEventHandler RouteChanged;
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a routing device (typically a transmitter or source) that provides numeric feedback for its current route.
|
||||
/// Extends <see cref="IRoutingNumeric"/>.
|
||||
/// </summary>
|
||||
public interface ITxRouting : IRoutingNumeric
|
||||
{
|
||||
/// <summary>
|
||||
/// Feedback indicating the currently routed video source by its numeric identifier.
|
||||
/// </summary>
|
||||
IntFeedback VideoSourceNumericFeedback { get; }
|
||||
/// <summary>
|
||||
/// Feedback indicating the currently routed audio source by its numeric identifier.
|
||||
/// </summary>
|
||||
IntFeedback AudioSourceNumericFeedback { get; }
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Defines an IRmcRouting with a feedback event
|
||||
/// </summary>
|
||||
public interface ITxRoutingWithFeedback : ITxRouting
|
||||
{
|
||||
}
|
||||
|
|
@ -74,13 +74,13 @@ public class RouteDescriptor
|
|||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "ExecuteRoutes: {0}", null, route.ToString());
|
||||
|
||||
if (route.SwitchingDevice is IRoutingSinkWithSwitching sink)
|
||||
if (route.SwitchingDevice is IRoutingSinkWithFeedback sink)
|
||||
{
|
||||
sink.ExecuteSwitch(route.InputPort.Selector);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (route.SwitchingDevice is IRouting switchingDevice)
|
||||
if (route.SwitchingDevice is IRoutingMidpointWithFeedback switchingDevice)
|
||||
{
|
||||
switchingDevice.ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
||||
|
||||
|
|
@ -97,9 +97,9 @@ public class RouteDescriptor
|
|||
/// <param name="clearRoute">If true, attempts to clear the route on the switching devices (e.g., set input to null/0).</param>
|
||||
public void ReleaseRoutes(bool clearRoute = false)
|
||||
{
|
||||
foreach (var route in Routes.Where(r => r.SwitchingDevice is IRouting))
|
||||
foreach (var route in Routes.Where(r => r.SwitchingDevice is IRoutingMidpointWithFeedback))
|
||||
{
|
||||
if (route.SwitchingDevice is IRouting switchingDevice)
|
||||
if (route.SwitchingDevice is IRoutingMidpointWithFeedback switchingDevice)
|
||||
{
|
||||
if (clearRoute)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
if (SwitchingDevice is IRouting)
|
||||
if (SwitchingDevice is IRoutingMidpointWithFeedback)
|
||||
return $"{(SwitchingDevice != null ? SwitchingDevice.Key : "No Device")} switches output {(OutputPort != null ? OutputPort.Key : "No output port")} to input {(InputPort != null ? InputPort.Key : "No input port")}";
|
||||
else
|
||||
return $"{(SwitchingDevice != null ? SwitchingDevice.Key : "No Device")} switches to input {(InputPort != null ? InputPort.Key : "No input port")}";
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
{
|
||||
midpointToSinksMap = new Dictionary<string, HashSet<string>>();
|
||||
|
||||
var sinks = DeviceManager.AllDevices.OfType<IRoutingSinkWithSwitchingWithInputPort>();
|
||||
var midpoints = DeviceManager.AllDevices.OfType<IRoutingWithFeedback>();
|
||||
var sinks = DeviceManager.AllDevices.OfType<IRoutingSinkWithFeedback>();
|
||||
var midpoints = DeviceManager.AllDevices.OfType<IRoutingMidpointWithFeedback>();
|
||||
|
||||
foreach (var sink in sinks)
|
||||
{
|
||||
|
|
@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
/// <summary>
|
||||
/// Gets all upstream midpoint device keys for a given sink
|
||||
/// </summary>
|
||||
private HashSet<string> GetUpstreamMidpoints(IRoutingSinkWithSwitchingWithInputPort sink)
|
||||
private HashSet<string> GetUpstreamMidpoints(IRoutingSinkWithFeedback sink)
|
||||
{
|
||||
var result = new HashSet<string>();
|
||||
var visited = new HashSet<string>();
|
||||
|
|
@ -109,7 +109,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
|
||||
visited.Add(tieLine.SourcePort.ParentDevice.Key);
|
||||
|
||||
if (tieLine.SourcePort.ParentDevice is IRoutingWithFeedback midpoint)
|
||||
if (tieLine.SourcePort.ParentDevice is IRoutingMidpointWithFeedback midpoint)
|
||||
{
|
||||
midpoints.Add(midpoint.Key);
|
||||
|
||||
|
|
@ -131,11 +131,11 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subscribes to the RouteChanged event on all devices implementing <see cref="IRoutingWithFeedback"/>.
|
||||
/// Subscribes to the RouteChanged event on all devices implementing <see cref="IRoutingMidpointWithFeedback"/>.
|
||||
/// </summary>
|
||||
private void SubscribeForMidpointFeedback()
|
||||
{
|
||||
var midpointDevices = DeviceManager.AllDevices.OfType<IRoutingWithFeedback>();
|
||||
var midpointDevices = DeviceManager.AllDevices.OfType<IRoutingMidpointWithFeedback>();
|
||||
|
||||
foreach (var device in midpointDevices)
|
||||
{
|
||||
|
|
@ -144,12 +144,12 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subscribes to the InputChanged event on all devices implementing <see cref="IRoutingSinkWithSwitchingWithInputPort"/>.
|
||||
/// Subscribes to the InputChanged event on all devices implementing <see cref="IRoutingSinkWithFeedback"/>.
|
||||
/// </summary>
|
||||
private void SubscribeForSinkFeedback()
|
||||
{
|
||||
var sinkDevices =
|
||||
DeviceManager.AllDevices.OfType<IRoutingSinkWithSwitchingWithInputPort>();
|
||||
DeviceManager.AllDevices.OfType<IRoutingSinkWithFeedback>();
|
||||
|
||||
foreach (var device in sinkDevices)
|
||||
{
|
||||
|
|
@ -164,7 +164,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
/// <param name="midpoint">The midpoint device that reported a route change.</param>
|
||||
/// <param name="newRoute">The descriptor of the new route.</param>
|
||||
private void HandleMidpointUpdate(
|
||||
IRoutingWithFeedback midpoint,
|
||||
IRoutingMidpointWithFeedback midpoint,
|
||||
RouteSwitchDescriptor newRoute
|
||||
)
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
|
||||
foreach (var sinkKey in affectedSinkKeys)
|
||||
{
|
||||
if (DeviceManager.GetDeviceForKey(sinkKey) is IRoutingSinkWithSwitchingWithInputPort sink)
|
||||
if (DeviceManager.GetDeviceForKey(sinkKey) is IRoutingSinkWithFeedback sink)
|
||||
{
|
||||
UpdateDestination(sink, sink.CurrentInputPort);
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
/// <param name="sender">The sink device that reported an input change.</param>
|
||||
/// <param name="currentInputPort">The new input port selected on the sink device.</param>
|
||||
private void HandleSinkUpdate(
|
||||
IRoutingSinkWithSwitching sender,
|
||||
IRoutingSinkWithFeedback sender,
|
||||
RoutingInputPort currentInputPort
|
||||
)
|
||||
{
|
||||
|
|
@ -246,7 +246,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
/// <param name="destination">The destination sink device to update.</param>
|
||||
/// <param name="inputPort">The currently selected input port on the destination device.</param>
|
||||
private void UpdateDestination(
|
||||
IRoutingSinkWithSwitching destination,
|
||||
IRoutingSinkWithFeedback destination,
|
||||
RoutingInputPort inputPort
|
||||
)
|
||||
{
|
||||
|
|
@ -298,7 +298,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
/// Called after debounce delay.
|
||||
/// </summary>
|
||||
private void UpdateDestinationImmediate(
|
||||
IRoutingSinkWithSwitching destination,
|
||||
IRoutingSinkWithFeedback destination,
|
||||
RoutingInputPort inputPort
|
||||
)
|
||||
{
|
||||
|
|
@ -491,7 +491,7 @@ namespace PepperDash.Essentials.Core.Routing
|
|||
// Get all potential sources (devices that only have outputs, not inputs+outputs)
|
||||
var sources = DeviceManager.AllDevices
|
||||
.OfType<IRoutingOutputs>()
|
||||
.Where(s => !(s is IRoutingInputsOutputs));
|
||||
.Where(s => !(s is IRoutingMidpoint));
|
||||
|
||||
// Try each signal type that this TieLine supports
|
||||
var signalTypes = new[]
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|||
})];
|
||||
}
|
||||
|
||||
// Check if device implements IRoutingInputsOutputs
|
||||
if (device is IRoutingInputsOutputs)
|
||||
// Check if device implements IRoutingMidpoint
|
||||
if (device is IRoutingMidpoint)
|
||||
{
|
||||
deviceInfo.HasInputsAndOutputs = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue