mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Compare commits
63 Commits
feature/up
...
v2.17.0-mc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fc4d21f02 | ||
|
|
fd70377c7f | ||
|
|
06341b14f3 | ||
|
|
b0a090062f | ||
|
|
9c0cab8218 | ||
|
|
c0af637108 | ||
|
|
9c9eaea928 | ||
|
|
258699fbcd | ||
|
|
738504e9fc | ||
|
|
cae1bbd6e6 | ||
|
|
dea4407e3e | ||
|
|
ab08a546f7 | ||
|
|
ef98d47792 | ||
|
|
c05976ee60 | ||
|
|
4ca1031bef | ||
|
|
6d61c4525e | ||
|
|
3db274ace5 | ||
|
|
f0f708294c | ||
|
|
a00d186c62 | ||
|
|
51da668dfd | ||
|
|
d2b7400039 | ||
|
|
2424838b7f | ||
|
|
9556edc064 | ||
|
|
f9088691fd | ||
|
|
e40b6a8b4c | ||
|
|
c3b39a87da | ||
|
|
06dc0e947e | ||
|
|
147997f460 | ||
|
|
49abec5eea | ||
|
|
6830efe42a | ||
|
|
d013068a0c | ||
|
|
52916d29f4 | ||
|
|
19e8489166 | ||
|
|
fe33443b25 | ||
|
|
8cf195b262 | ||
|
|
40406b797d | ||
|
|
65bc408ebf | ||
|
|
9d49fb8357 | ||
|
|
fb7797dac7 | ||
|
|
574f5f6dc9 | ||
|
|
e49c69a12f | ||
|
|
7889cba196 | ||
|
|
033aa1f3dd | ||
|
|
9b6c2d80ea | ||
|
|
a0fc731701 | ||
|
|
f2d0dca7b8 | ||
|
|
ab4e85d081 | ||
|
|
47017da527 | ||
|
|
4f0d464ba4 | ||
|
|
0107422507 | ||
|
|
1a366790e7 | ||
|
|
97448f4f0f | ||
|
|
cf3ece4237 | ||
|
|
808e8042a7 | ||
|
|
0bc4388bfd | ||
|
|
dbc132c0da | ||
|
|
5bb0ab2626 | ||
|
|
27bf36c58c | ||
|
|
ce886aea63 | ||
|
|
ef920bf54c | ||
|
|
a031424752 | ||
|
|
fd1ba345aa | ||
|
|
e03874a7a9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -395,3 +395,4 @@ 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.4.0-local</Version>
|
<Version>2.15.1-local</Version>
|
||||||
<InformationalVersion>$(Version)</InformationalVersion>
|
<InformationalVersion>$(Version)</InformationalVersion>
|
||||||
<Authors>PepperDash Technology</Authors>
|
<Authors>PepperDash Technology</Authors>
|
||||||
<Company>PepperDash Technology</Company>
|
<Company>PepperDash Technology</Company>
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -19,7 +20,6 @@ using Serilog.Templates;
|
|||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains debug commands for use in various situations
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Debug
|
public static class Debug
|
||||||
{
|
{
|
||||||
@@ -272,6 +272,9 @@ namespace PepperDash.Core
|
|||||||
if (result != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
if (result != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||||
{
|
{
|
||||||
CrestronConsole.Print($"Unable to retrieve stored log level for {levelStoreKey}.\r\nError: {result}.\r\nSetting level to {LogEventLevel.Information}\r\n");
|
CrestronConsole.Print($"Unable to retrieve stored log level for {levelStoreKey}.\r\nError: {result}.\r\nSetting level to {LogEventLevel.Information}\r\n");
|
||||||
|
|
||||||
|
CrestronDataStoreStatic.SetLocalIntValue(levelStoreKey, (int)LogEventLevel.Information);
|
||||||
|
|
||||||
return LogEventLevel.Information;
|
return LogEventLevel.Information;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,13 +349,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:
|
"Used to set the minimum level of debug messages to be printed to the console:\r\n" +
|
||||||
{_logLevels[0]} = 0
|
$"{_logLevels[0]} = 0\r\n" +
|
||||||
{_logLevels[1]} = 1
|
$"{_logLevels[1]} = 1\r\n" +
|
||||||
{_logLevels[2]} = 2
|
$"{_logLevels[2]} = 2\r\n" +
|
||||||
{_logLevels[3]} = 3
|
$"{_logLevels[3]} = 3\r\n" +
|
||||||
{_logLevels[4]} = 4
|
$"{_logLevels[4]} = 4\r\n" +
|
||||||
{_logLevels[5]} = 5");
|
$"{_logLevels[5]} = 5");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +376,7 @@ namespace PepperDash.Core
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enum.TryParse<LogEventLevel>(levelString, out var levelEnum))
|
if (Enum.TryParse<LogEventLevel>(levelString, true, out var levelEnum))
|
||||||
{
|
{
|
||||||
SetDebugLevel(levelEnum);
|
SetDebugLevel(levelEnum);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Serilog.Events;
|
using System;
|
||||||
using System;
|
using Serilog.Events;
|
||||||
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, args);
|
Log.LogMessage(ex, message, device: 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.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
|
Log.LogVerbose(ex, device, message, 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.LogMessage(LogEventLevel.Verbose, device, message, args);
|
Log.LogVerbose(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.LogMessage(LogEventLevel.Debug, ex, message, device, args);
|
Log.LogDebug(ex, device, message, 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.LogMessage(LogEventLevel.Debug, device, message, args);
|
Log.LogDebug(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.LogMessage(LogEventLevel.Information, ex, message, device, args);
|
Log.LogInformation(ex, device, message, 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.LogMessage(LogEventLevel.Information, device, message, args);
|
Log.LogInformation(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.LogMessage(LogEventLevel.Warning, ex, message, device, args);
|
Log.LogWarning(ex, device, message, 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.LogMessage(LogEventLevel.Warning, device, message, args);
|
Log.LogWarning(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.LogMessage(LogEventLevel.Error, ex, message, device, args);
|
Log.LogError(ex, device, message, 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.LogMessage(LogEventLevel.Error, device, message, args);
|
Log.LogError(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.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
|
Log.LogFatal(ex, device, message, 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.LogMessage(LogEventLevel.Fatal, device, message, args);
|
Log.LogFatal(device, message, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
|
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" />
|
||||||
<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" />
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
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.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
@@ -355,22 +353,22 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EiscApiPropertiesConfig
|
public class EiscApiPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("control")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Control
|
/// Gets or sets the Control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("control")]
|
||||||
public EssentialsControlPropertiesConfig Control { get; set; }
|
public EssentialsControlPropertiesConfig Control { get; set; }
|
||||||
|
|
||||||
[JsonProperty("devices")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Devices
|
/// Gets or sets the Devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("devices")]
|
||||||
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
public List<ApiDevicePropertiesConfig> Devices { get; set; }
|
||||||
|
|
||||||
[JsonProperty("rooms")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Rooms
|
/// Gets or sets the Rooms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("rooms")]
|
||||||
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
|
||||||
|
|
||||||
|
|
||||||
@@ -379,22 +377,22 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ApiDevicePropertiesConfig
|
public class ApiDevicePropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceKey
|
/// Gets or sets the DeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("deviceKey")]
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the JoinStart
|
/// Gets or sets the JoinStart
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the JoinMapKey
|
/// Gets or sets the JoinMapKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,22 +401,22 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ApiRoomPropertiesConfig
|
public class ApiRoomPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("roomKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomKey
|
/// Gets or sets the RoomKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("roomKey")]
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinStart")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the JoinStart
|
/// Gets or sets the JoinStart
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("joinStart")]
|
||||||
public uint JoinStart { get; set; }
|
public uint JoinStart { get; set; }
|
||||||
|
|
||||||
[JsonProperty("joinMapKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the JoinMapKey
|
/// Gets or sets the JoinMapKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("joinMapKey")]
|
||||||
public string JoinMapKey { get; set; }
|
public string JoinMapKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
138
src/PepperDash.Essentials.Core/Comm and IR/CommBridge.cs
Normal file
138
src/PepperDash.Essentials.Core/Comm and IR/CommBridge.cs
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
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,11 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
@@ -38,9 +36,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
/// Returns a comm method of either com port, TCP, SSH, and puts this into the DeviceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceConfig">The Device config object</param>
|
/// <param name="deviceConfig">The Device config object</param>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CreateCommForDevice method
|
/// CreateCommForDevice method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
public static IBasicCommunication CreateCommForDevice(DeviceConfig deviceConfig)
|
||||||
{
|
{
|
||||||
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
EssentialsControlPropertiesConfig controlConfig = GetControlPropertiesConfig(deviceConfig);
|
||||||
@@ -56,35 +54,38 @@ namespace PepperDash.Essentials.Core
|
|||||||
case eControlMethod.Com:
|
case eControlMethod.Com:
|
||||||
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig);
|
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig);
|
||||||
break;
|
break;
|
||||||
case eControlMethod.Cec:
|
case eControlMethod.ComBridge:
|
||||||
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
comm = new CommBridge(deviceConfig.Key + "-simpl", deviceConfig.Name + " Simpl");
|
||||||
break;
|
break;
|
||||||
|
case eControlMethod.Cec:
|
||||||
|
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
|
||||||
|
break;
|
||||||
case eControlMethod.IR:
|
case eControlMethod.IR:
|
||||||
break;
|
break;
|
||||||
case eControlMethod.Ssh:
|
case eControlMethod.Ssh:
|
||||||
{
|
{
|
||||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||||
ssh.AutoReconnect = c.AutoReconnect;
|
ssh.AutoReconnect = c.AutoReconnect;
|
||||||
if(ssh.AutoReconnect)
|
if (ssh.AutoReconnect)
|
||||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
comm = ssh;
|
comm = ssh;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eControlMethod.Tcpip:
|
case eControlMethod.Tcpip:
|
||||||
{
|
{
|
||||||
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
var tcp = new GenericTcpIpClient(deviceConfig.Key + "-tcp", c.Address, c.Port, c.BufferSize);
|
||||||
tcp.AutoReconnect = c.AutoReconnect;
|
tcp.AutoReconnect = c.AutoReconnect;
|
||||||
if (tcp.AutoReconnect)
|
if (tcp.AutoReconnect)
|
||||||
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
tcp.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
comm = tcp;
|
comm = tcp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eControlMethod.Udp:
|
case eControlMethod.Udp:
|
||||||
{
|
{
|
||||||
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
var udp = new GenericUdpServer(deviceConfig.Key + "-udp", c.Address, c.Port, c.BufferSize);
|
||||||
comm = udp;
|
comm = udp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eControlMethod.Telnet:
|
case eControlMethod.Telnet:
|
||||||
break;
|
break;
|
||||||
case eControlMethod.SecureTcpIp:
|
case eControlMethod.SecureTcpIp:
|
||||||
@@ -98,7 +99,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -107,15 +108,14 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
// put it in the device manager if it's the right flavor
|
// put it in the device manager if it's the right flavor
|
||||||
var comDev = comm as Device;
|
if (comm is Device comDev)
|
||||||
if (comDev != null)
|
|
||||||
DeviceManager.AddDevice(comDev);
|
DeviceManager.AddDevice(comDev);
|
||||||
return comm;
|
return comm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetComPort method
|
/// GetComPort method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
|
||||||
{
|
{
|
||||||
var comPar = config.ComParams;
|
var comPar = config.ComParams;
|
||||||
@@ -126,74 +126,74 @@ namespace PepperDash.Essentials.Core
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
/// Gets an ICec port from a RoutingInput or RoutingOutput on a device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetCecPort method
|
/// GetCecPort method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ICec GetCecPort(ControlPropertiesConfig config)
|
public static ICec GetCecPort(ControlPropertiesConfig config)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
|
||||||
? "is not valid, failed to get cec port"
|
? "is not valid, failed to get cec port"
|
||||||
: "found in device manager, attempting to get cec port");
|
: "found in device manager, attempting to get cec port");
|
||||||
|
|
||||||
if (dev == null)
|
if (dev == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(config.ControlPortName))
|
if (String.IsNullOrEmpty(config.ControlPortName))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var inputsOutputs = dev as IRoutingInputsOutputs;
|
var inputsOutputs = dev as IRoutingInputsOutputs;
|
||||||
if (inputsOutputs == null)
|
if (inputsOutputs == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
|
||||||
config.ControlPortDevKey, config.ControlPortName);
|
config.ControlPortDevKey, config.ControlPortName);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
|
var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
|
||||||
if (inputPort != null && inputPort.Port is ICec)
|
if (inputPort != null && inputPort.Port is ICec)
|
||||||
return inputPort.Port as ICec;
|
return inputPort.Port as ICec;
|
||||||
|
|
||||||
|
|
||||||
var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
|
|
||||||
if (outputPort != null && outputPort.Port is ICec)
|
var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
|
||||||
return outputPort.Port as ICec;
|
if (outputPort != null && outputPort.Port is ICec)
|
||||||
}
|
return outputPort.Port as ICec;
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "GetCecPort Exception Message: {0}", ex.Message);
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
|
Debug.LogMessage(LogEventLevel.Debug, "GetCecPort Exception Message: {0}", ex.Message);
|
||||||
if (ex.InnerException != null)
|
Debug.LogMessage(LogEventLevel.Verbose, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
|
||||||
Debug.LogMessage(LogEventLevel.Information, "GetCecPort Exception InnerException: {0}", ex.InnerException);
|
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}'",
|
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
|
||||||
config.ControlPortDevKey, config.ControlPortName);
|
config.ControlPortDevKey, config.ControlPortName);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
/// Helper to grab the IComPorts device for this PortDeviceKey. Key "controlSystem" will
|
||||||
/// return the ControlSystem object from the Global class.
|
/// return the ControlSystem object from the Global class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
/// <returns>IComPorts device or null if the device is not found or does not implement IComPorts</returns>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetIComPortsDeviceFromManagedDevice method
|
/// GetIComPortsDeviceFromManagedDevice method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
public static IComPorts GetIComPortsDeviceFromManagedDevice(string ComPortDevKey)
|
||||||
{
|
{
|
||||||
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
if ((ComPortDevKey.Equals("controlSystem", System.StringComparison.OrdinalIgnoreCase)
|
||||||
@@ -210,81 +210,81 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EssentialsControlPropertiesConfig
|
/// Represents a EssentialsControlPropertiesConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsControlPropertiesConfig :
|
public class EssentialsControlPropertiesConfig :
|
||||||
ControlPropertiesConfig
|
ControlPropertiesConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||||
public ComPort.ComPortSpec? ComParams { get; set; }
|
public ComPort.ComPortSpec? ComParams { get; set; }
|
||||||
|
|
||||||
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CresnetId { get; set; }
|
public string CresnetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to provide uint conversion of string CresnetId
|
/// Attempts to provide uint conversion of string CresnetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public uint CresnetIdInt
|
public uint CresnetIdInt
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Convert.ToUInt32(CresnetId, 16);
|
return Convert.ToUInt32(CresnetId, 16);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the InfinetId
|
/// Gets or sets the InfinetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string InfinetId { get; set; }
|
public string InfinetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attepmts to provide uiont conversion of string InifinetId
|
/// Attepmts to provide uiont conversion of string InifinetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public uint InfinetIdInt
|
public uint InfinetIdInt
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Convert.ToUInt32(InfinetId, 16);
|
return Convert.ToUInt32(InfinetId, 16);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a IrControlSpec
|
/// Represents a IrControlSpec
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IrControlSpec
|
public class IrControlSpec
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PortDeviceKey
|
/// Gets or sets the PortDeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PortDeviceKey { get; set; }
|
public string PortDeviceKey { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PortNumber
|
/// Gets or sets the PortNumber
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint PortNumber { get; set; }
|
public uint PortNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the File
|
/// Gets or sets the File
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string File { get; set; }
|
public string File { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,41 +18,41 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DeviceConfig
|
public class DeviceConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("key")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("key")]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
[JsonProperty("uid")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Uid
|
/// Gets or sets the Uid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("uid")]
|
||||||
public int Uid { get; set; }
|
public int Uid { get; set; }
|
||||||
|
|
||||||
[JsonProperty("name")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Name
|
/// Gets or sets the Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("group")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Group
|
/// Gets or sets the Group
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("group")]
|
||||||
public string Group { get; set; }
|
public string Group { get; set; }
|
||||||
|
|
||||||
[JsonProperty("type")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("properties")]
|
|
||||||
[JsonConverter(typeof(DevicePropertiesConverter))]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Properties
|
/// Gets or sets the Properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("properties")]
|
||||||
|
[JsonConverter(typeof(DevicePropertiesConverter))]
|
||||||
public JToken Properties { get; set; }
|
public JToken Properties { get; set; }
|
||||||
|
|
||||||
public DeviceConfig(DeviceConfig dc)
|
public DeviceConfig(DeviceConfig dc)
|
||||||
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
//Properties = JToken.FromObject(dc.Properties);
|
//Properties = JToken.FromObject(dc.Properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceConfig() {}
|
public DeviceConfig() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Crestron.SimplSharpPro.DM.Streaming;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.DM.Streaming;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -11,7 +12,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// subscribers when the port information is updated. Implementations of this interface should ensure that the <see
|
/// subscribers when the port information is updated. Implementations of this interface should ensure that the <see
|
||||||
/// cref="PortInformationChanged"/> event is raised whenever the <see cref="NetworkPorts"/> collection
|
/// cref="PortInformationChanged"/> event is raised whenever the <see cref="NetworkPorts"/> collection
|
||||||
/// changes.</remarks>
|
/// changes.</remarks>
|
||||||
public interface INvxNetworkPortInformation
|
public interface INvxNetworkPortInformation : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the port information changes.
|
/// Occurs when the port information changes.
|
||||||
|
|||||||
@@ -202,14 +202,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
private static void ListDevices(string s)
|
private static void ListDevices(string s)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "{0} Devices registered with Device Manager:", Devices.Count);
|
CrestronConsole.ConsoleCommandResponse($"{Devices.Count} Devices registered with Device Manager:\r\n");
|
||||||
|
|
||||||
var sorted = Devices.Values.ToList();
|
var sorted = Devices.Values.ToList();
|
||||||
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
|
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
|
||||||
|
|
||||||
foreach (var d in sorted)
|
foreach (var d in sorted)
|
||||||
{
|
{
|
||||||
var name = d is IKeyName ? (d as IKeyName).Name : "---";
|
var name = d is IKeyName ? (d as IKeyName).Name : "---";
|
||||||
Debug.LogMessage(LogEventLevel.Information, " [{0}] {1}", d.Key, name);
|
CrestronConsole.ConsoleCommandResponse($" [{d.Key}] {name}\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,28 +219,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
var dev = GetDeviceForKey(devKey);
|
var dev = GetDeviceForKey(devKey);
|
||||||
if (dev == null)
|
if (dev == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
|
CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' not found\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(dev is IHasFeedback statusDev))
|
if (!(dev is IHasFeedback statusDev))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' does not have visible feedbacks", devKey);
|
CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' does not have visible feedbacks\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statusDev.DumpFeedbacksToConsole(true);
|
statusDev.DumpFeedbacksToConsole(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static void ListDeviceCommands(string devKey)
|
|
||||||
//{
|
|
||||||
// var dev = GetDeviceForKey(devKey);
|
|
||||||
// if (dev == null)
|
|
||||||
// {
|
|
||||||
// Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// Debug.LogMessage(LogEventLevel.Information, "This needs to be reworked. Stay tuned.", devKey);
|
|
||||||
//}
|
|
||||||
|
|
||||||
private static void ListDeviceCommStatuses(string input)
|
private static void ListDeviceCommStatuses(string input)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -249,12 +239,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//static void DoDeviceCommand(string command)
|
|
||||||
//{
|
|
||||||
// Debug.LogMessage(LogEventLevel.Information, "Not yet implemented. Stay tuned");
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AddDevice method
|
/// AddDevice method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -475,9 +459,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (String.IsNullOrEmpty(s) || s.Contains("?"))
|
if (String.IsNullOrEmpty(s) || s.Contains("?"))
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]
|
"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]\r\n" +
|
||||||
{deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use
|
" {deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use\r\n" +
|
||||||
timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
|
" timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,29 @@ using PepperDash.Essentials.Core.Bridges;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
public abstract class EssentialsBridgeableDevice:EssentialsDevice, IBridgeAdvanced
|
/// <summary>
|
||||||
|
/// Base class for devices that can be bridged to an EISC API.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class EssentialsBridgeableDevice : EssentialsDevice, IBridgeAdvanced
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="EssentialsBridgeableDevice"/> class with the specified key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The unique key for the device.</param>
|
||||||
protected EssentialsBridgeableDevice(string key) : base(key)
|
protected EssentialsBridgeableDevice(string key) : base(key)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="EssentialsBridgeableDevice"/> class with the specified key and name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The unique key for the device.</param>
|
||||||
|
/// <param name="name">The display name for the device.</param>
|
||||||
protected EssentialsBridgeableDevice(string key, string name) : base(key, name)
|
protected EssentialsBridgeableDevice(string key, string name) : base(key, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for IHasFeedback
|
/// Defines the contract for IHasFeedback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IHasFeedback : IKeyed
|
public interface IHasFeedback : IKeyed
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -19,47 +19,72 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extension methods for IHasFeedback
|
||||||
|
/// </summary>
|
||||||
public static class IHasFeedbackExtensions
|
public static class IHasFeedbackExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the feedback type name for sorting purposes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="feedback">The feedback to get the type name for</param>
|
||||||
|
/// <returns>A string representing the feedback type</returns>
|
||||||
|
private static string GetFeedbackTypeName(Feedback feedback)
|
||||||
|
{
|
||||||
|
if (feedback is BoolFeedback)
|
||||||
|
return "boolean";
|
||||||
|
else if (feedback is IntFeedback)
|
||||||
|
return "integer";
|
||||||
|
else if (feedback is StringFeedback)
|
||||||
|
return "string";
|
||||||
|
else
|
||||||
|
return feedback.GetType().Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dumps the feedbacks to the console
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="getCurrentStates"></param>
|
||||||
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
|
||||||
{
|
{
|
||||||
Type t = source.GetType();
|
|
||||||
// get the properties and set them into a new collection of NameType wrappers
|
|
||||||
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
|
|
||||||
|
|
||||||
var feedbacks = source.Feedbacks;
|
var feedbacks = source.Feedbacks;
|
||||||
if (feedbacks != null)
|
|
||||||
|
if (feedbacks == null || feedbacks.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, source, "\n\nAvailable feedbacks:");
|
CrestronConsole.ConsoleCommandResponse("No available feedbacks\r\n");
|
||||||
foreach (var f in feedbacks)
|
return;
|
||||||
{
|
}
|
||||||
string val = "";
|
|
||||||
string type = "";
|
CrestronConsole.ConsoleCommandResponse("Available feedbacks:\r\n");
|
||||||
if (getCurrentStates)
|
|
||||||
{
|
// Sort feedbacks by type first, then by key
|
||||||
if (f is BoolFeedback)
|
var sortedFeedbacks = feedbacks.OrderBy(f => GetFeedbackTypeName(f)).ThenBy(f => string.IsNullOrEmpty(f.Key) ? "" : f.Key);
|
||||||
{
|
|
||||||
val = f.BoolValue.ToString();
|
foreach (var feedback in sortedFeedbacks)
|
||||||
type = "boolean";
|
{
|
||||||
}
|
string value = "";
|
||||||
else if (f is IntFeedback)
|
string type = "";
|
||||||
{
|
if (getCurrentStates)
|
||||||
val = f.IntValue.ToString();
|
{
|
||||||
type = "integer";
|
if (feedback is BoolFeedback)
|
||||||
}
|
{
|
||||||
else if (f is StringFeedback)
|
value = feedback.BoolValue.ToString();
|
||||||
{
|
type = "boolean";
|
||||||
val = f.StringValue;
|
}
|
||||||
type = "string";
|
else if (feedback is IntFeedback)
|
||||||
}
|
{
|
||||||
}
|
value = feedback.IntValue.ToString();
|
||||||
Debug.LogMessage(LogEventLevel.Information, "{0,-12} {1, -25} {2}", type,
|
type = "integer";
|
||||||
(string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key), val);
|
}
|
||||||
}
|
else if (feedback is StringFeedback)
|
||||||
|
{
|
||||||
|
value = feedback.StringValue;
|
||||||
|
type = "string";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CrestronConsole.ConsoleCommandResponse($" {type,-12} {(string.IsNullOrEmpty(feedback.Key) ? "-no key-" : feedback.Key),-25} {value}\r\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, source, "No available outputs:");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,6 +244,20 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type")]
|
||||||
public eRoutingSignalType Type { get; set; }
|
public eRoutingSignalType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key for a destination list item. If BOTH SourceListItemKey AND DestinationListItemKey are defined,
|
||||||
|
/// then the direct route method should be used.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("destinationListItemKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string DestinationListItemKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Key for a source list item. If BOTH SourceListItemKey AND DestinationListItemKey are defined,
|
||||||
|
/// then the direct route method should be used.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sourceListItemKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string SourceListItemKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (FactoryMethods.ContainsKey(typeName))
|
if (FactoryMethods.ContainsKey(typeName))
|
||||||
{
|
{
|
||||||
Debug.LogInformation("Unable to add type: '{typeName}'. Already exists in DeviceFactory", typeName);
|
Debug.LogInformation("Unable to add type: '{typeName}'. Already exists in DeviceFactory", typeName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogError(ex, "Exception occurred while creating device {0}: {1}", null, dc.Key, ex.Message);
|
Debug.LogError(ex, "Exception occurred while creating device {key}: {message}", dc.Key, ex.Message);
|
||||||
|
Debug.LogDebug(ex, "Exception details: {stackTrace}", ex.StackTrace);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,9 +250,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"Type: '{0}'
|
"Type: '{0}'\r\n" +
|
||||||
Type: '{1}'
|
" Type: '{1}'\r\n" +
|
||||||
Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine);
|
" Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<DocumentationFile>bin\$(Configuration)\PepperDash_Essentials_Core.xml</DocumentationFile>
|
<DocumentationFile>bin\$(Configuration)\PepperDash_Essentials_Core.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />
|
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />
|
||||||
|
|||||||
@@ -103,6 +103,12 @@ namespace PepperDash.Essentials.Core
|
|||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether to hide this scenario in the UI.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("hideInUi", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public bool HideInUi { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the collection of partition states.
|
/// Gets or sets the collection of partition states.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ namespace PepperDash.Essentials.Core
|
|||||||
[JsonProperty("isActive")]
|
[JsonProperty("isActive")]
|
||||||
bool IsActive { get; }
|
bool IsActive { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this scenario should be hidden in the UI.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("hideInUi")]
|
||||||
|
bool HideInUi { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activates this room combination scenario
|
/// Activates this room combination scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -14,18 +14,40 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
private RoomCombinationScenarioConfig _config;
|
private RoomCombinationScenarioConfig _config;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the key associated with the object.
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("key")]
|
[JsonProperty("key")]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name associated with the object.
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("partitionStates")]
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether to hide this scenario in the UI.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
[JsonProperty("hideInUi")]
|
||||||
|
|
||||||
|
public bool HideInUi
|
||||||
|
{
|
||||||
|
get { return _config.HideInUi; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PartitionStates
|
/// Gets or sets the PartitionStates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
///
|
||||||
|
[JsonProperty("partitionStates")]
|
||||||
|
|
||||||
public List<PartitionState> PartitionStates { get; private set; }
|
public List<PartitionState> PartitionStates { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines which UI devices get mapped to which room in this scenario. The Key should be the key of the UI device and the Value should be the key of the room to map to
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("uiMap")]
|
[JsonProperty("uiMap")]
|
||||||
public Dictionary<string, string> UiMap { get; set; }
|
public Dictionary<string, string> UiMap { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Room.Config
|
namespace PepperDash.Essentials.Room.Config
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EssentialsRoomConfigHelper
|
/// Represents a EssentialsRoomConfigHelper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsRoomConfigHelper
|
public class EssentialsRoomConfigHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetEmergency method
|
/// GetEmergency method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -31,100 +31,100 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="props"></param>
|
/// <param name="props"></param>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetMicrophonePrivacy method
|
/// GetMicrophonePrivacy method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static MicrophonePrivacyController GetMicrophonePrivacy(
|
public static MicrophonePrivacyController GetMicrophonePrivacy(
|
||||||
EssentialsRoomPropertiesConfig props, IPrivacy room)
|
EssentialsRoomPropertiesConfig props, IPrivacy room)
|
||||||
{
|
{
|
||||||
var microphonePrivacy = props.MicrophonePrivacy;
|
var microphonePrivacy = props.MicrophonePrivacy;
|
||||||
if (microphonePrivacy == null)
|
if (microphonePrivacy == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties");
|
Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Get the MicrophonePrivacy device from the device manager
|
// Get the MicrophonePrivacy device from the device manager
|
||||||
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController);
|
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController);
|
||||||
// Set this room as the IPrivacy device
|
// Set this room as the IPrivacy device
|
||||||
if (mP == null)
|
if (mP == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
|
Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
mP.SetPrivacyDevice(room);
|
mP.SetPrivacyDevice(room);
|
||||||
|
|
||||||
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
|
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
|
||||||
|
|
||||||
if (behaviour == null)
|
if (behaviour == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController");
|
Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (behaviour == "trackroomstate")
|
if (behaviour == "trackroomstate")
|
||||||
{
|
{
|
||||||
// Tie LED enable to room power state
|
// Tie LED enable to room power state
|
||||||
var essRoom = room as IEssentialsRoom;
|
var essRoom = room as IEssentialsRoom;
|
||||||
essRoom.OnFeedback.OutputChange += (o, a) =>
|
essRoom.OnFeedback.OutputChange += (o, a) =>
|
||||||
{
|
{
|
||||||
if (essRoom.OnFeedback.BoolValue)
|
if (essRoom.OnFeedback.BoolValue)
|
||||||
mP.EnableLeds = true;
|
mP.EnableLeds = true;
|
||||||
else
|
else
|
||||||
mP.EnableLeds = false;
|
mP.EnableLeds = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
mP.EnableLeds = essRoom.OnFeedback.BoolValue;
|
mP.EnableLeds = essRoom.OnFeedback.BoolValue;
|
||||||
}
|
}
|
||||||
else if (behaviour == "trackcallstate")
|
else if (behaviour == "trackcallstate")
|
||||||
{
|
{
|
||||||
// Tie LED enable to room power state
|
// Tie LED enable to room power state
|
||||||
var inCallRoom = room as IHasInCallFeedback;
|
var inCallRoom = room as IHasInCallFeedback;
|
||||||
inCallRoom.InCallFeedback.OutputChange += (o, a) =>
|
inCallRoom.InCallFeedback.OutputChange += (o, a) =>
|
||||||
{
|
{
|
||||||
if (inCallRoom.InCallFeedback.BoolValue)
|
if (inCallRoom.InCallFeedback.BoolValue)
|
||||||
mP.EnableLeds = true;
|
mP.EnableLeds = true;
|
||||||
else
|
else
|
||||||
mP.EnableLeds = false;
|
mP.EnableLeds = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
|
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mP;
|
return mP;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Represents a EssentialsRoomPropertiesConfig
|
|
||||||
/// </summary>
|
|
||||||
public class EssentialsRoomPropertiesConfig
|
|
||||||
{
|
|
||||||
[JsonProperty("addresses")]
|
|
||||||
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("description")]
|
/// <summary>
|
||||||
public string Description { get; set; }
|
/// Represents a EssentialsRoomPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
|
public class EssentialsRoomPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("addresses")]
|
||||||
|
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
|
||||||
|
|
||||||
[JsonProperty("emergency")]
|
[JsonProperty("description")]
|
||||||
public EssentialsRoomEmergencyConfig Emergency { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
[JsonProperty("help")]
|
[JsonProperty("emergency")]
|
||||||
/// <summary>
|
public EssentialsRoomEmergencyConfig Emergency { get; set; }
|
||||||
/// Gets or sets the Help
|
|
||||||
/// </summary>
|
|
||||||
public EssentialsHelpPropertiesConfig Help { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("helpMessage")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the Help
|
||||||
/// Gets or sets the HelpMessage
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("help")]
|
||||||
public string HelpMessage { get; set; }
|
public EssentialsHelpPropertiesConfig Help { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the HelpMessage
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("helpMessage")]
|
||||||
|
public string HelpMessage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read this value to get the help message. It checks for the old and new config format.
|
/// Read this value to get the help message. It checks for the old and new config format.
|
||||||
@@ -133,94 +133,94 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(Help != null && !string.IsNullOrEmpty(Help.Message))
|
if (Help != null && !string.IsNullOrEmpty(Help.Message))
|
||||||
{
|
{
|
||||||
return Help.Message;
|
return Help.Message;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return HelpMessage;
|
return HelpMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("environment")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the Environment
|
||||||
/// Gets or sets the Environment
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("environment")]
|
||||||
public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
|
public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
|
||||||
|
|
||||||
[JsonProperty("logo")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the LogoLight
|
||||||
/// Gets or sets the LogoLight
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("logo")]
|
||||||
public EssentialsLogoPropertiesConfig LogoLight { get; set; }
|
public EssentialsLogoPropertiesConfig LogoLight { get; set; }
|
||||||
|
|
||||||
[JsonProperty("logoDark")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LogoDark
|
/// Gets or sets the LogoDark
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("logoDark")]
|
||||||
public EssentialsLogoPropertiesConfig LogoDark { get; set; }
|
public EssentialsLogoPropertiesConfig LogoDark { get; set; }
|
||||||
|
|
||||||
[JsonProperty("microphonePrivacy")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the MicrophonePrivacy
|
|
||||||
/// </summary>
|
|
||||||
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("occupancy")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the MicrophonePrivacy
|
||||||
/// Gets or sets the Occupancy
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("microphonePrivacy")]
|
||||||
public EssentialsRoomOccSensorConfig Occupancy { get; set; }
|
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
|
||||||
|
|
||||||
[JsonProperty("oneButtonMeeting")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the Occupancy
|
||||||
/// Gets or sets the OneButtonMeeting
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("occupancy")]
|
||||||
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
|
public EssentialsRoomOccSensorConfig Occupancy { get; set; }
|
||||||
|
|
||||||
[JsonProperty("shutdownVacancySeconds")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the OneButtonMeeting
|
||||||
/// Gets or sets the ShutdownVacancySeconds
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("oneButtonMeeting")]
|
||||||
public int ShutdownVacancySeconds { get; set; }
|
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
|
||||||
|
|
||||||
[JsonProperty("shutdownPromptSeconds")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the ShutdownVacancySeconds
|
||||||
/// Gets or sets the ShutdownPromptSeconds
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("shutdownVacancySeconds")]
|
||||||
public int ShutdownPromptSeconds { get; set; }
|
public int ShutdownVacancySeconds { get; set; }
|
||||||
|
|
||||||
[JsonProperty("tech")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the ShutdownPromptSeconds
|
||||||
/// Gets or sets the Tech
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("shutdownPromptSeconds")]
|
||||||
public EssentialsRoomTechConfig Tech { get; set; }
|
public int ShutdownPromptSeconds { get; set; }
|
||||||
|
|
||||||
[JsonProperty("volumes")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the Tech
|
||||||
/// Gets or sets the Volumes
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("tech")]
|
||||||
public EssentialsRoomVolumesConfig Volumes { get; set; }
|
public EssentialsRoomTechConfig Tech { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Volumes
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("volumes")]
|
||||||
|
public EssentialsRoomVolumesConfig Volumes { get; set; }
|
||||||
|
|
||||||
[JsonProperty("fusion")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Fusion
|
/// Gets or sets the Fusion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("fusion")]
|
||||||
public EssentialsRoomFusionConfig Fusion { get; set; }
|
public EssentialsRoomFusionConfig Fusion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling=NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UiBehavior
|
/// Gets or sets the UiBehavior
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
|
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
|
||||||
|
|
||||||
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
|
/// <summary>
|
||||||
/// <summary>
|
/// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices
|
||||||
/// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices
|
/// </summary>
|
||||||
/// </summary>
|
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
|
||||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
|
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if this room represents a combination of other rooms
|
/// Indicates if this room represents a combination of other rooms
|
||||||
@@ -236,7 +236,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
LogoLight = new EssentialsLogoPropertiesConfig();
|
LogoLight = new EssentialsLogoPropertiesConfig();
|
||||||
LogoDark = new EssentialsLogoPropertiesConfig();
|
LogoDark = new EssentialsLogoPropertiesConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EssentialsRoomUiBehaviorConfig
|
/// Represents a EssentialsRoomUiBehaviorConfig
|
||||||
@@ -327,15 +327,15 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EssentialsEnvironmentPropertiesConfig
|
/// Represents a EssentialsEnvironmentPropertiesConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsEnvironmentPropertiesConfig
|
public class EssentialsEnvironmentPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Enabled
|
/// Gets or sets the Enabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
[JsonProperty("deviceKeys")]
|
[JsonProperty("deviceKeys")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -348,7 +348,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
DeviceKeys = new List<string>();
|
DeviceKeys = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a EssentialsRoomFusionConfig
|
/// Represents a EssentialsRoomFusionConfig
|
||||||
@@ -359,7 +359,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Convert.ToUInt32(IpId, 16);
|
return Convert.ToUInt32(IpId, 16);
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
{
|
{
|
||||||
throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId));
|
throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,17 +390,17 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsRoomMicrophonePrivacyConfig
|
public class EssentialsRoomMicrophonePrivacyConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceKey
|
/// Gets or sets the DeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("behaviour")]
|
[JsonProperty("behaviour")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Behaviour
|
/// Gets or sets the Behaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Behaviour { get; set; }
|
public string Behaviour { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -408,23 +408,23 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsHelpPropertiesConfig
|
public class EssentialsHelpPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("message")]
|
[JsonProperty("message")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Message
|
/// Gets or sets the Message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
[JsonProperty("showCallButton")]
|
[JsonProperty("showCallButton")]
|
||||||
public bool ShowCallButton { get; set; }
|
public bool ShowCallButton { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to "Call Help Desk"
|
/// Defaults to "Call Help Desk"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("callButtonText")]
|
[JsonProperty("callButtonText")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CallButtonText
|
/// Gets or sets the CallButtonText
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CallButtonText { get; set; }
|
public string CallButtonText { get; set; }
|
||||||
|
|
||||||
public EssentialsHelpPropertiesConfig()
|
public EssentialsHelpPropertiesConfig()
|
||||||
{
|
{
|
||||||
@@ -437,23 +437,23 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsOneButtonMeetingPropertiesConfig
|
public class EssentialsOneButtonMeetingPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("enable")]
|
[JsonProperty("enable")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Enable
|
/// Gets or sets the Enable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enable { get; set; }
|
public bool Enable { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialsRoomAddressPropertiesConfig
|
public class EssentialsRoomAddressPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("phoneNumber")]
|
[JsonProperty("phoneNumber")]
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; set; }
|
||||||
|
|
||||||
[JsonProperty("sipAddress")]
|
[JsonProperty("sipAddress")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SipAddress
|
/// Gets or sets the SipAddress
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SipAddress { get; set; }
|
public string SipAddress { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -462,14 +462,14 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsLogoPropertiesConfig
|
public class EssentialsLogoPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetLogoUrlLight method
|
/// GetLogoUrlLight method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -478,7 +478,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
if (Type == "url")
|
if (Type == "url")
|
||||||
return Url;
|
return Url;
|
||||||
if (Type == "system")
|
if (Type == "system")
|
||||||
return string.Format("http://{0}:8080/logo.png",
|
return string.Format("http://{0}:8080/logo.png",
|
||||||
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
|
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -502,22 +502,22 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EssentialsRoomOccSensorConfig
|
public class EssentialsRoomOccSensorConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceKey
|
/// Gets or sets the DeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeoutMinutes")]
|
[JsonProperty("timeoutMinutes")]
|
||||||
public int TimeoutMinutes { get; set; }
|
public int TimeoutMinutes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialsRoomTechConfig
|
public class EssentialsRoomTechConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("password")]
|
[JsonProperty("password")]
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Password
|
/// Gets or sets the Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Routing
|
namespace PepperDash.Essentials.Core.Routing
|
||||||
{
|
{
|
||||||
@@ -25,5 +25,19 @@ namespace PepperDash.Essentials.Core.Routing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; }
|
Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event raised when the current sources change.
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler CurrentSourcesChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the current source for a specific signal type.
|
||||||
|
/// This method updates the current source for the specified signal type and notifies any subscribers of the change.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="signalType">The signal type to update.</param>
|
||||||
|
/// <param name="sourceListKey">The key for the source list.</param>
|
||||||
|
/// <param name="sourceListItem">The source list item to set as the current source.</param>
|
||||||
|
void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,38 +22,38 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// The key of the source device.
|
/// The key of the source device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SourceKey { get; set; }
|
public string SourceKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key of the source card (if applicable, e.g., in a modular chassis).
|
/// The key of the source card (if applicable, e.g., in a modular chassis).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SourceCard { get; set; }
|
public string SourceCard { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key of the source output port, used for routing configurations.
|
/// The key of the source output port, used for routing configurations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SourcePort { get; set; }
|
public string SourcePort { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DestinationKey
|
/// Gets or sets the DestinationKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DestinationKey { get; set; }
|
public string DestinationKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DestinationCard
|
/// Gets or sets the DestinationCard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DestinationCard { get; set; }
|
public string DestinationCard { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DestinationPort
|
/// Gets or sets the DestinationPort
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DestinationPort { get; set; }
|
public string DestinationPort { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional override for the signal type of the tie line. If set, this overrides the destination port's type for routing calculations.
|
/// Optional override for the signal type of the tie line. If set, this overrides the destination port's type for routing calculations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public eRoutingSignalType? OverrideType { get; set; }
|
public eRoutingSignalType? OverrideType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the appropriate tie line for either a card-based device or
|
/// Returns the appropriate tie line for either a card-based device or
|
||||||
@@ -62,40 +62,39 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// <returns>null if config data does not match ports, cards or devices</returns>
|
/// <returns>null if config data does not match ports, cards or devices</returns>
|
||||||
public TieLine GetTieLine()
|
public TieLine GetTieLine()
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Build TieLine: {0}",null, this);
|
Debug.LogInformation("Build TieLine: {config}", ToString());
|
||||||
|
|
||||||
// Get the source device
|
// Get the source device
|
||||||
var sourceDev = DeviceManager.GetDeviceForKey(SourceKey) as IRoutingOutputs;
|
if (!(DeviceManager.GetDeviceForKey(SourceKey) is IRoutingOutputs sourceDev))
|
||||||
if (sourceDev == null)
|
|
||||||
{
|
{
|
||||||
LogError("Routable source not found");
|
LogError("Routable source not found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the destination device
|
// Get the destination device
|
||||||
var destDev = DeviceManager.GetDeviceForKey(DestinationKey) as IRoutingInputs;
|
if (!(DeviceManager.GetDeviceForKey(DestinationKey) is IRoutingInputs destDev))
|
||||||
if (destDev == null)
|
|
||||||
{
|
{
|
||||||
LogError("Routable destination not found");
|
LogError("Routable destination not found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the source port
|
//Get the source port
|
||||||
var sourceOutputPort = sourceDev.OutputPorts[SourcePort];
|
var sourceOutputPort = sourceDev.OutputPorts[SourcePort];
|
||||||
|
|
||||||
if (sourceOutputPort == null)
|
if (sourceOutputPort == null)
|
||||||
{
|
{
|
||||||
LogError("Source does not contain port");
|
LogError("Source does not contain port");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the Destination port
|
//Get the Destination port
|
||||||
var destinationInputPort = destDev.InputPorts[DestinationPort];
|
var destinationInputPort = destDev.InputPorts[DestinationPort];
|
||||||
|
|
||||||
if (destinationInputPort == null)
|
if (destinationInputPort == null)
|
||||||
{
|
{
|
||||||
LogError("Destination does not contain port");
|
LogError("Destination does not contain port");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TieLine(sourceOutputPort, destinationInputPort, OverrideType);
|
return new TieLine(sourceOutputPort, destinationInputPort, OverrideType);
|
||||||
}
|
}
|
||||||
@@ -104,9 +103,9 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// Logs an error message related to creating this tie line configuration.
|
/// Logs an error message related to creating this tie line configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg">The specific error message.</param>
|
/// <param name="msg">The specific error message.</param>
|
||||||
void LogError(string msg)
|
private void LogError(string msg)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Error, "WARNING: Cannot create tie line: {message}:\r {tieLineConfig}",null, msg, this);
|
Debug.LogError("Cannot create tie line: {message}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -115,8 +114,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
/// <returns>A string describing the source and destination of the configured tie line.</returns>
|
/// <returns>A string describing the source and destination of the configured tie line.</returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("{0}.{1}.{2} --> {3}.{4}.{5}", SourceKey, SourceCard, SourcePort,
|
return $"{SourceKey}.{SourceCard}.{SourcePort} --> {DestinationKey}.{DestinationCard}.{DestinationPort}";
|
||||||
DestinationKey, DestinationCard, DestinationPort);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,14 +14,14 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
////*****************************************************************************
|
////*****************************************************************************
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Base class for all subpage reference list controllers
|
///// Base class for all subpage reference list controllers
|
||||||
/// </summary>
|
///// </summary>
|
||||||
//public class SubpageReferenceListController
|
//public class SubpageReferenceListController
|
||||||
//{
|
//{
|
||||||
// public SubpageReferenceList TheList { get; protected set; }
|
// public SubpageReferenceList TheList { get; protected set; }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,26 +34,26 @@ namespace PepperDash.Essentials.Core
|
|||||||
public ushort Count
|
public ushort Count
|
||||||
{
|
{
|
||||||
get { return SetNumberOfItemsSig.UShortValue; }
|
get { return SetNumberOfItemsSig.UShortValue; }
|
||||||
set { SetNumberOfItemsSig.UShortValue = value; }
|
set { SetNumberOfItemsSig.UShortValue = value; }
|
||||||
}
|
}
|
||||||
public ushort MaxDefinedItems { get; private set; }
|
public ushort MaxDefinedItems { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ScrollToItemSig
|
/// Gets or sets the ScrollToItemSig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UShortInputSig ScrollToItemSig { get; private set; }
|
public UShortInputSig ScrollToItemSig { get; private set; }
|
||||||
UShortInputSig SetNumberOfItemsSig;
|
UShortInputSig SetNumberOfItemsSig;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BoolIncrement
|
/// Gets or sets the BoolIncrement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint BoolIncrement { get; protected set; }
|
public uint BoolIncrement { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UShortIncrement
|
/// Gets or sets the UShortIncrement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint UShortIncrement { get; protected set; }
|
public uint UShortIncrement { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the StringIncrement
|
/// Gets or sets the StringIncrement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint StringIncrement { get; protected set; }
|
public uint StringIncrement { get; protected set; }
|
||||||
|
|
||||||
protected readonly SmartObject SRL;
|
protected readonly SmartObject SRL;
|
||||||
@@ -87,8 +87,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange);
|
SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
|
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
|
||||||
triList.ID, smartObjectId);
|
triList.ID, smartObjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -96,17 +96,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// DOES NOT adjust Count
|
/// DOES NOT adjust Count
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AddItem method
|
/// AddItem method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddItem(SubpageReferenceListItem item)
|
public void AddItem(SubpageReferenceListItem item)
|
||||||
{
|
{
|
||||||
Items.Add(item);
|
Items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clear method
|
/// Clear method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
// If a line item needs to disconnect an CueActionPair or do something to release RAM
|
// If a line item needs to disconnect an CueActionPair or do something to release RAM
|
||||||
@@ -116,12 +116,12 @@ namespace PepperDash.Essentials.Core
|
|||||||
// Clean up the SRL
|
// Clean up the SRL
|
||||||
Count = 1;
|
Count = 1;
|
||||||
|
|
||||||
ScrollToItemSig.UShortValue = 1;
|
ScrollToItemSig.UShortValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refresh method
|
/// Refresh method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
foreach (var item in Items) item.Refresh();
|
foreach (var item in Items) item.Refresh();
|
||||||
@@ -157,7 +157,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum)
|
public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum)
|
||||||
{
|
{
|
||||||
if (sigNum > UShortIncrement) return null;
|
if (sigNum > UShortIncrement) return null;
|
||||||
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
|
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -172,7 +172,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
public StringOutputSig GetStringOutputSig(uint index, uint sigNum)
|
public StringOutputSig GetStringOutputSig(uint index, uint sigNum)
|
||||||
{
|
{
|
||||||
if (sigNum > StringIncrement) return null;
|
if (sigNum > StringIncrement) return null;
|
||||||
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
|
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -263,9 +263,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentDevice"></param>
|
/// <param name="currentDevice"></param>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SRL_SigChange method
|
/// SRL_SigChange method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
|
public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
|
||||||
{
|
{
|
||||||
var uo = args.Sig.UserObject;
|
var uo = args.Sig.UserObject;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ModalDialog
|
/// Represents a ModalDialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ModalDialog
|
public class ModalDialog
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -19,10 +19,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// Bool press 3992
|
/// Bool press 3992
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint Button2Join = 3992;
|
public const uint Button2Join = 3992;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 3993
|
/// 3993
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint CancelButtonJoin = 3993;
|
public const uint CancelButtonJoin = 3993;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///For visibility of single button. Bool feedback 3994
|
///For visibility of single button. Bool feedback 3994
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -35,19 +35,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// Shows the timer guage if in use. Bool feedback 3996
|
/// Shows the timer guage if in use. Bool feedback 3996
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint TimerVisibleJoin = 3996;
|
public const uint TimerVisibleJoin = 3996;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visibility join to show "X" button 3997
|
/// Visibility join to show "X" button 3997
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint CancelVisibleJoin = 3997;
|
public const uint CancelVisibleJoin = 3997;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the modal subpage. Boolean feeback join 3999
|
/// Shows the modal subpage. Boolean feeback join 3999
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const uint ModalVisibleJoin = 3999;
|
public const uint ModalVisibleJoin = 3999;
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// The seconds value of the countdown timer. Ushort join 3991
|
///// The seconds value of the countdown timer. Ushort join 3991
|
||||||
/// </summary>
|
///// </summary>
|
||||||
//public const uint TimerSecondsJoin = 3991;
|
//public const uint TimerSecondsJoin = 3991;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992
|
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -77,15 +77,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true when modal is showing
|
/// Returns true when modal is showing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ModalIsVisible
|
public bool ModalIsVisible
|
||||||
{
|
{
|
||||||
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
|
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanCancel { get; private set; }
|
public bool CanCancel { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
BasicTriList TriList;
|
BasicTriList TriList;
|
||||||
@@ -103,10 +103,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
TriList = triList;
|
TriList = triList;
|
||||||
// Attach actions to buttons
|
// Attach actions to buttons
|
||||||
|
|
||||||
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
|
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
|
||||||
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
|
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
|
||||||
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
|
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
|
||||||
CanCancel = true;
|
CanCancel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,7 +117,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="decreasingGauge">If the progress bar gauge needs to count down instead of up</param>
|
/// <param name="decreasingGauge">If the progress bar gauge needs to count down instead of up</param>
|
||||||
/// <param name="completeAction">The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out</param>
|
/// <param name="completeAction">The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out</param>
|
||||||
/// <returns>True when modal is created.</returns>
|
/// <returns>True when modal is created.</returns>
|
||||||
public bool PresentModalDialog(uint numberOfButtons, string title, string iconName,
|
public bool PresentModalDialog(uint numberOfButtons, string title, string iconName,
|
||||||
string message, string button1Text,
|
string message, string button1Text,
|
||||||
string button2Text, bool showGauge, bool showCancel, Action<uint> completeAction)
|
string button2Text, bool showGauge, bool showCancel, Action<uint> completeAction)
|
||||||
{
|
{
|
||||||
@@ -151,15 +151,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
TriList.StringInput[Button2TextJoin].StringValue = button2Text;
|
TriList.StringInput[Button2TextJoin].StringValue = button2Text;
|
||||||
}
|
}
|
||||||
// Show/hide guage
|
// Show/hide guage
|
||||||
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
|
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
|
||||||
|
|
||||||
CanCancel = showCancel;
|
CanCancel = showCancel;
|
||||||
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
|
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
|
||||||
|
|
||||||
//Reveal and activate
|
//Reveal and activate
|
||||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
|
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
|
||||||
|
|
||||||
WakePanel();
|
WakePanel();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -167,48 +167,48 @@ namespace PepperDash.Essentials.Core
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WakePanel method
|
/// WakePanel method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void WakePanel()
|
public void WakePanel()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var panel = TriList as TswFt5Button;
|
|
||||||
|
|
||||||
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
|
|
||||||
panel.ExtenderSystemReservedSigs.BacklightOn();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CancelDialog method
|
|
||||||
/// </summary>
|
|
||||||
public void CancelDialog()
|
|
||||||
{
|
{
|
||||||
OnModalComplete(0);
|
try
|
||||||
|
{
|
||||||
|
var panel = TriList as TswFt5Button;
|
||||||
|
|
||||||
|
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
|
||||||
|
panel.ExtenderSystemReservedSigs.BacklightOn();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hides dialog. Fires no action
|
/// CancelDialog method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void HideDialog()
|
public void CancelDialog()
|
||||||
{
|
{
|
||||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
OnModalComplete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hides dialog. Fires no action
|
||||||
|
/// </summary>
|
||||||
|
public void HideDialog()
|
||||||
|
{
|
||||||
|
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
// When the modal is cleared or times out, clean up the various bits
|
// When the modal is cleared or times out, clean up the various bits
|
||||||
void OnModalComplete(uint buttonNum)
|
void OnModalComplete(uint buttonNum)
|
||||||
{
|
{
|
||||||
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
|
||||||
|
|
||||||
var action = ModalCompleteAction;
|
var action = ModalCompleteAction;
|
||||||
if (action != null)
|
if (action != null)
|
||||||
action(buttonNum);
|
action(buttonNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
@@ -52,9 +53,9 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentSourceInfoKey
|
/// Gets or sets the CurrentSourceInfoKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CurrentSourceInfoKey { get; set; }
|
public string CurrentSourceInfoKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -89,29 +90,32 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; private set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public event EventHandler CurrentSourcesChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets feedback indicating whether the display is currently cooling down after being powered off.
|
/// Gets feedback indicating whether the display is currently cooling down after being powered off.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsWarmingUpFeedback
|
/// Gets or sets the IsWarmingUpFeedback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UsageTracker
|
/// Gets or sets the UsageTracker
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UsageTracking UsageTracker { get; set; }
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the WarmupTime
|
/// Gets or sets the WarmupTime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint WarmupTime { get; set; }
|
public uint WarmupTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CooldownTime
|
/// Gets or sets the CooldownTime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CooldownTime { get; set; }
|
public uint CooldownTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -189,7 +193,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the collection of feedback objects for this display device.
|
/// Gets the collection of feedback objects for this display device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual FeedbackCollection<Feedback> Feedbacks
|
public virtual FeedbackCollection<Feedback> Feedbacks
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -378,6 +382,53 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual void SetCurrentSource(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||||
|
{
|
||||||
|
foreach (eRoutingSignalType type in Enum.GetValues(typeof(eRoutingSignalType)))
|
||||||
|
{
|
||||||
|
var flagValue = Convert.ToInt32(type);
|
||||||
|
// Skip if flagValue is 0 or not a power of two (i.e., not a single-bit flag).
|
||||||
|
// (flagValue & (flagValue - 1)) != 0 checks if more than one bit is set.
|
||||||
|
if (flagValue == 0 || (flagValue & (flagValue - 1)) != 0)
|
||||||
|
{
|
||||||
|
this.LogDebug("Skipping {type}", type);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.LogDebug("setting {type}", type);
|
||||||
|
|
||||||
|
if (signalType.HasFlag(type))
|
||||||
|
{
|
||||||
|
UpdateCurrentSources(type, sourceListKey, sourceListItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Raise the CurrentSourcesChanged event
|
||||||
|
CurrentSourcesChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateCurrentSources(eRoutingSignalType signalType, string sourceListKey, SourceListItem sourceListItem)
|
||||||
|
{
|
||||||
|
if (CurrentSources.ContainsKey(signalType))
|
||||||
|
{
|
||||||
|
CurrentSources[signalType] = sourceListItem;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentSources.Add(signalType, sourceListItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the current source key for the specified signal type
|
||||||
|
if (CurrentSourceKeys.ContainsKey(signalType))
|
||||||
|
{
|
||||||
|
CurrentSourceKeys[signalType] = sourceListKey;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentSourceKeys.Add(signalType, sourceListKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />
|
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -29,12 +29,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
codec.CallStatusChange += Codec_CallStatusChange;
|
codec.CallStatusChange += Codec_CallStatusChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
|
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject());
|
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject(id));
|
||||||
|
|
||||||
|
AddAction("/audioDialerStatus", (id, content) => SendAtcFullMessageObject(id));
|
||||||
|
|
||||||
AddAction("/dial", (id, content) =>
|
AddAction("/dial", (id, content) =>
|
||||||
{
|
{
|
||||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||||
@@ -97,7 +101,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// Helper method to build call status for vtc
|
/// Helper method to build call status for vtc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private void SendAtcFullMessageObject()
|
private void SendAtcFullMessageObject(string id = null)
|
||||||
{
|
{
|
||||||
var info = Codec.CodecInfo;
|
var info = Codec.CodecInfo;
|
||||||
|
|
||||||
@@ -109,7 +113,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
phoneNumber = info.PhoneNumber
|
phoneNumber = info.PhoneNumber
|
||||||
}
|
}
|
||||||
})
|
}), id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject());
|
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject(id));
|
||||||
|
|
||||||
|
AddAction("/cameraStatus", (id, content) => SendCameraFullMessageObject(id));
|
||||||
|
|
||||||
|
|
||||||
if (Camera is IHasCameraPtzControl ptzCamera)
|
if (Camera is IHasCameraPtzControl ptzCamera)
|
||||||
@@ -140,17 +142,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
if (Camera is IHasCameraPresets presetsCamera)
|
if (Camera is IHasCameraPresets presetsCamera)
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= 6; i++)
|
AddAction("/recallPreset", (id, content) =>
|
||||||
{
|
{
|
||||||
var preset = i;
|
var msg = content.ToObject<MobileControlSimpleContent<int>>();
|
||||||
AddAction("/cameraPreset" + i, (id, content) =>
|
|
||||||
{
|
|
||||||
var msg = content.ToObject<MobileControlSimpleContent<int>>();
|
|
||||||
|
|
||||||
presetsCamera.PresetSelect(msg.Value);
|
presetsCamera.PresetSelect(msg.Value);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
AddAction("/storePreset", (id, content) =>
|
||||||
|
{
|
||||||
|
var msg = content.ToObject<MobileControlSimpleContent<int>>();
|
||||||
|
|
||||||
|
presetsCamera.PresetStore(msg.Value, string.Empty);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,15 +168,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
timerHandler(state.Value, cameraAction);
|
timerHandler(Camera.Key, cameraAction);
|
||||||
|
|
||||||
cameraAction(state.Value.Equals("true", StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to update the full status of the camera
|
/// Helper method to update the full status of the camera
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendCameraFullMessageObject()
|
private void SendCameraFullMessageObject(string id = null)
|
||||||
{
|
{
|
||||||
var presetList = new List<CameraPreset>();
|
var presetList = new List<CameraPreset>();
|
||||||
|
|
||||||
@@ -187,7 +190,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
cameraMode = GetCameraMode(),
|
cameraMode = GetCameraMode(),
|
||||||
hasPresets = Camera is IHasCameraPresets,
|
hasPresets = Camera is IHasCameraPresets,
|
||||||
presets = presetList
|
presets = presetList
|
||||||
})
|
}), id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IHasCurrentSourceInfoMessenger
|
||||||
|
/// </summary>
|
||||||
|
public class CurrentSourcesMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
private readonly ICurrentSources sourceDevice;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="CurrentSourcesMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="messagePath">The message path.</param>
|
||||||
|
/// <param name="device">The device.</param>
|
||||||
|
public CurrentSourcesMessenger(string key, string messagePath, ICurrentSources device) : base(key, messagePath, device as IKeyName)
|
||||||
|
{
|
||||||
|
sourceDevice = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers the actions for the messenger.
|
||||||
|
/// </summary>
|
||||||
|
protected override void RegisterActions()
|
||||||
|
{
|
||||||
|
base.RegisterActions();
|
||||||
|
|
||||||
|
AddAction("/fullStatus", (id, content) => SendCurrentSourceStatus(id));
|
||||||
|
|
||||||
|
AddAction("/currentSourceStatus", (id, content) => SendCurrentSourceStatus(id));
|
||||||
|
|
||||||
|
sourceDevice.CurrentSourcesChanged += (sender, e) =>
|
||||||
|
{
|
||||||
|
PostStatusMessage(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
currentSourceKeys = sourceDevice.CurrentSourceKeys,
|
||||||
|
currentSources = sourceDevice.CurrentSources
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendCurrentSourceStatus(string id = null)
|
||||||
|
{
|
||||||
|
var message = new CurrentSourcesStateMessage
|
||||||
|
{
|
||||||
|
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
|
||||||
|
CurrentSources = sourceDevice.CurrentSources
|
||||||
|
};
|
||||||
|
|
||||||
|
PostStatusMessage(message, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a CurrentSourcesStateMessage
|
||||||
|
/// </summary>
|
||||||
|
public class CurrentSourcesStateMessage : DeviceStateMessageBase
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CurrentSourceKey
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("currentSourceKeys", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public Dictionary<eRoutingSignalType, string> CurrentSourceKeys { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CurrentSource
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("currentSources")]
|
||||||
|
public Dictionary<eRoutingSignalType, SourceListItem> CurrentSources { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Timers;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceInfo;
|
using PepperDash.Essentials.Core.DeviceInfo;
|
||||||
using System.Timers;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -67,13 +67,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
debounceTimer.Start();
|
debounceTimer.Start();
|
||||||
};
|
};
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, context) => PostStatusMessage(new DeviceInfoStateMessage
|
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||||
{
|
|
||||||
DeviceInfo = _deviceInfoProvider.DeviceInfo
|
AddAction("/deviceInfo", (id, content) => SendFullStatus(id));
|
||||||
}));
|
|
||||||
|
|
||||||
AddAction("/update", (id, context) => _deviceInfoProvider.UpdateDeviceInfo());
|
AddAction("/update", (id, context) => _deviceInfoProvider.UpdateDeviceInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new DeviceInfoStateMessage
|
||||||
|
{
|
||||||
|
DeviceInfo = _deviceInfoProvider.DeviceInfo
|
||||||
|
}, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using PepperDash.Essentials.Core.Presets;
|
using PepperDash.Essentials.Core.Presets;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -16,18 +16,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
private readonly ITvPresetsProvider _presetsDevice;
|
private readonly ITvPresetsProvider _presetsDevice;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for DevicePresetsModelMessenger
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="messagePath">The message path.</param>
|
||||||
|
/// <param name="presetsDevice">The presets device.</param>
|
||||||
public DevicePresetsModelMessenger(string key, string messagePath, ITvPresetsProvider presetsDevice)
|
public DevicePresetsModelMessenger(string key, string messagePath, ITvPresetsProvider presetsDevice)
|
||||||
: base(key, messagePath, presetsDevice as Device)
|
: base(key, messagePath, presetsDevice as Device)
|
||||||
{
|
{
|
||||||
_presetsDevice = presetsDevice;
|
_presetsDevice = presetsDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendPresets()
|
private void SendPresets(string id = null)
|
||||||
{
|
{
|
||||||
PostStatusMessage(new PresetStateMessage
|
PostStatusMessage(new PresetStateMessage
|
||||||
{
|
{
|
||||||
Favorites = _presetsDevice.TvPresets.PresetsList
|
Favorites = _presetsDevice.TvPresets.PresetsList
|
||||||
});
|
}, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RecallPreset(ISetTopBoxNumericKeypad device, string channel)
|
private void RecallPreset(ISetTopBoxNumericKeypad device, string channel)
|
||||||
@@ -43,6 +49,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
#region Overrides of MessengerBase
|
#region Overrides of MessengerBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -51,7 +58,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
this.LogInformation("getting full status for client {id}", id);
|
this.LogInformation("getting full status for client {id}", id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SendPresets();
|
SendPresets(id);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -59,6 +66,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddAction("/presetsStatus", (id, content) => SendPresets(id));
|
||||||
|
|
||||||
AddAction("/recall", (id, content) =>
|
AddAction("/recall", (id, content) =>
|
||||||
{
|
{
|
||||||
var p = content.ToObject<PresetChannelMessage>();
|
var p = content.ToObject<PresetChannelMessage>();
|
||||||
@@ -91,16 +100,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PresetChannelMessage
|
public class PresetChannelMessage
|
||||||
{
|
{
|
||||||
[JsonProperty("preset")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Preset
|
/// Gets or sets the Preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("preset")]
|
||||||
public PresetChannel Preset;
|
public PresetChannel Preset;
|
||||||
|
|
||||||
[JsonProperty("deviceKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceKey
|
/// Gets or sets the DeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("deviceKey")]
|
||||||
public string DeviceKey;
|
public string DeviceKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,10 +118,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PresetStateMessage : DeviceStateMessageBase
|
public class PresetStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Favorites
|
/// Gets or sets the Favorites
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<PresetChannel> Favorites { get; set; } = new List<PresetChannel>();
|
public List<PresetChannel> Favorites { get; set; } = new List<PresetChannel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -14,13 +14,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
private readonly IBasicVolumeWithFeedback _localDevice;
|
private readonly IBasicVolumeWithFeedback _localDevice;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DeviceVolumeMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="messagePath">The message path.</param>
|
||||||
|
/// <param name="device">The device.</param>
|
||||||
public DeviceVolumeMessenger(string key, string messagePath, IBasicVolumeWithFeedback device)
|
public DeviceVolumeMessenger(string key, string messagePath, IBasicVolumeWithFeedback device)
|
||||||
: base(key, messagePath, device as IKeyName)
|
: base(key, messagePath, device as IKeyName)
|
||||||
{
|
{
|
||||||
_localDevice = device;
|
_localDevice = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendStatus()
|
private void SendStatus(string id = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -40,7 +46,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
messageObj.Volume.Units = volumeAdvanced.Units;
|
messageObj.Volume.Units = volumeAdvanced.Units;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostStatusMessage(messageObj);
|
PostStatusMessage(messageObj, id);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -50,10 +56,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
#region Overrides of MessengerBase
|
#region Overrides of MessengerBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/fullStatus", (id, content) => SendStatus());
|
AddAction("/fullStatus", (id, content) => SendStatus(id));
|
||||||
|
|
||||||
|
AddAction("/volumeStatus", (id, content) => SendStatus(id));
|
||||||
|
|
||||||
AddAction("/level", (id, content) =>
|
AddAction("/level", (id, content) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,22 +7,29 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenericMessenger : MessengerBase
|
public class GenericMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="GenericMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="device">The device.</param>
|
||||||
|
/// <param name="messagePath">The message path.</param>
|
||||||
public GenericMessenger(string key, EssentialsDevice device, string messagePath) : base(key, messagePath, device)
|
public GenericMessenger(string key, EssentialsDevice device, string messagePath) : base(key, messagePath, device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new DeviceStateMessageBase();
|
var state = new DeviceStateMessageBase();
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IBasicVideoMuteWithFeedbackMessenger
|
||||||
|
/// </summary>
|
||||||
|
public class IBasicVideoMuteWithFeedbackMessenger : MessengerBase
|
||||||
|
{
|
||||||
|
private readonly IBasicVideoMuteWithFeedback device;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="IBasicVideoMuteWithFeedbackMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
/// <param name="device"></param>
|
||||||
|
public IBasicVideoMuteWithFeedbackMessenger(string key, string messagePath, IBasicVideoMuteWithFeedback device)
|
||||||
|
: base(key, messagePath, device as IKeyName)
|
||||||
|
{
|
||||||
|
this.device = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendFullStatus method
|
||||||
|
/// </summary>
|
||||||
|
public void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
var messageObj = new IBasicVideoMuteWithFeedbackMessage
|
||||||
|
{
|
||||||
|
VideoMuteState = device.VideoMuteIsOn.BoolValue
|
||||||
|
};
|
||||||
|
|
||||||
|
PostStatusMessage(messageObj, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void RegisterActions()
|
||||||
|
{
|
||||||
|
base.RegisterActions();
|
||||||
|
|
||||||
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/videoMuteStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/videoMuteToggle", (id, content) =>
|
||||||
|
{
|
||||||
|
device.VideoMuteToggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAction("/videoMuteOn", (id, content) =>
|
||||||
|
{
|
||||||
|
device.VideoMuteOn();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAction("/videoMuteOff", (id, content) =>
|
||||||
|
{
|
||||||
|
device.VideoMuteOff();
|
||||||
|
});
|
||||||
|
|
||||||
|
device.VideoMuteIsOn.OutputChange += VideoMuteIsOnFeedback_OutputChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VideoMuteIsOnFeedback_OutputChange(object sender, FeedbackEventArgs args)
|
||||||
|
{
|
||||||
|
PostStatusMessage(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
videoMuteState = args.BoolValue
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a IBasicVideoMuteWithFeedbackMessage
|
||||||
|
/// </summary>
|
||||||
|
public class IBasicVideoMuteWithFeedbackMessage : DeviceStateMessageBase
|
||||||
|
{
|
||||||
|
[JsonProperty("videoMuteState")]
|
||||||
|
public bool VideoMuteState { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,14 +24,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
AddAction("/fullStatus", (id, content) =>
|
AddAction("/fullStatus", (id, content) =>
|
||||||
{
|
{
|
||||||
PostStatusMessage(new CommunicationMonitorState
|
SendFullStatus(id);
|
||||||
{
|
});
|
||||||
CommunicationMonitor = new CommunicationMonitorProps
|
|
||||||
{
|
AddAction("/commStatus", (id, content) =>
|
||||||
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
|
{
|
||||||
Status = _communicationMonitor.CommunicationMonitor.Status
|
SendFullStatus(id);
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_communicationMonitor.CommunicationMonitor.StatusChange += (sender, args) =>
|
_communicationMonitor.CommunicationMonitor.StatusChange += (sender, args) =>
|
||||||
@@ -46,6 +44,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new CommunicationMonitorState
|
||||||
|
{
|
||||||
|
CommunicationMonitor = new CommunicationMonitorProps
|
||||||
|
{
|
||||||
|
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
|
||||||
|
Status = _communicationMonitor.CommunicationMonitor.Status
|
||||||
|
},
|
||||||
|
}, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -22,15 +22,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) =>
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
{
|
|
||||||
var message = new IHasDspPresetsStateMessage
|
|
||||||
{
|
|
||||||
Presets = device.Presets
|
|
||||||
};
|
|
||||||
|
|
||||||
PostStatusMessage(message);
|
AddAction("/dspPresetStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
AddAction("/recallPreset", (id, content) =>
|
AddAction("/recallPreset", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -43,6 +37,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
var message = new IHasDspPresetsStateMessage
|
||||||
|
{
|
||||||
|
Presets = device.Presets
|
||||||
|
};
|
||||||
|
|
||||||
|
PostStatusMessage(message, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// partition states.</remarks>
|
/// partition states.</remarks>
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/combinerStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/setAutoMode", (id, content) =>
|
AddAction("/setAutoMode", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -120,7 +122,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -141,7 +143,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
Partitions = _roomCombiner.Partitions
|
Partitions = _roomCombiner.Partitions
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(message);
|
PostStatusMessage(message, id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <param name="cameraController"></param>
|
/// <param name="cameraController"></param>
|
||||||
/// <param name="messagePath"></param>
|
/// <param name="messagePath"></param>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
public IHasCamerasMessenger(string key, string messagePath , IHasCameras cameraController)
|
public IHasCamerasMessenger(string key, string messagePath, IHasCameras cameraController)
|
||||||
: base(key, messagePath, cameraController)
|
: base(key, messagePath, cameraController)
|
||||||
{
|
{
|
||||||
CameraController = cameraController ?? throw new ArgumentNullException("cameraController");
|
CameraController = cameraController ?? throw new ArgumentNullException("cameraController");
|
||||||
@@ -49,10 +49,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, context) =>
|
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||||
{
|
|
||||||
SendFullStatus(id);
|
AddAction("/cameraListStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
AddAction("/selectCamera", (id, content) =>
|
AddAction("/selectCamera", (id, content) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
public class IHasCurrentSourceInfoMessenger : MessengerBase
|
public class IHasCurrentSourceInfoMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
private readonly IHasCurrentSourceInfoChange sourceDevice;
|
private readonly IHasCurrentSourceInfoChange sourceDevice;
|
||||||
|
|
||||||
public IHasCurrentSourceInfoMessenger(string key, string messagePath, IHasCurrentSourceInfoChange device) : base(key, messagePath, device as IKeyName)
|
public IHasCurrentSourceInfoMessenger(string key, string messagePath, IHasCurrentSourceInfoChange device) : base(key, messagePath, device as IKeyName)
|
||||||
{
|
{
|
||||||
sourceDevice = device;
|
sourceDevice = device;
|
||||||
@@ -20,16 +21,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) =>
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
{
|
|
||||||
var message = new CurrentSourceStateMessage
|
|
||||||
{
|
|
||||||
CurrentSourceKey = sourceDevice.CurrentSourceInfoKey,
|
|
||||||
CurrentSource = sourceDevice.CurrentSourceInfo
|
|
||||||
};
|
|
||||||
|
|
||||||
PostStatusMessage(message);
|
AddAction("/currentSourceInfoStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
sourceDevice.CurrentSourceChange += (sender, e) =>
|
sourceDevice.CurrentSourceChange += (sender, e) =>
|
||||||
{
|
{
|
||||||
@@ -47,6 +41,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
var message = new CurrentSourceStateMessage
|
||||||
|
{
|
||||||
|
CurrentSourceKey = sourceDevice.CurrentSourceInfoKey,
|
||||||
|
CurrentSource = sourceDevice.CurrentSourceInfo
|
||||||
|
};
|
||||||
|
|
||||||
|
PostStatusMessage(message, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -54,16 +59,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CurrentSourceStateMessage : DeviceStateMessageBase
|
public class CurrentSourceStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentSourceKey
|
/// Gets or sets the CurrentSourceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CurrentSourceKey { get; set; }
|
public string CurrentSourceKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentSource")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentSource
|
/// Gets or sets the CurrentSource
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentSource")]
|
||||||
public SourceListItem CurrentSource { get; set; }
|
public SourceListItem CurrentSource { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -11,8 +11,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// Represents a IHasInputsMessenger
|
/// Represents a IHasInputsMessenger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IHasInputsMessenger<TKey> : MessengerBase
|
public class IHasInputsMessenger<TKey> : MessengerBase
|
||||||
{
|
{
|
||||||
private readonly IHasInputs<TKey> itemDevice;
|
private readonly IHasInputs<TKey> itemDevice;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -23,17 +23,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <param name="device"></param>
|
/// <param name="device"></param>
|
||||||
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
|
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
|
||||||
{
|
{
|
||||||
itemDevice = device;
|
itemDevice = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, context) =>
|
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||||
{
|
|
||||||
SendFullStatus();
|
AddAction("/inputStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
itemDevice.Inputs.ItemsUpdated += (sender, args) =>
|
itemDevice.Inputs.ItemsUpdated += (sender, args) =>
|
||||||
{
|
{
|
||||||
@@ -62,7 +61,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -77,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(stateObject);
|
PostStatusMessage(stateObject, id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
private readonly IHasPowerControlWithFeedback _powerControl;
|
private readonly IHasPowerControlWithFeedback _powerControl;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="IHasPowerControlWithFeedbackMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="messagePath">The message path.</param>
|
||||||
|
/// <param name="powerControl">The power control device</param>
|
||||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||||
: base(key, messagePath, powerControl as IKeyName)
|
: base(key, messagePath, powerControl as IKeyName)
|
||||||
{
|
{
|
||||||
@@ -21,21 +27,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendFullStatus method
|
/// SendFullStatus method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendFullStatus()
|
public void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var messageObj = new PowerControlWithFeedbackStateMessage
|
var messageObj = new PowerControlWithFeedbackStateMessage
|
||||||
{
|
{
|
||||||
PowerState = _powerControl.PowerIsOnFeedback.BoolValue
|
PowerState = _powerControl.PowerIsOnFeedback.BoolValue
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(messageObj);
|
PostStatusMessage(messageObj, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/powerStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
_powerControl.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; ;
|
_powerControl.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; ;
|
||||||
}
|
}
|
||||||
@@ -55,6 +64,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PowerControlWithFeedbackStateMessage : DeviceStateMessageBase
|
public class PowerControlWithFeedbackStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Power State
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? PowerState { get; set; }
|
public bool? PowerState { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
|
||||||
|
|
||||||
|
AddAction("/schedule/status", (id, content) => SendFullScheduleObject(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||||
@@ -51,13 +53,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to send the full schedule data
|
/// Helper method to send the full schedule data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendFullScheduleObject()
|
private void SendFullScheduleObject(string id = null)
|
||||||
{
|
{
|
||||||
PostStatusMessage(new FullScheduleMessage
|
PostStatusMessage(new FullScheduleMessage
|
||||||
{
|
{
|
||||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||||
});
|
}, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,16 +68,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class FullScheduleMessage : DeviceStateMessageBase
|
public class FullScheduleMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Meetings
|
/// Gets or sets the Meetings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<Meeting> Meetings { get; set; }
|
public List<Meeting> Meetings { get; set; }
|
||||||
|
|
||||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MeetingWarningMinutes
|
/// Gets or sets the MeetingWarningMinutes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public int MeetingWarningMinutes { get; set; }
|
public int MeetingWarningMinutes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +88,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MeetingChangeMessage
|
public class MeetingChangeMessage
|
||||||
{
|
{
|
||||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MeetingChange
|
/// Gets or sets the MeetingChange
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public MeetingChange MeetingChange { get; set; }
|
public MeetingChange MeetingChange { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,16 +101,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MeetingChange
|
public class MeetingChange
|
||||||
{
|
{
|
||||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ChangeType
|
/// Gets or sets the ChangeType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string ChangeType { get; set; }
|
public string ChangeType { get; set; }
|
||||||
|
|
||||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Meeting
|
/// Gets or sets the Meeting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Meeting Meeting { get; set; }
|
public Meeting Meeting { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -22,19 +22,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/humidityStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
device.HumidityFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
device.HumidityFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new IHumiditySensorStateMessage
|
var state = new IHumiditySensorStateMessage
|
||||||
{
|
{
|
||||||
Humidity = string.Format("{0}%", device.HumidityFeedback.UShortValue)
|
Humidity = string.Format("{0}%", device.HumidityFeedback.UShortValue)
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +45,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class IHumiditySensorStateMessage : DeviceStateMessageBase
|
public class IHumiditySensorStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("humidity")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Humidity
|
/// Gets or sets the Humidity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("humidity")]
|
||||||
public string Humidity { get; set; }
|
public string Humidity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -13,6 +13,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
public class ILevelControlsMessenger : MessengerBase
|
public class ILevelControlsMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
private ILevelControls levelControlsDevice;
|
private ILevelControls levelControlsDevice;
|
||||||
|
|
||||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
||||||
{
|
{
|
||||||
levelControlsDevice = device;
|
levelControlsDevice = device;
|
||||||
@@ -22,15 +23,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, context) =>
|
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
|
||||||
{
|
|
||||||
var message = new LevelControlStateMessage
|
|
||||||
{
|
|
||||||
Levels = levelControlsDevice.LevelControlPoints.ToDictionary(kv => kv.Key, kv => new Volume { Level = kv.Value.VolumeLevelFeedback.IntValue, Muted = kv.Value.MuteFeedback.BoolValue })
|
|
||||||
};
|
|
||||||
|
|
||||||
PostStatusMessage(message);
|
AddAction("/levelStats", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var levelControl in levelControlsDevice.LevelControlPoints)
|
foreach (var levelControl in levelControlsDevice.LevelControlPoints)
|
||||||
{
|
{
|
||||||
@@ -75,6 +70,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
var message = new LevelControlStateMessage
|
||||||
|
{
|
||||||
|
Levels = levelControlsDevice.LevelControlPoints.ToDictionary(kv => kv.Key, kv => new Volume { Level = kv.Value.VolumeLevelFeedback.IntValue, Muted = kv.Value.MuteFeedback.BoolValue })
|
||||||
|
};
|
||||||
|
|
||||||
|
PostStatusMessage(message, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -25,25 +25,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) =>
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "InputCount: {inputCount}, OutputCount: {outputCount}", this, matrixDevice.InputSlots.Count, matrixDevice.OutputSlots.Count);
|
|
||||||
var message = new MatrixStateMessage
|
|
||||||
{
|
|
||||||
Outputs = matrixDevice.OutputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingOutput(kvp.Value)),
|
|
||||||
Inputs = matrixDevice.InputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingInput(kvp.Value)),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
AddAction("/matrixStatus", (id, content) => SendFullStatus(id));
|
||||||
PostStatusMessage(message);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(e, "Exception Getting full status: {@exception}", this, e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAction("/route", (id, content) =>
|
AddAction("/route", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -80,6 +64,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendFullStatus(string id = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Verbose, "InputCount: {inputCount}, OutputCount: {outputCount}", this, matrixDevice.InputSlots.Count, matrixDevice.OutputSlots.Count);
|
||||||
|
var message = new MatrixStateMessage
|
||||||
|
{
|
||||||
|
Outputs = matrixDevice.OutputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingOutput(kvp.Value)),
|
||||||
|
Inputs = matrixDevice.InputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingInput(kvp.Value)),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PostStatusMessage(message, id);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(e, "Exception Getting full status: {@exception}", this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -14,17 +14,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
private readonly IProjectorScreenLiftControl device;
|
private readonly IProjectorScreenLiftControl device;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="IProjectorScreenLiftControlMessenger"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">message key</param>
|
||||||
|
/// <param name="messagePath">message path</param>
|
||||||
|
/// <param name="screenLiftDevice">screen lift device</param>
|
||||||
public IProjectorScreenLiftControlMessenger(string key, string messagePath, IProjectorScreenLiftControl screenLiftDevice)
|
public IProjectorScreenLiftControlMessenger(string key, string messagePath, IProjectorScreenLiftControl screenLiftDevice)
|
||||||
: base(key, messagePath, screenLiftDevice as IKeyName)
|
: base(key, messagePath, screenLiftDevice as IKeyName)
|
||||||
{
|
{
|
||||||
device = screenLiftDevice;
|
device = screenLiftDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers the actions for the messenger.
|
||||||
|
/// </summary>
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/screenliftStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/raise", (id, content) =>
|
AddAction("/raise", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -53,7 +64,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
PostStatusMessage(JToken.FromObject(state));
|
PostStatusMessage(JToken.FromObject(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new ScreenLiftStateMessage
|
var state = new ScreenLiftStateMessage
|
||||||
{
|
{
|
||||||
@@ -62,7 +73,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
DisplayDeviceKey = device.DisplayDeviceKey
|
DisplayDeviceKey = device.DisplayDeviceKey
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,20 +82,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ScreenLiftStateMessage : DeviceStateMessageBase
|
public class ScreenLiftStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the InUpPosition
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("inUpPosition", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("inUpPosition", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? InUpPosition { get; set; }
|
public bool? InUpPosition { get; set; }
|
||||||
|
|
||||||
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DisplayDeviceKey
|
/// Gets or sets the DisplayDeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DisplayDeviceKey { get; set; }
|
public string DisplayDeviceKey { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public eScreenLiftControlType Type { get; set; }
|
public eScreenLiftControlType Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
@@ -36,7 +36,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject());
|
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||||
|
|
||||||
|
AddAction("/routingStatus", (id, content) => SendRoutingFullMessageObject(id));
|
||||||
|
|
||||||
AddAction("/source", (id, content) =>
|
AddAction("/source", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -62,7 +64,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to update full status of the routing device
|
/// Helper method to update full status of the routing device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendRoutingFullMessageObject()
|
private void SendRoutingFullMessageObject(string id = null)
|
||||||
{
|
{
|
||||||
if (RoutingDevice is IRoutingSink sinkDevice)
|
if (RoutingDevice is IRoutingSink sinkDevice)
|
||||||
{
|
{
|
||||||
@@ -84,10 +86,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoutingStateMessage : DeviceStateMessageBase
|
public class RoutingStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("selectedSourceKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SelectedSourceKey
|
/// Gets or sets the SelectedSourceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("selectedSourceKey")]
|
||||||
public string SelectedSourceKey { get; set; }
|
public string SelectedSourceKey { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// Represents a ISelectableItemsMessenger
|
/// Represents a ISelectableItemsMessenger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ISelectableItemsMessenger<TKey> : MessengerBase
|
public class ISelectableItemsMessenger<TKey> : MessengerBase
|
||||||
{
|
{
|
||||||
private readonly ISelectableItems<TKey> itemDevice;
|
private readonly ISelectableItems<TKey> itemDevice;
|
||||||
|
|
||||||
private readonly string _propName;
|
private readonly string _propName;
|
||||||
@@ -34,9 +34,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, context) =>
|
AddAction("/fullStatus", (id, context) =>
|
||||||
{
|
SendFullStatus(id)
|
||||||
SendFullStatus();
|
);
|
||||||
});
|
|
||||||
|
AddAction("/itemsStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
itemDevice.ItemsUpdated += (sender, args) =>
|
itemDevice.ItemsUpdated += (sender, args) =>
|
||||||
{
|
{
|
||||||
@@ -65,7 +66,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -77,7 +78,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
CurrentItem = itemDevice.CurrentItem
|
CurrentItem = itemDevice.CurrentItem
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(stateObject);
|
PostStatusMessage(stateObject, id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -91,13 +92,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
|
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Items
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("items")]
|
[JsonProperty("items")]
|
||||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentItem")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentItem
|
/// Gets or sets the CurrentItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentItem")]
|
||||||
public TKey CurrentItem { get; set; }
|
public TKey CurrentItem { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/status", (id, content) =>
|
AddAction("/status", (id, content) => SendFullStatus(id));
|
||||||
{
|
|
||||||
SendFullStatus();
|
AddAction("/shutdownPromptStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
AddAction("/setShutdownPromptSeconds", (id, content) =>
|
AddAction("/setShutdownPromptSeconds", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -68,7 +67,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var status = new IShutdownPromptTimerStateMessage
|
var status = new IShutdownPromptTimerStateMessage
|
||||||
{
|
{
|
||||||
@@ -77,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
PercentageRemaining = _room.ShutdownPromptTimer.PercentFeedback.UShortValue
|
PercentageRemaining = _room.ShutdownPromptTimer.PercentFeedback.UShortValue
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(status);
|
PostStatusMessage(status, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,22 +86,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class IShutdownPromptTimerStateMessage : DeviceStateMessageBase
|
public class IShutdownPromptTimerStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("secondsRemaining")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SecondsRemaining
|
/// Gets or sets the SecondsRemaining
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("secondsRemaining")]
|
||||||
public int SecondsRemaining { get; set; }
|
public int SecondsRemaining { get; set; }
|
||||||
|
|
||||||
[JsonProperty("percentageRemaining")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PercentageRemaining
|
/// Gets or sets the PercentageRemaining
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("percentageRemaining")]
|
||||||
public int PercentageRemaining { get; set; }
|
public int PercentageRemaining { get; set; }
|
||||||
|
|
||||||
[JsonProperty("shutdownPromptSeconds")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ShutdownPromptSeconds
|
/// Gets or sets the ShutdownPromptSeconds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("shutdownPromptSeconds")]
|
||||||
public int ShutdownPromptSeconds { get; set; }
|
public int ShutdownPromptSeconds { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.CrestronIO;
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/switchedOutputStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/on", (id, content) =>
|
AddAction("/on", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -42,14 +44,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new ISwitchedOutputStateMessage
|
var state = new ISwitchedOutputStateMessage
|
||||||
{
|
{
|
||||||
IsOn = device.OutputIsOnFeedback.BoolValue
|
IsOn = device.OutputIsOnFeedback.BoolValue
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +60,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ISwitchedOutputStateMessage : DeviceStateMessageBase
|
public class ISwitchedOutputStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("isOn")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsOn
|
/// Gets or sets the IsOn
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("isOn")]
|
||||||
public bool IsOn { get; set; }
|
public bool IsOn { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
|
|
||||||
AddAction("/status", (id, content) =>
|
AddAction("/status", (id, content) => SendFullStatus(id));
|
||||||
{
|
|
||||||
SendFullStatus();
|
AddAction("/techPasswordStatus", (id, content) => SendFullStatus(id));
|
||||||
});
|
|
||||||
|
|
||||||
AddAction("/validateTechPassword", (id, content) =>
|
AddAction("/validateTechPassword", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -55,14 +54,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var status = new ITechPasswordStateMessage
|
var status = new ITechPasswordStateMessage
|
||||||
{
|
{
|
||||||
TechPasswordLength = _room.TechPasswordLength
|
TechPasswordLength = _room.TechPasswordLength
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(status);
|
PostStatusMessage(status, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/temperatureStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/setTemperatureUnitsToCelcius", (id, content) =>
|
AddAction("/setTemperatureUnitsToCelcius", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -38,7 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
device.TemperatureInCFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
device.TemperatureInCFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
// format the temperature to a string with one decimal place
|
// format the temperature to a string with one decimal place
|
||||||
var tempString = string.Format("{0}.{1}", device.TemperatureFeedback.UShortValue / 10, device.TemperatureFeedback.UShortValue % 10);
|
var tempString = string.Format("{0}.{1}", device.TemperatureFeedback.UShortValue / 10, device.TemperatureFeedback.UShortValue % 10);
|
||||||
@@ -49,7 +51,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
TemperatureInCelsius = device.TemperatureInCFeedback.BoolValue
|
TemperatureInCelsius = device.TemperatureInCFeedback.BoolValue
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,16 +60,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ITemperatureSensorStateMessage : DeviceStateMessageBase
|
public class ITemperatureSensorStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("temperature")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Temperature
|
/// Gets or sets the Temperature
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("temperature")]
|
||||||
public string Temperature { get; set; }
|
public string Temperature { get; set; }
|
||||||
|
|
||||||
[JsonProperty("temperatureInCelsius")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TemperatureInCelsius
|
/// Gets or sets the TemperatureInCelsius
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("temperatureInCelsius")]
|
||||||
public bool TemperatureInCelsius { get; set; }
|
public bool TemperatureInCelsius { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Lighting;
|
using PepperDash.Essentials.Core.Lighting;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/lightingStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/selectScene", (id, content) =>
|
AddAction("/selectScene", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -43,14 +45,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
lightingScenesDevice.SelectScene(s);
|
lightingScenesDevice.SelectScene(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
|
if (!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
|
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new LightingBaseStateMessage
|
var state = new LightingBaseStateMessage
|
||||||
{
|
{
|
||||||
@@ -58,7 +60,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
|
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,16 +69,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LightingBaseStateMessage : DeviceStateMessageBase
|
public class LightingBaseStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Scenes
|
/// Gets or sets the Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<LightingScene> Scenes { get; set; }
|
public List<LightingScene> Scenes { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentLightingScene
|
/// Gets or sets the CurrentLightingScene
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public LightingScene CurrentLightingScene { get; set; }
|
public LightingScene CurrentLightingScene { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -15,12 +15,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class MessengerBase : EssentialsDevice, IMobileControlMessenger
|
public abstract class MessengerBase : EssentialsDevice, IMobileControlMessenger
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The device this messenger is associated with
|
||||||
|
/// </summary>
|
||||||
protected IKeyName _device;
|
protected IKeyName _device;
|
||||||
|
|
||||||
private readonly List<string> _deviceInterfaces;
|
private readonly List<string> _deviceInterfaces;
|
||||||
|
|
||||||
private readonly Dictionary<string, Action<string, JToken>> _actions = new Dictionary<string, Action<string, JToken>>();
|
private readonly Dictionary<string, Action<string, JToken>> _actions = new Dictionary<string, Action<string, JToken>>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the DeviceKey
|
||||||
|
/// </summary>
|
||||||
public string DeviceKey => _device?.Key ?? "";
|
public string DeviceKey => _device?.Key ?? "";
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +56,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
MessagePath = messagePath;
|
MessagePath = messagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for a messenger associated with a device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="messagePath"></param>
|
||||||
|
/// <param name="device"></param>
|
||||||
protected MessengerBase(string key, string messagePath, IKeyName device)
|
protected MessengerBase(string key, string messagePath, IKeyName device)
|
||||||
: this(key, messagePath)
|
: this(key, messagePath)
|
||||||
{
|
{
|
||||||
@@ -96,6 +108,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
action(id, content);
|
action(id, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an action for a given path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="action"></param>
|
||||||
protected void AddAction(string path, Action<string, JToken> action)
|
protected void AddAction(string path, Action<string, JToken> action)
|
||||||
{
|
{
|
||||||
if (_actions.ContainsKey(path))
|
if (_actions.ContainsKey(path))
|
||||||
@@ -115,6 +132,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
return _actions.Keys.ToList();
|
return _actions.Keys.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes an action for a given path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
protected void RemoveAction(string path)
|
protected void RemoveAction(string path)
|
||||||
{
|
{
|
||||||
if (!_actions.ContainsKey(path))
|
if (!_actions.ContainsKey(path))
|
||||||
@@ -128,7 +149,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implemented in extending classes. Wire up API calls and feedback here
|
/// Implemented in extending classes. Wire up API calls and feedback here
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appServerController"></param>
|
|
||||||
protected virtual void RegisterActions()
|
protected virtual void RegisterActions()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -137,8 +157,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper for posting status message
|
/// Helper for posting status message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
|
/// <param name="clientId">Optional client id that will direct the message back to only that client</param>
|
||||||
protected void PostStatusMessage(DeviceStateMessageBase message, string clientId = null)
|
protected void PostStatusMessage(DeviceStateMessageBase message, string clientId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -159,16 +179,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
message.Name = _device.Name;
|
message.Name = _device.Name;
|
||||||
|
|
||||||
var token = JToken.FromObject(message);
|
var token = JToken.FromObject(message);
|
||||||
|
|
||||||
PostStatusMessage(token, MessagePath, clientId);
|
PostStatusMessage(token, MessagePath, clientId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
|
this.LogError(ex, "Exception posting status message for {messagePath} to {clientId}", MessagePath, clientId ?? "all clients");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting status message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="deviceState"></param>
|
||||||
|
/// <param name="clientId">Optional client id that will direct the message back to only that client</param>
|
||||||
protected void PostStatusMessage(string type, DeviceStateMessageBase deviceState, string clientId = null)
|
protected void PostStatusMessage(string type, DeviceStateMessageBase deviceState, string clientId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -188,10 +214,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
|
this.LogError(ex, "Exception posting status message for {type} to {clientId}", type, clientId ?? "all clients");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting status message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="clientId">Optional client id that will direct the message back to only that client</param>
|
||||||
protected void PostStatusMessage(JToken content, string type = "", string clientId = null)
|
protected void PostStatusMessage(JToken content, string type = "", string clientId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -204,6 +236,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting event message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"></param>
|
||||||
protected void PostEventMessage(DeviceEventMessageBase message)
|
protected void PostEventMessage(DeviceEventMessageBase message)
|
||||||
{
|
{
|
||||||
message.Key = _device.Key;
|
message.Key = _device.Key;
|
||||||
@@ -217,6 +253,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting event message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <param name="eventType"></param>
|
||||||
protected void PostEventMessage(DeviceEventMessageBase message, string eventType)
|
protected void PostEventMessage(DeviceEventMessageBase message, string eventType)
|
||||||
{
|
{
|
||||||
message.Key = _device.Key;
|
message.Key = _device.Key;
|
||||||
@@ -232,6 +273,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper for posting event message with no content
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventType"></param>
|
||||||
protected void PostEventMessage(string eventType)
|
protected void PostEventMessage(string eventType)
|
||||||
{
|
{
|
||||||
AppServerController?.SendMessageObject(new MobileControlMessage
|
AppServerController?.SendMessageObject(new MobileControlMessage
|
||||||
@@ -243,6 +288,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for device messages that include the type of message
|
||||||
|
/// </summary>
|
||||||
public abstract class DeviceMessageBase
|
public abstract class DeviceMessageBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -266,10 +314,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("messageType")]
|
[JsonProperty("messageType")]
|
||||||
public string MessageType => GetType().Name;
|
public string MessageType => GetType().Name;
|
||||||
|
|
||||||
[JsonProperty("messageBasePath")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MessageBasePath
|
/// Gets or sets the MessageBasePath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("messageBasePath")]
|
||||||
|
|
||||||
public string MessageBasePath { get; set; }
|
public string MessageBasePath { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,6 +333,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("interfaces")]
|
[JsonProperty("interfaces")]
|
||||||
public List<string> Interfaces { get; private set; }
|
public List<string> Interfaces { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the interfaces implemented by the device sending the message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="interfaces"></param>
|
||||||
public void SetInterfaces(List<string> interfaces)
|
public void SetInterfaces(List<string> interfaces)
|
||||||
{
|
{
|
||||||
Interfaces = interfaces;
|
Interfaces = interfaces;
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
using Crestron.SimplSharp;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handler for press/hold/release messages
|
||||||
|
/// </summary>
|
||||||
public static class PressAndHoldHandler
|
public static class PressAndHoldHandler
|
||||||
{
|
{
|
||||||
private const long ButtonHeartbeatInterval = 1000;
|
private const long ButtonHeartbeatInterval = 1000;
|
||||||
@@ -26,21 +29,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
private static void AddTimer(string deviceKey, Action<bool> action)
|
private static void AddTimer(string deviceKey, Action<bool> action)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to add timer for {deviceKey}", deviceKey);
|
Debug.LogDebug("Attempting to add timer for {deviceKey}", deviceKey);
|
||||||
|
|
||||||
if (_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
if (_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} already exists", deviceKey);
|
Debug.LogDebug("Timer for {deviceKey} already exists", deviceKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
Debug.LogDebug("Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||||
|
|
||||||
action(true);
|
action(true);
|
||||||
|
|
||||||
cancelTimer = new CTimer(o =>
|
cancelTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer expired for {deviceKey}", deviceKey);
|
Debug.LogDebug("Timer expired for {deviceKey}", deviceKey);
|
||||||
|
|
||||||
action(false);
|
action(false);
|
||||||
|
|
||||||
@@ -52,30 +55,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
private static void ResetTimer(string deviceKey, Action<bool> action)
|
private static void ResetTimer(string deviceKey, Action<bool> action)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to reset timer for {deviceKey}", deviceKey);
|
Debug.LogDebug("Attempting to reset timer for {deviceKey}", deviceKey);
|
||||||
|
|
||||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
Debug.LogDebug("Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||||
|
|
||||||
cancelTimer.Reset(ButtonHeartbeatInterval);
|
cancelTimer.Reset(ButtonHeartbeatInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StopTimer(string deviceKey, Action<bool> action)
|
private static void StopTimer(string deviceKey, Action<bool> action)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to stop timer for {deviceKey}", deviceKey);
|
Debug.LogDebug("Attempting to stop timer for {deviceKey}", deviceKey);
|
||||||
|
|
||||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
Debug.LogDebug("Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
|
||||||
|
|
||||||
action(false);
|
action(false);
|
||||||
cancelTimer.Stop();
|
cancelTimer.Stop();
|
||||||
@@ -84,15 +87,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
public static Action<string, Action<bool>> GetPressAndHoldHandler(string value)
|
public static Action<string, Action<bool>> GetPressAndHoldHandler(string value)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Getting press and hold handler for {value}", value);
|
Debug.LogDebug("Getting press and hold handler for {value}", value);
|
||||||
|
|
||||||
if (!_pushedActionHandlers.TryGetValue(value, out Action<string, Action<bool>> handler))
|
if (!_pushedActionHandlers.TryGetValue(value, out Action<string, Action<bool>> handler))
|
||||||
{
|
{
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Press and hold handler for {value} not found", value);
|
Debug.LogDebug("Press and hold handler for {value} not found", value);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Got handler for {value}", value);
|
Debug.LogDebug("Got handler for {value}", value);
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
@@ -104,7 +107,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||||
|
|
||||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
|
Debug.LogDebug("Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
|
||||||
|
|
||||||
var timerHandler = GetPressAndHoldHandler(msg.Value);
|
var timerHandler = GetPressAndHoldHandler(msg.Value);
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Room.Config;
|
using PepperDash.Essentials.Room.Config;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
var events = _room.GetScheduledEvents();
|
var events = _room.GetScheduledEvents();
|
||||||
|
|
||||||
SendFullStatus(events);
|
SendFullStatus(events, id);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAction("/scheduledEventsStatus", (id, content) =>
|
||||||
|
{
|
||||||
|
var events = _room.GetScheduledEvents();
|
||||||
|
|
||||||
|
SendFullStatus(events, id);
|
||||||
});
|
});
|
||||||
|
|
||||||
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
|
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
|
||||||
@@ -55,11 +62,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogException(ex,"Exception saving event");
|
this.LogException(ex, "Exception saving event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatus(List<ScheduledEventConfig> events)
|
private void SendFullStatus(List<ScheduledEventConfig> events, string id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var message = new RoomEventScheduleStateMessage
|
var message = new RoomEventScheduleStateMessage
|
||||||
@@ -67,7 +74,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
ScheduleEvents = events,
|
ScheduleEvents = events,
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(message);
|
PostStatusMessage(message, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Shades;
|
using PepperDash.Essentials.Core.Shades;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
AddAction("/shadesStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/shadeUp", (id, content) =>
|
AddAction("/shadeUp", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -75,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SendFullStatus()
|
private void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var state = new ShadeBaseStateMessage();
|
var state = new ShadeBaseStateMessage();
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
state.IsClosed = feedbackDevice.ShadeIsClosedFeedback.BoolValue;
|
state.IsClosed = feedbackDevice.ShadeIsClosedFeedback.BoolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +95,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShadeBaseStateMessage : DeviceStateMessageBase
|
public class ShadeBaseStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MiddleButtonLabel
|
/// Gets or sets the MiddleButtonLabel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string MiddleButtonLabel { get; set; }
|
public string MiddleButtonLabel { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using Crestron.SimplSharp;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Monitoring;
|
using PepperDash.Essentials.Core.Monitoring;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -56,36 +56,37 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
SendSystemMonitorStatusMessage();
|
SendSystemMonitorStatusMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendFullStatusMessage()
|
private void SendFullStatusMessage(string id = null)
|
||||||
{
|
{
|
||||||
SendSystemMonitorStatusMessage();
|
SendSystemMonitorStatusMessage(id);
|
||||||
|
|
||||||
foreach (var p in systemMonitor.ProgramStatusFeedbackCollection)
|
foreach (var p in systemMonitor.ProgramStatusFeedbackCollection)
|
||||||
{
|
{
|
||||||
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo));
|
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo), id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendSystemMonitorStatusMessage()
|
private void SendSystemMonitorStatusMessage(string id = null)
|
||||||
{
|
{
|
||||||
// This takes a while, launch a new thread
|
// This takes a while, launch a new thread
|
||||||
|
|
||||||
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
|
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
|
||||||
{
|
{
|
||||||
|
|
||||||
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
|
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
|
||||||
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
|
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
|
||||||
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
|
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
|
||||||
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
|
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
|
||||||
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
|
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
|
||||||
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
|
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
|
||||||
})
|
}), id
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatusMessage());
|
AddAction("/fullStatus", (id, content) => SendFullStatusMessage(id));
|
||||||
|
|
||||||
|
AddAction("/systemStatus", (id, content) => SendFullStatusMessage(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,40 +95,45 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SystemMonitorStateMessage
|
public class SystemMonitorStateMessage
|
||||||
{
|
{
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TimeZone
|
/// Gets or sets the TimeZone
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public int TimeZone { get; set; }
|
public int TimeZone { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TimeZoneName
|
/// Gets or sets the TimeZoneName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("timeZoneName", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string TimeZoneName { get; set; }
|
public string TimeZoneName { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IoControllerVersion
|
/// Gets or sets the IoControllerVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("ioControllerVersion", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string IoControllerVersion { get; set; }
|
public string IoControllerVersion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SnmpVersion
|
/// Gets or sets the SnmpVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("snmpVersion", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string SnmpVersion { get; set; }
|
public string SnmpVersion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the BacnetVersion
|
/// Gets or sets the BacnetVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("bacnetVersion", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string BacnetVersion { get; set; }
|
public string BacnetVersion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ControllerVersion
|
/// Gets or sets the ControllerVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("controllerVersion", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string ControllerVersion { get; set; }
|
public string ControllerVersion { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// SendFullStatus method
|
/// SendFullStatus method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendFullStatus()
|
public void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
var messageObj = new TwoWayDisplayBaseStateMessage
|
var messageObj = new TwoWayDisplayBaseStateMessage
|
||||||
{
|
{
|
||||||
@@ -31,16 +31,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
CurrentInput = _display.CurrentInputFeedback.StringValue
|
CurrentInput = _display.CurrentInputFeedback.StringValue
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(messageObj);
|
PostStatusMessage(messageObj, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
base.RegisterActions();
|
base.RegisterActions();
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
|
AddAction("/displayStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
//_display.PowerIsOnFeedback.OutputChange += PowerIsOnFeedbackOnOutputChange;
|
|
||||||
_display.CurrentInputFeedback.OutputChange += CurrentInputFeedbackOnOutputChange;
|
_display.CurrentInputFeedback.OutputChange += CurrentInputFeedbackOnOutputChange;
|
||||||
_display.IsCoolingDownFeedback.OutputChange += IsCoolingFeedbackOnOutputChange;
|
_display.IsCoolingDownFeedback.OutputChange += IsCoolingFeedbackOnOutputChange;
|
||||||
_display.IsWarmingUpFeedback.OutputChange += IsWarmingFeedbackOnOutputChange;
|
_display.IsWarmingUpFeedback.OutputChange += IsWarmingFeedbackOnOutputChange;
|
||||||
@@ -55,16 +56,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//private void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
|
||||||
//{
|
|
||||||
// PostStatusMessage(JToken.FromObject(new
|
|
||||||
// {
|
|
||||||
// powerState = feedbackEventArgs.BoolValue
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void IsWarmingFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
private void IsWarmingFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||||
{
|
{
|
||||||
PostStatusMessage(JToken.FromObject(new
|
PostStatusMessage(JToken.FromObject(new
|
||||||
@@ -96,10 +87,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
//[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
//[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
//public bool? PowerState { get; set; }
|
//public bool? PowerState { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentInput
|
/// Gets or sets the CurrentInput
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CurrentInput { get; set; }
|
public string CurrentInput { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
using Crestron.SimplSharp;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
@@ -9,9 +13,6 @@ using PepperDash.Essentials.Devices.Common.Cameras;
|
|||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
@@ -151,7 +152,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
PostStatusMessage(state);
|
PostStatusMessage(state);
|
||||||
|
|
||||||
SendFullStatus();
|
SendFullStatus();
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Error sending codec ready status");
|
this.LogError(ex, "Error sending codec ready status");
|
||||||
}
|
}
|
||||||
@@ -169,7 +171,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
AddAction("/isReady", (id, content) => SendIsReady());
|
AddAction("/isReady", (id, content) => SendIsReady());
|
||||||
|
|
||||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
|
||||||
|
AddAction("/codecStatus", (id, content) => SendFullStatus(id));
|
||||||
|
|
||||||
AddAction("/dial", (id, content) =>
|
AddAction("/dial", (id, content) =>
|
||||||
{
|
{
|
||||||
@@ -369,7 +372,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state);
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Error posting sharing source");
|
this.LogError(ex, "Error posting sharing source");
|
||||||
}
|
}
|
||||||
@@ -385,7 +389,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state);
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Error posting sharing content");
|
this.LogError(ex, "Error posting sharing content");
|
||||||
}
|
}
|
||||||
@@ -435,7 +440,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
MapCameraActions();
|
MapCameraActions();
|
||||||
PostSelectedCamera();
|
PostSelectedCamera();
|
||||||
} catch(Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Exception handling camera selected event");
|
this.LogError(ex, "Exception handling camera selected event");
|
||||||
}
|
}
|
||||||
@@ -780,14 +786,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SendFullStatus()
|
protected virtual void SendFullStatus(string id = null)
|
||||||
{
|
{
|
||||||
if (!Codec.IsReady)
|
if (!Codec.IsReady)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(GetStatus()));
|
Task.Run(() => PostStatusMessage(GetStatus(), id));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PostReceivingContent(bool receivingContent)
|
private void PostReceivingContent(bool receivingContent)
|
||||||
@@ -800,7 +806,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state);
|
||||||
} catch(Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Error posting receiving content");
|
this.LogError(ex, "Error posting receiving content");
|
||||||
}
|
}
|
||||||
@@ -949,22 +956,25 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("cameraSupportsOffMode", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("cameraSupportsOffMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? CameraSupportsOffMode { get; set; }
|
public bool? CameraSupportsOffMode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentDialString
|
/// Gets or sets the CurrentDialString
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CurrentDialString { get; set; }
|
public string CurrentDialString { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentDirectory
|
/// Gets or sets the CurrentDirectory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public CodecDirectory CurrentDirectory { get; set; }
|
public CodecDirectory CurrentDirectory { get; set; }
|
||||||
|
|
||||||
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DirectorySelectedFolderName
|
/// Gets or sets the DirectorySelectedFolderName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DirectorySelectedFolderName { get; set; }
|
public string DirectorySelectedFolderName { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasCameras", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasCameras", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -985,10 +995,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("initialPhonebookSyncComplete", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("initialPhonebookSyncComplete", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? InitialPhonebookSyncComplete { get; set; }
|
public bool? InitialPhonebookSyncComplete { get; set; }
|
||||||
|
|
||||||
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Info
|
/// Gets or sets the Info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public VideoCodecInfo Info { get; set; }
|
public VideoCodecInfo Info { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isInCall", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isInCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -1000,16 +1011,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("isZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsZoomRoom { get; set; }
|
public bool? IsZoomRoom { get; set; }
|
||||||
|
|
||||||
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MeetingInfo
|
/// Gets or sets the MeetingInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public MeetingInfo MeetingInfo { get; set; }
|
public MeetingInfo MeetingInfo { get; set; }
|
||||||
|
|
||||||
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Presets
|
/// Gets or sets the Presets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<CodecRoomPreset> Presets { get; set; }
|
public List<CodecRoomPreset> Presets { get; set; }
|
||||||
|
|
||||||
[JsonProperty("privacyModeIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("privacyModeIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -1024,10 +1037,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("sharingContentIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("sharingContentIsOn", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? SharingContentIsOn { get; set; }
|
public bool? SharingContentIsOn { get; set; }
|
||||||
|
|
||||||
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SharingSource
|
/// Gets or sets the SharingSource
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string SharingSource { get; set; }
|
public string SharingSource { get; set; }
|
||||||
|
|
||||||
[JsonProperty("showCamerasWhenNotInCall", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("showCamerasWhenNotInCall", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -1057,23 +1071,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? CameraOffIsSupported { get; set; }
|
public bool? CameraOffIsSupported { get; set; }
|
||||||
|
|
||||||
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CameraMode
|
/// Gets or sets the CameraMode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CameraMode { get; set; }
|
public string CameraMode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Cameras
|
/// Gets or sets the Cameras
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<CameraBase> Cameras { get; set; }
|
public List<CameraBase> Cameras { get; set; }
|
||||||
|
|
||||||
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SelectedCamera
|
/// Gets or sets the SelectedCamera
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Camera SelectedCamera { get; set; }
|
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public Camera SelectedCamera { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1081,25 +1098,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Camera
|
public class Camera
|
||||||
{
|
{
|
||||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Name
|
/// Gets or sets the Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsFarEnd { get; set; }
|
public bool? IsFarEnd { get; set; }
|
||||||
|
|
||||||
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Capabilities
|
/// Gets or sets the Capabilities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public CameraCapabilities Capabilities { get; set; }
|
public CameraCapabilities Capabilities { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,27 +1155,31 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PasswordPromptEventMessage : VideoCodecBaseEventMessage
|
public class PasswordPromptEventMessage : VideoCodecBaseEventMessage
|
||||||
{
|
{
|
||||||
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Message
|
/// Gets or sets the Message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LastAttemptWasIncorrect
|
/// Gets or sets the LastAttemptWasIncorrect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool LastAttemptWasIncorrect { get; set; }
|
public bool LastAttemptWasIncorrect { get; set; }
|
||||||
|
|
||||||
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LoginAttemptFailed
|
/// Gets or sets the LoginAttemptFailed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool LoginAttemptFailed { get; set; }
|
public bool LoginAttemptFailed { get; set; }
|
||||||
|
|
||||||
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LoginAttemptCancelled
|
/// Gets or sets the LoginAttemptCancelled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool LoginAttemptCancelled { get; set; }
|
public bool LoginAttemptCancelled { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<Compile Remove="Messengers\SIMPLVtcMessenger.cs" />
|
<Compile Remove="Messengers\SIMPLVtcMessenger.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
||||||
|
|||||||
@@ -7,16 +7,18 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AuthorizationResponse
|
public class AuthorizationResponse
|
||||||
{
|
{
|
||||||
[JsonProperty("authorized")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Authorized
|
/// Gets or sets the Authorized
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("authorized")]
|
||||||
public bool Authorized { get; set; }
|
public bool Authorized { get; set; }
|
||||||
|
|
||||||
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Reason
|
/// Gets or sets the Reason
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Reason { get; set; } = null;
|
public string Reason { get; set; } = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,10 +27,11 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AuthorizationRequest
|
public class AuthorizationRequest
|
||||||
{
|
{
|
||||||
[JsonProperty("grantCode")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the GrantCode
|
/// Gets or sets the GrantCode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("grantCode")]
|
||||||
public string GrantCode { get; set; }
|
public string GrantCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -9,25 +9,34 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlConfig
|
public class MobileControlConfig
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ServerUrl
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("serverUrl")]
|
[JsonProperty("serverUrl")]
|
||||||
public string ServerUrl { get; set; }
|
public string ServerUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ClientAppUrl
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("clientAppUrl")]
|
[JsonProperty("clientAppUrl")]
|
||||||
public string ClientAppUrl { get; set; }
|
public string ClientAppUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DirectServer
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("directServer")]
|
[JsonProperty("directServer")]
|
||||||
public MobileControlDirectServerPropertiesConfig DirectServer { get; set; }
|
public MobileControlDirectServerPropertiesConfig DirectServer { get; set; }
|
||||||
|
|
||||||
[JsonProperty("applicationConfig")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ApplicationConfig
|
/// Gets or sets the ApplicationConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("applicationConfig")]
|
||||||
public MobileControlApplicationConfig ApplicationConfig { get; set; } = null;
|
public MobileControlApplicationConfig ApplicationConfig { get; set; } = null;
|
||||||
|
|
||||||
[JsonProperty("enableApiServer")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EnableApiServer
|
/// Gets or sets the EnableApiServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("enableApiServer")]
|
||||||
public bool EnableApiServer { get; set; } = true;
|
public bool EnableApiServer { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,27 +45,42 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlDirectServerPropertiesConfig
|
public class MobileControlDirectServerPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("enableDirectServer")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EnableDirectServer
|
/// Gets or sets the EnableDirectServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("enableDirectServer")]
|
||||||
public bool EnableDirectServer { get; set; }
|
public bool EnableDirectServer { get; set; }
|
||||||
|
|
||||||
[JsonProperty("port")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("port")]
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
[JsonProperty("logging")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Logging
|
/// Gets or sets the Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("logging")]
|
||||||
public MobileControlLoggingConfig Logging { get; set; }
|
public MobileControlLoggingConfig Logging { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutomaticallyForwardPortToCSLAN
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("automaticallyForwardPortToCSLAN")]
|
[JsonProperty("automaticallyForwardPortToCSLAN")]
|
||||||
public bool? AutomaticallyForwardPortToCSLAN { get; set; }
|
public bool? AutomaticallyForwardPortToCSLAN { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CSLanUiDeviceKeys
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// A list of device keys for the CS LAN UI. These devices will get the CS LAN IP address instead of the LAN IP Address
|
||||||
|
/// </remarks>
|
||||||
|
[JsonProperty("csLanUiDeviceKeys")]
|
||||||
|
public List<string> CSLanUiDeviceKeys { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the MobileControlDirectServerPropertiesConfig class.
|
||||||
|
/// </summary>
|
||||||
public MobileControlDirectServerPropertiesConfig()
|
public MobileControlDirectServerPropertiesConfig()
|
||||||
{
|
{
|
||||||
Logging = new MobileControlLoggingConfig();
|
Logging = new MobileControlLoggingConfig();
|
||||||
@@ -68,26 +92,26 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlLoggingConfig
|
public class MobileControlLoggingConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("enableRemoteLogging")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EnableRemoteLogging
|
/// Gets or sets the EnableRemoteLogging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("enableRemoteLogging")]
|
||||||
public bool EnableRemoteLogging { get; set; }
|
public bool EnableRemoteLogging { get; set; }
|
||||||
|
|
||||||
[JsonProperty("host")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Host
|
/// Gets or sets the Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("host")]
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
[JsonProperty("port")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Port
|
/// Gets or sets the Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("port")]
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -95,16 +119,16 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlRoomBridgePropertiesConfig
|
public class MobileControlRoomBridgePropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("key")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("key")]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
[JsonProperty("roomKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomKey
|
/// Gets or sets the RoomKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("roomKey")]
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,53 +137,71 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlSimplRoomBridgePropertiesConfig
|
public class MobileControlSimplRoomBridgePropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("eiscId")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EiscId
|
/// Gets or sets the EiscId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("eiscId")]
|
||||||
public string EiscId { get; set; }
|
public string EiscId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a MobileControlApplicationConfig
|
||||||
|
/// </summary>
|
||||||
public class MobileControlApplicationConfig
|
public class MobileControlApplicationConfig
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ApiPath
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("apiPath")]
|
[JsonProperty("apiPath")]
|
||||||
public string ApiPath { get; set; }
|
public string ApiPath { get; set; }
|
||||||
|
|
||||||
[JsonProperty("gatewayAppPath")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the GatewayAppPath
|
/// Gets or sets the GatewayAppPath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("gatewayAppPath")]
|
||||||
public string GatewayAppPath { get; set; }
|
public string GatewayAppPath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the EnableDev
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("enableDev")]
|
[JsonProperty("enableDev")]
|
||||||
public bool? EnableDev { get; set; }
|
public bool? EnableDev { get; set; }
|
||||||
|
|
||||||
[JsonProperty("logoPath")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LogoPath
|
/// Gets or sets the LogoPath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("logoPath")]
|
||||||
public string LogoPath { get; set; }
|
public string LogoPath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IconSet
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("iconSet")]
|
[JsonProperty("iconSet")]
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public MCIconSet? IconSet { get; set; }
|
public MCIconSet? IconSet { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the LoginMode
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("loginMode")]
|
[JsonProperty("loginMode")]
|
||||||
public string LoginMode { get; set; }
|
public string LoginMode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Modes
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("modes")]
|
[JsonProperty("modes")]
|
||||||
public Dictionary<string, McMode> Modes { get; set; }
|
public Dictionary<string, McMode> Modes { get; set; }
|
||||||
|
|
||||||
[JsonProperty("enableRemoteLogging")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Logging
|
/// Gets or sets the Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("enableRemoteLogging")]
|
||||||
public bool Logging { get; set; }
|
public bool Logging { get; set; }
|
||||||
|
|
||||||
[JsonProperty("partnerMetadata", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PartnerMetadata
|
/// Gets or sets the PartnerMetadata
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("partnerMetadata", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<MobileControlPartnerMetadata> PartnerMetadata { get; set; }
|
public List<MobileControlPartnerMetadata> PartnerMetadata { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,22 +210,22 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlPartnerMetadata
|
public class MobileControlPartnerMetadata
|
||||||
{
|
{
|
||||||
[JsonProperty("role")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Role
|
/// Gets or sets the Role
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("role")]
|
||||||
public string Role { get; set; }
|
public string Role { get; set; }
|
||||||
|
|
||||||
[JsonProperty("description")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Description
|
/// Gets or sets the Description
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("description")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
[JsonProperty("logoPath")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LogoPath
|
/// Gets or sets the LogoPath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("logoPath")]
|
||||||
public string LogoPath { get; set; }
|
public string LogoPath { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,21 +234,22 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class McMode
|
public class McMode
|
||||||
{
|
{
|
||||||
[JsonProperty("listPageText")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ListPageText
|
/// Gets or sets the ListPageText
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("listPageText")]
|
||||||
public string ListPageText { get; set; }
|
public string ListPageText { get; set; }
|
||||||
[JsonProperty("loginHelpText")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the LoginHelpText
|
/// Gets or sets the LoginHelpText
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("loginHelpText")]
|
||||||
public string LoginHelpText { get; set; }
|
public string LoginHelpText { get; set; }
|
||||||
|
|
||||||
[JsonProperty("passcodePageText")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PasscodePageText
|
/// Gets or sets the PasscodePageText
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("passcodePageText")]
|
||||||
public string PasscodePageText { get; set; }
|
public string PasscodePageText { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,8 +258,19 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum MCIconSet
|
public enum MCIconSet
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Google icon set
|
||||||
|
/// </summary>
|
||||||
GOOGLE,
|
GOOGLE,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Habanero icon set
|
||||||
|
/// </summary>
|
||||||
HABANERO,
|
HABANERO,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Neo icon set
|
||||||
|
/// </summary>
|
||||||
NEO
|
NEO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
@@ -39,10 +39,11 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlRuntimeInfo
|
public class MobileControlRuntimeInfo
|
||||||
{
|
{
|
||||||
[JsonProperty("pluginVersion")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the PluginVersion
|
/// Gets or sets the PluginVersion
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("pluginVersion")]
|
||||||
public string PluginVersion { get; set; }
|
public string PluginVersion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("essentialsVersion")]
|
[JsonProperty("essentialsVersion")]
|
||||||
@@ -51,10 +52,11 @@ namespace PepperDash.Essentials
|
|||||||
[JsonProperty("pepperDashCoreVersion")]
|
[JsonProperty("pepperDashCoreVersion")]
|
||||||
public string PepperDashCoreVersion { get; set; }
|
public string PepperDashCoreVersion { get; set; }
|
||||||
|
|
||||||
[JsonProperty("essentialsPlugins")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EssentialsPlugins
|
/// Gets or sets the EssentialsPlugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("essentialsPlugins")]
|
||||||
public List<LoadedAssembly> EssentialsPlugins { get; set; }
|
public List<LoadedAssembly> EssentialsPlugins { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
using Crestron.SimplSharp;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharp.Net.Http;
|
using Crestron.SimplSharp.Net.Http;
|
||||||
using Crestron.SimplSharp.WebScripting;
|
using Crestron.SimplSharp.WebScripting;
|
||||||
@@ -30,12 +36,6 @@ using PepperDash.Essentials.RoomBridges;
|
|||||||
using PepperDash.Essentials.Services;
|
using PepperDash.Essentials.Services;
|
||||||
using PepperDash.Essentials.WebApiHandlers;
|
using PepperDash.Essentials.WebApiHandlers;
|
||||||
using PepperDash.Essentials.WebSocketServer;
|
using PepperDash.Essentials.WebSocketServer;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebSocketSharp;
|
using WebSocketSharp;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
@@ -244,7 +244,7 @@ namespace PepperDash.Essentials
|
|||||||
CrestronEnvironment.ProgramStatusEventHandler +=
|
CrestronEnvironment.ProgramStatusEventHandler +=
|
||||||
CrestronEnvironment_ProgramStatusEventHandler;
|
CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
|
|
||||||
ApiOnlineAndAuthorized = new BoolFeedback(() =>
|
ApiOnlineAndAuthorized = new BoolFeedback("apiOnlineAndAuthorized", () =>
|
||||||
{
|
{
|
||||||
if (_wsClient2 == null)
|
if (_wsClient2 == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -505,6 +505,25 @@ namespace PepperDash.Essentials
|
|||||||
messengerAdded = true;
|
messengerAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (device is IBasicVideoMuteWithFeedback)
|
||||||
|
{
|
||||||
|
var deviceKey = device.Key;
|
||||||
|
this.LogVerbose(
|
||||||
|
"Adding IBasicVideoMuteWithFeedback for {deviceKey}",
|
||||||
|
deviceKey
|
||||||
|
);
|
||||||
|
|
||||||
|
var videoMuteControlDevice = device as IBasicVideoMuteWithFeedback;
|
||||||
|
var messenger = new IBasicVideoMuteWithFeedbackMessenger(
|
||||||
|
$"{device.Key}-videoMute-{Key}",
|
||||||
|
string.Format("/device/{0}", deviceKey),
|
||||||
|
videoMuteControlDevice
|
||||||
|
);
|
||||||
|
AddDefaultDeviceMessenger(messenger);
|
||||||
|
|
||||||
|
messengerAdded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (device is ILightingScenes || device is LightingBase)
|
if (device is ILightingScenes || device is LightingBase)
|
||||||
{
|
{
|
||||||
var deviceKey = device.Key;
|
var deviceKey = device.Key;
|
||||||
@@ -582,7 +601,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
this.LogVerbose(
|
this.LogVerbose(
|
||||||
"Adding ISetTopBoxControlMessenger for {deviceKey}"
|
"Adding ISetTopBoxControlMessenger for {deviceKey}"
|
||||||
);
|
);
|
||||||
|
|
||||||
var messenger = new ISetTopBoxControlsMessenger(
|
var messenger = new ISetTopBoxControlsMessenger(
|
||||||
$"{device.Key}-stb-{Key}",
|
$"{device.Key}-stb-{Key}",
|
||||||
@@ -599,7 +618,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
this.LogVerbose(
|
this.LogVerbose(
|
||||||
"Adding IChannelMessenger for {deviceKey}", device.Key
|
"Adding IChannelMessenger for {deviceKey}", device.Key
|
||||||
);
|
);
|
||||||
|
|
||||||
var messenger = new IChannelMessenger(
|
var messenger = new IChannelMessenger(
|
||||||
$"{device.Key}-channel-{Key}",
|
$"{device.Key}-channel-{Key}",
|
||||||
@@ -614,7 +633,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
if (device is IColor colorDevice)
|
if (device is IColor colorDevice)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Adding IColorMessenger for {deviceKey}", device.Key);
|
this.LogVerbose("Adding IColorMessenger for {deviceKey}", device.Key);
|
||||||
|
|
||||||
var messenger = new IColorMessenger(
|
var messenger = new IColorMessenger(
|
||||||
$"{device.Key}-color-{Key}",
|
$"{device.Key}-color-{Key}",
|
||||||
@@ -629,7 +648,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
if (device is IDPad dPadDevice)
|
if (device is IDPad dPadDevice)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Adding IDPadMessenger for {deviceKey}", device.Key);
|
this.LogVerbose("Adding IDPadMessenger for {deviceKey}", device.Key);
|
||||||
|
|
||||||
var messenger = new IDPadMessenger(
|
var messenger = new IDPadMessenger(
|
||||||
$"{device.Key}-dPad-{Key}",
|
$"{device.Key}-dPad-{Key}",
|
||||||
@@ -644,7 +663,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
if (device is INumericKeypad nkDevice)
|
if (device is INumericKeypad nkDevice)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Adding INumericKeyapdMessenger for {deviceKey}", device.Key);
|
this.LogVerbose("Adding INumericKeyapdMessenger for {deviceKey}", device.Key);
|
||||||
|
|
||||||
var messenger = new INumericKeypadMessenger(
|
var messenger = new INumericKeypadMessenger(
|
||||||
$"{device.Key}-numericKeypad-{Key}",
|
$"{device.Key}-numericKeypad-{Key}",
|
||||||
@@ -659,7 +678,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
if (device is IHasPowerControl pcDevice)
|
if (device is IHasPowerControl pcDevice)
|
||||||
{
|
{
|
||||||
this.LogVerbose("Adding IHasPowerControlMessenger for {deviceKey}", device.Key);
|
this.LogVerbose("Adding IHasPowerControlMessenger for {deviceKey}", device.Key);
|
||||||
|
|
||||||
var messenger = new IHasPowerMessenger(
|
var messenger = new IHasPowerMessenger(
|
||||||
$"{device.Key}-powerControl-{Key}",
|
$"{device.Key}-powerControl-{Key}",
|
||||||
@@ -693,7 +712,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
this.LogVerbose(
|
this.LogVerbose(
|
||||||
"Adding ITransportMessenger for {deviceKey}", device.Key
|
"Adding ITransportMessenger for {deviceKey}", device.Key
|
||||||
);
|
);
|
||||||
|
|
||||||
var messenger = new ITransportMessenger(
|
var messenger = new ITransportMessenger(
|
||||||
$"{device.Key}-transport-{Key}",
|
$"{device.Key}-transport-{Key}",
|
||||||
@@ -721,6 +740,17 @@ namespace PepperDash.Essentials
|
|||||||
messengerAdded = true;
|
messengerAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (device is ICurrentSources currentSources)
|
||||||
|
{
|
||||||
|
this.LogVerbose("Adding CurrentSourcesMessenger for {deviceKey}", device.Key);
|
||||||
|
|
||||||
|
var messenger = new CurrentSourcesMessenger($"{device.Key}-currentSources-{Key}", $"/device/{device.Key}", currentSources);
|
||||||
|
|
||||||
|
AddDefaultDeviceMessenger(messenger);
|
||||||
|
|
||||||
|
messengerAdded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (device is ISwitchedOutput switchedDevice)
|
if (device is ISwitchedOutput switchedDevice)
|
||||||
{
|
{
|
||||||
this.LogVerbose(
|
this.LogVerbose(
|
||||||
@@ -1454,7 +1484,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds an action to the dictionary
|
/// Adds an action to the dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key">The path of the API command</param>
|
/// <param name="messenger">The messenger for the API command</param>
|
||||||
/// <param name="action">The action to be triggered by the commmand</param>
|
/// <param name="action">The action to be triggered by the commmand</param>
|
||||||
public void AddAction<T>(T messenger, Action<string, string, JToken> action)
|
public void AddAction<T>(T messenger, Action<string, string, JToken> action)
|
||||||
where T : IMobileControlMessenger
|
where T : IMobileControlMessenger
|
||||||
@@ -1625,15 +1655,14 @@ namespace PepperDash.Essentials
|
|||||||
if (Config.EnableApiServer)
|
if (Config.EnableApiServer)
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"Mobile Control Edge Server API Information:
|
"Mobile Control Edge Server API Information:\r\n\r\n" +
|
||||||
|
"\tServer address: {0}\r\n" +
|
||||||
Server address: {0}
|
"\tSystem Name: {1}\r\n" +
|
||||||
System Name: {1}
|
"\tSystem URL: {2}\r\n" +
|
||||||
System URL: {2}
|
"\tSystem UUID: {3}\r\n" +
|
||||||
System UUID: {3}
|
"\tSystem User code: {4}\r\n" +
|
||||||
System User code: {4}
|
"\tConnected?: {5}\r\n" +
|
||||||
Connected?: {5}
|
"\tSeconds Since Last Ack: {6}\r\n",
|
||||||
Seconds Since Last Ack: {6}",
|
|
||||||
url,
|
url,
|
||||||
name,
|
name,
|
||||||
ConfigReader.ConfigObject.SystemUrl,
|
ConfigReader.ConfigObject.SystemUrl,
|
||||||
@@ -1646,10 +1675,8 @@ namespace PepperDash.Essentials
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"
|
"\r\nMobile Control Edge Server API Information:\r\n" +
|
||||||
Mobile Control Edge Server API Information:
|
" Not Enabled in Config.\r\n"
|
||||||
Not Enabled in Config.
|
|
||||||
"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1660,21 +1687,17 @@ Mobile Control Edge Server API Information:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"
|
"\r\nMobile Control Direct Server Information:\r\n" +
|
||||||
Mobile Control Direct Server Information:
|
" User App URL: {0}\r\n" +
|
||||||
User App URL: {0}
|
" Server port: {1}\r\n",
|
||||||
Server port: {1}
|
|
||||||
",
|
|
||||||
string.Format("{0}[insert_client_token]", _directServer.UserAppUrlPrefix),
|
string.Format("{0}[insert_client_token]", _directServer.UserAppUrlPrefix),
|
||||||
_directServer.Port
|
_directServer.Port
|
||||||
);
|
);
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"
|
"\r\n UI Client Info:\r\n" +
|
||||||
UI Client Info:
|
" Tokens Defined: {0}\r\n" +
|
||||||
Tokens Defined: {0}
|
" Clients Connected: {1}\r\n",
|
||||||
Clients Connected: {1}
|
|
||||||
",
|
|
||||||
_directServer.UiClients.Count,
|
_directServer.UiClients.Count,
|
||||||
_directServer.ConnectedUiClientsCount
|
_directServer.ConnectedUiClientsCount
|
||||||
);
|
);
|
||||||
@@ -1692,15 +1715,13 @@ Mobile Control Direct Server Information:
|
|||||||
}
|
}
|
||||||
|
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"
|
"\r\nClient {0}:\r\n" +
|
||||||
Client {0}:
|
"Room Key: {1}\r\n" +
|
||||||
Room Key: {1}
|
"Touchpanel Key: {6}\r\n" +
|
||||||
Touchpanel Key: {6}
|
"Token: {2}\r\n" +
|
||||||
Token: {2}
|
"Client URL: {3}\r\n" +
|
||||||
Client URL: {3}
|
"Connected: {4}\r\n" +
|
||||||
Connected: {4}
|
"Duration: {5}\r\n",
|
||||||
Duration: {5}
|
|
||||||
",
|
|
||||||
clientNo,
|
clientNo,
|
||||||
clientContext.Value.Token.RoomKey,
|
clientContext.Value.Token.RoomKey,
|
||||||
clientContext.Key,
|
clientContext.Key,
|
||||||
@@ -1715,9 +1736,8 @@ Duration: {5}
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
@"
|
"\r\nMobile Control Direct Server Information:\r\n" +
|
||||||
Mobile Control Direct Server Infromation:
|
" Not Enabled in Config.\r\n"
|
||||||
Not Enabled in Config."
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2309,7 +2329,7 @@ Mobile Control Direct Server Infromation:
|
|||||||
{
|
{
|
||||||
this.LogInformation("-- Warning: Incoming message has no registered handler {type}", message.Type);
|
this.LogInformation("-- Warning: Incoming message has no registered handler {type}", message.Type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var handler in handlers)
|
foreach (var handler in handlers)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<Compile Remove="RoomBridges\SourceDeviceMapDictionary.cs" />
|
<Compile Remove="RoomBridges\SourceDeviceMapDictionary.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.90" />
|
||||||
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
|
<PackageReference Include="WebSocketSharp-netstandard" Version="1.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
@@ -17,9 +20,6 @@ using PepperDash.Essentials.Devices.Common.Room;
|
|||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
using PepperDash.Essentials.Room.Config;
|
using PepperDash.Essentials.Room.Config;
|
||||||
using PepperDash.Essentials.WebSocketServer;
|
using PepperDash.Essentials.WebSocketServer;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using IShades = PepperDash.Essentials.Core.Shades.IShades;
|
using IShades = PepperDash.Essentials.Core.Shades.IShades;
|
||||||
using ShadeBase = PepperDash.Essentials.Devices.Common.Shades.ShadeBase;
|
using ShadeBase = PepperDash.Essentials.Devices.Common.Shades.ShadeBase;
|
||||||
|
|
||||||
@@ -485,6 +485,7 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// Sends the full status of the room to the server
|
/// Sends the full status of the room to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
|
/// <param name="id"></param>
|
||||||
private void SendFullStatusForClientId(string id, IEssentialsRoom room)
|
private void SendFullStatusForClientId(string id, IEssentialsRoom room)
|
||||||
{
|
{
|
||||||
//Parent.SendMessageObject(GetFullStatus(room));
|
//Parent.SendMessageObject(GetFullStatus(room));
|
||||||
@@ -554,6 +555,7 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the configuration of the room and the details about the devices associated with the room
|
/// Determines the configuration of the room and the details about the devices associated with the room
|
||||||
|
/// </summary>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private RoomConfiguration GetRoomConfiguration(IEssentialsRoom room)
|
private RoomConfiguration GetRoomConfiguration(IEssentialsRoom room)
|
||||||
@@ -798,31 +800,38 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoomStateMessage : DeviceStateMessageBase
|
public class RoomStateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("configuration", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Configuration
|
/// Gets or sets the Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("configuration", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public RoomConfiguration Configuration { get; set; }
|
public RoomConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
[JsonProperty("activityMode", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("activityMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public int? ActivityMode { get; set; }
|
public int? ActivityMode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("advancedSharingActive", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("advancedSharingActive", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? AdvancedSharingActive { get; set; }
|
public bool? AdvancedSharingActive { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isOn", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isOn", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsOn { get; set; }
|
public bool? IsOn { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isWarmingUp", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isWarmingUp", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsWarmingUp { get; set; }
|
public bool? IsWarmingUp { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isCoolingDown", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isCoolingDown", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsCoolingDown { get; set; }
|
public bool? IsCoolingDown { get; set; }
|
||||||
[JsonProperty("selectedSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the SelectedSourceKey
|
/// Gets or sets the SelectedSourceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("selectedSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string SelectedSourceKey { get; set; }
|
public string SelectedSourceKey { get; set; }
|
||||||
[JsonProperty("share", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Share
|
/// Gets or sets the Share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("share", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public ShareState Share { get; set; }
|
public ShareState Share { get; set; }
|
||||||
|
|
||||||
[JsonProperty("volumes", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("volumes", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -837,13 +846,16 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShareState
|
public class ShareState
|
||||||
{
|
{
|
||||||
[JsonProperty("currentShareText", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CurrentShareText
|
/// Gets or sets the CurrentShareText
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentShareText", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CurrentShareText { get; set; }
|
public string CurrentShareText { get; set; }
|
||||||
|
|
||||||
[JsonProperty("enabled", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("enabled", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? Enabled { get; set; }
|
public bool? Enabled { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isSharing", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("isSharing", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? IsSharing { get; set; }
|
public bool? IsSharing { get; set; }
|
||||||
}
|
}
|
||||||
@@ -853,131 +865,156 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoomConfiguration
|
public class RoomConfiguration
|
||||||
{
|
{
|
||||||
//[JsonProperty("shutdownPromptSeconds", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
//public int? ShutdownPromptSeconds { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("hasVideoConferencing", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasVideoConferencing", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasVideoConferencing { get; set; }
|
public bool? HasVideoConferencing { get; set; }
|
||||||
|
|
||||||
[JsonProperty("videoCodecIsZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("videoCodecIsZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? VideoCodecIsZoomRoom { get; set; }
|
public bool? VideoCodecIsZoomRoom { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasAudioConferencing", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasAudioConferencing", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasAudioConferencing { get; set; }
|
public bool? HasAudioConferencing { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasEnvironmentalControls", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasEnvironmentalControls", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasEnvironmentalControls { get; set; }
|
public bool? HasEnvironmentalControls { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasCameraControls", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasCameraControls", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasCameraControls { get; set; }
|
public bool? HasCameraControls { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasSetTopBoxControls", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasSetTopBoxControls", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasSetTopBoxControls { get; set; }
|
public bool? HasSetTopBoxControls { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasRoutingControls", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasRoutingControls", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? HasRoutingControls { get; set; }
|
public bool? HasRoutingControls { get; set; }
|
||||||
|
|
||||||
[JsonProperty("touchpanelKeys", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TouchpanelKeys
|
/// Gets or sets the TouchpanelKeys
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("touchpanelKeys", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<string> TouchpanelKeys { get; set; }
|
public List<string> TouchpanelKeys { get; set; }
|
||||||
|
|
||||||
[JsonProperty("zoomRoomControllerKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ZoomRoomControllerKey
|
/// Gets or sets the ZoomRoomControllerKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("zoomRoomControllerKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string ZoomRoomControllerKey { get; set; }
|
public string ZoomRoomControllerKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("ciscoNavigatorKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CiscoNavigatorKey
|
/// Gets or sets the CiscoNavigatorKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("ciscoNavigatorKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string CiscoNavigatorKey { get; set; }
|
public string CiscoNavigatorKey { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty("videoCodecKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the VideoCodecKey
|
/// Gets or sets the VideoCodecKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("videoCodecKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string VideoCodecKey { get; set; }
|
public string VideoCodecKey { get; set; }
|
||||||
[JsonProperty("audioCodecKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AudioCodecKey
|
/// Gets or sets the AudioCodecKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("audioCodecKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string AudioCodecKey { get; set; }
|
public string AudioCodecKey { get; set; }
|
||||||
[JsonProperty("matrixRoutingKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MatrixRoutingKey
|
/// Gets or sets the MatrixRoutingKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("matrixRoutingKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string MatrixRoutingKey { get; set; }
|
public string MatrixRoutingKey { get; set; }
|
||||||
[JsonProperty("endpointKeys", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EndpointKeys
|
/// Gets or sets the EndpointKeys
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("endpointKeys", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<string> EndpointKeys { get; set; }
|
public List<string> EndpointKeys { get; set; }
|
||||||
|
|
||||||
[JsonProperty("accessoryDeviceKeys", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AccessoryDeviceKeys
|
/// Gets or sets the AccessoryDeviceKeys
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("accessoryDeviceKeys", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<string> AccessoryDeviceKeys { get; set; }
|
public List<string> AccessoryDeviceKeys { get; set; }
|
||||||
|
|
||||||
[JsonProperty("defaultDisplayKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DefaultDisplayKey
|
/// Gets or sets the DefaultDisplayKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("defaultDisplayKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DefaultDisplayKey { get; set; }
|
public string DefaultDisplayKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("destinations", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("destinations", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Dictionary<eSourceListItemDestinationTypes, string> Destinations { get; set; }
|
public Dictionary<eSourceListItemDestinationTypes, string> Destinations { get; set; }
|
||||||
[JsonProperty("environmentalDevices", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the EnvironmentalDevices
|
/// Gets or sets the EnvironmentalDevices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("environmentalDevices", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<EnvironmentalDeviceConfiguration> EnvironmentalDevices { get; set; }
|
public List<EnvironmentalDeviceConfiguration> EnvironmentalDevices { get; set; }
|
||||||
|
|
||||||
[JsonProperty("sourceList", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("sourceList", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Dictionary<string, SourceListItem> SourceList { get; set; }
|
public Dictionary<string, SourceListItem> SourceList { get; set; }
|
||||||
|
|
||||||
[JsonProperty("destinationList", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("destinationList", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Dictionary<string, DestinationListItem> DestinationList { get; set; }
|
public Dictionary<string, DestinationListItem> DestinationList { get; set; }
|
||||||
|
|
||||||
[JsonProperty("audioControlPointList", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AudioControlPointList
|
/// Gets or sets the AudioControlPointList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("audioControlPointList", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public AudioControlPointListItem AudioControlPointList { get; set; }
|
public AudioControlPointListItem AudioControlPointList { get; set; }
|
||||||
|
|
||||||
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Dictionary<string, CameraListItem> CameraList { get; set; }
|
public Dictionary<string, CameraListItem> CameraList { get; set; }
|
||||||
|
|
||||||
[JsonProperty("defaultPresentationSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DefaultPresentationSourceKey
|
/// Gets or sets the DefaultPresentationSourceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("defaultPresentationSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DefaultPresentationSourceKey { get; set; }
|
public string DefaultPresentationSourceKey { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty("helpMessage", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HelpMessage
|
/// Gets or sets the HelpMessage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("helpMessage", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string HelpMessage { get; set; }
|
public string HelpMessage { get; set; }
|
||||||
|
|
||||||
[JsonProperty("techPassword", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TechPassword
|
/// Gets or sets the TechPassword
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("techPassword", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string TechPassword { get; set; }
|
public string TechPassword { get; set; }
|
||||||
|
|
||||||
[JsonProperty("uiBehavior", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UiBehavior
|
/// Gets or sets the UiBehavior
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("uiBehavior", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
|
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
|
||||||
|
|
||||||
[JsonProperty("supportsAdvancedSharing", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("supportsAdvancedSharing", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? SupportsAdvancedSharing { get; set; }
|
public bool? SupportsAdvancedSharing { get; set; }
|
||||||
|
|
||||||
[JsonProperty("userCanChangeShareMode", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("userCanChangeShareMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? UserCanChangeShareMode { get; set; }
|
public bool? UserCanChangeShareMode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("roomCombinerKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomCombinerKey
|
/// Gets or sets the RoomCombinerKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("roomCombinerKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string RoomCombinerKey { get; set; }
|
public string RoomCombinerKey { get; set; }
|
||||||
|
|
||||||
public RoomConfiguration()
|
public RoomConfiguration()
|
||||||
@@ -994,17 +1031,19 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EnvironmentalDeviceConfiguration
|
public class EnvironmentalDeviceConfiguration
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceKey
|
/// Gets or sets the DeviceKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("deviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string DeviceKey { get; private set; }
|
public string DeviceKey { get; private set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
[JsonProperty("deviceType", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DeviceType
|
/// Gets or sets the DeviceType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
[JsonProperty("deviceType", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public eEnvironmentalDeviceTypes DeviceType { get; private set; }
|
public eEnvironmentalDeviceTypes DeviceType { get; private set; }
|
||||||
|
|
||||||
public EnvironmentalDeviceConfiguration(string key, eEnvironmentalDeviceTypes type)
|
public EnvironmentalDeviceConfiguration(string key, eEnvironmentalDeviceTypes type)
|
||||||
@@ -1031,57 +1070,18 @@ namespace PepperDash.Essentials.RoomBridges
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ApiTouchPanelToken
|
public class ApiTouchPanelToken
|
||||||
{
|
{
|
||||||
[JsonProperty("touchPanels", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TouchPanels
|
/// Gets or sets the TouchPanels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("touchPanels", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public List<JoinToken> TouchPanels { get; set; } = new List<JoinToken>();
|
public List<JoinToken> TouchPanels { get; set; } = new List<JoinToken>();
|
||||||
|
|
||||||
[JsonProperty("userAppUrl", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UserAppUrl
|
/// Gets or sets the UserAppUrl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("userAppUrl", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string UserAppUrl { get; set; } = "";
|
public string UserAppUrl { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SERIES3
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a SourceSelectMessageContent
|
|
||||||
/// </summary>
|
|
||||||
public class SourceSelectMessageContent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the SourceListItem
|
|
||||||
/// </summary>
|
|
||||||
public string SourceListItem { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the SourceListKey
|
|
||||||
/// </summary>
|
|
||||||
public string SourceListKey { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a DirectRoute
|
|
||||||
/// </summary>
|
|
||||||
public class DirectRoute
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the SourceKey
|
|
||||||
/// </summary>
|
|
||||||
public string SourceKey { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the DestinationKey
|
|
||||||
/// </summary>
|
|
||||||
public string DestinationKey { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="b"></param>
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate for PressAndHoldAction
|
|
||||||
/// </summary>
|
|
||||||
public delegate void PressAndHoldAction(bool b);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
using Crestron.SimplSharpPro.UI;
|
using Crestron.SimplSharpPro.UI;
|
||||||
@@ -14,6 +16,7 @@ using PepperDash.Essentials.Core.Config;
|
|||||||
using PepperDash.Essentials.Core.DeviceInfo;
|
using PepperDash.Essentials.Core.DeviceInfo;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
using PepperDash.Essentials.Core.UI;
|
using PepperDash.Essentials.Core.UI;
|
||||||
|
using Serilog.Events;
|
||||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Touchpanel
|
namespace PepperDash.Essentials.Touchpanel
|
||||||
@@ -106,6 +109,11 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
|
|
||||||
public ReadOnlyCollection<ConnectedIpInformation> ConnectedIps => Panel.ConnectedIpList;
|
public ReadOnlyCollection<ConnectedIpInformation> ConnectedIps => Panel.ConnectedIpList;
|
||||||
|
|
||||||
|
private System.Net.IPAddress csIpAddress;
|
||||||
|
|
||||||
|
private System.Net.IPAddress csSubnetMask;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the MobileControlTouchpanelController class.
|
/// Initializes a new instance of the MobileControlTouchpanelController class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -182,6 +190,20 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
};
|
};
|
||||||
|
|
||||||
RegisterForExtenders();
|
RegisterForExtenders();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var csAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetCSAdapter);
|
||||||
|
var csSubnetMask = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, csAdapterId);
|
||||||
|
var csIpAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, csAdapterId);
|
||||||
|
|
||||||
|
this.csSubnetMask = System.Net.IPAddress.Parse(csSubnetMask);
|
||||||
|
this.csIpAddress = System.Net.IPAddress.Parse(csIpAddress);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.LogInformation("This processor does not have a CS LAN", this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -381,19 +403,81 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
McServerUrlFeedback.LinkInputSig(Panel.StringInput[3]);
|
McServerUrlFeedback.LinkInputSig(Panel.StringInput[3]);
|
||||||
UserCodeFeedback.LinkInputSig(Panel.StringInput[4]);
|
UserCodeFeedback.LinkInputSig(Panel.StringInput[4]);
|
||||||
|
|
||||||
|
Panel.IpInformationChange += (sender, args) =>
|
||||||
|
{
|
||||||
|
if (args.Connected)
|
||||||
|
{
|
||||||
|
this.LogVerbose("Connection from IP: {ip}", args.DeviceIpAddress);
|
||||||
|
this.LogInformation("Sending {appUrl} on join 1", AppUrlFeedback.StringValue);
|
||||||
|
|
||||||
|
var appUrl = GetUrlWithCorrectIp(_appUrl);
|
||||||
|
Panel.StringInput[1].StringValue = appUrl;
|
||||||
|
|
||||||
|
SetAppUrl(appUrl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.LogVerbose("Disconnection from IP: {ip}", args.DeviceIpAddress);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Panel.OnlineStatusChange += (sender, args) =>
|
Panel.OnlineStatusChange += (sender, args) =>
|
||||||
{
|
{
|
||||||
UpdateFeedbacks();
|
|
||||||
|
|
||||||
this.LogInformation("Sending {appUrl} on join 1", AppUrlFeedback.StringValue);
|
this.LogInformation("Sending {appUrl} on join 1", AppUrlFeedback.StringValue);
|
||||||
|
|
||||||
Panel.StringInput[1].StringValue = AppUrlFeedback.StringValue;
|
UpdateFeedbacks();
|
||||||
|
Panel.StringInput[1].StringValue = _appUrl;
|
||||||
Panel.StringInput[2].StringValue = QrCodeUrlFeedback.StringValue;
|
Panel.StringInput[2].StringValue = QrCodeUrlFeedback.StringValue;
|
||||||
Panel.StringInput[3].StringValue = McServerUrlFeedback.StringValue;
|
Panel.StringInput[3].StringValue = McServerUrlFeedback.StringValue;
|
||||||
Panel.StringInput[4].StringValue = UserCodeFeedback.StringValue;
|
Panel.StringInput[4].StringValue = UserCodeFeedback.StringValue;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the URL with the correct IP address based on the connected devices and the Crestron processor's IP address.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string GetUrlWithCorrectIp(string url)
|
||||||
|
{
|
||||||
|
var lanAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter);
|
||||||
|
|
||||||
|
var processorIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, lanAdapterId);
|
||||||
|
|
||||||
|
if(csIpAddress == null || csSubnetMask == null || url == null)
|
||||||
|
{
|
||||||
|
this.LogWarning("CS IP Address Subnet Mask or url is null, cannot determine correct IP for URL");
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.LogVerbose("Processor IP: {processorIp}, CS IP: {csIpAddress}, CS Subnet Mask: {csSubnetMask}", processorIp, csIpAddress, csSubnetMask);
|
||||||
|
this.LogVerbose("Connected IP Count: {connectedIps}", ConnectedIps.Count);
|
||||||
|
|
||||||
|
var ip = ConnectedIps.Any(ipInfo =>
|
||||||
|
{
|
||||||
|
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
|
||||||
|
{
|
||||||
|
return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
|
||||||
|
}
|
||||||
|
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
|
||||||
|
return false;
|
||||||
|
}) ? csIpAddress.ToString() : processorIp;
|
||||||
|
|
||||||
|
var match = Regex.Match(url, @"^http://([^:/]+):\d+/mc/app\?token=.+$");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
string ipa = match.Groups[1].Value;
|
||||||
|
// ip will be "192.168.1.100"
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace ipa with ip but leave the rest of the string intact
|
||||||
|
var updatedUrl = Regex.Replace(url, @"^http://[^:/]+", $"http://{ip}");
|
||||||
|
|
||||||
|
this.LogVerbose("Updated URL: {updatedUrl}", updatedUrl);
|
||||||
|
|
||||||
|
return updatedUrl;
|
||||||
|
}
|
||||||
|
|
||||||
private void SubscribeForMobileControlUpdates()
|
private void SubscribeForMobileControlUpdates()
|
||||||
{
|
{
|
||||||
foreach (var dev in DeviceManager.AllDevices)
|
foreach (var dev in DeviceManager.AllDevices)
|
||||||
@@ -426,7 +510,7 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
_bridge.UserCodeChanged += UpdateFeedbacks;
|
_bridge.UserCodeChanged += UpdateFeedbacks;
|
||||||
_bridge.AppUrlChanged += (s, a) =>
|
_bridge.AppUrlChanged += (s, a) =>
|
||||||
{
|
{
|
||||||
this.LogInformation("AppURL changed");
|
this.LogInformation("AppURL changed: {appURL}", _bridge.AppUrl);
|
||||||
SetAppUrl(_bridge.AppUrl);
|
SetAppUrl(_bridge.AppUrl);
|
||||||
UpdateFeedbacks(s, a);
|
UpdateFeedbacks(s, a);
|
||||||
};
|
};
|
||||||
@@ -443,7 +527,8 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetAppUrl(string url)
|
public void SetAppUrl(string url)
|
||||||
{
|
{
|
||||||
_appUrl = url;
|
_appUrl = GetUrlWithCorrectIp(url);
|
||||||
|
|
||||||
AppUrlFeedback.FireUpdate();
|
AppUrlFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,28 +8,32 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesConfig
|
public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesConfig
|
||||||
{
|
{
|
||||||
[JsonProperty("useDirectServer")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UseDirectServer
|
/// Gets or sets the UseDirectServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("useDirectServer")]
|
||||||
public bool UseDirectServer { get; set; } = false;
|
public bool UseDirectServer { get; set; } = false;
|
||||||
|
|
||||||
[JsonProperty("zoomRoomController")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ZoomRoomController
|
/// Gets or sets the ZoomRoomController
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("zoomRoomController")]
|
||||||
public bool ZoomRoomController { get; set; } = false;
|
public bool ZoomRoomController { get; set; } = false;
|
||||||
|
|
||||||
[JsonProperty("buttonToolbarTimeoutInS")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ButtonToolbarTimoutInS
|
/// Gets or sets the ButtonToolbarTimoutInS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("buttonToolbarTimeoutInS")]
|
||||||
public ushort ButtonToolbarTimoutInS { get; set; } = 0;
|
public ushort ButtonToolbarTimoutInS { get; set; } = 0;
|
||||||
|
|
||||||
[JsonProperty("theme")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Theme
|
/// Gets or sets the Theme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("theme")]
|
||||||
public string Theme { get; set; } = "light";
|
public string Theme { get; set; } = "light";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,10 +42,11 @@ namespace PepperDash.Essentials.Touchpanel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ThemeUpdateMessage : DeviceStateMessageBase
|
public class ThemeUpdateMessage : DeviceStateMessageBase
|
||||||
{
|
{
|
||||||
[JsonProperty("theme")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Theme
|
/// Gets or sets the Theme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("theme")]
|
||||||
public string Theme { get; set; }
|
public string Theme { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,18 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserCodeChangedContent
|
public class UserCodeChangedContent
|
||||||
{
|
{
|
||||||
[JsonProperty("userCode")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UserCode
|
/// Gets or sets the UserCode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("userCode")]
|
||||||
public string UserCode { get; set; }
|
public string UserCode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the QrChecksum
|
/// Gets or sets the QrChecksum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
|
||||||
public string QrChecksum { get; set; }
|
public string QrChecksum { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -8,10 +8,11 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Volumes
|
public class Volumes
|
||||||
{
|
{
|
||||||
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Master
|
/// Gets or sets the Master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public Volume Master { get; set; }
|
public Volume Master { get; set; }
|
||||||
|
|
||||||
[JsonProperty("auxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("auxFaders", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -30,10 +31,11 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Volume
|
public class Volume
|
||||||
{
|
{
|
||||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Key
|
/// Gets or sets the Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -42,10 +44,11 @@ namespace PepperDash.Essentials
|
|||||||
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public bool? Muted { get; set; }
|
public bool? Muted { get; set; }
|
||||||
|
|
||||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Label
|
/// Gets or sets the Label
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Label { get; set; }
|
public string Label { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
@@ -58,10 +61,11 @@ namespace PepperDash.Essentials
|
|||||||
public bool? PrivacyMuted { get; set; }
|
public bool? PrivacyMuted { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MuteIcon
|
/// Gets or sets the MuteIcon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string MuteIcon { get; set; }
|
public string MuteIcon { get; set; }
|
||||||
|
|
||||||
public Volume(string key, int level, bool muted, string label, bool hasMute, string muteIcon)
|
public Volume(string key, int level, bool muted, string label, bool hasMute, string muteIcon)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Crestron.SimplSharp.WebScripting;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Crestron.SimplSharp.WebScripting;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core.Web.RequestHandlers;
|
using PepperDash.Core.Web.RequestHandlers;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.WebApiHandlers
|
namespace PepperDash.Essentials.WebApiHandlers
|
||||||
{
|
{
|
||||||
@@ -51,16 +51,18 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ActionPath
|
public class ActionPath
|
||||||
{
|
{
|
||||||
[JsonProperty("messengerKey")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MessengerKey
|
/// Gets or sets the MessengerKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("messengerKey")]
|
||||||
public string MessengerKey { get; set; }
|
public string MessengerKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("path")]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Path
|
/// Gets or sets the Path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("path")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,22 +148,25 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClientRequest
|
public class ClientRequest
|
||||||
{
|
{
|
||||||
[JsonProperty("roomKey", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RoomKey
|
/// Gets or sets the RoomKey
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("roomKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
[JsonProperty("grantCode", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the GrantCode
|
/// Gets or sets the GrantCode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("grantCode", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string GrantCode { get; set; }
|
public string GrantCode { get; set; }
|
||||||
|
|
||||||
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Token
|
/// Gets or sets the Token
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,22 +175,25 @@ namespace PepperDash.Essentials.WebApiHandlers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClientResponse
|
public class ClientResponse
|
||||||
{
|
{
|
||||||
[JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Error
|
/// Gets or sets the Error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Error { get; set; }
|
public string Error { get; set; }
|
||||||
|
|
||||||
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Token
|
/// Gets or sets the Token
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
|
||||||
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Path
|
/// Gets or sets the Path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents info about a device including supproted interfaces
|
||||||
|
/// </summary>
|
||||||
|
public class DeviceInterfaceInfo : IKeyName
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Key
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("key")]
|
||||||
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Name
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Interfaces
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("interfaces")]
|
||||||
|
public List<string> Interfaces { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JoinResponse
|
||||||
|
/// </summary>
|
||||||
|
public class JoinResponse
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ClientId
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("clientId")]
|
||||||
|
public string ClientId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("roomKey")]
|
||||||
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("systemUUid")]
|
||||||
|
public string SystemUuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RoomUuid
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("roomUUid")]
|
||||||
|
public string RoomUuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Config
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("config")]
|
||||||
|
public object Config { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the CodeExpires
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("codeExpires")]
|
||||||
|
public DateTime CodeExpires { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UserCode
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("userCode")]
|
||||||
|
public string UserCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UserAppUrl
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("userAppUrl")]
|
||||||
|
public string UserAppUrl { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the EnableDebug
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("enableDebug")]
|
||||||
|
public bool EnableDebug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DeviceInterfaceSupport
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("deviceInterfaceSupport")]
|
||||||
|
public Dictionary<string, DeviceInterfaceInfo> DeviceInterfaceSupport { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JoinToken
|
||||||
|
/// </summary>
|
||||||
|
public class JoinToken
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Code
|
||||||
|
/// </summary>
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
public string RoomKey { get; set; }
|
||||||
|
|
||||||
|
public string Uuid { get; set; }
|
||||||
|
|
||||||
|
public string TouchpanelKey { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Token
|
||||||
|
/// </summary>
|
||||||
|
public string Token { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -41,8 +42,14 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
|
|
||||||
private HttpServer _server;
|
private HttpServer _server;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the HttpServer instance
|
||||||
|
/// </summary>
|
||||||
public HttpServer Server => _server;
|
public HttpServer Server => _server;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of UI client contexts
|
||||||
|
/// </summary>
|
||||||
public Dictionary<string, UiClientContext> UiClients { get; private set; }
|
public Dictionary<string, UiClientContext> UiClients { get; private set; }
|
||||||
|
|
||||||
private readonly MobileControlSystemController _parent;
|
private readonly MobileControlSystemController _parent;
|
||||||
@@ -61,17 +68,20 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string lanIpAddress => CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter));
|
private string LanIpAddress => CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter));
|
||||||
|
|
||||||
private System.Net.IPAddress csIpAddress;
|
private readonly System.Net.IPAddress csIpAddress;
|
||||||
|
|
||||||
private System.Net.IPAddress csSubnetMask;
|
private readonly System.Net.IPAddress csSubnetMask;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The path for the WebSocket messaging
|
/// The path for the WebSocket messaging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly string _wsPath = "/mc/api/ui/join/";
|
private readonly string _wsPath = "/mc/api/ui/join/";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the WebSocket path
|
||||||
|
/// </summary>
|
||||||
public string WsPath => _wsPath;
|
public string WsPath => _wsPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -89,6 +99,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Port { get; private set; }
|
public int Port { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user app URL prefix
|
||||||
|
/// </summary>
|
||||||
public string UserAppUrlPrefix
|
public string UserAppUrlPrefix
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -101,6 +114,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the count of connected UI clients
|
||||||
|
/// </summary>
|
||||||
public int ConnectedUiClientsCount
|
public int ConnectedUiClientsCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -119,6 +135,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the MobileControlWebsocketServer class.
|
||||||
|
/// </summary>
|
||||||
public MobileControlWebsocketServer(string key, int customPort, MobileControlSystemController parent)
|
public MobileControlWebsocketServer(string key, int customPort, MobileControlSystemController parent)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
@@ -136,7 +155,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Automatically forwarding port {0} to CS LAN", Port);
|
this.LogInformation("Automatically forwarding port {port} to CS LAN", Port);
|
||||||
|
|
||||||
var csAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetCSAdapter);
|
var csAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetCSAdapter);
|
||||||
var csIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, csAdapterId);
|
var csIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, csAdapterId);
|
||||||
@@ -145,16 +164,17 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
|
|
||||||
if (result != CrestronEthernetHelper.PortForwardingUserPatRetCodes.NoErr)
|
if (result != CrestronEthernetHelper.PortForwardingUserPatRetCodes.NoErr)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Error, "Error adding port forwarding: {0}", result);
|
this.LogError("Error adding port forwarding: {error}", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "This processor does not have a CS LAN", this);
|
this.LogInformation("This processor does not have a CS LAN", this);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(ex, "Error automatically forwarding port to CS LAN");
|
this.LogError("Error automatically forwarding port to CS LAN: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +191,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
{
|
{
|
||||||
if (parent.Config.DirectServer.AutomaticallyForwardPortToCSLAN == false)
|
if (parent.Config.DirectServer.AutomaticallyForwardPortToCSLAN == false)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "This processor does not have a CS LAN", this);
|
this.LogInformation("This processor does not have a CS LAN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,13 +260,15 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
_server.OnPost += Server_OnPost;
|
_server.OnPost += Server_OnPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_server.Log.Output = (data, level) => this.LogInformation("WebSocket Server Log [{level}]: {data}", level, data);
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
|
|
||||||
_server.Start();
|
_server.Start();
|
||||||
|
|
||||||
if (_server.IsListening)
|
if (_server.IsListening)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Mobile Control WebSocket Server listening on port {port}", this, _server.Port);
|
this.LogInformation("Mobile Control WebSocket Server listening on port {port}", _server.Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += OnProgramStop;
|
CrestronEnvironment.ProgramStatusEventHandler += OnProgramStop;
|
||||||
@@ -259,7 +281,8 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(ex, "Exception intializing websocket server", this);
|
this.LogError("Exception initializing direct server: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,17 +350,10 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
string ip = processorIp;
|
string ip = processorIp;
|
||||||
if (touchpanel.Touchpanel is IMobileControlCrestronTouchpanelController crestronTouchpanel && csIpAddress != null)
|
|
||||||
|
if (_parent.Config.DirectServer.CSLanUiDeviceKeys != null && _parent.Config.DirectServer.CSLanUiDeviceKeys.Any(k => k.Equals(touchpanel.Touchpanel.Key, StringComparison.InvariantCultureIgnoreCase)) && csIpAddress != null)
|
||||||
{
|
{
|
||||||
ip = crestronTouchpanel.ConnectedIps.Any(ipInfo =>
|
ip = csIpAddress.ToString();
|
||||||
{
|
|
||||||
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
|
|
||||||
{
|
|
||||||
return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
|
|
||||||
}
|
|
||||||
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
|
|
||||||
return false;
|
|
||||||
}) ? csIpAddress.ToString() : processorIp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";
|
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";
|
||||||
@@ -449,7 +465,8 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.LogError(ex, "Error getting application configuration");
|
this.LogError("Error getting application configuration: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -485,15 +502,14 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
{
|
{
|
||||||
if (token.Value == null)
|
if (token.Value == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Warning, "Token value is null", this);
|
this.LogWarning("Token value is null");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Adding token: {0} for room: {1}", this, token.Key, token.Value.RoomKey);
|
this.LogInformation("Adding token: {key} for room: {roomKey}", token.Key, token.Value.RoomKey);
|
||||||
|
|
||||||
if (UiClients == null)
|
if (UiClients == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Warning, "UiClients is null", this);
|
|
||||||
UiClients = new Dictionary<string, UiClientContext>();
|
UiClients = new Dictionary<string, UiClientContext>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +519,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
|
|
||||||
if (UiClients.Count > 0)
|
if (UiClients.Count > 0)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Restored {uiClientCount} UiClients from secrets data", this, UiClients.Count);
|
this.LogInformation("Restored {uiClientCount} UiClients from secrets data", UiClients.Count);
|
||||||
|
|
||||||
foreach (var client in UiClients)
|
foreach (var client in UiClients)
|
||||||
{
|
{
|
||||||
@@ -513,36 +529,28 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
|
|
||||||
_server.AddWebSocketService(path, () =>
|
_server.AddWebSocketService(path, () =>
|
||||||
{
|
{
|
||||||
var c = new UiClient();
|
var c = new UiClient($"uiclient-{key}-{roomKey}");
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "Constructing UiClient with id: {key}", this, key);
|
this.LogDebug("Constructing UiClient with id: {key}", key);
|
||||||
|
|
||||||
c.Controller = _parent;
|
c.Controller = _parent;
|
||||||
c.RoomKey = roomKey;
|
c.RoomKey = roomKey;
|
||||||
UiClients[key].SetClient(c);
|
UiClients[key].SetClient(c);
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//_server.WebSocketServices.AddService<UiClient>(path, (c) =>
|
|
||||||
//{
|
|
||||||
// Debug.Console(2, this, "Constructing UiClient with id: {0}", key);
|
|
||||||
// c.Controller = _parent;
|
|
||||||
// c.RoomKey = roomKey;
|
|
||||||
// UiClients[key].SetClient(c);
|
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Warning, "No secret found");
|
this.LogWarning("No secret found");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Debug, "{uiClientCount} UiClients restored from secrets data", this, UiClients.Count);
|
this.LogDebug("{uiClientCount} UiClients restored from secrets data", UiClients.Count);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(ex, "Exception retrieving secret", this);
|
this.LogError("Exception retrieving secret: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +563,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
{
|
{
|
||||||
if (_secret == null)
|
if (_secret == null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Error, "Secret is null", this);
|
this.LogError("Secret is null");
|
||||||
|
|
||||||
_secret = new ServerTokenSecrets(string.Empty);
|
_secret = new ServerTokenSecrets(string.Empty);
|
||||||
}
|
}
|
||||||
@@ -573,7 +581,8 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(ex, "Exception updating secret", this);
|
this.LogError("Exception updating secret: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,6 +630,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
CrestronConsole.ConsoleCommandResponse($"Token: {token}");
|
CrestronConsole.ConsoleCommandResponse($"Token: {token}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validates the grant code against the room key
|
||||||
|
/// </summary>
|
||||||
public (string, string) ValidateGrantCode(string grantCode, string roomKey)
|
public (string, string) ValidateGrantCode(string grantCode, string roomKey)
|
||||||
{
|
{
|
||||||
var bridge = _parent.GetRoomBridge(roomKey);
|
var bridge = _parent.GetRoomBridge(roomKey);
|
||||||
@@ -634,6 +646,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
return ValidateGrantCode(grantCode, bridge);
|
return ValidateGrantCode(grantCode, bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validates the grant code against the room key
|
||||||
|
/// </summary>
|
||||||
public (string, string) ValidateGrantCode(string grantCode, MobileControlBridgeBase bridge)
|
public (string, string) ValidateGrantCode(string grantCode, MobileControlBridgeBase bridge)
|
||||||
{
|
{
|
||||||
// TODO: Authenticate grant code passed in
|
// TODO: Authenticate grant code passed in
|
||||||
@@ -655,6 +670,9 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates a new client token for the specified bridge
|
||||||
|
/// </summary>
|
||||||
public (string, string) GenerateClientToken(MobileControlBridgeBase bridge, string touchPanelKey = "")
|
public (string, string) GenerateClientToken(MobileControlBridgeBase bridge, string touchPanelKey = "")
|
||||||
{
|
{
|
||||||
var key = Guid.NewGuid().ToString();
|
var key = Guid.NewGuid().ToString();
|
||||||
@@ -667,18 +685,18 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
|
|
||||||
_server.AddWebSocketService(path, () =>
|
_server.AddWebSocketService(path, () =>
|
||||||
{
|
{
|
||||||
var c = new UiClient();
|
var c = new UiClient($"uiclient-{key}-{bridge.RoomKey}");
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "Constructing UiClient with id: {0}", this, key);
|
this.LogVerbose("Constructing UiClient with id: {key}", key);
|
||||||
c.Controller = _parent;
|
c.Controller = _parent;
|
||||||
c.RoomKey = bridge.RoomKey;
|
c.RoomKey = bridge.RoomKey;
|
||||||
UiClients[key].SetClient(c);
|
UiClients[key].SetClient(c);
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Added new WebSocket UiClient service at path: {path}", this, path);
|
this.LogInformation("Added new WebSocket UiClient service at path: {path}", path);
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Token: {@token}", this, token);
|
this.LogInformation("Token: {@token}", token);
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "{serviceCount} websocket services present", this, _server.WebSocketServices.Count);
|
this.LogVerbose("{serviceCount} websocket services present", _server.WebSocketServices.Count);
|
||||||
|
|
||||||
UpdateSecret();
|
UpdateSecret();
|
||||||
|
|
||||||
@@ -692,7 +710,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
{
|
{
|
||||||
if (s == "?" || string.IsNullOrEmpty(s))
|
if (s == "?" || string.IsNullOrEmpty(s))
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(@"Removes all clients from the server. To execute add 'confirm' to command");
|
CrestronConsole.ConsoleCommandResponse(@"Remove all clients from the server. To execute add 'confirm' to command");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,7 +864,8 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(ex, "Caught an exception in the OnGet handler", this);
|
this.LogError("Exception in OnGet handler: {message}", ex.Message);
|
||||||
|
this.LogDebug(ex, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -935,6 +954,20 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
res.StatusCode = 200;
|
res.StatusCode = 200;
|
||||||
res.ContentType = "application/json";
|
res.ContentType = "application/json";
|
||||||
|
|
||||||
|
var devices = DeviceManager.GetDevices();
|
||||||
|
Dictionary<string, DeviceInterfaceInfo> deviceInterfaces = new Dictionary<string, DeviceInterfaceInfo>();
|
||||||
|
|
||||||
|
foreach (var device in devices)
|
||||||
|
{
|
||||||
|
var interfaces = device?.GetType().GetInterfaces().Select((i) => i.Name).ToList() ?? new List<string>();
|
||||||
|
deviceInterfaces.Add(device.Key, new DeviceInterfaceInfo
|
||||||
|
{
|
||||||
|
Key = device.Key,
|
||||||
|
Name = device is IKeyName ? (device as IKeyName).Name : "",
|
||||||
|
Interfaces = interfaces
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the response object
|
// Construct the response object
|
||||||
JoinResponse jRes = new JoinResponse
|
JoinResponse jRes = new JoinResponse
|
||||||
{
|
{
|
||||||
@@ -948,7 +981,8 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
UserAppUrl = string.Format("http://{0}:{1}/mc/app",
|
UserAppUrl = string.Format("http://{0}:{1}/mc/app",
|
||||||
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0),
|
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0),
|
||||||
Port),
|
Port),
|
||||||
EnableDebug = false
|
EnableDebug = false,
|
||||||
|
DeviceInterfaceSupport = deviceInterfaces
|
||||||
};
|
};
|
||||||
|
|
||||||
// Serialize to JSON and convert to Byte[]
|
// Serialize to JSON and convert to Byte[]
|
||||||
@@ -1134,7 +1168,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.LogVerbose("File not found: {filePath}", filePath);
|
this.LogWarning("File not found: {filePath}", filePath);
|
||||||
res.StatusCode = (int)HttpStatusCode.NotFound;
|
res.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
res.Close();
|
res.Close();
|
||||||
return;
|
return;
|
||||||
@@ -1204,145 +1238,4 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a Version
|
|
||||||
/// </summary>
|
|
||||||
public class Version
|
|
||||||
{
|
|
||||||
[JsonProperty("serverVersion")]
|
|
||||||
public string ServerVersion { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("serverIsRunningOnProcessorHardware")]
|
|
||||||
public bool ServerIsRunningOnProcessorHardware { get; private set; }
|
|
||||||
|
|
||||||
public Version()
|
|
||||||
{
|
|
||||||
ServerIsRunningOnProcessorHardware = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a UiClientContext
|
|
||||||
/// </summary>
|
|
||||||
public class UiClientContext
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Client
|
|
||||||
/// </summary>
|
|
||||||
public UiClient Client { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Token
|
|
||||||
/// </summary>
|
|
||||||
public JoinToken Token { get; private set; }
|
|
||||||
|
|
||||||
public UiClientContext(JoinToken token)
|
|
||||||
{
|
|
||||||
Token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SetClient method
|
|
||||||
/// </summary>
|
|
||||||
public void SetClient(UiClient client)
|
|
||||||
{
|
|
||||||
Client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a ServerTokenSecrets
|
|
||||||
/// </summary>
|
|
||||||
public class ServerTokenSecrets
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the GrantCode
|
|
||||||
/// </summary>
|
|
||||||
public string GrantCode { get; set; }
|
|
||||||
|
|
||||||
public Dictionary<string, JoinToken> Tokens { get; set; }
|
|
||||||
|
|
||||||
public ServerTokenSecrets(string grantCode)
|
|
||||||
{
|
|
||||||
GrantCode = grantCode;
|
|
||||||
Tokens = new Dictionary<string, JoinToken>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a JoinToken
|
|
||||||
/// </summary>
|
|
||||||
public class JoinToken
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Code
|
|
||||||
/// </summary>
|
|
||||||
public string Code { get; set; }
|
|
||||||
|
|
||||||
public string RoomKey { get; set; }
|
|
||||||
|
|
||||||
public string Uuid { get; set; }
|
|
||||||
|
|
||||||
public string TouchpanelKey { get; set; } = "";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Token
|
|
||||||
/// </summary>
|
|
||||||
public string Token { get; set; } = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a JoinResponse
|
|
||||||
/// </summary>
|
|
||||||
public class JoinResponse
|
|
||||||
{
|
|
||||||
[JsonProperty("clientId")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the ClientId
|
|
||||||
/// </summary>
|
|
||||||
public string ClientId { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("roomKey")]
|
|
||||||
public string RoomKey { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("systemUUid")]
|
|
||||||
public string SystemUuid { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("roomUUid")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the RoomUuid
|
|
||||||
/// </summary>
|
|
||||||
public string RoomUuid { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("config")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Config
|
|
||||||
/// </summary>
|
|
||||||
public object Config { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("codeExpires")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the CodeExpires
|
|
||||||
/// </summary>
|
|
||||||
public DateTime CodeExpires { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("userCode")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the UserCode
|
|
||||||
/// </summary>
|
|
||||||
public string UserCode { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("userAppUrl")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the UserAppUrl
|
|
||||||
/// </summary>
|
|
||||||
public string UserAppUrl { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("enableDebug")]
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the EnableDebug
|
|
||||||
/// </summary>
|
|
||||||
public bool EnableDebug { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ServerTokenSecrets
|
||||||
|
/// </summary>
|
||||||
|
public class ServerTokenSecrets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the GrantCode
|
||||||
|
/// </summary>
|
||||||
|
public string GrantCode { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<string, JoinToken> Tokens { get; set; }
|
||||||
|
|
||||||
|
public ServerTokenSecrets(string grantCode)
|
||||||
|
{
|
||||||
|
GrantCode = grantCode;
|
||||||
|
Tokens = new Dictionary<string, JoinToken>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,27 @@
|
|||||||
using Newtonsoft.Json;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Core.Logging;
|
||||||
using PepperDash.Essentials.AppServer.Messengers;
|
using PepperDash.Essentials.AppServer.Messengers;
|
||||||
using PepperDash.Essentials.RoomBridges;
|
using PepperDash.Essentials.RoomBridges;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using System;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using WebSocketSharp;
|
using WebSocketSharp;
|
||||||
using WebSocketSharp.Server;
|
using WebSocketSharp.Server;
|
||||||
using ErrorEventArgs = WebSocketSharp.ErrorEventArgs;
|
using ErrorEventArgs = WebSocketSharp.ErrorEventArgs;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.WebSocketServer
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the behaviour to associate with a UiClient for WebSocket communication
|
/// Represents the behaviour to associate with a UiClient for WebSocket communication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UiClient : WebSocketBehavior
|
public class UiClient : WebSocketBehavior, IKeyed
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string Key { get; private set; }
|
||||||
|
|
||||||
public MobileControlSystemController Controller { get; set; }
|
public MobileControlSystemController Controller { get; set; }
|
||||||
|
|
||||||
public string RoomKey { get; set; }
|
public string RoomKey { get; set; }
|
||||||
@@ -41,17 +45,18 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UiClient()
|
public UiClient(string key)
|
||||||
{
|
{
|
||||||
|
Key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void OnOpen()
|
protected override void OnOpen()
|
||||||
{
|
{
|
||||||
base.OnOpen();
|
base.OnOpen();
|
||||||
|
|
||||||
var url = Context.WebSocket.Url;
|
var url = Context.WebSocket.Url;
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "New WebSocket Connection from: {0}", null, url);
|
this.LogInformation("New WebSocket Connection from: {url}", url);
|
||||||
|
|
||||||
var match = Regex.Match(url.AbsoluteUri, "(?:ws|wss):\\/\\/.*(?:\\/mc\\/api\\/ui\\/join\\/)(.*)");
|
var match = Regex.Match(url.AbsoluteUri, "(?:ws|wss):\\/\\/.*(?:\\/mc\\/api\\/ui\\/join\\/)(.*)");
|
||||||
|
|
||||||
@@ -117,6 +122,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
Controller.SendMessageObjectToDirectClient(message);
|
Controller.SendMessageObjectToDirectClient(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void OnMessage(MessageEventArgs e)
|
protected override void OnMessage(MessageEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMessage(e);
|
base.OnMessage(e);
|
||||||
@@ -128,18 +134,21 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void OnClose(CloseEventArgs e)
|
protected override void OnClose(CloseEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnClose(e);
|
base.OnClose(e);
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "WebSocket UiClient Closing: {0} reason: {1}", null, e.Code, e.Reason);
|
this.LogInformation("WebSocket UiClient Closing: {code} reason: {reason}", e.Code, e.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
protected override void OnError(ErrorEventArgs e)
|
protected override void OnError(ErrorEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnError(e);
|
base.OnError(e);
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "WebSocket UiClient Error: {exception} message: {message}", e.Exception, e.Message);
|
this.LogError("WebSocket UiClient Error: {message}", e.Message);
|
||||||
|
this.LogDebug(e.Exception, "Stack Trace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a UiClientContext
|
||||||
|
/// </summary>
|
||||||
|
public class UiClientContext
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Client
|
||||||
|
/// </summary>
|
||||||
|
public UiClient Client { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Token
|
||||||
|
/// </summary>
|
||||||
|
public JoinToken Token { get; private set; }
|
||||||
|
|
||||||
|
public UiClientContext(JoinToken token)
|
||||||
|
{
|
||||||
|
Token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetClient method
|
||||||
|
/// </summary>
|
||||||
|
public void SetClient(UiClient client)
|
||||||
|
{
|
||||||
|
Client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.WebSocketServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a Version
|
||||||
|
/// </summary>
|
||||||
|
public class Version
|
||||||
|
{
|
||||||
|
[JsonProperty("serverVersion")]
|
||||||
|
public string ServerVersion { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("serverIsRunningOnProcessorHardware")]
|
||||||
|
public bool ServerIsRunningOnProcessorHardware { get; private set; }
|
||||||
|
|
||||||
|
public Version()
|
||||||
|
{
|
||||||
|
ServerIsRunningOnProcessorHardware = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
using System;
|
||||||
using System;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -41,29 +41,6 @@ namespace PepperDash.Essentials
|
|||||||
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||||
|
|
||||||
Debug.SetErrorLogMinimumDebugLevel(CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? LogEventLevel.Warning : LogEventLevel.Verbose);
|
Debug.SetErrorLogMinimumDebugLevel(CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? LogEventLevel.Warning : LogEventLevel.Verbose);
|
||||||
|
|
||||||
// AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
|
|
||||||
{
|
|
||||||
var assemblyName = new AssemblyName(args.Name).Name;
|
|
||||||
if (assemblyName == "PepperDash_Core")
|
|
||||||
{
|
|
||||||
return Assembly.LoadFrom("PepperDashCore.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assemblyName == "PepperDash_Essentials_Core")
|
|
||||||
{
|
|
||||||
return Assembly.LoadFrom("PepperDash.Essentials.Core.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assemblyName == "Essentials Devices Common")
|
|
||||||
{
|
|
||||||
return Assembly.LoadFrom("PepperDash.Essentials.Devices.Common.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -267,6 +244,8 @@ namespace PepperDash.Essentials
|
|||||||
// _ = new ProcessorExtensionDeviceFactory();
|
// _ = new ProcessorExtensionDeviceFactory();
|
||||||
// _ = new MobileControlFactory();
|
// _ = new MobileControlFactory();
|
||||||
|
|
||||||
|
LoadAssets();
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Starting Essentials load from configuration");
|
Debug.LogMessage(LogEventLevel.Information, "Starting Essentials load from configuration");
|
||||||
|
|
||||||
var filesReady = SetupFilesystem();
|
var filesReady = SetupFilesystem();
|
||||||
@@ -568,5 +547,142 @@ namespace PepperDash.Essentials
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void LoadAssets()
|
||||||
|
{
|
||||||
|
var applicationDirectory = new DirectoryInfo(Global.ApplicationDirectoryPathPrefix);
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Searching: {applicationDirectory:l} for embedded assets - {Destination}", applicationDirectory.FullName, Global.FilePathPrefix);
|
||||||
|
|
||||||
|
var zipFiles = applicationDirectory.GetFiles("assets*.zip");
|
||||||
|
|
||||||
|
if (zipFiles.Length > 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Multiple assets zip files found. Cannot continue.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipFiles.Length == 1)
|
||||||
|
{
|
||||||
|
var zipFile = zipFiles[0];
|
||||||
|
var assetsRoot = System.IO.Path.GetFullPath(Global.FilePathPrefix);
|
||||||
|
if (!assetsRoot.EndsWith(Path.DirectorySeparatorChar.ToString()) && !assetsRoot.EndsWith(Path.AltDirectorySeparatorChar.ToString()))
|
||||||
|
{
|
||||||
|
assetsRoot += Path.DirectorySeparatorChar;
|
||||||
|
}
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Found assets zip file: {zipFile:l}... Unzipping...", zipFile.FullName);
|
||||||
|
using (var archive = ZipFile.OpenRead(zipFile.FullName))
|
||||||
|
{
|
||||||
|
foreach (var entry in archive.Entries)
|
||||||
|
{
|
||||||
|
var destinationPath = Path.Combine(Global.FilePathPrefix, entry.FullName);
|
||||||
|
var fullDest = System.IO.Path.GetFullPath(destinationPath);
|
||||||
|
if (!fullDest.StartsWith(assetsRoot, StringComparison.OrdinalIgnoreCase))
|
||||||
|
throw new InvalidOperationException($"Entry '{entry.FullName}' is trying to extract outside of the target directory.");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(entry.Name))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a directory exists where a file should go, delete it
|
||||||
|
if (Directory.Exists(destinationPath))
|
||||||
|
Directory.Delete(destinationPath, true);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));
|
||||||
|
entry.ExtractToFile(destinationPath, true);
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Extracted: {entry:l} to {Destination}", entry.FullName, destinationPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleaning up zip files
|
||||||
|
foreach (var file in zipFiles)
|
||||||
|
{
|
||||||
|
File.Delete(file.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
var htmlZipFiles = applicationDirectory.GetFiles("htmlassets*.zip");
|
||||||
|
|
||||||
|
if (htmlZipFiles.Length > 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Multiple htmlassets zip files found in application directory. Please ensure only one htmlassets*.zip file is present and retry.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (htmlZipFiles.Length == 1)
|
||||||
|
{
|
||||||
|
var htmlZipFile = htmlZipFiles[0];
|
||||||
|
var programDir = new DirectoryInfo(Global.FilePathPrefix.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
|
||||||
|
var userOrNvramDir = programDir.Parent;
|
||||||
|
var rootDir = userOrNvramDir?.Parent;
|
||||||
|
if (rootDir == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"Unable to determine root directory for html extraction. Current path: {Global.FilePathPrefix}");
|
||||||
|
}
|
||||||
|
var htmlDir = Path.Combine(rootDir.FullName, "html");
|
||||||
|
var htmlRoot = System.IO.Path.GetFullPath(htmlDir);
|
||||||
|
if (!htmlRoot.EndsWith(Path.DirectorySeparatorChar.ToString()) &&
|
||||||
|
!htmlRoot.EndsWith(Path.AltDirectorySeparatorChar.ToString()))
|
||||||
|
{
|
||||||
|
htmlRoot += Path.DirectorySeparatorChar;
|
||||||
|
}
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Found htmlassets zip file: {zipFile:l}... Unzipping...", htmlZipFile.FullName);
|
||||||
|
using (var archive = ZipFile.OpenRead(htmlZipFile.FullName))
|
||||||
|
{
|
||||||
|
foreach (var entry in archive.Entries)
|
||||||
|
{
|
||||||
|
var destinationPath = Path.Combine(htmlDir, entry.FullName);
|
||||||
|
var fullDest = System.IO.Path.GetFullPath(destinationPath);
|
||||||
|
if (!fullDest.StartsWith(htmlRoot, StringComparison.OrdinalIgnoreCase))
|
||||||
|
throw new InvalidOperationException($"Entry '{entry.FullName}' is trying to extract outside of the target directory.");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(entry.Name))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only delete the file if it exists and is a file, not a directory
|
||||||
|
if (File.Exists(destinationPath))
|
||||||
|
File.Delete(destinationPath);
|
||||||
|
|
||||||
|
var parentDir = Path.GetDirectoryName(destinationPath);
|
||||||
|
if (!string.IsNullOrEmpty(parentDir))
|
||||||
|
Directory.CreateDirectory(parentDir);
|
||||||
|
|
||||||
|
entry.ExtractToFile(destinationPath, true);
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Extracted: {entry:l} to {Destination}", entry.FullName, destinationPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleaning up html zip files
|
||||||
|
foreach (var file in htmlZipFiles)
|
||||||
|
{
|
||||||
|
File.Delete(file.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonFiles = applicationDirectory.GetFiles("*configurationFile*.json");
|
||||||
|
|
||||||
|
if (jsonFiles.Length > 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Multiple configuration files found. Cannot continue.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonFiles.Length == 1)
|
||||||
|
{
|
||||||
|
var jsonFile = jsonFiles[0];
|
||||||
|
var finalPath = Path.Combine(Global.FilePathPrefix, jsonFile.Name);
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Found configuration file: {jsonFile:l}... Moving to: {Destination}", jsonFile.FullName, finalPath);
|
||||||
|
|
||||||
|
if (File.Exists(finalPath))
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Information, "Removing existing configuration file: {Destination}", finalPath);
|
||||||
|
File.Delete(finalPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonFile.MoveTo(finalPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug 4.7.2|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug 4.7.2|AnyCPU'">
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<DocumentationFile>bin\$(Configuration)\PepperDashEssentials.xml</DocumentationFile>
|
<DocumentationFile>bin\$(Configuration)\PepperDashEssentials.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Example Configuration\EssentialsHuddleSpaceRoom\configurationFile-HuddleSpace-2-Source.json">
|
<None Include="Example Configuration\EssentialsHuddleSpaceRoom\configurationFile-HuddleSpace-2-Source.json">
|
||||||
@@ -48,7 +48,8 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.21.133" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.21.90" />
|
||||||
|
<PackageReference Include="System.IO.Compression" Version="4.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
||||||
|
|||||||
Reference in New Issue
Block a user