mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
adds IRoutingSink for readability and adds a protection in ExecuteRoutes if the device happens to be IRoutingSinkWithNoSwitching and IRouting like a codec might potentially be
This commit is contained in:
@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// and then attempts a new Route and if sucessful, stores that RouteDescriptor
|
/// and then attempts a new Route and if sucessful, stores that RouteDescriptor
|
||||||
/// in RouteDescriptorCollection.DefaultCollection
|
/// in RouteDescriptorCollection.DefaultCollection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ReleaseAndMakeRoute(this IRoutingSinkNoSwitching destination, IRoutingOutputs source, eRoutingSignalType signalType)
|
public static void ReleaseAndMakeRoute(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType)
|
||||||
{
|
{
|
||||||
destination.ReleaseRoute();
|
destination.ReleaseRoute();
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// RouteDescriptorCollection.DefaultCollection
|
/// RouteDescriptorCollection.DefaultCollection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="destination"></param>
|
/// <param name="destination"></param>
|
||||||
public static void ReleaseRoute(this IRoutingInputs destination)
|
public static void ReleaseRoute(this IRoutingSink destination)
|
||||||
{
|
{
|
||||||
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
|
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
|
||||||
if (current != null)
|
if (current != null)
|
||||||
@@ -56,7 +56,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// of an audio/video route are discovered a route descriptor is returned. If no route is
|
/// of an audio/video route are discovered a route descriptor is returned. If no route is
|
||||||
/// discovered, then null is returned
|
/// discovered, then null is returned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static RouteDescriptor GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType)
|
public static RouteDescriptor GetRouteToSource(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType)
|
||||||
{
|
{
|
||||||
var routeDescr = new RouteDescriptor(source, destination, signalType);
|
var routeDescr = new RouteDescriptor(source, destination, signalType);
|
||||||
// if it's a single signal type, find the route
|
// if it's a single signal type, find the route
|
||||||
@@ -265,8 +265,14 @@ namespace PepperDash.Essentials.Core
|
|||||||
foreach (var route in Routes)
|
foreach (var route in Routes)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "ExecuteRoutes: {0}", route.ToString());
|
Debug.Console(2, "ExecuteRoutes: {0}", route.ToString());
|
||||||
if (route.SwitchingDevice is IRoutingSinkWithSwitching)
|
if (route.SwitchingDevice is IRoutingSink)
|
||||||
(route.SwitchingDevice as IRoutingSinkWithSwitching).ExecuteSwitch(route.InputPort.Selector);
|
{
|
||||||
|
var device = route.SwitchingDevice as IRoutingSinkWithSwitching;
|
||||||
|
if (device == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
device.ExecuteSwitch(route.InputPort.Selector);
|
||||||
|
}
|
||||||
else if (route.SwitchingDevice is IRouting)
|
else if (route.SwitchingDevice is IRouting)
|
||||||
{
|
{
|
||||||
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
||||||
|
|||||||
@@ -48,10 +48,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
|
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For fixed-source endpoint devices
|
/// For fixed-source endpoint devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange
|
public interface IRoutingSinkNoSwitching : IRoutingSink
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,7 +64,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Endpoint device like a display, that selects inputs
|
/// Endpoint device like a display, that selects inputs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching, IHasCurrentSourceInfoChange
|
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching
|
||||||
{
|
{
|
||||||
//void ClearRoute();
|
//void ClearRoute();
|
||||||
void ExecuteSwitch(object inputSelector);
|
void ExecuteSwitch(object inputSelector);
|
||||||
|
|||||||
Reference in New Issue
Block a user