mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
fix: add tieline type to output for console & CWS
This commit is contained in:
@@ -1,98 +1,91 @@
|
|||||||
using System;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
public class TieLine
|
public class TieLine
|
||||||
{
|
{
|
||||||
public RoutingOutputPort SourcePort { get; private set; }
|
public RoutingOutputPort SourcePort { get; private set; }
|
||||||
public RoutingInputPort DestinationPort { get; private set; }
|
public RoutingInputPort DestinationPort { get; private set; }
|
||||||
//public int InUseCount { get { return DestinationUsingThis.Count; } }
|
//public int InUseCount { get { return DestinationUsingThis.Count; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type of this tie line. Will either be the type of the desination port
|
/// Gets the type of this tie line. Will either be the type of the desination port
|
||||||
/// or the type of OverrideType when it is set.
|
/// or the type of OverrideType when it is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public eRoutingSignalType Type
|
public eRoutingSignalType Type
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (OverrideType.HasValue) return OverrideType.Value;
|
if (OverrideType.HasValue) return OverrideType.Value;
|
||||||
return DestinationPort.Type;
|
return DestinationPort.Type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use this to override the Type property for the destination port. For example,
|
/// Use this to override the Type property for the destination port. For example,
|
||||||
/// when the tie line is type AudioVideo, and the signal flow should be limited to
|
/// when the tie line is type AudioVideo, and the signal flow should be limited to
|
||||||
/// Audio-only or Video only, changing this type will alter the signal paths
|
/// Audio-only or Video only, changing this type will alter the signal paths
|
||||||
/// available to the routing algorithm without affecting the actual Type
|
/// available to the routing algorithm without affecting the actual Type
|
||||||
/// of the destination port.
|
/// of the destination port.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public eRoutingSignalType? OverrideType { get; set; }
|
public eRoutingSignalType? OverrideType { get; set; }
|
||||||
|
|
||||||
//List<IRoutingInputs> DestinationUsingThis = new List<IRoutingInputs>();
|
//List<IRoutingInputs> DestinationUsingThis = new List<IRoutingInputs>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For tie lines that represent internal links, like from cards to the matrix in a DM.
|
/// For tie lines that represent internal links, like from cards to the matrix in a DM.
|
||||||
/// This property is true if SourcePort and DestinationPort IsInternal
|
/// This property is true if SourcePort and DestinationPort IsInternal
|
||||||
/// property are both true
|
/// property are both true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsInternal { get { return SourcePort.IsInternal && DestinationPort.IsInternal; } }
|
public bool IsInternal { get { return SourcePort.IsInternal && DestinationPort.IsInternal; } }
|
||||||
public bool TypeMismatch { get { return SourcePort.Type != DestinationPort.Type; } }
|
public bool TypeMismatch { get { return SourcePort.Type != DestinationPort.Type; } }
|
||||||
public bool ConnectionTypeMismatch { get { return SourcePort.ConnectionType != DestinationPort.ConnectionType; } }
|
public bool ConnectionTypeMismatch { get { return SourcePort.ConnectionType != DestinationPort.ConnectionType; } }
|
||||||
public string TypeMismatchNote { get; set; }
|
public string TypeMismatchNote { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sourcePort"></param>
|
/// <param name="sourcePort"></param>
|
||||||
/// <param name="destinationPort"></param>
|
/// <param name="destinationPort"></param>
|
||||||
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort)
|
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort)
|
||||||
{
|
{
|
||||||
if (sourcePort == null || destinationPort == null)
|
if (sourcePort == null || destinationPort == null)
|
||||||
throw new ArgumentNullException("source or destination port");
|
throw new ArgumentNullException("source or destination port");
|
||||||
SourcePort = sourcePort;
|
SourcePort = sourcePort;
|
||||||
DestinationPort = destinationPort;
|
DestinationPort = destinationPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
|
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="overrideType">The signal type to limit the link to. Overrides DestinationPort.Type</param>
|
/// <param name="overrideType">The signal type to limit the link to. Overrides DestinationPort.Type</param>
|
||||||
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort, eRoutingSignalType overrideType) :
|
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort, eRoutingSignalType overrideType) :
|
||||||
this(sourcePort, destinationPort)
|
this(sourcePort, destinationPort)
|
||||||
{
|
{
|
||||||
OverrideType = overrideType;
|
OverrideType = overrideType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will link up video status from supporting inputs to connected outputs
|
/// Will link up video status from supporting inputs to connected outputs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Activate()
|
public void Activate()
|
||||||
{
|
{
|
||||||
// Now does nothing
|
// Now does nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
// Now does nothing
|
// Now does nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("Tie line: {0}:{1} --> {2}:{3}", SourcePort.ParentDevice.Key, SourcePort.Key,
|
return string.Format("Tie line: {0}:{1} --> {2}:{3} {4}", SourcePort.ParentDevice.Key, SourcePort.Key,
|
||||||
DestinationPort.ParentDevice.Key, DestinationPort.Key);
|
DestinationPort.ParentDevice.Key, DestinationPort.Key, Type.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//********************************************************************************
|
//********************************************************************************
|
||||||
|
|
||||||
@@ -109,6 +102,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
static TieLineCollection _Default;
|
private static TieLineCollection _Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,24 @@
|
|||||||
using Crestron.SimplSharp.WebScripting;
|
using Crestron.SimplSharp.WebScripting;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core.Web.RequestHandlers;
|
using PepperDash.Core.Web.RequestHandlers;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||||
{
|
{
|
||||||
public class GetTieLinesRequestHandler:WebApiBaseRequestHandler
|
public class GetTieLinesRequestHandler : WebApiBaseRequestHandler
|
||||||
{
|
{
|
||||||
public GetTieLinesRequestHandler() : base(true) { }
|
public GetTieLinesRequestHandler() : base(true) { }
|
||||||
|
|
||||||
protected override void HandleGet(HttpCwsContext context)
|
protected override void HandleGet(HttpCwsContext context)
|
||||||
{
|
{
|
||||||
var tieLineString = JsonConvert.SerializeObject(TieLineCollection.Default.Select((tl) => new {
|
var tieLineString = JsonConvert.SerializeObject(TieLineCollection.Default.Select((tl) => new
|
||||||
|
{
|
||||||
sourceKey = tl.SourcePort.ParentDevice.Key,
|
sourceKey = tl.SourcePort.ParentDevice.Key,
|
||||||
sourcePort = tl.SourcePort.Key,
|
sourcePort = tl.SourcePort.Key,
|
||||||
destinationKey = tl.DestinationPort.ParentDevice.Key,
|
destinationKey = tl.DestinationPort.ParentDevice.Key,
|
||||||
destinationPort = tl.DestinationPort.Key
|
destinationPort = tl.DestinationPort.Key,
|
||||||
|
type = tl.Type.ToString(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
context.Response.StatusCode = 200;
|
context.Response.StatusCode = 200;
|
||||||
|
|||||||
Reference in New Issue
Block a user