mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-04 07:14:58 +00:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Crestron.SimplSharp.WebScripting;
|
|
using Newtonsoft.Json;
|
|
using PepperDash.Core.Web.RequestHandlers;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|
{
|
|
public class GetTieLinesRequestHandler : WebApiBaseRequestHandler
|
|
{
|
|
public GetTieLinesRequestHandler() : base(true) { }
|
|
|
|
protected override void HandleGet(HttpCwsContext context)
|
|
{
|
|
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,
|
|
type = tl.Type.ToString(),
|
|
}));
|
|
|
|
context.Response.StatusCode = 200;
|
|
context.Response.StatusDescription = "OK";
|
|
context.Response.ContentType = "application/json";
|
|
context.Response.ContentEncoding = Encoding.UTF8;
|
|
context.Response.Write(tieLineString, false);
|
|
context.Response.End();
|
|
|
|
}
|
|
}
|
|
}
|