Compare commits

..

8 Commits

Author SHA1 Message Date
Andrew Welker
db4f540710 Merge pull request #1394 from PepperDash/temp
merge temp into dev
2026-03-03 13:39:46 -05:00
Neil Dorin
ce8b08e312 Merge pull request #1371 from PepperDash/temp-to-dev 2025-12-23 12:14:03 -05:00
Andrew Welker
13e833b797 Merge pull request #1366 from PepperDash/main
Main -> Development
2025-12-09 15:48:09 -05:00
Andrew Welker
2be078da18 Merge pull request #1360 from PepperDash/temp-to-dev
Temp to dev
2025-11-25 13:42:11 -05:00
Neil Dorin
7330ae2e30 Merge pull request #1330 from PepperDash/temp-to-dev 2025-10-10 10:32:48 -04:00
Andrew Welker
a57dddba5e Merge pull request #1341 from PepperDash/main
Update temp-to-dev branch
2025-10-10 10:31:28 -04:00
Neil Dorin
0bfec16622 Merge pull request #1328 from PepperDash/temp-to-dev
Temp to dev
2025-09-08 11:29:40 -06:00
Andrew Welker
94e7b8210f Merge pull request #1323 from PepperDash/temp-to-dev
Temp to dev
2025-08-26 10:19:59 -04:00
6 changed files with 60 additions and 118 deletions

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.29.0-local</Version>
<Version>2.19.4-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technology</Authors>
<Company>PepperDash Technology</Company>

View File

@@ -27,19 +27,18 @@ namespace PepperDash.Core
public class DebugWebsocketSink : ILogEventSink
{
private HttpServer _httpsServer;
private string _path = "/debug/join/";
private const string _certificateName = "selfCres";
private const string _certificatePassword = "cres12345";
public int Port
{
get
{
if (_httpsServer == null) return 0;
public int Port
{ get
{
if(_httpsServer == null) return 0;
return _httpsServer.Port;
}
}
}
public string Url
@@ -55,7 +54,7 @@ namespace PepperDash.Core
/// Gets or sets the IsRunning
/// </summary>
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
private readonly ITextFormatter _textFormatter;
@@ -131,7 +130,7 @@ namespace PepperDash.Core
/// </summary>
public void StartServerAndSetPort(int port)
{
Debug.LogInformation("Starting Websocket Server on port: {port}", port);
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
Start(port, $"\\user\\{_certificateName}.pfx", _certificatePassword);
@@ -146,7 +145,7 @@ namespace PepperDash.Core
if (!string.IsNullOrWhiteSpace(certPath))
{
Debug.LogInformation("Assigning SSL Configuration");
Debug.Console(0, "Assigning SSL Configuration");
_httpsServer.SslConfiguration = new ServerSslConfiguration(new X509Certificate2(certPath, certPassword))
{
ClientCertificateRequired = false,
@@ -155,24 +154,54 @@ namespace PepperDash.Core
//this is just to test, you might want to actually validate
ClientCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
Debug.LogInformation("HTTPS ClientCerticateValidation Callback triggered");
Debug.Console(0, "HTTPS ClientCerticateValidation Callback triggered");
return true;
}
};
}
Debug.LogInformation("Adding Debug Client Service");
Debug.Console(0, "Adding Debug Client Service");
_httpsServer.AddWebSocketService<DebugClient>(_path);
Debug.LogInformation("Assigning Log Info");
Debug.Console(0, "Assigning Log Info");
_httpsServer.Log.Level = LogLevel.Trace;
_httpsServer.Log.Output = WriteWebSocketInternalLog;
Debug.LogInformation("Starting");
_httpsServer.Log.Output = (d, s) =>
{
uint level;
switch(d.Level)
{
case WebSocketSharp.LogLevel.Fatal:
level = 3;
break;
case WebSocketSharp.LogLevel.Error:
level = 2;
break;
case WebSocketSharp.LogLevel.Warn:
level = 1;
break;
case WebSocketSharp.LogLevel.Info:
level = 0;
break;
case WebSocketSharp.LogLevel.Debug:
level = 4;
break;
case WebSocketSharp.LogLevel.Trace:
level = 5;
break;
default:
level = 4;
break;
}
Debug.Console(level, "{1} {0}\rCaller:{2}\rMessage:{3}\rs:{4}", d.Level.ToString(), d.Date.ToString(), d.Caller.ToString(), d.Message, s);
};
Debug.Console(0, "Starting");
_httpsServer.Start();
Debug.LogInformation("Ready");
Debug.Console(0, "Ready");
}
catch (Exception ex)
{
Debug.LogError(ex, "WebSocket Failed to start: {message}", ex.Message);
Debug.Console(0, "WebSocket Failed to start {0}", ex.Message);
}
}
@@ -181,68 +210,10 @@ namespace PepperDash.Core
/// </summary>
public void StopServer()
{
Debug.LogInformation("Stopping Websocket Server");
Debug.Console(0, "Stopping Websocket Server");
_httpsServer?.Stop();
try
{
if (_httpsServer == null || !_httpsServer.IsListening)
{
return;
}
// Prevent close-sequence internal websocket logs from re-entering the logging pipeline.
_httpsServer.Log.Output = (d, s) => { };
var serviceHost = _httpsServer.WebSocketServices[_path];
if (serviceHost == null)
{
_httpsServer.Stop();
_httpsServer = null;
return;
}
serviceHost.Sessions.Broadcast("Server is stopping");
foreach (var session in serviceHost.Sessions.Sessions)
{
if (session?.Context?.WebSocket != null && session.Context.WebSocket.IsAlive)
{
session.Context.WebSocket.Close(1001, "Server is stopping");
}
}
_httpsServer.Stop();
_httpsServer = null;
}
catch (Exception ex)
{
Debug.LogError(ex, "WebSocket Failed to stop gracefully {0}", ex.Message);
Debug.LogVerbose("Stack Trace\r\n{0}", ex.StackTrace);
}
}
private static void WriteWebSocketInternalLog(LogData data, string supplemental)
{
try
{
if (data == null)
{
return;
}
var message = string.IsNullOrWhiteSpace(data.Message) ? "<none>" : data.Message;
var details = string.IsNullOrWhiteSpace(supplemental) ? string.Empty : string.Format(" | details: {0}", supplemental);
// Use direct console output to avoid recursive log sink calls.
CrestronConsole.PrintLine(string.Format("WS[{0}] {1} | message: {2}{3}", data.Level, data.Date, message, details));
}
catch
{
// Never throw from websocket log callback.
}
_httpsServer = null;
}
}
@@ -283,7 +254,7 @@ namespace PepperDash.Core
public DebugClient()
{
Debug.LogInformation("DebugClient Created");
Debug.Console(0, "DebugClient Created");
}
protected override void OnOpen()
@@ -291,7 +262,7 @@ namespace PepperDash.Core
base.OnOpen();
var url = Context.WebSocket.Url;
Debug.LogInformation("New WebSocket Connection from: {url}", url);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WebSocket Connection from: {0}", url);
_connectionTime = DateTime.Now;
}
@@ -300,14 +271,14 @@ namespace PepperDash.Core
{
base.OnMessage(e);
Debug.LogInformation("WebSocket UiClient Message: {data}", e.Data);
Debug.Console(0, "WebSocket UiClient Message: {0}", e.Data);
}
protected override void OnClose(CloseEventArgs e)
{
base.OnClose(e);
Debug.LogInformation("WebSocket UiClient Closing: {code} reason: {reason}", e.Code, e.Reason);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Closing: {0} reason: {1}", e.Code, e.Reason);
}
@@ -315,7 +286,7 @@ namespace PepperDash.Core
{
base.OnError(e);
Debug.LogError(e.Exception, "WebSocket UiClient Error: {message}", e.Message);
Debug.Console(2, Debug.ErrorLogLevel.Notice, "WebSocket UiClient Error: {0} message: {1}", e.Exception, e.Message);
}
}
}

View File

@@ -30,17 +30,6 @@ namespace PepperDash.Essentials.Core.Bridges
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
protected BridgeApi(string key, string name) :
base(key, name)
{
}
}
/// <summary>
@@ -69,7 +58,7 @@ namespace PepperDash.Essentials.Core.Bridges
/// <param name="dc">Device configuration</param>
/// <param name="eisc">EISC instance</param>
public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
base(dc.Key, dc.Name)
base(dc.Key)
{
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();

View File

@@ -138,9 +138,7 @@ namespace PepperDash.Essentials.Core
///
/// </summary>
[JsonProperty("destinations")]
[Obsolete("This property is obsolete and will be removed in future versions.")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; }
/// <summary>
/// A means to reference a source list for this source item, in the event that this source has an input that can have sources routed to it
/// </summary>
@@ -177,12 +175,6 @@ namespace PepperDash.Essentials.Core
[JsonProperty("syncProviderDeviceKey")]
public string SyncProviderDeviceKey { get; set; }
/// <summary>
/// The key of the device that provides audio for this source item
/// </summary>
[JsonProperty("audioDeviceKey")]
public string AudioDeviceKey { get; set; }
/// <summary>
/// Indicates if the source supports USB connections
/// </summary>

View File

@@ -90,8 +90,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
/// <param name="context"></param>
protected override void HandlePost(HttpCwsContext context)
{
Task.Run(() => Debug.WebsocketSink.StopServer());
Debug.WebsocketSink.StopServer();
context.Response.StatusCode = 200;
context.Response.StatusDescription = "OK";
@@ -99,5 +98,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
Debug.LogMessage(LogEventLevel.Information, "Websocket Debug Session Stopped");
}
}
}

View File

@@ -922,18 +922,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
if (presetsCodec != null && Codec is IHasFarEndCameraControl &&
(Codec as IHasFarEndCameraControl).ControllingFarEndCameraFeedback.BoolValue)
{
currentPresets = presetsCodec.FarEndRoomPresets;
}
else if (presetsCodec != null)
{
currentPresets = presetsCodec.NearEndPresets;
}
if (currentPresets == null)
{
return new List<CodecRoomPreset>();
}
else if (presetsCodec != null) currentPresets = presetsCodec.NearEndPresets;
return currentPresets;
}