mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
fix: fixes conditions for specific port and device matches
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -30,6 +31,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
private static void ReleaseAndMakeRoute(IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType, RoutingInputPort destinationPort = null, RoutingOutputPort sourcePort = null)
|
private static void ReleaseAndMakeRoute(IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType, RoutingInputPort destinationPort = null, RoutingOutputPort sourcePort = null)
|
||||||
{
|
{
|
||||||
|
if(destination == null) throw new ArgumentNullException(nameof(destination));
|
||||||
|
if(source == null) throw new ArgumentNullException(nameof(source));
|
||||||
|
if(destinationPort == null) Debug.LogMessage(LogEventLevel.Verbose, "Destination port is null");
|
||||||
|
if(sourcePort == null) Debug.LogMessage(LogEventLevel.Verbose, "Source port is null");
|
||||||
|
|
||||||
var routeRequest = new RouteRequest
|
var routeRequest = new RouteRequest
|
||||||
{
|
{
|
||||||
Destination = destination,
|
Destination = destination,
|
||||||
@@ -141,6 +147,18 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (!destination.GetRouteToSource(source, null, null, signalType, 0, routeDescriptor, destinationPort, sourcePort))
|
if (!destination.GetRouteToSource(source, null, null, signalType, 0, routeDescriptor, destinationPort, sourcePort))
|
||||||
routeDescriptor = null;
|
routeDescriptor = null;
|
||||||
|
|
||||||
|
foreach (var route in routeDescriptor.Routes)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose,
|
||||||
|
@"Route for device: {route}
|
||||||
|
InputPort: {InputPort}
|
||||||
|
OutputPort: {OutputPort}",
|
||||||
|
destination,
|
||||||
|
route.SwitchingDevice.Key,
|
||||||
|
route.InputPort,
|
||||||
|
route.OutputPort);
|
||||||
|
}
|
||||||
|
|
||||||
return routeDescriptor;
|
return routeDescriptor;
|
||||||
}
|
}
|
||||||
// otherwise, audioVideo needs to be handled as two steps.
|
// otherwise, audioVideo needs to be handled as two steps.
|
||||||
@@ -157,6 +175,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (!videoSuccess)
|
if (!videoSuccess)
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Cannot find video route to {0}", destination, source.Key);
|
Debug.LogMessage(LogEventLevel.Debug, "Cannot find video route to {0}", destination, source.Key);
|
||||||
|
|
||||||
|
foreach (var route in routeDescriptor.Routes)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose,
|
||||||
|
@"Route for device: {route}
|
||||||
|
InputPort: {InputPort}
|
||||||
|
OutputPort: {OutputPort}",
|
||||||
|
destination,
|
||||||
|
route.SwitchingDevice.Key,
|
||||||
|
route.InputPort,
|
||||||
|
route.OutputPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!audioSuccess && !videoSuccess)
|
if (!audioSuccess && !videoSuccess)
|
||||||
routeDescriptor = null;
|
routeDescriptor = null;
|
||||||
|
|
||||||
@@ -209,17 +240,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
// find a tieLine to a specific destination port without a specific source port
|
// find a tieLine to a specific destination port without a specific source port
|
||||||
else if (destinationPort != null && sourcePort == null)
|
else if (destinationPort != null && sourcePort == null)
|
||||||
{
|
{
|
||||||
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.Key == destinationPort.Key && t.SourcePort.ParentDevice.Key == source.Key);
|
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.DestinationPort.Key == destinationPort.Key && t.SourcePort.ParentDevice.Key == source.Key);
|
||||||
}
|
}
|
||||||
// find a tieline to a specific source port without a specific destination port
|
// find a tieline to a specific source port without a specific destination port
|
||||||
else if (destinationPort == null & sourcePort != null)
|
else if (destinationPort == null & sourcePort != null)
|
||||||
{
|
{
|
||||||
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.SourcePort.Key == sourcePort.Key);
|
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.SourcePort.ParentDevice.Key == source.Key && t.SourcePort.Key == sourcePort.Key);
|
||||||
}
|
}
|
||||||
// find a tieline to a specific source port and destination port
|
// find a tieline to a specific source port and destination port
|
||||||
else if (destinationPort != null && sourcePort != null)
|
else if (destinationPort != null && sourcePort != null)
|
||||||
{
|
{
|
||||||
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.Key == destinationPort.Key && t.SourcePort.Key == sourcePort.Key);
|
directTie = destinationTieLines.FirstOrDefault(t => t.DestinationPort.ParentDevice.Key == destination.Key && t.DestinationPort.Key == destinationPort.Key && t.SourcePort.ParentDevice.Key == source.Key && t.SourcePort.Key == sourcePort.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directTie != null) // Found a tie directly to the source
|
if (directTie != null) // Found a tie directly to the source
|
||||||
@@ -262,6 +293,12 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (upstreamRoutingSuccess)
|
if (upstreamRoutingSuccess)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "Upstream device route found", destination);
|
Debug.LogMessage(LogEventLevel.Verbose, "Upstream device route found", destination);
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, "Route found on {0}", destination, midpointDevice.Key);
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose,
|
||||||
|
@"TieLine:\n
|
||||||
|
SourcePort: {SourcePort}\n
|
||||||
|
DestinationPort: {DestinationPort}\n"
|
||||||
|
, destination, tieLine.SourcePort, tieLine.DestinationPort);
|
||||||
goodInputPort = tieLine.DestinationPort;
|
goodInputPort = tieLine.DestinationPort;
|
||||||
break; // Stop looping the inputs in this cycle
|
break; // Stop looping the inputs in this cycle
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common
|
namespace PepperDash.Essentials.Devices.Common
|
||||||
{
|
{
|
||||||
public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingSource, IRoutingOutputs, IUsageTracking
|
public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingSource, IUsageTracking
|
||||||
{
|
{
|
||||||
|
|
||||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user