mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Compare commits
19 Commits
v2.14.0-IB
...
feature/un
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
473c6d4590 | ||
|
|
903236d6d9 | ||
|
|
9245ac9c74 | ||
|
|
b47f1d6b77 | ||
|
|
fda4a5a816 | ||
|
|
9f70e3c721 | ||
|
|
ec6aeb17f6 | ||
|
|
91dc655103 | ||
|
|
bf31fb10eb | ||
|
|
5e21bad596 | ||
|
|
2368f0c8cc | ||
|
|
be58a0bc29 | ||
|
|
8406f69e0d | ||
|
|
116d83394a | ||
|
|
9b8e452eb4 | ||
|
|
c9d86bd5dd | ||
|
|
b2b257020f | ||
|
|
6f58e18d14 | ||
|
|
60fc0298ec |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -395,4 +395,3 @@ essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/Pepp
|
|||||||
_site/
|
_site/
|
||||||
api/
|
api/
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
/._PepperDash.Essentials.4Series.sln
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the string event handler for line events on the gather
|
/// Defines the string event handler for line events on the gather
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ControlPropertiesConfig
|
/// Represents a ControlPropertiesConfig
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Crestron Control Methods for a comm object
|
/// Crestron Control Methods for a comm object
|
||||||
@@ -74,10 +68,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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static JObject ParseObject(string json)
|
public static JObject ParseObject(string json)
|
||||||
{
|
{
|
||||||
#if NET6_0
|
#if NET8_0
|
||||||
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
||||||
#else
|
#else
|
||||||
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
||||||
@@ -186,7 +186,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static JArray ParseArray(string json)
|
public static JArray ParseArray(string json)
|
||||||
{
|
{
|
||||||
#if NET6_0
|
#if NET8_0
|
||||||
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
|
||||||
#else
|
#else
|
||||||
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json)))
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using Crestron.SimplSharp;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharp.CrestronDataStore;
|
using Crestron.SimplSharp.CrestronDataStore;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharp.CrestronLogger;
|
using Crestron.SimplSharp.CrestronLogger;
|
||||||
@@ -16,10 +11,15 @@ using Serilog.Events;
|
|||||||
using Serilog.Formatting.Compact;
|
using Serilog.Formatting.Compact;
|
||||||
using Serilog.Formatting.Json;
|
using Serilog.Formatting.Json;
|
||||||
using Serilog.Templates;
|
using Serilog.Templates;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -48,9 +48,6 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
private static readonly LoggingLevelSwitch _fileLevelSwitch;
|
private static readonly LoggingLevelSwitch _fileLevelSwitch;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the minimum log level for the websocket sink.
|
|
||||||
/// </summary>
|
|
||||||
public static LogEventLevel WebsocketMinimumLogLevel
|
public static LogEventLevel WebsocketMinimumLogLevel
|
||||||
{
|
{
|
||||||
get { return _websocketLoggingLevelSwitch.MinimumLevel; }
|
get { return _websocketLoggingLevelSwitch.MinimumLevel; }
|
||||||
@@ -58,9 +55,6 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
private static readonly DebugWebsocketSink _websocketSink;
|
private static readonly DebugWebsocketSink _websocketSink;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the websocket sink for debug logging.
|
|
||||||
/// </summary>
|
|
||||||
public static DebugWebsocketSink WebsocketSink
|
public static DebugWebsocketSink WebsocketSink
|
||||||
{
|
{
|
||||||
get { return _websocketSink; }
|
get { return _websocketSink; }
|
||||||
@@ -97,33 +91,29 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
private const int SaveTimeoutMs = 30000;
|
private const int SaveTimeoutMs = 30000;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates whether the system is running on an appliance.
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsRunningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
|
public static bool IsRunningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PepperDashCoreVersion
|
/// Gets or sets the PepperDashCoreVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string PepperDashCoreVersion { get; private set; }
|
public static string PepperDashCoreVersion { get; private set; }
|
||||||
|
|
||||||
private static CTimer _saveTimer;
|
private static CTimer _saveTimer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When true, the IncludedExcludedKeys dict will contain keys to include.
|
/// When true, the IncludedExcludedKeys dict will contain keys to include.
|
||||||
/// When false (default), IncludedExcludedKeys will contain keys to exclude.
|
/// When false (default), IncludedExcludedKeys will contain keys to exclude.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool _excludeAllMode;
|
private static bool _excludeAllMode;
|
||||||
|
|
||||||
private static readonly Dictionary<string, object> IncludedExcludedKeys;
|
//static bool ExcludeNoKeyMessages;
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, object> IncludedExcludedKeys;
|
||||||
|
|
||||||
private static readonly LoggerConfiguration _defaultLoggerConfiguration;
|
private static readonly LoggerConfiguration _defaultLoggerConfiguration;
|
||||||
|
|
||||||
private static LoggerConfiguration _loggerConfiguration;
|
private static LoggerConfiguration _loggerConfiguration;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the logger configuration for the debug logging.
|
|
||||||
/// </summary>
|
|
||||||
public static LoggerConfiguration LoggerConfiguration => _loggerConfiguration;
|
public static LoggerConfiguration LoggerConfiguration => _loggerConfiguration;
|
||||||
|
|
||||||
static Debug()
|
static Debug()
|
||||||
@@ -138,7 +128,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
var defaultFileLogLevel = GetStoredLogEventLevel(FileLevelStoreKey);
|
var defaultFileLogLevel = GetStoredLogEventLevel(FileLevelStoreKey);
|
||||||
|
|
||||||
_consoleLoggingLevelSwitch = new LoggingLevelSwitch(initialMinimumLevel: defaultConsoleLevel);
|
_consoleLoggingLevelSwitch = new LoggingLevelSwitch(initialMinimumLevel: defaultConsoleLevel);
|
||||||
|
|
||||||
_websocketLoggingLevelSwitch = new LoggingLevelSwitch(initialMinimumLevel: defaultWebsocketLevel);
|
_websocketLoggingLevelSwitch = new LoggingLevelSwitch(initialMinimumLevel: defaultWebsocketLevel);
|
||||||
|
|
||||||
@@ -154,7 +144,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
CrestronConsole.PrintLine($"Saving log files to {logFilePath}");
|
CrestronConsole.PrintLine($"Saving log files to {logFilePath}");
|
||||||
|
|
||||||
var errorLogTemplate = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
|
var errorLogTemplate = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
|
||||||
? "{@t:fff}ms [{@l:u4}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}"
|
? "{@t:fff}ms [{@l:u4}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}"
|
||||||
: "[{@t:yyyy-MM-dd HH:mm:ss.fff}][{@l:u4}][{App}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}";
|
: "[{@t:yyyy-MM-dd HH:mm:ss.fff}][{@l:u4}][{App}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}";
|
||||||
|
|
||||||
@@ -165,7 +155,7 @@ namespace PepperDash.Core
|
|||||||
.WriteTo.Sink(new DebugConsoleSink(new ExpressionTemplate("[{@t:yyyy-MM-dd HH:mm:ss.fff}][{@l:u4}][{App}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}")), levelSwitch: _consoleLoggingLevelSwitch)
|
.WriteTo.Sink(new DebugConsoleSink(new ExpressionTemplate("[{@t:yyyy-MM-dd HH:mm:ss.fff}][{@l:u4}][{App}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}")), levelSwitch: _consoleLoggingLevelSwitch)
|
||||||
.WriteTo.Sink(_websocketSink, levelSwitch: _websocketLoggingLevelSwitch)
|
.WriteTo.Sink(_websocketSink, levelSwitch: _websocketLoggingLevelSwitch)
|
||||||
.WriteTo.Sink(new DebugErrorLogSink(new ExpressionTemplate(errorLogTemplate)), levelSwitch: _errorLogLevelSwitch)
|
.WriteTo.Sink(new DebugErrorLogSink(new ExpressionTemplate(errorLogTemplate)), levelSwitch: _errorLogLevelSwitch)
|
||||||
.WriteTo.File(new RenderedCompactJsonFormatter(), logFilePath,
|
.WriteTo.File(new RenderedCompactJsonFormatter(), logFilePath,
|
||||||
rollingInterval: RollingInterval.Day,
|
rollingInterval: RollingInterval.Day,
|
||||||
restrictedToMinimumLevel: LogEventLevel.Debug,
|
restrictedToMinimumLevel: LogEventLevel.Debug,
|
||||||
retainedFileCountLimit: CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? 30 : 60,
|
retainedFileCountLimit: CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? 30 : 60,
|
||||||
@@ -203,27 +193,27 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
CrestronConsole.PrintLine(msg);
|
CrestronConsole.PrintLine(msg);
|
||||||
|
|
||||||
LogMessage(LogEventLevel.Information, msg);
|
LogMessage(LogEventLevel.Information,msg);
|
||||||
|
|
||||||
IncludedExcludedKeys = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
|
IncludedExcludedKeys = new Dictionary<string, object>();
|
||||||
|
|
||||||
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
||||||
{
|
{
|
||||||
// Add command to console
|
// Add command to console
|
||||||
CrestronConsole.AddNewConsoleCommand(SetDoNotLoadOnNextBootFromConsole, "donotloadonnextboot",
|
CrestronConsole.AddNewConsoleCommand(SetDoNotLoadOnNextBootFromConsole, "donotloadonnextboot",
|
||||||
"donotloadonnextboot:P [true/false]: Should the application load on next boot", ConsoleAccessLevelEnum.AccessOperator);
|
"donotloadonnextboot:P [true/false]: Should the application load on next boot", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
||||||
"appdebug:P [0-5]: Sets the application's console debug message level",
|
"appdebug:P [0-5]: Sets the application's console debug message level",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(ShowDebugLog, "appdebuglog",
|
CrestronConsole.AddNewConsoleCommand(ShowDebugLog, "appdebuglog",
|
||||||
"appdebuglog:P [all] Use \"all\" for full log.",
|
"appdebuglog:P [all] Use \"all\" for full log.",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(s => CrestronLogger.Clear(false), "appdebugclear",
|
CrestronConsole.AddNewConsoleCommand(s => CrestronLogger.Clear(false), "appdebugclear",
|
||||||
"appdebugclear:P Clears the current custom log",
|
"appdebugclear:P Clears the current custom log",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(SetDebugFilterFromConsole, "appdebugfilter",
|
CrestronConsole.AddNewConsoleCommand(SetDebugFilterFromConsole, "appdebugfilter",
|
||||||
"appdebugfilter [params]", ConsoleAccessLevelEnum.AccessOperator);
|
"appdebugfilter [params]", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
@@ -234,7 +224,7 @@ namespace PepperDash.Core
|
|||||||
Level = context.Level;
|
Level = context.Level;
|
||||||
DoNotLoadConfigOnNextBoot = context.DoNotLoadOnNextBoot;
|
DoNotLoadConfigOnNextBoot = context.DoNotLoadOnNextBoot;
|
||||||
|
|
||||||
if (DoNotLoadConfigOnNextBoot)
|
if(DoNotLoadConfigOnNextBoot)
|
||||||
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
|
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
|
||||||
|
|
||||||
_consoleLoggingLevelSwitch.MinimumLevelChanged += (sender, args) =>
|
_consoleLoggingLevelSwitch.MinimumLevelChanged += (sender, args) =>
|
||||||
@@ -267,26 +257,22 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = CrestronDataStoreStatic.GetLocalIntValue(levelStoreKey, out int logLevel);
|
var result = CrestronDataStoreStatic.GetLocalIntValue(levelStoreKey, out int logLevel);
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logLevel < 0 || logLevel > 5)
|
if(logLevel < 0 || logLevel > 5)
|
||||||
{
|
{
|
||||||
CrestronConsole.PrintLine($"Stored Log level not valid for {levelStoreKey}: {logLevel}. Setting level to {LogEventLevel.Information}");
|
CrestronConsole.PrintLine($"Stored Log level not valid for {levelStoreKey}: {logLevel}. Setting level to {LogEventLevel.Information}");
|
||||||
return LogEventLevel.Information;
|
return LogEventLevel.Information;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (LogEventLevel)logLevel;
|
return (LogEventLevel)logLevel;
|
||||||
}
|
} catch (Exception ex)
|
||||||
catch (Exception ex)
|
|
||||||
{
|
{
|
||||||
CrestronConsole.PrintLine($"Exception retrieving log level for {levelStoreKey}: {ex.Message}");
|
CrestronConsole.PrintLine($"Exception retrieving log level for {levelStoreKey}: {ex.Message}");
|
||||||
return LogEventLevel.Information;
|
return LogEventLevel.Information;
|
||||||
@@ -298,7 +284,7 @@ namespace PepperDash.Core
|
|||||||
var assembly = Assembly.GetExecutingAssembly();
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
var ver =
|
var ver =
|
||||||
assembly
|
assembly
|
||||||
.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
|
.GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false);
|
||||||
|
|
||||||
if (ver != null && ver.Length > 0)
|
if (ver != null && ver.Length > 0)
|
||||||
{
|
{
|
||||||
@@ -349,13 +335,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,25 +351,25 @@ namespace PepperDash.Core
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int.TryParse(levelString, out var levelInt))
|
if(int.TryParse(levelString, out var levelInt))
|
||||||
{
|
{
|
||||||
if (levelInt < 0 || levelInt > 5)
|
if(levelInt < 0 || levelInt > 5)
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse($"Error: Unable to parse {levelString} to valid log level. If using a number, value must be between 0-5");
|
CrestronConsole.ConsoleCommandResponse($"Error: Unable to parse {levelString} to valid log level. If using a number, value must be between 0-5");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetDebugLevel((uint)levelInt);
|
SetDebugLevel((uint) levelInt);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse($"Error: Unable to parse {levelString} to valid log level");
|
CrestronConsole.ConsoleCommandResponse($"Error: Unable to parse {levelString} to valid log level");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse("Usage: appdebug:P [0-5]");
|
CrestronConsole.ConsoleCommandResponse("Usage: appdebug:P [0-5]");
|
||||||
@@ -399,7 +385,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetDebugLevel(uint level)
|
public static void SetDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
if (!_logLevels.TryGetValue(level, out var logLevel))
|
if(!_logLevels.TryGetValue(level, out var logLevel))
|
||||||
{
|
{
|
||||||
logLevel = LogEventLevel.Information;
|
logLevel = LogEventLevel.Information;
|
||||||
|
|
||||||
@@ -421,9 +407,9 @@ namespace PepperDash.Core
|
|||||||
CrestronConsole.ConsoleCommandResponse("[Application {0}], Debug level set to {1}\r\n",
|
CrestronConsole.ConsoleCommandResponse("[Application {0}], Debug level set to {1}\r\n",
|
||||||
InitialParametersClass.ApplicationNumber, _consoleLoggingLevelSwitch.MinimumLevel);
|
InitialParametersClass.ApplicationNumber, _consoleLoggingLevelSwitch.MinimumLevel);
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse($"Storing level {level}:{(int)level}");
|
CrestronConsole.ConsoleCommandResponse($"Storing level {level}:{(int) level}");
|
||||||
|
|
||||||
var err = CrestronDataStoreStatic.SetLocalIntValue(LevelStoreKey, (int)level);
|
var err = CrestronDataStoreStatic.SetLocalIntValue(LevelStoreKey, (int) level);
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse($"Store result: {err}:{(int)level}");
|
CrestronConsole.ConsoleCommandResponse($"Store result: {err}:{(int)level}");
|
||||||
|
|
||||||
@@ -436,9 +422,9 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
||||||
|
|
||||||
var err = CrestronDataStoreStatic.SetLocalUintValue(WebSocketLevelStoreKey, (uint)level);
|
var err = CrestronDataStoreStatic.SetLocalUintValue(WebSocketLevelStoreKey, (uint) level);
|
||||||
|
|
||||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||||
LogMessage(LogEventLevel.Information, "Error saving websocket debug level setting: {erro}", err);
|
LogMessage(LogEventLevel.Information, "Error saving websocket debug level setting: {erro}", err);
|
||||||
@@ -505,83 +491,83 @@ namespace PepperDash.Core
|
|||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SetDebugFilterFromConsole method
|
/// SetDebugFilterFromConsole method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetDebugFilterFromConsole(string items)
|
public static void SetDebugFilterFromConsole(string items)
|
||||||
{
|
{
|
||||||
var str = items.Trim();
|
var str = items.Trim();
|
||||||
if (str == "?")
|
if (str == "?")
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse("Usage:\r APPDEBUGFILTER key1 key2 key3....\r " +
|
CrestronConsole.ConsoleCommandResponse("Usage:\r APPDEBUGFILTER key1 key2 key3....\r " +
|
||||||
"+all: at beginning puts filter into 'default include' mode\r" +
|
"+all: at beginning puts filter into 'default include' mode\r" +
|
||||||
" All keys that follow will be excluded from output.\r" +
|
" All keys that follow will be excluded from output.\r" +
|
||||||
"-all: at beginning puts filter into 'default exclude all' mode.\r" +
|
"-all: at beginning puts filter into 'default exclude all' mode.\r" +
|
||||||
" All keys that follow will be the only keys that are shown\r" +
|
" All keys that follow will be the only keys that are shown\r" +
|
||||||
"+nokey: Enables messages with no key (default)\r" +
|
"+nokey: Enables messages with no key (default)\r" +
|
||||||
"-nokey: Disables messages with no key.\r" +
|
"-nokey: Disables messages with no key.\r" +
|
||||||
"(nokey settings are independent of all other settings)");
|
"(nokey settings are independent of all other settings)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var keys = Regex.Split(str, @"\s*");
|
var keys = Regex.Split(str, @"\s*");
|
||||||
foreach (var keyToken in keys)
|
foreach (var keyToken in keys)
|
||||||
{
|
{
|
||||||
var lkey = keyToken.ToLower();
|
var lkey = keyToken.ToLower();
|
||||||
if (lkey == "+all")
|
if (lkey == "+all")
|
||||||
{
|
{
|
||||||
IncludedExcludedKeys.Clear();
|
IncludedExcludedKeys.Clear();
|
||||||
_excludeAllMode = false;
|
_excludeAllMode = false;
|
||||||
}
|
}
|
||||||
else if (lkey == "-all")
|
else if (lkey == "-all")
|
||||||
{
|
{
|
||||||
IncludedExcludedKeys.Clear();
|
IncludedExcludedKeys.Clear();
|
||||||
_excludeAllMode = true;
|
_excludeAllMode = true;
|
||||||
}
|
}
|
||||||
//else if (lkey == "+nokey")
|
//else if (lkey == "+nokey")
|
||||||
//{
|
//{
|
||||||
// ExcludeNoKeyMessages = false;
|
// ExcludeNoKeyMessages = false;
|
||||||
//}
|
//}
|
||||||
//else if (lkey == "-nokey")
|
//else if (lkey == "-nokey")
|
||||||
//{
|
//{
|
||||||
// ExcludeNoKeyMessages = true;
|
// ExcludeNoKeyMessages = true;
|
||||||
//}
|
//}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string key;
|
string key;
|
||||||
if (lkey.StartsWith("-"))
|
if (lkey.StartsWith("-"))
|
||||||
{
|
{
|
||||||
key = lkey.Substring(1);
|
key = lkey.Substring(1);
|
||||||
// if in exclude all mode, we need to remove this from the inclusions
|
// if in exclude all mode, we need to remove this from the inclusions
|
||||||
if (_excludeAllMode)
|
if (_excludeAllMode)
|
||||||
{
|
{
|
||||||
if (IncludedExcludedKeys.ContainsKey(key))
|
if (IncludedExcludedKeys.ContainsKey(key))
|
||||||
IncludedExcludedKeys.Remove(key);
|
IncludedExcludedKeys.Remove(key);
|
||||||
}
|
}
|
||||||
// otherwise include all mode, add to the exclusions
|
// otherwise include all mode, add to the exclusions
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IncludedExcludedKeys[key] = new object();
|
IncludedExcludedKeys[key] = new object();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lkey.StartsWith("+"))
|
else if (lkey.StartsWith("+"))
|
||||||
{
|
{
|
||||||
key = lkey.Substring(1);
|
key = lkey.Substring(1);
|
||||||
// if in exclude all mode, we need to add this as inclusion
|
// if in exclude all mode, we need to add this as inclusion
|
||||||
if (_excludeAllMode)
|
if (_excludeAllMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
IncludedExcludedKeys[key] = new object();
|
IncludedExcludedKeys[key] = new object();
|
||||||
}
|
}
|
||||||
// otherwise include all mode, remove this from exclusions
|
// otherwise include all mode, remove this from exclusions
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IncludedExcludedKeys.ContainsKey(key))
|
if (IncludedExcludedKeys.ContainsKey(key))
|
||||||
IncludedExcludedKeys.Remove(key);
|
IncludedExcludedKeys.Remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -609,7 +595,7 @@ namespace PepperDash.Core
|
|||||||
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
||||||
{
|
{
|
||||||
return _contexts.GetDebugSettingsForKey(deviceKey);
|
return _contexts.GetDebugSettingsForKey(deviceKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the flag to prevent application starting on next boot
|
/// Sets the flag to prevent application starting on next boot
|
||||||
@@ -668,15 +654,9 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Logs a message at the specified log level.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level">Level to log at</param>
|
|
||||||
/// <param name="message">Message template</param>
|
|
||||||
/// <param name="args">Args to put into message template</param>
|
|
||||||
public static void LogMessage(LogEventLevel level, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(level, message, args);
|
_logger.Write(level, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -712,7 +692,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, message, args);
|
_logger.Write(LogEventLevel.Verbose, message, args);
|
||||||
}
|
}
|
||||||
@@ -723,7 +703,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, ex, message, args);
|
_logger.Write(LogEventLevel.Verbose, ex, message, args);
|
||||||
}
|
}
|
||||||
@@ -742,7 +722,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, string message, params object[] args)
|
public static void LogVerbose(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, ex, message, args);
|
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -818,7 +798,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogInformation(Exception ex, string message, params object[] args)
|
public static void LogInformation(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Information, ex, message, args);
|
_logger.Write(LogEventLevel.Information, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -856,7 +836,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogWarning(Exception ex, string message, params object[] args)
|
public static void LogWarning(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Warning, ex, message, args);
|
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -894,7 +874,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogError(Exception ex, string message, params object[] args)
|
public static void LogError(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Error, ex, message, args);
|
_logger.Write(LogEventLevel.Error, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -932,7 +912,7 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogFatal(Exception ex, string message, params object[] args)
|
public static void LogFatal(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Fatal, ex, message, args);
|
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -943,7 +923,7 @@ namespace PepperDash.Core
|
|||||||
if (!_logLevels.ContainsKey(level)) return;
|
if (!_logLevels.ContainsKey(level)) return;
|
||||||
|
|
||||||
var logLevel = _logLevels[level];
|
var logLevel = _logLevels[level];
|
||||||
|
|
||||||
LogMessage(logLevel, format, items);
|
LogMessage(logLevel, format, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,7 +978,7 @@ namespace PepperDash.Core
|
|||||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||||
public static void Console(uint level, IKeyed dev, ErrorLogLevel errorLogLevel,
|
public static void Console(uint level, IKeyed dev, ErrorLogLevel errorLogLevel,
|
||||||
string format, params object[] items)
|
string format, params object[] items)
|
||||||
{
|
{
|
||||||
LogMessage(level, dev, format, items);
|
LogMessage(level, dev, format, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1142,7 +1122,7 @@ namespace PepperDash.Core
|
|||||||
return string.Format(@"\user\debugSettings\program{0}", InitialParametersClass.ApplicationNumber);
|
return string.Format(@"\user\debugSettings\program{0}", InitialParametersClass.ApplicationNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Format("{0}{1}user{1}debugSettings{1}{2}.json", Directory.GetApplicationRootDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId);
|
return string.Format("{0}{1}user{1}debugSettings{1}{2}.json",Directory.GetApplicationRootDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1153,15 +1133,15 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error
|
/// Error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Error,
|
Error,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Warning
|
/// Warning
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Warning,
|
Warning,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notice
|
/// Notice
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Notice,
|
Notice,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// None
|
/// None
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>PepperDash.Core</RootNamespace>
|
<RootNamespace>PepperDash.Core</RootNamespace>
|
||||||
<AssemblyName>PepperDashCore</AssemblyName>
|
<AssemblyName>PepperDashCore</AssemblyName>
|
||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net8</TargetFramework>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<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.90" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<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" />
|
||||||
@@ -52,9 +53,6 @@
|
|||||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6'">
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Comm\._GenericSshClient.cs" />
|
<Compile Remove="Comm\._GenericSshClient.cs" />
|
||||||
<Compile Remove="Comm\._GenericTcpIpClient.cs" />
|
<Compile Remove="Comm\._GenericTcpIpClient.cs" />
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using System.Reflection;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.EthernetCommunication;
|
using Crestron.SimplSharpPro.EthernetCommunication;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Essentials.Core.Communications;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PepperDash.Core;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
//using PepperDash.Essentials.Devices.Common.Cameras;
|
//using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a AirMediaControllerJoinMap
|
/// Represents a AirMediaControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a AppleTvJoinMap
|
/// Represents a AppleTvJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a C2nRthsControllerJoinMap
|
/// Represents a C2nRthsControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CameraControllerJoinMap
|
/// Represents a CameraControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CenOdtOccupancySensorBaseJoinMap
|
/// Represents a CenOdtOccupancySensorBaseJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DisplayControllerJoinMap
|
/// Represents a DisplayControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges {
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmBladeChassisControllerJoinMap
|
/// Represents a DmBladeChassisControllerJoinMap
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmChassisControllerJoinMap
|
/// Represents a DmChassisControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmRmcControllerJoinMap
|
/// Represents a DmRmcControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmTxControllerJoinMap
|
/// Represents a DmTxControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsAudioOutputControllerJoinMap
|
/// Represents a DmpsAudioOutputControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsMicrophoneControllerJoinMap
|
/// Represents a DmpsMicrophoneControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a DmpsRoutingControllerJoinMap
|
/// Represents a DmpsRoutingControllerJoinMap
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericLightingJoinMap
|
/// Represents a GenericLightingJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GenericRelayControllerJoinMap
|
/// Represents a GenericRelayControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GlsOccupancySensorBaseJoinMap
|
/// Represents a GlsOccupancySensorBaseJoinMap
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using PepperDash.Essentials.Core;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a HdMdNxM4kEControllerJoinMap
|
/// Represents a HdMdNxM4kEControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a HdMdxxxCEControllerJoinMap
|
/// Represents a HdMdxxxCEControllerJoinMap
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using PepperDash.Essentials.Core;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a HdPsXxxControllerJoinMap
|
/// Represents a HdPsXxxControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Hrxxx0WirelessRemoteControllerJoinMap
|
/// Represents a Hrxxx0WirelessRemoteControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a IAnalogInputJoinMap
|
/// Represents a IAnalogInputJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a IBasicCommunicationJoinMap
|
/// Represents a IBasicCommunicationJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a IDigitalInputJoinMap
|
/// Represents a IDigitalInputJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a IDigitalOutputJoinMap
|
/// Represents a IDigitalOutputJoinMap
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Join map for IRBlurayBase devices
|
/// Join map for IRBlurayBase devices
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a PduJoinMapBase
|
/// Represents a PduJoinMapBase
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a SetTopBoxControllerJoinMap
|
/// Represents a SetTopBoxControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a StatusSignControllerJoinMap
|
/// Represents a StatusSignControllerJoinMap
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a SystemMonitorJoinMap
|
/// Represents a SystemMonitorJoinMap
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using System;
|
using System;
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
72
src/PepperDash.Essentials.Core/Bridges/SigHelper.cs
Normal file
72
src/PepperDash.Essentials.Core/Bridges/SigHelper.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class for various Sig events
|
||||||
|
/// </summary>
|
||||||
|
public class SigHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Runs action when Sig is pressed
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sig"></param>
|
||||||
|
public static void Pressed(Sig sig, Action act) { if (sig.BoolValue) act(); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs action when Sig is released
|
||||||
|
/// </summary>
|
||||||
|
public static void Released(Sig sig, Action act) { if (!sig.BoolValue) act(); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetBoolOutAction method
|
||||||
|
/// </summary>
|
||||||
|
public static void SetBoolOutAction(BoolOutputSig sig, Action<bool> a)
|
||||||
|
{
|
||||||
|
if (sig != null)
|
||||||
|
sig.UserObject = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Safely clears action of non-null sig.
|
||||||
|
/// </summary>
|
||||||
|
public static void ClearBoolOutAction(BoolOutputSig sig)
|
||||||
|
{
|
||||||
|
if (sig != null)
|
||||||
|
sig.UserObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does a timed ramp, where the time is scaled proportional to the
|
||||||
|
/// remaining range to cover
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sig">Ushort sig to scale</param>
|
||||||
|
/// <param name="newLevel">Level to go to</param>
|
||||||
|
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
|
||||||
|
/// <summary>
|
||||||
|
/// RampTimeScaled method
|
||||||
|
/// </summary>
|
||||||
|
public static void RampTimeScaled(Sig sig, ushort newLevel, uint time)
|
||||||
|
{
|
||||||
|
var level = sig.UShortValue;
|
||||||
|
var diff = Math.Abs(level - newLevel);
|
||||||
|
var scaledTime = (uint)(diff * time / 65535);
|
||||||
|
Ramp(sig, newLevel, scaledTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ramps signal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sig"></param>
|
||||||
|
/// <param name="level"></param>
|
||||||
|
/// <param name="time">In ms (not hundredths like Crestron Sig ramp function)</param>
|
||||||
|
/// <summary>
|
||||||
|
/// Ramp method
|
||||||
|
/// </summary>
|
||||||
|
public static void Ramp(Sig sig, ushort level, uint time)
|
||||||
|
{
|
||||||
|
sig.CreateRamp(level, time / 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
|
||||||
using Serilog.Events;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CommFactory
|
|
||||||
{
|
|
||||||
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
|
||||||
(deviceConfig.Properties["control"].ToString());
|
|
||||||
//Debug.LogMessage(LogEventLevel.Verbose, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceConfig">The Device config object</param>
|
|
||||||
/// <summary>
|
|
||||||
/// CreateCommForDevice method
|
|
||||||
/// </summary>
|
|
||||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
|
||||||
{
|
|
||||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
|
||||||
if (controlConfig == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
IBasicCommunication comm = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var c = controlConfig.TcpSshProperties;
|
|
||||||
switch (controlConfig.Method)
|
|
||||||
{
|
|
||||||
case eControlMethod.Com:
|
|
||||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig);
|
|
||||||
break;
|
|
||||||
case eControlMethod.ComBridge:
|
|
||||||
comm = new CommBridge(deviceConfig.Key + "-simpl", deviceConfig.Name + " Simpl");
|
|
||||||
break;
|
|
||||||
case eControlMethod.Cec:
|
|
||||||
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
|
||||||
break;
|
|
||||||
case eControlMethod.IR:
|
|
||||||
break;
|
|
||||||
case eControlMethod.Ssh:
|
|
||||||
{
|
|
||||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
|
||||||
ssh.AutoReconnect = c.AutoReconnect;
|
|
||||||
if (ssh.AutoReconnect)
|
|
||||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
|
||||||
comm = ssh;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case eControlMethod.Tcpip:
|
|
||||||
{
|
|
||||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
|
||||||
tcp.AutoReconnect = c.AutoReconnect;
|
|
||||||
if (tcp.AutoReconnect)
|
|
||||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
|
||||||
comm = tcp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case eControlMethod.Udp:
|
|
||||||
{
|
|
||||||
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
|
||||||
comm = udp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case eControlMethod.Telnet:
|
|
||||||
break;
|
|
||||||
case eControlMethod.SecureTcpIp:
|
|
||||||
{
|
|
||||||
var secureTcp = new GenericSecureTcpIpClient(deviceConfig.Key + "-secureTcp", c.Address, c.Port, c.BufferSize);
|
|
||||||
secureTcp.AutoReconnect = c.AutoReconnect;
|
|
||||||
if (secureTcp.AutoReconnect)
|
|
||||||
secureTcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
|
||||||
comm = secureTcp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
|
||||||
deviceConfig.Properties.ToString(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// put it in the device manager if it's the right flavor
|
|
||||||
if (comm is Device comDev)
|
|
||||||
DeviceManager.AddDevice(comDev);
|
|
||||||
return comm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// GetComPort method
|
|
||||||
/// </summary>
|
|
||||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
|
||||||
{
|
|
||||||
var comPar = config.ComParams;
|
|
||||||
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
|
||||||
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
|
||||||
return dev.ComPorts[config.ControlPortNumber.Value];
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetCecPort method
|
|
||||||
/// </summary>
|
|
||||||
public static ICec GetCecPort(ControlPropertiesConfig config)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
|
|
||||||
? "is not valid, failed to get cec port"
|
|
||||||
: "found in device manager, attempting to get cec port");
|
|
||||||
|
|
||||||
if (dev == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(config.ControlPortName))
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var inputsOutputs = dev as IRoutingInputsOutputs;
|
|
||||||
if (inputsOutputs == null)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
|
|
||||||
config.ControlPortDevKey, config.ControlPortName);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
|
|
||||||
if (inputPort != null && inputPort.Port is ICec)
|
|
||||||
return inputPort.Port as ICec;
|
|
||||||
|
|
||||||
|
|
||||||
var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
|
|
||||||
if (outputPort != null && outputPort.Port is ICec)
|
|
||||||
return outputPort.Port as ICec;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "GetCecPort Exception Message: {0}", ex.Message);
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
|
|
||||||
if (ex.InnerException != null)
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort Exception InnerException: {0}", ex.InnerException);
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
|
|
||||||
config.ControlPortDevKey, config.ControlPortName);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
|
||||||
/// return the ControlSystem object from the Global class.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
|
||||||
/// <summary>
|
|
||||||
/// GetIComPortsDeviceFromManagedDevice method
|
|
||||||
/// </summary>
|
|
||||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
|
||||||
{
|
|
||||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
|
||||||
|| ComPortDevKey.Equals("processor", System.StringComparison.OrdinalIgnoreCase))
|
|
||||||
&& Global.ControlSystem is IComPorts)
|
|
||||||
return Global.ControlSystem;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
|
||||||
if (dev == null)
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
|
||||||
return dev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a EssentialsControlPropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class EssentialsControlPropertiesConfig :
|
|
||||||
ControlPropertiesConfig
|
|
||||||
{
|
|
||||||
|
|
||||||
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
|
||||||
public ComPort.ComPortSpec? ComParams { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
public string CresnetId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to provide uint conversion of string CresnetId
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public uint CresnetIdInt
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Convert.ToUInt32(CresnetId, 16);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the InfinetId
|
|
||||||
/// </summary>
|
|
||||||
public string InfinetId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attepmts to provide uiont conversion of string InifinetId
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public uint InfinetIdInt
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Convert.ToUInt32(InfinetId, 16);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a IrControlSpec
|
|
||||||
/// </summary>
|
|
||||||
public class IrControlSpec
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the PortDeviceKey
|
|
||||||
/// </summary>
|
|
||||||
public string PortDeviceKey { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the PortNumber
|
|
||||||
/// </summary>
|
|
||||||
public uint PortNumber { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the File
|
|
||||||
/// </summary>
|
|
||||||
public string File { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public interface IComPortsDevice
|
|
||||||
{
|
|
||||||
IComPorts Device { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CecPortController
|
/// Represents a CecPortController
|
||||||
@@ -139,7 +133,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
foreach (var t in split)
|
foreach (var t in split)
|
||||||
{
|
{
|
||||||
if (t.StartsWith(@"\") && t.Length == 4)
|
if (t.StartsWith(@"\") && t.Length == 4)
|
||||||
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
|
b.Append((char)Convert.ToByte(t.Substring(2, 2), 16));
|
||||||
else
|
else
|
||||||
b.Append(t);
|
b.Append(t);
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ComPortController
|
/// Represents a ComPortController
|
||||||
@@ -190,11 +185,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
// split out hex chars and build string
|
// split out hex chars and build string
|
||||||
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
|
var split = Regex.Split(s, @"(\\[Xx][0-9a-fA-F][0-9a-fA-F])");
|
||||||
StringBuilder b = new StringBuilder();
|
var b = new StringBuilder();
|
||||||
foreach (var t in split)
|
foreach (var t in split)
|
||||||
{
|
{
|
||||||
if (t.StartsWith(@"\") && t.Length == 4)
|
if (t.StartsWith(@"\") && t.Length == 4)
|
||||||
b.Append((char)(Convert.ToByte(t.Substring(2, 2), 16)));
|
b.Append((char)Convert.ToByte(t.Substring(2, 2), 16));
|
||||||
else
|
else
|
||||||
b.Append(t);
|
b.Append(t);
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This converter creates a proper ComPort.ComPortSpec struct from more-friendly JSON values. It uses
|
/// This converter creates a proper ComPort.ComPortSpec struct from more-friendly JSON values. It uses
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class ComTextHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a byte array
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(byte[] bytes)
|
||||||
|
{
|
||||||
|
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetEscapedText method
|
||||||
|
/// </summary>
|
||||||
|
public static string GetEscapedText(string text)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets debug text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDebugText method
|
||||||
|
/// </summary>
|
||||||
|
public static string GetDebugText(string text)
|
||||||
|
{
|
||||||
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
289
src/PepperDash.Essentials.Core/Communications/CommFactory.cs
Normal file
289
src/PepperDash.Essentials.Core/Communications/CommFactory.cs
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using Serilog.Events;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class CommFactory
|
||||||
|
{
|
||||||
|
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
|
||||||
|
(deviceConfig.Properties["control"].ToString());
|
||||||
|
//Debug.LogMessage(LogEventLevel.Verbose, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceConfig">The Device config object</param>
|
||||||
|
/// <summary>
|
||||||
|
/// CreateCommForDevice method
|
||||||
|
/// </summary>
|
||||||
|
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||||
|
{
|
||||||
|
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||||
|
if (controlConfig == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IBasicCommunication comm = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var c = controlConfig.TcpSshProperties;
|
||||||
|
switch (controlConfig.Method)
|
||||||
|
{
|
||||||
|
case eControlMethod.Com:
|
||||||
|
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig);
|
||||||
|
break;
|
||||||
|
case eControlMethod.Cec:
|
||||||
|
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
||||||
|
break;
|
||||||
|
case eControlMethod.IR:
|
||||||
|
break;
|
||||||
|
case eControlMethod.Ssh:
|
||||||
|
{
|
||||||
|
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||||
|
ssh.AutoReconnect = c.AutoReconnect;
|
||||||
|
if(ssh.AutoReconnect)
|
||||||
|
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
|
comm = ssh;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Tcpip:
|
||||||
|
{
|
||||||
|
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||||
|
tcp.AutoReconnect = c.AutoReconnect;
|
||||||
|
if (tcp.AutoReconnect)
|
||||||
|
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
|
comm = tcp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Udp:
|
||||||
|
{
|
||||||
|
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
||||||
|
comm = udp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case eControlMethod.Telnet:
|
||||||
|
break;
|
||||||
|
case eControlMethod.SecureTcpIp:
|
||||||
|
{
|
||||||
|
var secureTcp = new GenericSecureTcpIpClient(deviceConfig.Key + "-secureTcp", c.Address, c.Port, c.BufferSize);
|
||||||
|
secureTcp.AutoReconnect = c.AutoReconnect;
|
||||||
|
if (secureTcp.AutoReconnect)
|
||||||
|
secureTcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
|
comm = secureTcp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
|
||||||
|
deviceConfig.Properties.ToString(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// put it in the device manager if it's the right flavor
|
||||||
|
var comDev = comm as Device;
|
||||||
|
if (comDev != null)
|
||||||
|
DeviceManager.AddDevice(comDev);
|
||||||
|
return comm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetComPort method
|
||||||
|
/// </summary>
|
||||||
|
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||||
|
{
|
||||||
|
var comPar = config.ComParams;
|
||||||
|
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
|
||||||
|
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
|
||||||
|
return dev.ComPorts[config.ControlPortNumber.Value];
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetCecPort method
|
||||||
|
/// </summary>
|
||||||
|
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
|
||||||
|
? "is not valid, failed to get cec port"
|
||||||
|
: "found in device manager, attempting to get cec port");
|
||||||
|
|
||||||
|
if (dev == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(config.ControlPortName))
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var inputsOutputs = dev as IRoutingInputsOutputs;
|
||||||
|
if (inputsOutputs == null)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
|
||||||
|
config.ControlPortDevKey, config.ControlPortName);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
|
||||||
|
if (inputPort != null && inputPort.Port is ICec)
|
||||||
|
return inputPort.Port as ICec;
|
||||||
|
|
||||||
|
|
||||||
|
var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
|
||||||
|
if (outputPort != null && outputPort.Port is ICec)
|
||||||
|
return outputPort.Port as ICec;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, "GetCecPort Exception Message: {0}", ex.Message);
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
|
||||||
|
if (ex.InnerException != null)
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort Exception InnerException: {0}", ex.InnerException);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
|
||||||
|
config.ControlPortDevKey, config.ControlPortName);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||||
|
/// return the ControlSystem object from the Global class.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetIComPortsDeviceFromManagedDevice method
|
||||||
|
/// </summary>
|
||||||
|
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||||
|
{
|
||||||
|
if ((ComPortDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| ComPortDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
|
||||||
|
&& Global.ControlSystem is IComPorts)
|
||||||
|
return Global.ControlSystem;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
|
||||||
|
if (dev == null)
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
|
||||||
|
return dev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a EssentialsControlPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
|
public class EssentialsControlPropertiesConfig :
|
||||||
|
ControlPropertiesConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||||
|
public ComPort.ComPortSpec? ComParams { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string CresnetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to provide uint conversion of string CresnetId
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public uint CresnetIdInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToUInt32(CresnetId, 16);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the InfinetId
|
||||||
|
/// </summary>
|
||||||
|
public string InfinetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attepmts to provide uiont conversion of string InifinetId
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public uint InfinetIdInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToUInt32(InfinetId, 16);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IrControlSpec
|
||||||
|
/// </summary>
|
||||||
|
public class IrControlSpec
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortDeviceKey
|
||||||
|
/// </summary>
|
||||||
|
public string PortDeviceKey { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortNumber
|
||||||
|
/// </summary>
|
||||||
|
public uint PortNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the File
|
||||||
|
/// </summary>
|
||||||
|
public string File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum eGenericCommMethodStatusChangeType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Connected
|
||||||
|
/// </summary>
|
||||||
|
Connected,
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnected
|
||||||
|
/// </summary>
|
||||||
|
Disconnected
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This delegate defines handler for IBasicCommunication status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comm">Device firing the status change</param>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Bytes
|
||||||
|
/// </summary>
|
||||||
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
||||||
|
{
|
||||||
|
Bytes = bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveBytesArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveTextArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Text { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Delimiter { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public GenericCommMethodReceiveTextArgs(string text)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="delimiter"></param>
|
||||||
|
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
||||||
|
:this(text)
|
||||||
|
{
|
||||||
|
Delimiter = delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the string event handler for line events on the gather
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public delegate void LineReceivedHandler(string text);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attaches to IBasicCommunication as a text gather
|
||||||
|
/// </summary>
|
||||||
|
public class CommunicationGather
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event that fires when a line is received from the IBasicCommunication source.
|
||||||
|
/// The event merely contains the text, not an EventArgs type class.
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<GenericCommMethodReceiveTextArgs> LineReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The communication port that this gathers on
|
||||||
|
/// </summary>
|
||||||
|
public ICommunicationReceiver Port { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default false. If true, the delimiter will be included in the line output
|
||||||
|
/// events
|
||||||
|
/// </summary>
|
||||||
|
public bool IncludeDelimiter { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For receive buffer
|
||||||
|
/// </summary>
|
||||||
|
StringBuilder ReceiveBuffer = new StringBuilder();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delimiter, like it says!
|
||||||
|
/// </summary>
|
||||||
|
char Delimiter;
|
||||||
|
|
||||||
|
string[] StringDelimiters;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for using a char delimiter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="delimiter"></param>
|
||||||
|
public CommunicationGather(ICommunicationReceiver port, char delimiter)
|
||||||
|
{
|
||||||
|
Port = port;
|
||||||
|
Delimiter = delimiter;
|
||||||
|
port.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Port_TextReceived);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for using a single string delimiter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="delimiter"></param>
|
||||||
|
public CommunicationGather(ICommunicationReceiver port, string delimiter)
|
||||||
|
:this(port, new string[] { delimiter} )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for using an array of string delimiters
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="delimiters"></param>
|
||||||
|
public CommunicationGather(ICommunicationReceiver port, string[] delimiters)
|
||||||
|
{
|
||||||
|
Port = port;
|
||||||
|
StringDelimiters = delimiters;
|
||||||
|
port.TextReceived += Port_TextReceivedStringDelimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop method
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
Port.TextReceived -= Port_TextReceived;
|
||||||
|
Port.TextReceived -= Port_TextReceivedStringDelimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handler for raw data coming from port
|
||||||
|
/// </summary>
|
||||||
|
void Port_TextReceived(object sender, GenericCommMethodReceiveTextArgs args)
|
||||||
|
{
|
||||||
|
var handler = LineReceived;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
ReceiveBuffer.Append(args.Text);
|
||||||
|
var str = ReceiveBuffer.ToString();
|
||||||
|
var lines = str.Split(Delimiter);
|
||||||
|
if (lines.Length > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < lines.Length - 1; i++)
|
||||||
|
{
|
||||||
|
string strToSend = null;
|
||||||
|
if (IncludeDelimiter)
|
||||||
|
strToSend = lines[i] + Delimiter;
|
||||||
|
else
|
||||||
|
strToSend = lines[i];
|
||||||
|
handler(this, new GenericCommMethodReceiveTextArgs(strToSend));
|
||||||
|
}
|
||||||
|
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
void Port_TextReceivedStringDelimiter(object sender, GenericCommMethodReceiveTextArgs args)
|
||||||
|
{
|
||||||
|
var handler = LineReceived;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
// Receive buffer should either be empty or not contain the delimiter
|
||||||
|
// If the line does not have a delimiter, append the
|
||||||
|
ReceiveBuffer.Append(args.Text);
|
||||||
|
var str = ReceiveBuffer.ToString();
|
||||||
|
|
||||||
|
// Case: Receiving DEVICE get version\x0d\0x0a+OK "value":"1234"\x0d\x0a
|
||||||
|
|
||||||
|
// RX: DEV
|
||||||
|
// Split: (1) "DEV"
|
||||||
|
// RX: I
|
||||||
|
// Split: (1) "DEVI"
|
||||||
|
// RX: CE get version
|
||||||
|
// Split: (1) "DEVICE get version"
|
||||||
|
// RX: \x0d\x0a+OK "value":"1234"\x0d\x0a
|
||||||
|
// Split: (2) DEVICE get version, +OK "value":"1234"
|
||||||
|
|
||||||
|
// Iterate the delimiters and fire an event for any matching delimiter
|
||||||
|
foreach (var delimiter in StringDelimiters)
|
||||||
|
{
|
||||||
|
var lines = Regex.Split(str, delimiter);
|
||||||
|
if (lines.Length == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int i = 0; i < lines.Length - 1; i++)
|
||||||
|
{
|
||||||
|
string strToSend = null;
|
||||||
|
if (IncludeDelimiter)
|
||||||
|
strToSend = lines[i] + delimiter;
|
||||||
|
else
|
||||||
|
strToSend = lines[i];
|
||||||
|
handler(this, new GenericCommMethodReceiveTextArgs(strToSend, delimiter));
|
||||||
|
}
|
||||||
|
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deconstructor. Disconnects from port TextReceived events.
|
||||||
|
/// </summary>
|
||||||
|
~CommunicationGather()
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Controls the ability to disable/enable debugging of TX/RX data sent to/from a device with a built in timer to disable
|
||||||
|
/// </summary>
|
||||||
|
public class CommunicationStreamDebugging
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Device Key that this instance configures
|
||||||
|
/// </summary>
|
||||||
|
public string ParentDeviceKey { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timer to disable automatically if not manually disabled
|
||||||
|
/// </summary>
|
||||||
|
private CTimer DebugExpiryPeriod;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DebugSetting
|
||||||
|
/// </summary>
|
||||||
|
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
||||||
|
|
||||||
|
private uint _DebugTimeoutInMs;
|
||||||
|
private const uint _DefaultDebugTimeoutMin = 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timeout in Minutes
|
||||||
|
/// </summary>
|
||||||
|
public uint DebugTimeoutMinutes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _DebugTimeoutInMs/60000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RxStreamDebuggingIsEnabled
|
||||||
|
/// </summary>
|
||||||
|
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that transmit stream debugging is enabled
|
||||||
|
/// </summary>
|
||||||
|
public bool TxStreamDebuggingIsEnabled { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentDeviceKey"></param>
|
||||||
|
public CommunicationStreamDebugging(string parentDeviceKey)
|
||||||
|
{
|
||||||
|
ParentDeviceKey = parentDeviceKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="setting"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebuggingWithDefaultTimeout method
|
||||||
|
/// </summary>
|
||||||
|
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
||||||
|
{
|
||||||
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
{
|
||||||
|
DisableDebugging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDebuggingWithSpecificTimeout(setting, _DefaultDebugTimeoutMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the debugging setting for the specified number of minutes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="setting"></param>
|
||||||
|
/// <param name="minutes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebuggingWithSpecificTimeout method
|
||||||
|
/// </summary>
|
||||||
|
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
||||||
|
{
|
||||||
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
{
|
||||||
|
DisableDebugging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_DebugTimeoutInMs = minutes * 60000;
|
||||||
|
|
||||||
|
StopDebugTimer();
|
||||||
|
|
||||||
|
DebugExpiryPeriod = new CTimer((o) => DisableDebugging(), _DebugTimeoutInMs);
|
||||||
|
|
||||||
|
if ((setting & eStreamDebuggingSetting.Rx) == eStreamDebuggingSetting.Rx)
|
||||||
|
RxStreamDebuggingIsEnabled = true;
|
||||||
|
|
||||||
|
if ((setting & eStreamDebuggingSetting.Tx) == eStreamDebuggingSetting.Tx)
|
||||||
|
TxStreamDebuggingIsEnabled = true;
|
||||||
|
|
||||||
|
Debug.SetDeviceDebugSettings(ParentDeviceKey, setting);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disabled debugging
|
||||||
|
/// </summary>
|
||||||
|
private void DisableDebugging()
|
||||||
|
{
|
||||||
|
StopDebugTimer();
|
||||||
|
|
||||||
|
Debug.SetDeviceDebugSettings(ParentDeviceKey, eStreamDebuggingSetting.Off);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopDebugTimer()
|
||||||
|
{
|
||||||
|
RxStreamDebuggingIsEnabled = false;
|
||||||
|
TxStreamDebuggingIsEnabled = false;
|
||||||
|
|
||||||
|
if (DebugExpiryPeriod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugExpiryPeriod.Stop();
|
||||||
|
DebugExpiryPeriod.Dispose();
|
||||||
|
DebugExpiryPeriod = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The available settings for stream debugging
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration of eStreamDebuggingSetting values
|
||||||
|
/// </summary>
|
||||||
|
public enum eStreamDebuggingSetting
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Debug off
|
||||||
|
/// </summary>
|
||||||
|
Off = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug received data
|
||||||
|
/// </summary>
|
||||||
|
Rx = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Tx = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug both received and transmitted data
|
||||||
|
/// </summary>
|
||||||
|
Both = Rx | Tx
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The available settings for stream debugging response types
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum eStreamDebuggingDataTypeSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in byte format
|
||||||
|
/// </summary>
|
||||||
|
Bytes = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in text format
|
||||||
|
/// </summary>
|
||||||
|
Text = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Debug data in both byte and text formats
|
||||||
|
/// </summary>
|
||||||
|
Both = Bytes | Text,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ConsoleCommMockDevice
|
/// Represents a ConsoleCommMockDevice
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ControlPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
|
public class ControlPropertiesConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The method of control
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("method")]
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public eControlMethod Method { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key of the device that contains the control port
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("controlPortDevKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string ControlPortDevKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of the control port on the device specified by ControlPortDevKey
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("controlPortNumber", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||||
|
public uint? ControlPortNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the control port on the device specified by ControlPortDevKey
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("controlPortName", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value
|
||||||
|
public string ControlPortName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Properties for ethernet based communications
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tcpSshProperties", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public TcpSshPropertiesConfig TcpSshProperties { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The filename and path for the IR file
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("irFile", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string IrFile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The IpId of a Crestron device
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string IpId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Readonly uint representation of the IpId
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public uint IpIdInt { get { return Convert.ToUInt32(IpId, 16); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Char indicating end of line
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("endOfLineChar", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public char EndOfLineChar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to Environment.NewLine;
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("endOfLineString", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string EndOfLineString { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("deviceReadyResponsePattern", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string DeviceReadyResponsePattern { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used when communcating to programs running in VC-4
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("roomId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string RoomId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public ControlPropertiesConfig()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
247
src/PepperDash.Essentials.Core/Communications/EventArgs.cs
Normal file
247
src/PepperDash.Essentials.Core/Communications/EventArgs.cs
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
/*PepperDash Technology Corp.
|
||||||
|
Copyright: 2017
|
||||||
|
------------------------------------
|
||||||
|
***Notice of Ownership and Copyright***
|
||||||
|
The material in which this notice appears is the property of PepperDash Technology Corporation,
|
||||||
|
which claims copyright under the laws of the United States of America in the entire body of material
|
||||||
|
and in all parts thereof, regardless of the use to which it is being put. Any use, in whole or in part,
|
||||||
|
of this material by another party without the express written permission of PepperDash Technology Corporation is prohibited.
|
||||||
|
PepperDash Technology Corporation reserves all rights under applicable laws.
|
||||||
|
------------------------------------ */
|
||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for notifying of socket status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
public delegate void GenericSocketStatusChangeEventDelegate(ISocketStatus client);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs class for socket status changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericSocketStatusChageEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Client
|
||||||
|
/// </summary>
|
||||||
|
public ISocketStatus Client { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
public GenericSocketStatusChageEventArgs(ISocketStatus client)
|
||||||
|
{
|
||||||
|
Client = client;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericSocketStatusChageEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for notifying of TCP Server state changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public delegate void GenericTcpServerStateChangedEventDelegate(ServerState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs class for TCP Server state changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerStateChangedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the State
|
||||||
|
/// </summary>
|
||||||
|
public ServerState State { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public GenericTcpServerStateChangedEventArgs(ServerState state)
|
||||||
|
{
|
||||||
|
State = state;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerStateChangedEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for TCP Server socket status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socket"></param>
|
||||||
|
/// <param name="clientIndex"></param>
|
||||||
|
/// <param name="clientStatus"></param>
|
||||||
|
public delegate void GenericTcpServerSocketStatusChangeEventDelegate(object socket, uint clientIndex, SocketStatus clientStatus);
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for TCP server socket status changes
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerSocketStatusChangeEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public object Socket { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public uint ReceivedFromClientIndex { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public SocketStatus ClientStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socket"></param>
|
||||||
|
/// <param name="clientStatus"></param>
|
||||||
|
public GenericTcpServerSocketStatusChangeEventArgs(object socket, SocketStatus clientStatus)
|
||||||
|
{
|
||||||
|
Socket = socket;
|
||||||
|
ClientStatus = clientStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socket"></param>
|
||||||
|
/// <param name="clientIndex"></param>
|
||||||
|
/// <param name="clientStatus"></param>
|
||||||
|
public GenericTcpServerSocketStatusChangeEventArgs(object socket, uint clientIndex, SocketStatus clientStatus)
|
||||||
|
{
|
||||||
|
Socket = socket;
|
||||||
|
ReceivedFromClientIndex = clientIndex;
|
||||||
|
ClientStatus = clientStatus;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerSocketStatusChangeEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for TCP server com method receive text
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerCommMethodReceiveTextArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public uint ReceivedFromClientIndex { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ushort ReceivedFromClientIndexShort
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (ushort)ReceivedFromClientIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Text
|
||||||
|
/// </summary>
|
||||||
|
public string Text { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs(string text)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="clientIndex"></param>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs(string text, uint clientIndex)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
ReceivedFromClientIndex = clientIndex;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for TCP server client ready for communication
|
||||||
|
/// </summary>
|
||||||
|
public class GenericTcpServerClientReadyForcommunicationsEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool IsReady;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isReady"></param>
|
||||||
|
public GenericTcpServerClientReadyForcommunicationsEventArgs(bool isReady)
|
||||||
|
{
|
||||||
|
IsReady = isReady;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericTcpServerClientReadyForcommunicationsEventArgs() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventArgs for UDP connected
|
||||||
|
/// </summary>
|
||||||
|
public class GenericUdpConnectedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ushort UConnected;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool Connected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericUdpConnectedEventArgs() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uconnected"></param>
|
||||||
|
public GenericUdpConnectedEventArgs(ushort uconnected)
|
||||||
|
{
|
||||||
|
UConnected = uconnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connected"></param>
|
||||||
|
public GenericUdpConnectedEventArgs(bool connected)
|
||||||
|
{
|
||||||
|
Connected = connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Config.Essentials;
|
||||||
|
using PepperDash.Essentials.Core.Touchpanels;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
||||||
@@ -120,7 +120,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (sComm == null) return;
|
if (sComm == null) return;
|
||||||
sComm.ConnectionChange += (s, a) =>
|
sComm.ConnectionChange += (s, a) =>
|
||||||
{
|
{
|
||||||
trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus));
|
trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)a.Client.ClientStatus);
|
||||||
trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus ==
|
trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus ==
|
||||||
SocketStatus.SOCKET_STATUS_CONNECTED);
|
SocketStatus.SOCKET_STATUS_CONNECTED);
|
||||||
};
|
};
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
using Crestron.SimplSharp.Net.Http;
|
using Crestron.SimplSharp.Net.Http;
|
||||||
using PepperDash.Core;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
|
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,17 +32,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendText(string path)
|
public void SendText(string path)
|
||||||
{
|
{
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
var request = new HttpClientRequest();
|
||||||
string url = string.Format("http://{0}/{1}", Client.HostName, path);
|
var url = string.Format("http://{0}/{1}", Client.HostName, path);
|
||||||
request.Url = new UrlParser(url);
|
request.Url = new UrlParser(url);
|
||||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
var error = Client.DispatchAsyncEx(request, Response, request);
|
||||||
}
|
}
|
||||||
public void SendText(string format, params object[] items)
|
public void SendText(string format, params object[] items)
|
||||||
{
|
{
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
var request = new HttpClientRequest();
|
||||||
string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
var url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
||||||
request.Url = new UrlParser(url);
|
request.Url = new UrlParser(url);
|
||||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
var error = Client.DispatchAsyncEx(request, Response, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -51,8 +50,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendTextNoResponse(string format, params object[] items)
|
public void SendTextNoResponse(string format, params object[] items)
|
||||||
{
|
{
|
||||||
HttpClientRequest request = new HttpClientRequest();
|
var request = new HttpClientRequest();
|
||||||
string url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
var url = string.Format("http://{0}/{1}", Client.HostName, string.Format(format, items));
|
||||||
request.Url = new UrlParser(url);
|
request.Url = new UrlParser(url);
|
||||||
Client.Dispatch(request);
|
Client.Dispatch(request);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a device that can automatically attempt to reconnect
|
||||||
|
/// </summary>
|
||||||
|
public interface IAutoReconnect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enable automatic recconnect
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("autoReconnect")]
|
||||||
|
bool AutoReconnect { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Interval in ms to attempt automatic recconnections
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("autoReconnectIntervalMs")]
|
||||||
|
int AutoReconnectIntervalMs { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the contract for IBasicCommunication
|
||||||
|
/// </summary>
|
||||||
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Send text to the device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
void SendText(string text);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send bytes to the device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
void SendBytes(byte[] bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
||||||
|
/// </summary>
|
||||||
|
public interface IBasicCommunicationWithStreamDebugging : IBasicCommunication, IStreamDebugging
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface IComPortsDevice
|
||||||
|
{
|
||||||
|
IComPorts Device { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An incoming communication stream
|
||||||
|
/// </summary>
|
||||||
|
public interface ICommunicationReceiver : IKeyed
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of bytes received
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of text received
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates connection status
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("isConnected")]
|
||||||
|
bool IsConnected { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Connect to the device
|
||||||
|
/// </summary>
|
||||||
|
void Connect();
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect from the device
|
||||||
|
/// </summary>
|
||||||
|
void Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
||||||
|
/// GenericTcpIpClient
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatus : IBasicCommunication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of socket status changes
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current socket status of the client
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("clientStatus")]
|
||||||
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
|
SocketStatus ClientStatus { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatusWithStreamDebugging : ISocketStatus, IStreamDebugging
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device with stream debugging capablities
|
||||||
|
/// </summary>
|
||||||
|
public interface IStreamDebugging
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Object to enable stream debugging
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("streamDebugging")]
|
||||||
|
CommunicationStreamDebugging StreamDebugging { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a TcpClientConfigObject
|
||||||
|
/// </summary>
|
||||||
|
public class TcpClientConfigObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TcpSsh Properties
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("control")]
|
||||||
|
public ControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("secure")]
|
||||||
|
public bool Secure { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sharedKeyRequired")]
|
||||||
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The shared key that must match on the server and client
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sharedKey")]
|
||||||
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
||||||
|
/// heartbeats do not raise received events.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("heartbeatRequired")]
|
||||||
|
public bool HeartbeatRequired { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("heartbeatRequiredIntervalInSeconds")]
|
||||||
|
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("heartbeatStringToMatch")]
|
||||||
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Receive Queue size must be greater than 20 or defaults to 20
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("receiveQueueSize")]
|
||||||
|
public int ReceiveQueueSize { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tcp Server Config object with properties for a tcp server with shared key and heartbeat capabilities
|
||||||
|
/// </summary>
|
||||||
|
public class TcpServerConfigObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Uique key
|
||||||
|
/// </summary>
|
||||||
|
public string Key { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Max Clients that the server will allow to connect.
|
||||||
|
/// </summary>
|
||||||
|
public ushort MaxClients { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Bool value for secure. Currently not implemented in TCP sockets as they are not dynamic
|
||||||
|
/// </summary>
|
||||||
|
public bool Secure { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Port for the server to listen on
|
||||||
|
/// </summary>
|
||||||
|
public int Port { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Require a shared key that both server and client negotiate. If negotiation fails server disconnects the client
|
||||||
|
/// </summary>
|
||||||
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The shared key that must match on the server and client
|
||||||
|
/// </summary>
|
||||||
|
public string SharedKey { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Require a heartbeat on the client/server connection that will cause the server/client to disconnect if the heartbeat is not received.
|
||||||
|
/// heartbeats do not raise received events.
|
||||||
|
/// </summary>
|
||||||
|
public bool HeartbeatRequired { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The interval in seconds for the heartbeat from the client. If not received client is disconnected
|
||||||
|
/// </summary>
|
||||||
|
public ushort HeartbeatRequiredIntervalInSeconds { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// HeartbeatString that will be checked against the message received. defaults to heartbeat if no string is provided.
|
||||||
|
/// </summary>
|
||||||
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Client buffer size. See Crestron help. defaults to 2000 if not greater than 2000
|
||||||
|
/// </summary>
|
||||||
|
public int BufferSize { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Receive Queue size must be greater than 20 or defaults to 20
|
||||||
|
/// </summary>
|
||||||
|
public int ReceiveQueueSize { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a TcpSshPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
|
public class TcpSshPropertiesConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Address to connect to
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Port to connect to
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty(Required = Required.Always)]
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Username credential
|
||||||
|
/// </summary>
|
||||||
|
public string Username { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Password
|
||||||
|
/// </summary>
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defaults to 32768
|
||||||
|
/// </summary>
|
||||||
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnect
|
||||||
|
/// </summary>
|
||||||
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnectIntervalMs
|
||||||
|
/// </summary>
|
||||||
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default constructor
|
||||||
|
/// </summary>
|
||||||
|
public TcpSshPropertiesConfig()
|
||||||
|
{
|
||||||
|
BufferSize = 32768;
|
||||||
|
AutoReconnect = true;
|
||||||
|
AutoReconnectIntervalMs = 5000;
|
||||||
|
Username = "";
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Communications
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Crestron Control Methods for a comm object
|
||||||
|
/// </summary>
|
||||||
|
public enum eControlMethod
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
None = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// RS232/422/485
|
||||||
|
/// </summary>
|
||||||
|
Com,
|
||||||
|
/// <summary>
|
||||||
|
/// Crestron IpId (most Crestron ethernet devices)
|
||||||
|
/// </summary>
|
||||||
|
IpId,
|
||||||
|
/// <summary>
|
||||||
|
/// Crestron IpIdTcp (HD-MD series, etc.)
|
||||||
|
/// </summary>
|
||||||
|
IpidTcp,
|
||||||
|
/// <summary>
|
||||||
|
/// Crestron IR control
|
||||||
|
/// </summary>
|
||||||
|
IR,
|
||||||
|
/// <summary>
|
||||||
|
/// SSH client
|
||||||
|
/// </summary>
|
||||||
|
Ssh,
|
||||||
|
/// <summary>
|
||||||
|
/// TCP/IP client
|
||||||
|
/// </summary>
|
||||||
|
Tcpip,
|
||||||
|
/// <summary>
|
||||||
|
/// Telnet
|
||||||
|
/// </summary>
|
||||||
|
Telnet,
|
||||||
|
/// <summary>
|
||||||
|
/// Crestnet device
|
||||||
|
/// </summary>
|
||||||
|
Cresnet,
|
||||||
|
/// <summary>
|
||||||
|
/// CEC Control, via a DM HDMI port
|
||||||
|
/// </summary>
|
||||||
|
Cec,
|
||||||
|
/// <summary>
|
||||||
|
/// UDP Server
|
||||||
|
/// </summary>
|
||||||
|
Udp,
|
||||||
|
/// <summary>
|
||||||
|
/// HTTP client
|
||||||
|
/// </summary>
|
||||||
|
Http,
|
||||||
|
/// <summary>
|
||||||
|
/// HTTPS client
|
||||||
|
/// </summary>
|
||||||
|
Https,
|
||||||
|
/// <summary>
|
||||||
|
/// Websocket client
|
||||||
|
/// </summary>
|
||||||
|
Ws,
|
||||||
|
/// <summary>
|
||||||
|
/// Secure Websocket client
|
||||||
|
/// </summary>
|
||||||
|
Wss,
|
||||||
|
/// <summary>
|
||||||
|
/// Secure TCP/IP
|
||||||
|
/// </summary>
|
||||||
|
SecureTcpIp
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
using Crestron.SimplSharpPro;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,6 +6,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,4 @@
|
|||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
using PepperDash.Core;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ConfigPropertiesHelpers
|
/// Represents a ConfigPropertiesHelpers
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,13 +5,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Core.Config;
|
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config.Essentials
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the ConfigObject from the file
|
/// Loads the ConfigObject from the file
|
||||||
@@ -37,7 +34,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
// Check for local config file first
|
// Check for local config file first
|
||||||
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
|
var filePath = Global.FilePathPrefix + ConfigWriter.LocalConfigFolder + Global.DirectorySeparator + Global.ConfigFileName;
|
||||||
|
|
||||||
bool localConfigFound = false;
|
var localConfigFound = false;
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Attempting to load Local config file: '{0}'", filePath);
|
Debug.LogMessage(LogEventLevel.Information, "Attempting to load Local config file: '{0}'", filePath);
|
||||||
|
|
||||||
@@ -113,7 +110,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the file
|
// Read the file
|
||||||
using (StreamReader fs = new StreamReader(filePath))
|
using (var fs = new StreamReader(filePath))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Loading config file: '{0}'", filePath);
|
Debug.LogMessage(LogEventLevel.Information, "Loading config file: '{0}'", filePath);
|
||||||
|
|
||||||
@@ -213,7 +210,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
{
|
{
|
||||||
debugStringWidth = 51;
|
debugStringWidth = 51;
|
||||||
}
|
}
|
||||||
var qualifier = (filePathLength % 2 != 0)
|
var qualifier = filePathLength % 2 != 0
|
||||||
? " Using Local Config File "
|
? " Using Local Config File "
|
||||||
: " Using Local Config File ";
|
: " Using Local Config File ";
|
||||||
var bookend1 = (debugStringWidth - qualifier.Length) / 2;
|
var bookend1 = (debugStringWidth - qualifier.Length) / 2;
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Crestron.SimplSharp.Net.Http;
|
using Crestron.SimplSharp.Net.Http;
|
||||||
using Crestron.SimplSharpPro.Diagnostics;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config.Essentials
|
||||||
{
|
{
|
||||||
public static class ConfigUpdater
|
public static class ConfigUpdater
|
||||||
{
|
{
|
||||||
@@ -146,7 +139,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
|
Debug.LogMessage(LogEventLevel.Information, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
|
||||||
|
|
||||||
for (int i = 0; i < archivedConfigFiles.Length; i++ )
|
for (var i = 0; i < archivedConfigFiles.Length; i++ )
|
||||||
{
|
{
|
||||||
var file = archivedConfigFiles[i];
|
var file = archivedConfigFiles[i];
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Deleting archived file: '{0}'", file.FullName);
|
Debug.LogMessage(LogEventLevel.Information, "Deleting archived file: '{0}'", file.FullName);
|
||||||
@@ -196,7 +189,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
|
|
||||||
OnStatusUpdate(eUpdateStatus.RestartingProgram);
|
OnStatusUpdate(eUpdateStatus.RestartingProgram);
|
||||||
|
|
||||||
string response = string.Empty;
|
var response = string.Empty;
|
||||||
|
|
||||||
CrestronConsole.SendControlSystemCommand(string.Format("progreset -p:{0}", InitialParametersClass.ApplicationNumber), ref response);
|
CrestronConsole.SendControlSystemCommand(string.Format("progreset -p:{0}", InitialParametersClass.ApplicationNumber), ref response);
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
namespace PepperDash.Essentials.Core.Config.Essentials
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
/// Responsible for updating config at runtime, and writing the updates out to a local file
|
||||||
@@ -36,7 +33,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
public static bool UpdateDeviceProperties(string deviceKey, JToken properties)
|
||||||
{
|
{
|
||||||
bool success = false;
|
var success = false;
|
||||||
|
|
||||||
// Get the current device config
|
// Get the current device config
|
||||||
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(deviceKey));
|
||||||
@@ -61,7 +58,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool UpdateDeviceConfig(DeviceConfig config)
|
public static bool UpdateDeviceConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
bool success = false;
|
var success = false;
|
||||||
|
|
||||||
var deviceConfigIndex = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
|
var deviceConfigIndex = ConfigReader.ConfigObject.Devices.FindIndex(d => d.Key.Equals(config.Key));
|
||||||
|
|
||||||
@@ -84,7 +81,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool UpdateRoomConfig(DeviceConfig config)
|
public static bool UpdateRoomConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
bool success = false;
|
var success = false;
|
||||||
|
|
||||||
var roomConfigIndex = ConfigReader.ConfigObject.Rooms.FindIndex(d => d.Key.Equals(config.Key));
|
var roomConfigIndex = ConfigReader.ConfigObject.Rooms.FindIndex(d => d.Key.Equals(config.Key));
|
||||||
|
|
||||||
@@ -149,7 +146,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
{
|
{
|
||||||
if (fileLock.TryEnter())
|
if (fileLock.TryEnter())
|
||||||
{
|
{
|
||||||
using (StreamWriter sw = new StreamWriter(filePath))
|
using (var sw = new StreamWriter(filePath))
|
||||||
{
|
{
|
||||||
sw.Write(configData);
|
sw.Write(configData);
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PepperDash.Core;
|
namespace PepperDash.Essentials.Core.Config.Essentials
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the ConfigObject from the file
|
/// Loads the ConfigObject from the file
|
||||||
@@ -34,12 +27,12 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
if (SystemUrl.Contains("#"))
|
if (SystemUrl.Contains("#"))
|
||||||
{
|
{
|
||||||
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
|
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
|
||||||
string uuid = result.Groups[1].Value;
|
var uuid = result.Groups[1].Value;
|
||||||
return uuid;
|
return uuid;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*");
|
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*");
|
||||||
string uuid = result.Groups[1].Value;
|
var uuid = result.Groups[1].Value;
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,12 +49,12 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
if (TemplateUrl.Contains("#"))
|
if (TemplateUrl.Contains("#"))
|
||||||
{
|
{
|
||||||
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
|
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
|
||||||
string uuid = result.Groups[1].Value;
|
var uuid = result.Groups[1].Value;
|
||||||
return uuid;
|
return uuid;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*");
|
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*");
|
||||||
string uuid = result.Groups[2].Value;
|
var uuid = result.Groups[2].Value;
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace PepperDash.Essentials.Core.Config
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for ILoadConfig
|
/// Defines the contract for ILoadConfig
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Essentials.Core.Global;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
|
/// The information gathered by the processor at runtime about it's NICs and their IP addresses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("ipInfo")]
|
[JsonProperty("ipInfo")]
|
||||||
public Dictionary<short, EthernetAdapterInfo> IpInfo
|
public Dictionary<short, Core.Global.EthernetAdapterInfo> IpInfo
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace PepperDash.Essentials.Core.Config
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Config
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a SourceDevicePropertiesConfigBase
|
/// Represents a SourceDevicePropertiesConfigBase
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Core.JsonStandardObjects;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.Crestron
|
||||||
{
|
{
|
||||||
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Feedbacks
|
/// Gets or sets the Feedbacks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FeedbackCollection<Feedback> Feedbacks { get; private set; }
|
public FeedbackCollection<Feedbacks.Feedback> Feedbacks { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsOnline
|
/// Gets or sets the IsOnline
|
||||||
@@ -39,7 +39,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Feedbacks = new FeedbackCollection<Feedback>();
|
Feedbacks = new FeedbackCollection<Feedbacks.Feedback>();
|
||||||
|
|
||||||
Hardware = hardware;
|
Hardware = hardware;
|
||||||
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline);
|
IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline);
|
||||||
@@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
protected CrestronGenericBaseDevice(string key, string name)
|
protected CrestronGenericBaseDevice(string key, string name)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Feedbacks = new FeedbackCollection<Feedback>();
|
Feedbacks = new FeedbackCollection<Feedbacks.Feedback>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// AddToFeedbackList method
|
/// AddToFeedbackList method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddToFeedbackList(params Feedback[] newFbs)
|
public void AddToFeedbackList(params Feedbacks.Feedback[] newFbs)
|
||||||
{
|
{
|
||||||
foreach (var f in newFbs)
|
foreach (var f in newFbs)
|
||||||
{
|
{
|
||||||
@@ -186,8 +186,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public UsageTracking UsageTracker { get; set; }
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
|
FeedbackCollection<Feedbacks.Feedback> IHasFeedback.Feedbacks => throw new System.NotImplementedException();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A bridge class to cover the basic features of GenericBase hardware
|
|
||||||
/// </summary>
|
|
||||||
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
|
||||||
{
|
|
||||||
public virtual GenericBase Hardware { get; protected set; }
|
|
||||||
|
|
||||||
public BoolFeedback IsOnline { get; private set; }
|
|
||||||
public BoolFeedback IsRegistered { get; private set; }
|
|
||||||
public StringFeedback IpConnectionsText { get; private set; }
|
|
||||||
|
|
||||||
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
|
||||||
: base(key, name)
|
|
||||||
{
|
|
||||||
Hardware = hardware;
|
|
||||||
IsOnline = new BoolFeedback(CommonBoolCue.IsOnlineFeedback, () => Hardware.IsOnline);
|
|
||||||
IsRegistered = new BoolFeedback(new Cue("IsRegistered", 0, eCueType.Bool), () => Hardware.Registered);
|
|
||||||
IpConnectionsText = new StringFeedback(CommonStringCue.IpConnectionsText, () =>
|
|
||||||
string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()));
|
|
||||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Make sure that overriding classes call this!
|
|
||||||
/// Registers the Crestron device, connects up to the base events, starts communication monitor
|
|
||||||
/// </summary>
|
|
||||||
public override bool CustomActivate()
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "Activating");
|
|
||||||
var response = Hardware.RegisterWithLogging(Key);
|
|
||||||
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
<<<<<<< HEAD
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
>>>>>>> origin/feature/ecs-342-neil
|
|
||||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
|
||||||
CommunicationMonitor.Start();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This disconnects events and unregisters the base hardware device.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
CommunicationMonitor.Stop();
|
|
||||||
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
|
||||||
|
|
||||||
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list containing the Outputs that we want to expose.
|
|
||||||
/// </summary>
|
|
||||||
public virtual List<Feedback> Feedbacks
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new List<Feedback>
|
|
||||||
{
|
|
||||||
IsOnline,
|
|
||||||
IsRegistered,
|
|
||||||
IpConnectionsText
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
|
||||||
{
|
|
||||||
IsOnline.FireUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IStatusMonitor Members
|
|
||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IUsageTracking Members
|
|
||||||
|
|
||||||
public UsageTracking UsageTracker { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
//***********************************************************************************
|
|
||||||
public class CrestronGenericBaseDeviceEventIds
|
|
||||||
{
|
|
||||||
public const uint IsOnline = 1;
|
|
||||||
public const uint IpConnectionsText =2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds logging to Register() failure
|
|
||||||
/// </summary>
|
|
||||||
public static class GenericBaseExtensions
|
|
||||||
{
|
|
||||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
|
||||||
{
|
|
||||||
var result = device.Register();
|
|
||||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Cannot register device '{0}': {1}", key, result);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Touchpanels;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.Touchpanels;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.PartitionSensor;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
|
using PepperDash.Essentials.Core.JoinMaps;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
using PepperDash.Essentials.Core.Touchpanels;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
using System;
|
using Crestron.SimplSharpPro;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for IHasCresnetBranches
|
/// Defines the contract for IHasCresnetBranches
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
using System;
|
using PepperDash.Essentials.Core.Feedbacks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.CrestronIO
|
namespace PepperDash.Essentials.Core.CrestronIO
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user