mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #221 from PepperDash/feature/releaseAndMakeRoute-nullEx
Change ReleaseAndMakeRoute to use IRoutingSinkNoSwitching instead of IRoutingInputs
This commit is contained in:
@@ -555,7 +555,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
|
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
|
||||||
{
|
{
|
||||||
IRoutingSinkNoSwitching dest = null;
|
IRoutingSink dest = null;
|
||||||
|
|
||||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||||
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace PepperDash.Essentials
|
|||||||
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; }
|
public IRoutingSink DefaultAudioDevice { get; private set; }
|
||||||
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
|
public IBasicVolumeControls DefaultVolumeControls { get; private set; }
|
||||||
|
|
||||||
public bool ExcludeFromGlobalFunctions { get; set; }
|
public bool ExcludeFromGlobalFunctions { get; set; }
|
||||||
@@ -471,14 +471,14 @@ namespace PepperDash.Essentials
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool DoRoute(SourceRouteListItem route)
|
bool DoRoute(SourceRouteListItem route)
|
||||||
{
|
{
|
||||||
IRoutingSinkNoSwitching dest = null;
|
IRoutingSink dest = null;
|
||||||
|
|
||||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||||
dest = DefaultAudioDevice;
|
dest = DefaultAudioDevice;
|
||||||
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
|
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
|
||||||
dest = DefaultDisplay;
|
dest = DefaultDisplay;
|
||||||
else
|
else
|
||||||
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
|
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
|
||||||
|
|
||||||
if (dest == null)
|
if (dest == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool DoRoute(SourceRouteListItem route)
|
bool DoRoute(SourceRouteListItem route)
|
||||||
{
|
{
|
||||||
IRoutingSinkNoSwitching dest = null;
|
IRoutingSink dest = null;
|
||||||
|
|
||||||
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
|
||||||
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
dest = DefaultAudioDevice as IRoutingSinkNoSwitching;
|
||||||
|
|||||||
@@ -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 IRoutingInputs 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
|
||||||
@@ -152,7 +152,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (outputPortToUse == null)
|
if (outputPortToUse == null)
|
||||||
{
|
{
|
||||||
// it's a sink device
|
// it's a sink device
|
||||||
routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort));
|
routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort));
|
||||||
}
|
}
|
||||||
else if (destination is IRouting)
|
else if (destination is IRouting)
|
||||||
{
|
{
|
||||||
@@ -265,14 +265,20 @@ 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);
|
{
|
||||||
else if (route.SwitchingDevice is IRouting)
|
var device = route.SwitchingDevice as IRoutingSinkWithSwitching;
|
||||||
{
|
if (device == null)
|
||||||
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
continue;
|
||||||
route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType);
|
|
||||||
Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
|
device.ExecuteSwitch(route.InputPort.Selector);
|
||||||
}
|
}
|
||||||
|
else if (route.SwitchingDevice is IRouting)
|
||||||
|
{
|
||||||
|
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
|
||||||
|
route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType);
|
||||||
|
Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
|
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For fixed-source endpoint devices
|
||||||
|
/// </summary>
|
||||||
|
public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For fixed-source endpoint devices
|
/// For fixed-source endpoint devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange
|
[Obsolete]
|
||||||
|
public interface IRoutingSinkNoSwitching : IRoutingSink
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,7 +68,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 : IRoutingSink
|
||||||
{
|
{
|
||||||
//void ClearRoute();
|
//void ClearRoute();
|
||||||
void ExecuteSwitch(object inputSelector);
|
void ExecuteSwitch(object inputSelector);
|
||||||
|
|||||||
Reference in New Issue
Block a user