Compare commits

..

20 Commits

Author SHA1 Message Date
Nick Genovese
4dee5f450c fix: update Crestron.SimplSharp.SDK.ProgramLibrary version to 2.21.133 2025-08-08 14:23:47 -04:00
Nick Genovese
1e8591b3e0 fix: update Crestron.SimplSharp.SDK.Library and ProgramLibrary versions to 2.21.133 2025-08-08 13:21:35 -04:00
Andrew Welker
bb4b2f88b6 Merge pull request #1304 from PepperDash/temp-to-dev
Temp to dev
2025-08-05 16:39:38 -05:00
Andrew Welker
a41aba1904 Merge pull request #1300 from PepperDash/temp-to-dev
Temp to dev
2025-07-28 11:54:11 -05:00
Neil Dorin
b47f1d6b77 Merge pull request #1293 from PepperDash/to-dev 2025-07-23 07:53:44 -06:00
Andrew Welker
fda4a5a816 Merge pull request #1282 from PepperDash/main
Update Dev
2025-07-04 10:45:35 -05:00
Andrew Welker
9f70e3c721 Merge pull request #1276 from PepperDash/temp-to-dev
Temp to dev
2025-06-26 14:16:36 -04:00
Andrew Welker
ec6aeb17f6 Merge pull request #1271 from PepperDash/temp-to-dev
Temp to dev
2025-05-19 16:52:45 -05:00
Neil Dorin
91dc655103 Merge pull request #1269 from PepperDash/camera-preset-fix 2025-05-14 09:42:11 -06:00
Andrew Welker
bf31fb10eb fix: use correct join for preset select 2025-05-14 10:39:42 -05:00
Neil Dorin
5e21bad596 Merge pull request #1266 from PepperDash/temp-to-dev 2025-05-02 12:23:51 -06:00
Neil Dorin
2368f0c8cc Merge pull request #1262 from PepperDash/temp-to-dev 2025-04-28 11:37:01 -06:00
Neil Dorin
be58a0bc29 Merge pull request #1260 from PepperDash/temp-to-dev 2025-04-24 09:32:32 -06:00
Neil Dorin
8406f69e0d Merge pull request #1257 from PepperDash/temp-to-dev 2025-04-18 11:46:18 -06:00
Andrew Welker
116d83394a Merge pull request #1255 from PepperDash/temp-to-dev
Temp to dev
2025-04-14 11:15:27 -05:00
Neil Dorin
9b8e452eb4 Merge pull request #1251 from PepperDash/temp-to-dev 2025-04-11 14:00:02 -06:00
Neil Dorin
c9d86bd5dd Merge pull request #1248 from PepperDash/temp-to-dev 2025-04-11 11:55:35 -06:00
Neil Dorin
b2b257020f Merge pull request #1246 from PepperDash/temp-to-dev 2025-04-08 13:48:10 -06:00
Neil Dorin
6f58e18d14 Merge pull request #1244 from PepperDash/temp-to-dev
Temp to dev
2025-04-04 10:30:10 -06:00
Neil Dorin
60fc0298ec Merge pull request #1242 from PepperDash/temp-to-dev
Temp to dev
2025-04-02 11:14:45 -06:00
25 changed files with 309 additions and 757 deletions

View File

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

View File

@@ -74,10 +74,6 @@ namespace PepperDash.Core
/// <summary> /// <summary>
/// Secure TCP/IP /// Secure TCP/IP
/// </summary> /// </summary>
SecureTcpIp, SecureTcpIp
/// <summary>
/// Used when comms needs to be handled in SIMPL and bridged opposite the normal direction
/// </summary>
ComBridge
} }
} }

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
@@ -20,6 +19,7 @@ using Serilog.Templates;
namespace PepperDash.Core namespace PepperDash.Core
{ {
/// <summary> /// <summary>
/// Contains debug commands for use in various situations
/// </summary> /// </summary>
public static class Debug public static class Debug
{ {
@@ -272,9 +272,6 @@ namespace PepperDash.Core
if (result != CrestronDataStore.CDS_ERROR.CDS_SUCCESS) if (result != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
{ {
CrestronConsole.Print($"Unable to retrieve stored log level for {levelStoreKey}.\r\nError: {result}.\r\nSetting level to {LogEventLevel.Information}\r\n"); CrestronConsole.Print($"Unable to retrieve stored log level for {levelStoreKey}.\r\nError: {result}.\r\nSetting level to {LogEventLevel.Information}\r\n");
CrestronDataStoreStatic.SetLocalIntValue(levelStoreKey, (int)LogEventLevel.Information);
return LogEventLevel.Information; return LogEventLevel.Information;
} }
@@ -349,13 +346,13 @@ namespace PepperDash.Core
if (levelString.Trim() == "?") if (levelString.Trim() == "?")
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"Used to set the minimum level of debug messages to be printed to the console:\r\n" + $@"Used to set the minimum level of debug messages to be printed to the console:
$"{_logLevels[0]} = 0\r\n" + {_logLevels[0]} = 0
$"{_logLevels[1]} = 1\r\n" + {_logLevels[1]} = 1
$"{_logLevels[2]} = 2\r\n" + {_logLevels[2]} = 2
$"{_logLevels[3]} = 3\r\n" + {_logLevels[3]} = 3
$"{_logLevels[4]} = 4\r\n" + {_logLevels[4]} = 4
$"{_logLevels[5]} = 5"); {_logLevels[5]} = 5");
return; return;
} }
@@ -376,7 +373,7 @@ namespace PepperDash.Core
return; return;
} }
if (Enum.TryParse<LogEventLevel>(levelString, true, out var levelEnum)) if (Enum.TryParse<LogEventLevel>(levelString, out var levelEnum))
{ {
SetDebugLevel(levelEnum); SetDebugLevel(levelEnum);
return; return;

View File

@@ -1,5 +1,5 @@
using System; using Serilog.Events;
using Serilog.Events; using System;
using Log = PepperDash.Core.Debug; using Log = PepperDash.Core.Debug;
namespace PepperDash.Core.Logging namespace PepperDash.Core.Logging
@@ -11,7 +11,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args) public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogMessage(ex, message, device: device, args); Log.LogMessage(ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -19,7 +19,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args) public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogVerbose(ex, device, message, args); Log.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -27,7 +27,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogVerbose(this IKeyed device, string message, params object[] args) public static void LogVerbose(this IKeyed device, string message, params object[] args)
{ {
Log.LogVerbose(device, message, args); Log.LogMessage(LogEventLevel.Verbose, device, message, args);
} }
/// <summary> /// <summary>
@@ -35,7 +35,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args) public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogDebug(ex, device, message, args); Log.LogMessage(LogEventLevel.Debug, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -43,7 +43,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogDebug(this IKeyed device, string message, params object[] args) public static void LogDebug(this IKeyed device, string message, params object[] args)
{ {
Log.LogDebug(device, message, args); Log.LogMessage(LogEventLevel.Debug, device, message, args);
} }
/// <summary> /// <summary>
@@ -51,7 +51,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args) public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogInformation(ex, device, message, args); Log.LogMessage(LogEventLevel.Information, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -59,7 +59,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogInformation(this IKeyed device, string message, params object[] args) public static void LogInformation(this IKeyed device, string message, params object[] args)
{ {
Log.LogInformation(device, message, args); Log.LogMessage(LogEventLevel.Information, device, message, args);
} }
/// <summary> /// <summary>
@@ -67,7 +67,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args) public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogWarning(ex, device, message, args); Log.LogMessage(LogEventLevel.Warning, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -75,7 +75,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogWarning(this IKeyed device, string message, params object[] args) public static void LogWarning(this IKeyed device, string message, params object[] args)
{ {
Log.LogWarning(device, message, args); Log.LogMessage(LogEventLevel.Warning, device, message, args);
} }
/// <summary> /// <summary>
@@ -83,7 +83,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args) public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogError(ex, device, message, args); Log.LogMessage(LogEventLevel.Error, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -91,7 +91,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogError(this IKeyed device, string message, params object[] args) public static void LogError(this IKeyed device, string message, params object[] args)
{ {
Log.LogError(device, message, args); Log.LogMessage(LogEventLevel.Error, device, message, args);
} }
/// <summary> /// <summary>
@@ -99,7 +99,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args) public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
{ {
Log.LogFatal(ex, device, message, args); Log.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
} }
/// <summary> /// <summary>
@@ -107,7 +107,7 @@ namespace PepperDash.Core.Logging
/// </summary> /// </summary>
public static void LogFatal(this IKeyed device, string message, params object[] args) public static void LogFatal(this IKeyed device, string message, params object[] args)
{ {
Log.LogFatal(device, message, args); Log.LogMessage(LogEventLevel.Fatal, device, message, args);
} }
} }
} }

View File

@@ -43,7 +43,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" /> <PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.133" />
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" /> <PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" /> <PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />

View File

@@ -7,13 +7,6 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary> /// </summary>
public interface IBridgeAdvanced public interface IBridgeAdvanced
{ {
/// <summary>
/// Links the bridge to the API using the provided trilist, join start, join map key, and bridge.
/// </summary>
/// <param name="trilist">The trilist to link to.</param>
/// <param name="joinStart">The starting join number.</param>
/// <param name="joinMapKey">The key for the join map.</param>
/// <param name="bridge">The EISC API bridge.</param>
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
} }
} }

View File

@@ -1,138 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Crestron.SimplSharp.CrestronSockets;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Implements IBasicCommunication and sends all communication through an EISC
/// </summary>
[Description("Generic communication wrapper class for any IBasicCommunication type")]
public class CommBridge : EssentialsBridgeableDevice, IBasicCommunication
{
private EiscApiAdvanced eisc;
private IBasicCommunicationJoinMap joinMap;
/// <summary>
/// Event triggered when text is received through the communication bridge.
/// </summary>
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
/// <summary>
/// Event triggered when bytes are received through the communication bridge.
/// </summary>
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
/// <summary>
/// Indicates whether the communication bridge is currently connected.
/// </summary>
public bool IsConnected { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="CommBridge"/> class.
/// </summary>
/// <param name="key">The unique key for the communication bridge.</param>
/// <param name="name">The display name for the communication bridge.</param>
public CommBridge(string key, string name)
: base(key, name)
{
}
/// <summary>
/// Sends a byte array through the communication bridge.
/// </summary>
/// <param name="bytes">The byte array to send.</param>
public void SendBytes(byte[] bytes)
{
if (eisc == null)
{
this.LogWarning("EISC is null, cannot send bytes.");
return;
}
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, Encoding.ASCII.GetString(bytes, 0, bytes.Length));
}
/// <summary>
/// Sends a text string through the communication bridge.
/// </summary>
/// <param name="text">The text string to send.</param>
public void SendText(string text)
{
if (eisc == null)
{
this.LogWarning("EISC is null, cannot send text.");
return;
}
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, text);
}
/// <summary>
/// Initiates a connection through the communication bridge.
/// </summary>
public void Connect()
{
if (eisc == null)
{
this.LogWarning("EISC is null, cannot connect.");
return;
}
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, true);
}
/// <summary>
/// Terminates the connection through the communication bridge.
/// </summary>
public void Disconnect()
{
if (eisc == null)
{
this.LogWarning("EISC is null, cannot disconnect.");
return;
}
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, false);
}
/// <inheritdoc />
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
joinMap = new IBasicCommunicationJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
this.LogDebug("Linking to Trilist '{0}'", trilist.ID.ToString("X"));
eisc = bridge;
trilist.SetBoolSigAction(joinMap.Connected.JoinNumber, (b) => IsConnected = b);
trilist.SetStringSigAction(joinMap.TextReceived.JoinNumber, (s) =>
{
TextReceived?.Invoke(this, new GenericCommMethodReceiveTextArgs(s));
BytesReceived?.Invoke(this, new GenericCommMethodReceiveBytesArgs(Encoding.ASCII.GetBytes(s)));
});
}
}
}

View File

@@ -1,9 +1,11 @@
using System; using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using Serilog.Events; using Serilog.Events;
@@ -54,9 +56,6 @@ namespace PepperDash.Essentials.Core
case eControlMethod.Com: case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig); comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig);
break; break;
case eControlMethod.ComBridge:
comm = new CommBridge(deviceConfig.Key + "-simpl", deviceConfig.Name + " Simpl");
break;
case eControlMethod.Cec: case eControlMethod.Cec:
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig); comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
break; break;
@@ -108,7 +107,8 @@ namespace PepperDash.Essentials.Core
} }
// put it in the device manager if it's the right flavor // put it in the device manager if it's the right flavor
if (comm is Device comDev) var comDev = comm as Device;
if (comDev != null)
DeviceManager.AddDevice(comDev); DeviceManager.AddDevice(comDev);
return comm; return comm;
} }

View File

@@ -1,29 +0,0 @@
using System;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Config
{
/// <summary>
/// Represents the base properties for a streaming device.
/// </summary>
public class BaseStreamingDeviceProperties
{
/// <summary>
/// The multicast video address for the streaming device.
/// </summary>
[JsonProperty("multicastVideoAddress", NullValueHandling = NullValueHandling.Ignore)]
public string MulticastVideoAddress { get; set; }
/// <summary>
/// The multicast audio address for the streaming device.
/// </summary>
[JsonProperty("multicastAudioAddress", NullValueHandling = NullValueHandling.Ignore)]
public string MulticastAudioAddress { get; set; }
/// <summary>
/// The URL for the streaming device's media stream.
/// </summary>
[JsonProperty("streamUrl", NullValueHandling = NullValueHandling.Ignore)]
public string StreamUrl { get; set; }
}
}

View File

@@ -475,9 +475,9 @@ namespace PepperDash.Essentials.Core
if (String.IsNullOrEmpty(s) || s.Contains("?")) if (String.IsNullOrEmpty(s) || s.Contains("?"))
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]\r\n" + @"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]
" {deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use\r\n" + {deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use
" timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes"); timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
return; return;
} }

View File

@@ -3,29 +3,16 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary>
/// Base class for devices that can be bridged to an EISC API.
/// </summary>
public abstract class EssentialsBridgeableDevice:EssentialsDevice, IBridgeAdvanced public abstract class EssentialsBridgeableDevice:EssentialsDevice, IBridgeAdvanced
{ {
/// <summary>
/// Initializes a new instance of the <see cref="EssentialsBridgeableDevice"/> class with the specified key.
/// </summary>
/// <param name="key">The unique key for the device.</param>
protected EssentialsBridgeableDevice(string key) : base(key) protected EssentialsBridgeableDevice(string key) : base(key)
{ {
} }
/// <summary>
/// Initializes a new instance of the <see cref="EssentialsBridgeableDevice"/> class with the specified key and name.
/// </summary>
/// <param name="key">The unique key for the device.</param>
/// <param name="name">The display name for the device.</param>
protected EssentialsBridgeableDevice(string key, string name) : base(key, name) protected EssentialsBridgeableDevice(string key, string name) : base(key, name)
{ {
} }
/// <inheritdoc />
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
} }
} }

View File

@@ -244,20 +244,6 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
[JsonProperty("type")] [JsonProperty("type")]
public eRoutingSignalType Type { get; set; } public eRoutingSignalType Type { get; set; }
/// <summary>
/// Key for a destination list item. If BOTH SourceListItemKey AND DestinationListItemKey are defined,
/// then the direct route method should be used.
/// </summary>
[JsonProperty("destinationListItemKey", NullValueHandling = NullValueHandling.Ignore)]
public string DestinationListItemKey { get; set; }
/// <summary>
/// Key for a source list item. If BOTH SourceListItemKey AND DestinationListItemKey are defined,
/// then the direct route method should be used.
/// </summary>
[JsonProperty("sourceListItemKey", NullValueHandling = NullValueHandling.Ignore)]
public string SourceListItemKey { get; set; }
} }
/// <summary> /// <summary>

View File

@@ -217,8 +217,7 @@ namespace PepperDash.Essentials.Core
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.LogError(ex, "Exception occurred while creating device {key}: {message}", dc.Key, ex.Message); Debug.LogError(ex, "Exception occurred while creating device {0}: {1}", null, dc.Key, ex.Message);
Debug.LogDebug(ex, "Exception details: {stackTrace}", ex.StackTrace);
return null; return null;
} }
} }
@@ -250,9 +249,9 @@ namespace PepperDash.Essentials.Core
} }
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"Type: '{0}'\r\n" + @"Type: '{0}'
" Type: '{1}'\r\n" + Type: '{1}'
" Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine); Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine);
} }
} }

View File

@@ -25,7 +25,7 @@
<DocumentationFile>bin\$(Configuration)\PepperDash_Essentials_Core.xml</DocumentationFile> <DocumentationFile>bin\$(Configuration)\PepperDash_Essentials_Core.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" /> <None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />

View File

@@ -1,5 +1,5 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Routing namespace PepperDash.Essentials.Core.Routing
{ {
@@ -25,19 +25,5 @@ namespace PepperDash.Essentials.Core.Routing
/// </summary> /// </summary>
Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; } Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; }
/// <summary>
/// Event raised when the current sources change.
/// </summary>
event EventHandler CurrentSourcesChanged;
/// <summary>
/// Sets the current source for a specific signal type.
/// This method updates the current source for the specified signal type and notifies any subscribers of the change.
/// </summary>
/// <param name="signalType">The signal type to update.</param>
/// <param name="sourceListKey">The key for the source list.</param>
/// <param name="sourceListItem">The source list item to set as the current source.</param>
void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem);
} }
} }

View File

@@ -62,17 +62,18 @@ namespace PepperDash.Essentials.Core.Config
/// <returns>null if config data does not match ports, cards or devices</returns> /// <returns>null if config data does not match ports, cards or devices</returns>
public TieLine GetTieLine() public TieLine GetTieLine()
{ {
Debug.LogInformation("Build TieLine: {config}", ToString()); Debug.LogMessage(LogEventLevel.Information, "Build TieLine: {0}",null, this);
// Get the source device // Get the source device
if (!(DeviceManager.GetDeviceForKey(SourceKey) is IRoutingOutputs sourceDev)) var sourceDev = DeviceManager.GetDeviceForKey(SourceKey) as IRoutingOutputs;
if (sourceDev == null)
{ {
LogError("Routable source not found"); LogError("Routable source not found");
return null; return null;
} }
// Get the destination device // Get the destination device
if (!(DeviceManager.GetDeviceForKey(DestinationKey) is IRoutingInputs destDev)) var destDev = DeviceManager.GetDeviceForKey(DestinationKey) as IRoutingInputs;
if (destDev == null)
{ {
LogError("Routable destination not found"); LogError("Routable destination not found");
return null; return null;
@@ -103,9 +104,9 @@ namespace PepperDash.Essentials.Core.Config
/// Logs an error message related to creating this tie line configuration. /// Logs an error message related to creating this tie line configuration.
/// </summary> /// </summary>
/// <param name="msg">The specific error message.</param> /// <param name="msg">The specific error message.</param>
private void LogError(string msg) void LogError(string msg)
{ {
Debug.LogError("Cannot create tie line: {message}", msg); Debug.LogMessage(LogEventLevel.Error, "WARNING: Cannot create tie line: {message}:\r {tieLineConfig}",null, msg, this);
} }
/// <summary> /// <summary>
@@ -114,7 +115,8 @@ namespace PepperDash.Essentials.Core.Config
/// <returns>A string describing the source and destination of the configured tie line.</returns> /// <returns>A string describing the source and destination of the configured tie line.</returns>
public override string ToString() public override string ToString()
{ {
return $"{SourceKey}.{SourceCard}.{SourcePort} --> {DestinationKey}.{DestinationCard}.{DestinationPort}"; return string.Format("{0}.{1}.{2} --> {3}.{4}.{5}", SourceKey, SourceCard, SourcePort,
DestinationKey, DestinationCard, DestinationPort);
} }
} }
} }

View File

@@ -5,7 +5,6 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
@@ -90,9 +89,6 @@ namespace PepperDash.Essentials.Devices.Common.Displays
/// <inheritdoc/> /// <inheritdoc/>
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; } public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
/// <inheritdoc />
public event EventHandler CurrentSourcesChanged;
/// <summary> /// <summary>
/// Gets feedback indicating whether the display is currently cooling down after being powered off. /// Gets feedback indicating whether the display is currently cooling down after being powered off.
/// </summary> /// </summary>
@@ -382,53 +378,6 @@ namespace PepperDash.Essentials.Devices.Common.Displays
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
} }
/// <inheritdoc />
public virtual void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
{
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
{
var flagValue = Convert.ToInt32(type);
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
{
this.LogDebug("Skipping {type}", type);
continue;
}
this.LogDebug("setting {type}", type);
if (signalType.HasFlag(type))
{
UpdateCurrentSources(type, sourceListKey, sourceListItem);
}
}
// Raise the CurrentSourcesChanged event
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
}
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
{
if (CurrentSources.ContainsKey(signalType))
{
CurrentSources[signalType] = sourceListItem;
}
else
{
CurrentSources.Add(signalType, sourceListItem);
}
// Update the current source key for the specified signal type
if (CurrentSourceKeys.ContainsKey(signalType))
{
CurrentSourceKeys[signalType] = sourceListKey;
}
else
{
CurrentSourceKeys.Add(signalType, sourceListKey);
}
}
} }
/// <summary> /// <summary>

View File

@@ -29,6 +29,6 @@
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" /> <ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,77 +0,0 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Represents a IHasCurrentSourceInfoMessenger
/// </summary>
public class CurrentSourcesMessenger : MessengerBase
{
private readonly ICurrentSources sourceDevice;
/// <summary>
/// Initializes a new instance of the <see cref="CurrentSourcesMessenger"/> class.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="messagePath">The message path.</param>
/// <param name="device">The device.</param>
public CurrentSourcesMessenger(string key, string messagePath, ICurrentSources device) : base(key, messagePath, device as IKeyName)
{
sourceDevice = device;
}
/// <summary>
/// Registers the actions for the messenger.
/// </summary>
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) =>
{
var message = new CurrentSourcesStateMessage
{
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
CurrentSources = sourceDevice.CurrentSources
};
PostStatusMessage(message);
});
sourceDevice.CurrentSourcesChanged += (sender, e) =>
{
PostStatusMessage(JToken.FromObject(new
{
currentSourceKeys = sourceDevice.CurrentSourceKeys,
currentSources = sourceDevice.CurrentSources
}));
};
}
}
/// <summary>
/// Represents a CurrentSourcesStateMessage
/// </summary>
public class CurrentSourcesStateMessage : DeviceStateMessageBase
{
/// <summary>
/// Gets or sets the CurrentSourceKey
/// </summary>
[JsonProperty("currentSourceKeys", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; set; }
/// <summary>
/// Gets or sets the CurrentSource
/// </summary>
[JsonProperty("currentSources")]
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; set; }
}
}

View File

@@ -1,77 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Represents a IBasicVideoMuteWithFeedbackMessenger
/// </summary>
public class IBasicVideoMuteWithFeedbackMessenger : MessengerBase
{
private readonly IBasicVideoMuteWithFeedback device;
public IBasicVideoMuteWithFeedbackMessenger(string key, string messagePath, IBasicVideoMuteWithFeedback device)
: base(key, messagePath, device as IKeyName)
{
this.device = device;
}
/// <summary>
/// SendFullStatus method
/// </summary>
public void SendFullStatus()
{
var messageObj = new IBasicVideoMuteWithFeedbackMessage
{
VideoMuteState = device.VideoMuteIsOn.BoolValue
};
PostStatusMessage(messageObj);
}
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/videoMuteToggle", (id, content) =>
{
device.VideoMuteToggle();
});
AddAction("/videoMuteOn", (id, content) =>
{
device.VideoMuteOn();
});
AddAction("/videoMuteOff", (id, content) =>
{
device.VideoMuteOff();
});
device.VideoMuteIsOn.OutputChange += VideoMuteIsOnFeedback_OutputChange;
}
private void VideoMuteIsOnFeedback_OutputChange(object sender, FeedbackEventArgs args)
{
PostStatusMessage(JToken.FromObject(new
{
videoMuteState = args.BoolValue
})
);
}
}
/// <summary>
/// Represents a IBasicVideoMuteWithFeedbackMessage
/// </summary>
public class IBasicVideoMuteWithFeedbackMessage : DeviceStateMessageBase
{
[JsonProperty("videoMuteState")]
public bool VideoMuteState { get; set; }
}
}

View File

@@ -54,18 +54,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
public class CurrentSourceStateMessage : DeviceStateMessageBase public class CurrentSourceStateMessage : DeviceStateMessageBase
{ {
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary> /// <summary>
/// Gets or sets the CurrentSourceKey /// Gets or sets the CurrentSourceKey
/// </summary> /// </summary>
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
public string CurrentSourceKey { get; set; } public string CurrentSourceKey { get; set; }
[JsonProperty("currentSource")]
/// <summary> /// <summary>
/// Gets or sets the CurrentSource /// Gets or sets the CurrentSource
/// </summary> /// </summary>
[JsonProperty("currentSource")]
public SourceListItem CurrentSource { get; set; } public SourceListItem CurrentSource { get; set; }
} }
} }

View File

@@ -33,7 +33,7 @@
<Compile Remove="Messengers\SIMPLVtcMessenger.cs" /> <Compile Remove="Messengers\SIMPLVtcMessenger.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" /> <ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />

View File

@@ -1,10 +1,4 @@
using System; using Crestron.SimplSharp;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharp.WebScripting; using Crestron.SimplSharp.WebScripting;
@@ -36,6 +30,12 @@ using PepperDash.Essentials.RoomBridges;
using PepperDash.Essentials.Services; using PepperDash.Essentials.Services;
using PepperDash.Essentials.WebApiHandlers; using PepperDash.Essentials.WebApiHandlers;
using PepperDash.Essentials.WebSocketServer; using PepperDash.Essentials.WebSocketServer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WebSocketSharp; using WebSocketSharp;
namespace PepperDash.Essentials namespace PepperDash.Essentials
@@ -505,25 +505,6 @@ namespace PepperDash.Essentials
messengerAdded = true; messengerAdded = true;
} }
if (device is IBasicVideoMuteWithFeedback)
{
var deviceKey = device.Key;
this.LogVerbose(
"Adding IBasicVideoMuteWithFeedback for {deviceKey}",
deviceKey
);
var videoMuteControlDevice = device as IBasicVideoMuteWithFeedback;
var messenger = new IBasicVideoMuteWithFeedbackMessenger(
$"{device.Key}-videoMute-{Key}",
string.Format("/device/{0}", deviceKey),
videoMuteControlDevice
);
AddDefaultDeviceMessenger(messenger);
messengerAdded = true;
}
if (device is ILightingScenes || device is LightingBase) if (device is ILightingScenes || device is LightingBase)
{ {
var deviceKey = device.Key; var deviceKey = device.Key;
@@ -740,17 +721,6 @@ namespace PepperDash.Essentials
messengerAdded = true; messengerAdded = true;
} }
if (device is ICurrentSources currentSources)
{
this.LogVerbose("Adding CurrentSourcesMessenger for {deviceKey}", device.Key);
var messenger = new CurrentSourcesMessenger($"{device.Key}-currentSources-{Key}", $"/device/{device.Key}", currentSources);
AddDefaultDeviceMessenger(messenger);
messengerAdded = true;
}
if (device is ISwitchedOutput switchedDevice) if (device is ISwitchedOutput switchedDevice)
{ {
this.LogVerbose( this.LogVerbose(
@@ -1655,14 +1625,15 @@ namespace PepperDash.Essentials
if (Config.EnableApiServer) if (Config.EnableApiServer)
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"Mobile Control Edge Server API Information:\r\n\r\n" + @"Mobile Control Edge Server API Information:
"\tServer address: {0}\r\n" +
"\tSystem Name: {1}\r\n" + Server address: {0}
"\tSystem URL: {2}\r\n" + System Name: {1}
"\tSystem UUID: {3}\r\n" + System URL: {2}
"\tSystem User code: {4}\r\n" + System UUID: {3}
"\tConnected?: {5}\r\n" + System User code: {4}
"\tSeconds Since Last Ack: {6}\r\n", Connected?: {5}
Seconds Since Last Ack: {6}",
url, url,
name, name,
ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.SystemUrl,
@@ -1675,8 +1646,10 @@ namespace PepperDash.Essentials
else else
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"\r\nMobile Control Edge Server API Information:\r\n" + @"
" Not Enabled in Config.\r\n" Mobile Control Edge Server API Information:
Not Enabled in Config.
"
); );
} }
@@ -1687,17 +1660,21 @@ namespace PepperDash.Essentials
) )
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"\r\nMobile Control Direct Server Information:\r\n" + @"
" User App URL: {0}\r\n" + Mobile Control Direct Server Information:
" Server port: {1}\r\n", User App URL: {0}
Server port: {1}
",
string.Format("{0}[insert_client_token]", _directServer.UserAppUrlPrefix), string.Format("{0}[insert_client_token]", _directServer.UserAppUrlPrefix),
_directServer.Port _directServer.Port
); );
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"\r\n UI Client Info:\r\n" + @"
" Tokens Defined: {0}\r\n" + UI Client Info:
" Clients Connected: {1}\r\n", Tokens Defined: {0}
Clients Connected: {1}
",
_directServer.UiClients.Count, _directServer.UiClients.Count,
_directServer.ConnectedUiClientsCount _directServer.ConnectedUiClientsCount
); );
@@ -1715,13 +1692,15 @@ namespace PepperDash.Essentials
} }
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"\r\nClient {0}:\r\n" + @"
"Room Key: {1}\r\n" + Client {0}:
"Touchpanel Key: {6}\r\n" + Room Key: {1}
"Token: {2}\r\n" + Touchpanel Key: {6}
"Client URL: {3}\r\n" + Token: {2}
"Connected: {4}\r\n" + Client URL: {3}
"Duration: {5}\r\n", Connected: {4}
Duration: {5}
",
clientNo, clientNo,
clientContext.Value.Token.RoomKey, clientContext.Value.Token.RoomKey,
clientContext.Key, clientContext.Key,
@@ -1736,8 +1715,9 @@ namespace PepperDash.Essentials
else else
{ {
CrestronConsole.ConsoleCommandResponse( CrestronConsole.ConsoleCommandResponse(
"\r\nMobile Control Direct Server Information:\r\n" + @"
" Not Enabled in Config.\r\n" Mobile Control Direct Server Infromation:
Not Enabled in Config."
); );
} }
} }

View File

@@ -38,7 +38,7 @@
<Compile Remove="RoomBridges\SourceDeviceMapDictionary.cs" /> <Compile Remove="RoomBridges\SourceDeviceMapDictionary.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" /> <PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -48,7 +48,7 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.21.133" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" /> <ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />