fix: add OverrideType property to TieLineConfig

The TielineConfig had no property for the `type` property from an Essentials configuration file to be deserialized into. This has been corrected so that the `type` property in a Tieline JSON configuration is now respected and used to build the tieline.
This commit is contained in:
Andrew Welker
2025-04-04 00:04:53 -05:00
parent 1b17d92ee0
commit b531d724ff
2 changed files with 16 additions and 1 deletions

View File

@@ -57,6 +57,16 @@ namespace PepperDash.Essentials.Core
DestinationPort = destinationPort;
}
/// <summary>
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
/// </summary>
/// <param name="overrideType">The signal type to limit the link to. Overrides DestinationPort.Type</param>
public TieLine(RoutingOutputPort sourcePort, RoutingInputPort destinationPort, eRoutingSignalType? overrideType) :
this(sourcePort, destinationPort)
{
OverrideType = overrideType;
}
/// <summary>
/// Creates a tie line with an overriding Type. See help for OverrideType property for info
/// </summary>

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -23,6 +24,10 @@ namespace PepperDash.Essentials.Core.Config
public string DestinationCard { get; set; }
public string DestinationPort { get; set; }
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public eRoutingSignalType? OverrideType { get; set; }
/// <summary>
/// Returns the appropriate tie line for either a card-based device or
/// regular device with ports on-device.
@@ -65,7 +70,7 @@ namespace PepperDash.Essentials.Core.Config
return null;
}
return new TieLine(sourceOutputPort, destinationInputPort);
return new TieLine(sourceOutputPort, destinationInputPort, OverrideType);
}
void LogError(string msg)