fix: add tieline type to output for console & CWS

This commit is contained in:
Andrew Welker
2024-06-24 14:57:07 -05:00
parent c50726f813
commit ba4ca20936
2 changed files with 82 additions and 90 deletions

View File

@@ -1,13 +1,6 @@
using System;
using Newtonsoft.Json;
using System;
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
{
@@ -89,8 +82,8 @@ namespace PepperDash.Essentials.Core
public override string ToString()
{
return string.Format("Tie line: {0}:{1} --> {2}:{3}", SourcePort.ParentDevice.Key, SourcePort.Key,
DestinationPort.ParentDevice.Key, DestinationPort.Key);
return string.Format("Tie line: {0}:{1} --> {2}:{3} {4}", SourcePort.ParentDevice.Key, SourcePort.Key,
DestinationPort.ParentDevice.Key, DestinationPort.Key, Type.ToString());
}
}
@@ -109,6 +102,6 @@ namespace PepperDash.Essentials.Core
}
[JsonIgnore]
static TieLineCollection _Default;
private static TieLineCollection _Default;
}
}

View File

@@ -1,11 +1,8 @@
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
{
@@ -15,11 +12,13 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
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,
sourcePort = tl.SourcePort.Key,
destinationKey = tl.DestinationPort.ParentDevice.Key,
destinationPort = tl.DestinationPort.Key
destinationPort = tl.DestinationPort.Key,
type = tl.Type.ToString(),
}));
context.Response.StatusCode = 200;