Compare commits

..

22 Commits

Author SHA1 Message Date
Andrew Welker
650fa3aab0 fix: enable internal logging for the websocket at the trace level 2025-09-29 10:48:34 -05:00
Andrew Welker
0efddcf5ab Merge branch 'main' into mc-connect-logging 2025-09-29 10:37:26 -05:00
Andrew Welker
8cc4d36f5f Revert "refactor(force-patch): move MC touch panel class to use partial classes"
This reverts commit 3261c01bfa.
2025-09-29 10:36:50 -05:00
Andrew Welker
aa4d241dde Merge pull request #1337 from PepperDash/Ibasicvolumecontrols-messenger
fix: modify volume messenger to start with IBasicVolumeControls
2025-09-26 10:40:44 -04:00
Andrew Welker
9fc5586531 fix: use IBasicVolumeControls to build DeviceVolumeMessenger 2025-09-25 15:29:35 -05:00
Neil Dorin
6d93662b31 Merge pull request #1338 from PepperDash/io-updates 2025-09-25 09:59:36 -06:00
Andrew Welker
11b190e76f docs: put XML comments on correct thing 2025-09-25 10:51:30 -05:00
Andrew Welker
df03a71cbc chore: fix errors in log statements
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-25 09:50:55 -05:00
Andrew Welker
72e67a1c4c fix: implement IHasFeedback for all IO devices and modify logging 2025-09-25 09:47:44 -05:00
Andrew Welker
f8728b6825 docs: update XML comments for EssentialsDeviceFactory 2025-09-25 09:46:55 -05:00
Andrew Welker
d9ef8a2289 docs: add XML comments for IAnalogInput 2025-09-25 09:46:03 -05:00
Andrew Welker
278408a3bc docs: reword XML comments for IHasFeedback Interface 2025-09-25 09:45:42 -05:00
Andrew Welker
d7f9c74b2f fix: modify volume messenger to start with IBasicVolumeControls 2025-09-23 13:39:03 -05:00
Andrew Welker
5921b5dbb0 Merge pull request #1336 from PepperDash/hotfix/check-for-cs-lan-on-mctp
Hotfix/check for cs lan on mctp
2025-09-23 13:58:15 -04:00
Neil Dorin
ba0de5128f Update src/PepperDash.Essentials.MobileControl/Touchpanel/MobileControlTouchpanelController.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-23 11:56:57 -06:00
Andrew Welker
3261c01bfa refactor(force-patch): move MC touch panel class to use partial classes 2025-09-19 13:13:09 -05:00
Neil Dorin
258699fbcd fix: Enhance AppUrl change logging
Updated logging to include the new AppUrl value when it changes. This provides better context in the logs, making it easier to track the specific URL that was set.
2025-09-18 18:23:12 -06:00
Neil Dorin
738504e9fc fix: Add error handling for network parameter retrieval
Introduced a try-catch block to handle exceptions when fetching the Crestron Ethernet adapter's ID, subnet mask, and IP address. Added logging for cases where the processor lacks a CS LAN. Also included a new using directive for Serilog.Events.
2025-09-18 14:48:21 -06:00
Andrew Welker
f84ae4d82f fix: use correct keys and switch for file log level 2025-09-17 12:42:39 -05:00
Andrew Welker
9a18bfd816 Merge branch 'main' into mc-connect-logging 2025-09-17 11:41:23 -05:00
Andrew Welker
557e39f2f2 fix: CS LAN fixes 2025-09-17 11:38:20 -05:00
Andrew Welker
7c6aa1c0ff fix: set file log level for debugging 2025-09-15 11:02:06 -05:00
55 changed files with 751 additions and 948 deletions

View File

@@ -466,14 +466,14 @@ namespace PepperDash.Core
/// </summary>
public static void SetFileMinimumDebugLevel(LogEventLevel level)
{
_errorLogLevelSwitch.MinimumLevel = level;
_fileLevelSwitch.MinimumLevel = level;
var err = CrestronDataStoreStatic.SetLocalUintValue(ErrorLogLevelStoreKey, (uint)level);
var err = CrestronDataStoreStatic.SetLocalUintValue(FileLevelStoreKey, (uint)level);
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
LogMessage(LogEventLevel.Information, "Error saving File debug level setting: {error}", err);
LogMessage(LogEventLevel.Information, "File debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
LogMessage(LogEventLevel.Information, "File debug level set to {0}", _fileLevelSwitch.MinimumLevel);
}
/// <summary>

View File

@@ -2,59 +2,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
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 Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
{
[Description("Wrapper class for Digital Input")]
/// <summary>
/// Represents a GenericDigitalInputDevice
/// </summary>
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
/// [Description("Wrapper class for Digital Input")]
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IHasFeedback
{
/// <summary>
/// Gets or sets the InputPort
/// </summary>
public DigitalInput InputPort { get; private set; }
private DigitalInput inputPort;
/// <summary>
/// Gets or sets the InputStateFeedback
/// </summary>
public BoolFeedback InputStateFeedback { get; private set; }
Func<bool> InputStateFeedbackFunc
{
get
{
return () => InputPort.State;
}
}
/// <inheritdoc />
public FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
/// <summary>
/// Initializes a new instance of the <see cref="GenericDigitalInputDevice"/> class.
/// </summary>
/// <param name="key">key for device</param>
/// <param name="name">name for device</param>
/// <param name="postActivationFunc">function to call after activation. Should return the DigitalInput</param>
/// <param name="config">config for device</param>
public GenericDigitalInputDevice(string key, string name, Func<IOPortConfig, DigitalInput> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
InputStateFeedback = new BoolFeedback("inputState", () => inputPort.State);
AddPostActivationAction(() =>
{
InputPort = postActivationFunc(config);
inputPort = postActivationFunc(config);
InputPort.Register();
InputPort.StateChange += InputPort_StateChange;
inputPort.Register();
inputPort.StateChange += InputPort_StateChange;
});
}
@@ -71,41 +66,31 @@ namespace PepperDash.Essentials.Core.CrestronIO
private static DigitalInput GetDigitalInput(IOPortConfig dc)
{
IDigitalInputPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsDigitalInput)
{
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Processor does not support Digital Inputs");
Debug.LogError("GetDigitalInput: Processor does not support Digital Inputs");
return null;
}
ioPortDevice = Global.ControlSystem;
return Global.ControlSystem.DigitalInputPorts[dc.PortNumber];
}
else
if (!(DeviceManager.GetDeviceForKey(dc.PortDeviceKey) is IDigitalInputPorts ioPortDevice))
{
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts;
if (ioPortDev == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device '0' is not a valid IDigitalInputPorts Device", dc.PortDeviceKey);
Debug.LogError("GetDigitalInput: Device {key} is not a valid device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogError("GetDigitalInput: Device {key} does not contain a digital input port {port}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
return ioPortDevice.DigitalInputPorts[dc.PortNumber];
}
#endregion
@@ -131,20 +116,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.LogDebug("Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
}
catch (Exception e)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
this.LogError("Unable to link device {key}. {message}", Key, e.Message);
this.LogDebug(e, "Stack Trace: ");
}
}
@@ -153,22 +138,22 @@ namespace PepperDash.Essentials.Core.CrestronIO
#region Factory
/// <summary>
/// Represents a GenericDigitalInputDeviceFactory
/// Factory for creating GenericDigitalInputDevice devices
/// </summary>
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
{
/// <summary>
/// Constructor for GenericDigitalInputDeviceFactory
/// </summary>
public GenericDigitalInputDeviceFactory()
{
TypeNames = new List<string>() { "digitalinput" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Digital Input Device");
Debug.LogDebug("Factory Attempting to create new Generic Digital Input Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -2,66 +2,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Newtonsoft.Json;
using Serilog.Events;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
/// <summary>
/// Represents a generic digital input deviced tied to a versiport
/// </summary>
public class GenericVersiportAnalogInputDevice : EssentialsBridgeableDevice, IAnalogInput
public class GenericVersiportAnalogInputDevice : EssentialsBridgeableDevice, IAnalogInput, IHasFeedback
{
public Versiport InputPort { get; private set; }
private Versiport inputPort;
/// <inheritdoc />
public IntFeedback InputValueFeedback { get; private set; }
/// <summary>
/// Get the InputMinimumChangeFeedback
/// </summary>
/// <remarks>
/// Updates when the analog input minimum change value changes
/// </remarks>
public IntFeedback InputMinimumChangeFeedback { get; private set; }
Func<int> InputValueFeedbackFunc
{
get
{
return () => InputPort.AnalogIn;
}
}
Func<int> InputMinimumChangeFeedbackFunc
{
get { return () => InputPort.AnalogMinChange; }
}
/// <inheritdoc />
public FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
/// <summary>
/// Initializes a new instance of the <see cref="GenericVersiportAnalogInputDevice"/> class.
/// </summary>
/// <param name="key">key for the device</param>
/// <param name="name">name for the device</param>
/// <param name="postActivationFunc">function to call after activation</param>
/// <param name="config">IO port configuration</param>
public GenericVersiportAnalogInputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
base(key, name)
{
InputValueFeedback = new IntFeedback(InputValueFeedbackFunc);
InputMinimumChangeFeedback = new IntFeedback(InputMinimumChangeFeedbackFunc);
InputValueFeedback = new IntFeedback("inputValue", () => inputPort.AnalogIn);
InputMinimumChangeFeedback = new IntFeedback("inputMinimumChange", () => inputPort.AnalogMinChange);
AddPostActivationAction(() =>
{
InputPort = postActivationFunc(config);
inputPort = postActivationFunc(config);
InputPort.Register();
inputPort.Register();
InputPort.SetVersiportConfiguration(eVersiportConfiguration.AnalogInput);
InputPort.AnalogMinChange = (ushort)(config.MinimumChange > 0 ? config.MinimumChange : 655);
inputPort.SetVersiportConfiguration(eVersiportConfiguration.AnalogInput);
inputPort.AnalogMinChange = (ushort)(config.MinimumChange > 0 ? config.MinimumChange : 655);
if (config.DisablePullUpResistor)
InputPort.DisablePullUpResistor = true;
inputPort.DisablePullUpResistor = true;
InputPort.VersiportChange += InputPort_VersiportChange;
Debug.LogMessage(LogEventLevel.Debug, this, "Created GenericVersiportAnalogInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
inputPort.VersiportChange += InputPort_VersiportChange;
this.LogDebug("Created GenericVersiportAnalogInputDevice on port {port}. DisablePullUpResistor: {pullUpResistorDisabled}", config.PortNumber, inputPort.DisablePullUpResistor);
});
}
@@ -69,20 +67,17 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// <summary>
/// Set minimum voltage change for device to update voltage changed method
/// </summary>
/// <param name="value">valid values range from 0 - 65535, representing the full 100% range of the processor voltage source. Check processor documentation for details</param>
/// <summary>
/// SetMinimumChange method
/// </summary>
/// <param name="value">valid values range from 0 - 65535, representing the full 100% range of the processor voltage source. Check processor documentation for details</param>
public void SetMinimumChange(ushort value)
{
InputPort.AnalogMinChange = value;
inputPort.AnalogMinChange = value;
}
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
this.LogDebug("Versiport change: {event}", args.Event);
if(args.Event == eVersiportEvent.AnalogInChange)
if (args.Event == eVersiportEvent.AnalogInChange)
InputValueFeedback.FireUpdate();
if (args.Event == eVersiportEvent.AnalogMinChangeChange)
InputMinimumChangeFeedback.FireUpdate();
@@ -91,9 +86,6 @@ namespace PepperDash.Essentials.Core.CrestronIO
#region Bridge Linking
/// <summary>
/// LinkToApi method
/// </summary>
/// <inheritdoc />
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
@@ -110,12 +102,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.LogDebug("Linking to Trilist '{trilistId}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputValueFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputValue.JoinNumber]);
@@ -125,8 +117,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
catch (Exception e)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
this.LogError("Unable to link device {key}: {message}", Key, e.Message);
this.LogDebug(e, "Stack Trace: ");
}
trilist.OnlineStatusChange += (d, args) =>
@@ -138,11 +130,6 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
void trilist_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
throw new NotImplementedException();
}
#endregion
@@ -151,70 +138,55 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public static Versiport GetVersiportDigitalInput(IOPortConfig dc)
{
IIOPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Processor does not support Versiports");
Debug.LogError("GetVersiportAnalogInput: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
return Global.ControlSystem.VersiPorts[dc.PortNumber];
}
else
if (!(DeviceManager.GetDeviceForKey(dc.PortDeviceKey) is IIOPorts ioPortDevice))
{
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
Debug.LogError("GetVersiportAnalogInput: Device {key} is not a valid device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogError("GetVersiportAnalogInput: Device {key} does not contain a port {port}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
if(!ioPortDevice.VersiPorts[dc.PortNumber].SupportsAnalogInput)
if (!ioPortDevice.VersiPorts[dc.PortNumber].SupportsAnalogInput)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} does not support AnalogInput on port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogError("GetVersiportAnalogInput: Device {key} does not support AnalogInput on port {port}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
return ioPortDevice.VersiPorts[dc.PortNumber];
}
}
/// <summary>
/// Represents a GenericVersiportAbalogInputDeviceFactory
/// Factory for creating GenericVersiportAnalogInputDevice devices
/// </summary>
public class GenericVersiportAbalogInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportAnalogInputDevice>
public class GenericVersiportAnalogInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportAnalogInputDevice>
{
public GenericVersiportAbalogInputDeviceFactory()
/// <summary>
/// Constructor for GenericVersiportAnalogInputDeviceFactory
/// </summary>
public GenericVersiportAnalogInputDeviceFactory()
{
TypeNames = new List<string>() { "versiportanaloginput" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
Debug.LogDebug("Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -2,78 +2,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Newtonsoft.Json;
using Serilog.Events;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
/// <summary>
/// Represents a generic digital input deviced tied to a versiport
/// </summary>
public class GenericVersiportDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IPartitionStateProvider
public class GenericVersiportDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput, IPartitionStateProvider, IHasFeedback
{
public Versiport InputPort { get; private set; }
private Versiport inputPort;
/// <summary>
/// Gets or sets the InputStateFeedback
/// </summary>
public BoolFeedback InputStateFeedback { get; private set; }
Func<bool> InputStateFeedbackFunc
{
get
{
return () => InputPort.DigitalIn;
}
}
/// <inheritdoc />
public FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
/// <summary>
/// Gets or sets the PartitionPresentFeedback
/// </summary>
public BoolFeedback PartitionPresentFeedback { get; }
public bool PartitionPresent => !InputStateFeedbackFunc();
/// <summary>
/// Get partition state
/// </summary>
public bool PartitionPresent => !inputPort.DigitalIn;
/// <summary>
/// Initializes a new instance of the <see cref="GenericVersiportDigitalInputDevice"/> class.
/// </summary>
/// <param name="key">key for device</param>
/// <param name="name">name for device</param>
/// <param name="postActivationFunc">function to call after activation. Should return the Versiport</param>
/// <param name="config">config for device</param>
public GenericVersiportDigitalInputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
base(key, name)
{
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
PartitionPresentFeedback = new BoolFeedback(() => !InputStateFeedbackFunc());
InputStateFeedback = new BoolFeedback("inputState", () => inputPort.DigitalIn);
PartitionPresentFeedback = new BoolFeedback("partitionPresent", () => !inputPort.DigitalIn);
AddPostActivationAction(() =>
{
InputPort = postActivationFunc(config);
inputPort = postActivationFunc(config);
InputPort.Register();
inputPort.Register();
InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
inputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
if (config.DisablePullUpResistor)
InputPort.DisablePullUpResistor = true;
inputPort.DisablePullUpResistor = true;
InputPort.VersiportChange += InputPort_VersiportChange;
inputPort.VersiportChange += InputPort_VersiportChange;
InputStateFeedback.FireUpdate();
PartitionPresentFeedback.FireUpdate();
Debug.LogMessage(LogEventLevel.Debug, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
this.LogDebug("Created GenericVersiportDigitalInputDevice for port {port}. DisablePullUpResistor: {pullUpResistorDisable}", config.PortNumber, inputPort.DisablePullUpResistor);
});
Feedbacks.Add(InputStateFeedback);
Feedbacks.Add(PartitionPresentFeedback);
}
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
this.LogDebug("Versiport change: {0}", args.Event);
if(args.Event == eVersiportEvent.DigitalInChange)
if (args.Event == eVersiportEvent.DigitalInChange)
{
InputStateFeedback.FireUpdate();
PartitionPresentFeedback.FireUpdate();
@@ -102,20 +106,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.LogDebug("Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
}
catch (Exception e)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
this.LogError("Unable to link device {key}. Input is null. {message}", Key, e.Message);
this.LogDebug(e, "Stack Trace: ");
}
}
@@ -127,63 +131,50 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public static Versiport GetVersiportDigitalInput(IOPortConfig dc)
{
IIOPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Processor does not support Versiports");
Debug.LogError("GetVersiportDigitalInput: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
return Global.ControlSystem.VersiPorts[dc.PortNumber];
}
else
if (!(DeviceManager.GetDeviceForKey(dc.PortDeviceKey) is IIOPorts ioPortDevice))
{
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
Debug.LogError("GetVersiportDigitalInput: Device {key} is not a valid device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogError("GetVersiportDigitalInput: Device {key} does not contain versiport {port}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
return ioPortDevice.VersiPorts[dc.PortNumber];
}
}
/// <summary>
/// Represents a GenericVersiportDigitalInputDeviceFactory
/// Factory class for GenericVersiportDigitalInputDevice
/// </summary>
public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
{
/// <summary>
/// Constructor for GenericVersiportDigitalInputDeviceFactory
/// </summary>
public GenericVersiportDigitalInputDeviceFactory()
{
TypeNames = new List<string>() { "versiportinput" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
Debug.LogDebug("Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -2,18 +2,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
@@ -21,76 +16,68 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// <summary>
/// Represents a generic digital input deviced tied to a versiport
/// </summary>
public class GenericVersiportDigitalOutputDevice : EssentialsBridgeableDevice, IDigitalOutput
public class GenericVersiportDigitalOutputDevice : EssentialsBridgeableDevice, IDigitalOutput, IHasFeedback
{
public Versiport OutputPort { get; private set; }
private Versiport outputPort;
/// <summary>
/// Gets or sets the OutputStateFeedback
/// </summary>
public BoolFeedback OutputStateFeedback { get; private set; }
Func<bool> OutputStateFeedbackFunc
{
get
{
return () => OutputPort.DigitalOut;
}
}
/// <inheritdoc />
public FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
/// <summary>
/// Initializes a new instance of the <see cref="GenericVersiportDigitalOutputDevice"/> class.
/// </summary>
public GenericVersiportDigitalOutputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
base(key, name)
{
OutputStateFeedback = new BoolFeedback(OutputStateFeedbackFunc);
OutputStateFeedback = new BoolFeedback("outputState", () => outputPort.DigitalOut);
AddPostActivationAction(() =>
{
OutputPort = postActivationFunc(config);
outputPort = postActivationFunc(config);
OutputPort.Register();
outputPort.Register();
if (!OutputPort.SupportsDigitalOutput)
if (!outputPort.SupportsDigitalOutput)
{
Debug.LogMessage(LogEventLevel.Information, this, "Device does not support configuration as a Digital Output");
this.LogError("Device does not support configuration as a Digital Output");
return;
}
OutputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput);
outputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput);
OutputPort.VersiportChange += OutputPort_VersiportChange;
outputPort.VersiportChange += OutputPort_VersiportChange;
});
}
void OutputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
this.LogDebug("Versiport change: {event}", args.Event);
if(args.Event == eVersiportEvent.DigitalOutChange)
if (args.Event == eVersiportEvent.DigitalOutChange)
OutputStateFeedback.FireUpdate();
}
/// <summary>
/// Set value of the versiport digital output
/// </summary>
/// <param name="state">value to set the output to</param>
/// <summary>
/// SetOutput method
/// </summary>
/// <param name="state">value to set the output to</param>
public void SetOutput(bool state)
{
if (OutputPort.SupportsDigitalOutput)
{
Debug.LogMessage(LogEventLevel.Information, this, "Passed the Check");
OutputPort.DigitalOut = state;
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Versiport does not support Digital Output Mode");
}
if (!outputPort.SupportsDigitalOutput)
{
this.LogError("Versiport does not support Digital Output Mode");
return;
}
outputPort.DigitalOut = state;
}
#region Bridge Linking
@@ -114,12 +101,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
this.LogDebug("Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
OutputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OutputState.JoinNumber]);
@@ -127,8 +114,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
catch (Exception e)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
this.LogError("Unable to link device: {message}", e.Message);
this.LogDebug(e, "Stack Trace: ");
}
}
@@ -140,41 +127,28 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public static Versiport GetVersiportDigitalOutput(IOPortConfig dc)
{
IIOPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsVersiport)
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
}
else
{
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device '0' is not a valid IOPorts Device", dc.PortDeviceKey);
Debug.LogError("GetVersiportDigitalOutput: Processor does not support Versiports");
return null;
}
return Global.ControlSystem.VersiPorts[dc.PortNumber];
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
var port = ioPortDevice.VersiPorts[dc.PortNumber];
return port;
if (!(DeviceManager.GetDeviceForKey(dc.PortDeviceKey) is IIOPorts ioPortDevice))
{
Debug.LogError("GetVersiportDigitalOutput: Device {key} is not a valid device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOutput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
return ioPortDevice.VersiPorts[dc.PortNumber];
}
}
@@ -184,18 +158,18 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
{
/// <summary>
/// Initialize a new instance of the <see cref="GenericVersiportDigitalOutputDeviceFactory"/> class.
/// </summary>
public GenericVersiportDigitalOutputDeviceFactory()
{
TypeNames = new List<string>() { "versiportoutput" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
Debug.LogDebug("Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -12,6 +12,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public interface IAnalogInput
{
/// <summary>
/// Get the InputValueFeedback.
/// </summary>
/// <remarks>
/// Updates when the analog input value changes
/// </remarks>
IntFeedback InputValueFeedback { get; }
}
}

View File

@@ -14,25 +14,28 @@ namespace PepperDash.Essentials.Core.CrestronIO
/// </summary>
public class IOPortConfig
{
[JsonProperty("portDeviceKey")]
/// <summary>
/// Gets or sets the PortDeviceKey
/// </summary>
[JsonProperty("portDeviceKey")]
public string PortDeviceKey { get; set; }
[JsonProperty("portNumber")]
/// <summary>
/// Gets or sets the PortNumber
/// </summary>
[JsonProperty("portNumber")]
public uint PortNumber { get; set; }
[JsonProperty("disablePullUpResistor")]
/// <summary>
/// Gets or sets the DisablePullUpResistor
/// </summary>
[JsonProperty("disablePullUpResistor")]
public bool DisablePullUpResistor { get; set; }
[JsonProperty("minimumChange")]
/// <summary>
/// Gets or sets the MinimumChange
/// </summary>
[JsonProperty("minimumChange")]
public int MinimumChange { get; set; }
}
}

View File

@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core
public List<string> TypeNames { get; protected set; }
/// <summary>
/// The method that will build the device
/// Build the device using the configuration
/// </summary>
/// <param name="dc">The device config</param>
/// <returns>An instance of the device</returns>

View File

@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core
public interface IHasFeedback : IKeyed
{
/// <summary>
/// This method shall return a list of all Output objects on a device,
/// This method returns a list of all Output objects on a device,
/// including all "aggregate" devices.
/// </summary>
FeedbackCollection<Feedback> Feedbacks { get; }

View File

@@ -1,8 +1,8 @@
using System;
using System.Linq;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.AudioCodec;
using PepperDash.Essentials.Devices.Common.Codec;
using System;
using System.Linq;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -29,16 +29,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
codec.CallStatusChange += Codec_CallStatusChange;
}
/// <inheritdoc />
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject(id));
AddAction("/audioDialerStatus", (id, content) => SendAtcFullMessageObject(id));
AddAction("/fullStatus", (id, content) => SendAtcFullMessageObject());
AddAction("/dial", (id, content) =>
{
var msg = content.ToObject<MobileControlSimpleContent<string>>();
@@ -101,7 +97,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Helper method to build call status for vtc
/// </summary>
/// <returns></returns>
private void SendAtcFullMessageObject(string id = null)
private void SendAtcFullMessageObject()
{
var info = Codec.CodecInfo;
@@ -113,7 +109,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
phoneNumber = info.PhoneNumber
}
}), id
})
);
}
}

View File

@@ -55,9 +55,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject(id));
AddAction("/cameraStatus", (id, content) => SendCameraFullMessageObject(id));
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject());
if (Camera is IHasCameraPtzControl ptzCamera)
@@ -175,7 +173,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// Helper method to update the full status of the camera
/// </summary>
private void SendCameraFullMessageObject(string id = null)
private void SendCameraFullMessageObject()
{
var presetList = new List<CameraPreset>();
@@ -190,7 +188,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
cameraMode = GetCameraMode(),
hasPresets = Camera is IHasCameraPresets,
presets = presetList
}), id
})
);
}

View File

@@ -33,9 +33,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendCurrentSourceStatus(id));
AddAction("/fullStatus", (id, content) =>
{
var message = new CurrentSourcesStateMessage
{
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
CurrentSources = sourceDevice.CurrentSources
};
AddAction("/currentSourceStatus", (id, content) => SendCurrentSourceStatus(id));
PostStatusMessage(message);
});
sourceDevice.CurrentSourcesChanged += (sender, e) =>
{
@@ -46,17 +53,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
}));
};
}
private void SendCurrentSourceStatus(string id = null)
{
var message = new CurrentSourcesStateMessage
{
CurrentSourceKeys = sourceDevice.CurrentSourceKeys,
CurrentSources = sourceDevice.CurrentSources
};
PostStatusMessage(message, id);
}
}
/// <summary>

View File

@@ -1,8 +1,8 @@
using System.Timers;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceInfo;
using System.Timers;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -67,19 +67,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
debounceTimer.Start();
};
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
AddAction("/deviceInfo", (id, content) => SendFullStatus(id));
AddAction("/update", (id, context) => _deviceInfoProvider.UpdateDeviceInfo());
}
private void SendFullStatus(string id = null)
{
PostStatusMessage(new DeviceInfoStateMessage
AddAction("/fullStatus", (id, context) => PostStatusMessage(new DeviceInfoStateMessage
{
DeviceInfo = _deviceInfoProvider.DeviceInfo
}, id);
}));
AddAction("/update", (id, context) => _deviceInfoProvider.UpdateDeviceInfo());
}
}

View File

@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Presets;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -16,24 +16,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
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)
: base(key, messagePath, presetsDevice as Device)
{
_presetsDevice = presetsDevice;
}
private void SendPresets(string id = null)
private void SendPresets()
{
PostStatusMessage(new PresetStateMessage
{
Favorites = _presetsDevice.TvPresets.PresetsList
}, id);
});
}
private void RecallPreset(ISetTopBoxNumericKeypad device, string channel)
@@ -49,7 +43,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
#region Overrides of MessengerBase
/// <inheritdoc />
protected override void RegisterActions()
{
@@ -58,7 +51,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
this.LogInformation("getting full status for client {id}", id);
try
{
SendPresets(id);
SendPresets();
}
catch (Exception ex)
{
@@ -66,8 +59,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
});
AddAction("/presetsStatus", (id, content) => SendPresets(id));
AddAction("/recall", (id, content) =>
{
var p = content.ToObject<PresetChannelMessage>();
@@ -100,16 +91,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class PresetChannelMessage
{
[JsonProperty("preset")]
/// <summary>
/// Gets or sets the Preset
/// </summary>
[JsonProperty("preset")]
public PresetChannel Preset;
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
[JsonProperty("deviceKey")]
public string DeviceKey;
}
@@ -118,11 +109,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class PresetStateMessage : DeviceStateMessageBase
{
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Favorites
/// </summary>
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
public List<PresetChannel> Favorites { get; set; } = new List<PresetChannel>();
}
}

View File

@@ -3,6 +3,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.AppServer.Messengers
@@ -12,7 +13,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class DeviceVolumeMessenger : MessengerBase
{
private readonly IBasicVolumeWithFeedback _localDevice;
private readonly IBasicVolumeControls device;
/// <summary>
/// Initializes a new instance of the <see cref="DeviceVolumeMessenger"/> class.
@@ -20,27 +21,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <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, IBasicVolumeControls device)
: base(key, messagePath, device as IKeyName)
{
_localDevice = device;
this.device = device;
}
private void SendStatus(string id = null)
{
try
{
if (!(device is IBasicVolumeWithFeedback feedbackDevice))
{
return;
}
var messageObj = new VolumeStateMessage
{
Volume = new Volume
{
Level = _localDevice?.VolumeLevelFeedback.IntValue ?? -1,
Muted = _localDevice?.MuteFeedback.BoolValue ?? false,
Level = feedbackDevice?.VolumeLevelFeedback.IntValue ?? -1,
Muted = feedbackDevice?.MuteFeedback.BoolValue ?? false,
HasMute = true, // assume all devices have mute for now
}
};
if (_localDevice is IBasicVolumeWithFeedbackAdvanced volumeAdvanced)
if (device is IBasicVolumeWithFeedbackAdvanced volumeAdvanced)
{
messageObj.Volume.RawValue = volumeAdvanced.RawVolumeLevel.ToString();
messageObj.Volume.Units = volumeAdvanced.Units;
@@ -56,9 +62,47 @@ namespace PepperDash.Essentials.AppServer.Messengers
#region Overrides of MessengerBase
/// <inheritdoc />
protected override void RegisterActions()
{
AddAction("/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume up with {value}", DeviceKey, b);
try
{
device.VolumeUp(b);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Got exception during volume up: {Exception}", null, ex);
}
}));
AddAction("/muteToggle", (id, content) =>
{
device.MuteToggle();
});
AddAction("/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume down with {value}", DeviceKey, b);
try
{
device.VolumeDown(b);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Got exception during volume down: {Exception}", null, ex);
}
}));
if (!(device is IBasicVolumeWithFeedback feedback))
{
this.LogDebug("Skipping feedback methods for {deviceKey}", (device as IKeyName)?.Key);
return;
}
AddAction("/fullStatus", (id, content) => SendStatus(id));
AddAction("/volumeStatus", (id, content) => SendStatus(id));
@@ -67,54 +111,24 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
var volume = content.ToObject<MobileControlSimpleContent<ushort>>();
_localDevice.SetVolume(volume.Value);
feedback.SetVolume(volume.Value);
});
AddAction("/muteToggle", (id, content) =>
{
_localDevice.MuteToggle();
});
AddAction("/muteOn", (id, content) =>
{
_localDevice.MuteOn();
feedback.MuteOn();
});
AddAction("/muteOff", (id, content) =>
{
_localDevice.MuteOff();
feedback.MuteOff();
});
AddAction("/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume up with {value}", DeviceKey, b);
try
{
_localDevice.VolumeUp(b);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Got exception during volume up: {Exception}", null, ex);
}
}));
AddAction("/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume down with {value}", DeviceKey, b);
try
{
_localDevice.VolumeDown(b);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Got exception during volume down: {Exception}", null, ex);
}
}));
_localDevice.MuteFeedback.OutputChange += (sender, args) =>
feedback.MuteFeedback.OutputChange += (sender, args) =>
{
PostStatusMessage(JToken.FromObject(
new
@@ -127,10 +141,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
);
};
_localDevice.VolumeLevelFeedback.OutputChange += (sender, args) =>
feedback.VolumeLevelFeedback.OutputChange += (sender, args) =>
{
var rawValue = "";
if (_localDevice is IBasicVolumeWithFeedbackAdvanced volumeAdvanced)
if (feedback is IBasicVolumeWithFeedbackAdvanced volumeAdvanced)
{
rawValue = volumeAdvanced.RawVolumeLevel.ToString();
}
@@ -146,8 +160,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
PostStatusMessage(JToken.FromObject(message));
};
}
#endregion

View File

@@ -7,29 +7,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
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)
{
}
/// <inheritdoc />
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new DeviceStateMessageBase();
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -13,12 +13,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
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)
{
@@ -28,24 +22,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// SendFullStatus method
/// </summary>
public void SendFullStatus(string id = null)
public void SendFullStatus()
{
var messageObj = new IBasicVideoMuteWithFeedbackMessage
{
VideoMuteState = device.VideoMuteIsOn.BoolValue
};
PostStatusMessage(messageObj, id);
PostStatusMessage(messageObj);
}
/// <inheritdoc />
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/videoMuteStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/videoMuteToggle", (id, content) =>
{

View File

@@ -24,12 +24,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
AddAction("/fullStatus", (id, content) =>
{
SendFullStatus(id);
});
AddAction("/commStatus", (id, content) =>
{
SendFullStatus(id);
PostStatusMessage(new CommunicationMonitorState
{
CommunicationMonitor = new CommunicationMonitorProps
{
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
Status = _communicationMonitor.CommunicationMonitor.Status
}
});
});
_communicationMonitor.CommunicationMonitor.StatusChange += (sender, args) =>
@@ -44,18 +46,6 @@ 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>

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -22,9 +22,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) =>
{
var message = new IHasDspPresetsStateMessage
{
Presets = device.Presets
};
AddAction("/dspPresetStatus", (id, content) => SendFullStatus(id));
PostStatusMessage(message);
});
AddAction("/recallPreset", (id, content) =>
{
@@ -37,16 +43,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
});
}
private void SendFullStatus(string id = null)
{
var message = new IHasDspPresetsStateMessage
{
Presets = device.Presets
};
PostStatusMessage(message, id);
}
}
/// <summary>

View File

@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -46,9 +46,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// partition states.</remarks>
protected override void RegisterActions()
{
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/combinerStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/setAutoMode", (id, content) =>
{
@@ -122,7 +120,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
try
{
@@ -143,7 +141,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
Partitions = _roomCombiner.Partitions
};
PostStatusMessage(message, id);
PostStatusMessage(message);
}
catch (Exception e)
{

View File

@@ -1,11 +1,11 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.Cameras;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Devices.Common.Cameras;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="cameraController"></param>
/// <param name="messagePath"></param>
/// <exception cref="ArgumentNullException"></exception>
public IHasCamerasMessenger(string key, string messagePath, IHasCameras cameraController)
public IHasCamerasMessenger(string key, string messagePath , IHasCameras cameraController)
: base(key, messagePath, cameraController)
{
CameraController = cameraController ?? throw new ArgumentNullException("cameraController");
@@ -49,9 +49,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
AddAction("/cameraListStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, context) =>
{
SendFullStatus(id);
});
AddAction("/selectCamera", (id, content) =>
{

View File

@@ -11,7 +11,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
public class IHasCurrentSourceInfoMessenger : MessengerBase
{
private readonly IHasCurrentSourceInfoChange sourceDevice;
public IHasCurrentSourceInfoMessenger(string key, string messagePath, IHasCurrentSourceInfoChange device) : base(key, messagePath, device as IKeyName)
{
sourceDevice = device;
@@ -21,9 +20,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) =>
{
var message = new CurrentSourceStateMessage
{
CurrentSourceKey = sourceDevice.CurrentSourceInfoKey,
CurrentSource = sourceDevice.CurrentSourceInfo
};
AddAction("/currentSourceInfoStatus", (id, content) => SendFullStatus(id));
PostStatusMessage(message);
});
sourceDevice.CurrentSourceChange += (sender, e) =>
{
@@ -41,17 +47,6 @@ 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>

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -11,8 +11,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Represents a IHasInputsMessenger
/// </summary>
public class IHasInputsMessenger<TKey> : MessengerBase
{
private readonly IHasInputs<TKey> itemDevice;
{
private readonly IHasInputs<TKey> itemDevice;
/// <summary>
@@ -23,16 +23,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="device"></param>
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
{
itemDevice = device;
itemDevice = device;
}
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
AddAction("/inputStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, context) =>
{
SendFullStatus();
});
itemDevice.Inputs.ItemsUpdated += (sender, args) =>
{
@@ -61,7 +62,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
try
{
@@ -76,7 +77,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
};
PostStatusMessage(stateObject, id);
PostStatusMessage(stateObject);
}
catch (Exception e)
{

View File

@@ -12,12 +12,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
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)
: base(key, messagePath, powerControl as IKeyName)
{
@@ -27,24 +21,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// SendFullStatus method
/// </summary>
public void SendFullStatus(string id = null)
public void SendFullStatus()
{
var messageObj = new PowerControlWithFeedbackStateMessage
{
PowerState = _powerControl.PowerIsOnFeedback.BoolValue
};
PostStatusMessage(messageObj, id);
PostStatusMessage(messageObj);
}
/// <inheritdoc />
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/powerStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
_powerControl.PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; ;
}
@@ -64,9 +55,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class PowerControlWithFeedbackStateMessage : DeviceStateMessageBase
{
/// <summary>
/// Power State
/// </summary>
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
public bool? PowerState { get; set; }
}

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.Codec;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -27,9 +27,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
protected override void RegisterActions()
{
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
AddAction("/schedule/status", (id, content) => SendFullScheduleObject(id));
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
}
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
@@ -53,13 +51,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// Helper method to send the full schedule data
/// </summary>
private void SendFullScheduleObject(string id = null)
private void SendFullScheduleObject()
{
PostStatusMessage(new FullScheduleMessage
{
Meetings = ScheduleSource.CodecSchedule.Meetings,
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
}, id);
});
}
}
@@ -68,18 +66,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class FullScheduleMessage : DeviceStateMessageBase
{
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Meetings
/// </summary>
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
public List<Meeting> Meetings { get; set; }
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MeetingWarningMinutes
/// </summary>
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
public int MeetingWarningMinutes { get; set; }
}
@@ -88,11 +84,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class MeetingChangeMessage
{
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MeetingChange
/// </summary>
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
public MeetingChange MeetingChange { get; set; }
}
@@ -101,18 +96,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class MeetingChange
{
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the ChangeType
/// </summary>
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
public string ChangeType { get; set; }
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Meeting
/// </summary>
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
public Meeting Meeting { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -22,21 +22,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/humidityStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
device.HumidityFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new IHumiditySensorStateMessage
{
Humidity = string.Format("{0}%", device.HumidityFeedback.UShortValue)
};
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -45,11 +43,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class IHumiditySensorStateMessage : DeviceStateMessageBase
{
[JsonProperty("humidity")]
/// <summary>
/// Gets or sets the Humidity
/// </summary>
[JsonProperty("humidity")]
public string Humidity { get; set; }
}
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -13,7 +13,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
public class ILevelControlsMessenger : MessengerBase
{
private ILevelControls levelControlsDevice;
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
{
levelControlsDevice = device;
@@ -23,9 +22,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, context) => SendFullStatus(id));
AddAction("/fullStatus", (id, context) =>
{
var message = new LevelControlStateMessage
{
Levels = levelControlsDevice.LevelControlPoints.ToDictionary(kv => kv.Key, kv => new Volume { Level = kv.Value.VolumeLevelFeedback.IntValue, Muted = kv.Value.MuteFeedback.BoolValue })
};
AddAction("/levelStats", (id, content) => SendFullStatus(id));
PostStatusMessage(message);
});
foreach (var levelControl in levelControlsDevice.LevelControlPoints)
{
@@ -70,16 +75,6 @@ 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>

View File

@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -25,9 +25,25 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) =>
{
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) =>
{
@@ -64,26 +80,6 @@ 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>

View File

@@ -1,9 +1,9 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -14,28 +14,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
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)
: base(key, messagePath, screenLiftDevice as IKeyName)
{
device = screenLiftDevice;
}
/// <summary>
/// Registers the actions for the messenger.
/// </summary>
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/screenliftStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/raise", (id, content) =>
{
@@ -64,7 +53,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
PostStatusMessage(JToken.FromObject(state));
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new ScreenLiftStateMessage
{
@@ -73,7 +62,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
DisplayDeviceKey = device.DisplayDeviceKey
};
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -82,23 +71,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class ScreenLiftStateMessage : DeviceStateMessageBase
{
/// <summary>
/// Gets or sets the InUpPosition
/// </summary>
[JsonProperty("inUpPosition", NullValueHandling = NullValueHandling.Ignore)]
public bool? InUpPosition { get; set; }
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DisplayDeviceKey
/// </summary>
[JsonProperty("displayDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
public string DisplayDeviceKey { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Type
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
public eScreenLiftControlType Type { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
@@ -36,9 +36,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
protected override void RegisterActions()
{
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject(id));
AddAction("/routingStatus", (id, content) => SendRoutingFullMessageObject(id));
AddAction("/fullStatus", (id, content) => SendRoutingFullMessageObject());
AddAction("/source", (id, content) =>
{
@@ -64,7 +62,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// Helper method to update full status of the routing device
/// </summary>
private void SendRoutingFullMessageObject(string id = null)
private void SendRoutingFullMessageObject()
{
if (RoutingDevice is IRoutingSink sinkDevice)
{
@@ -86,10 +84,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class RoutingStateMessage : DeviceStateMessageBase
{
[JsonProperty("selectedSourceKey")]
/// <summary>
/// Gets or sets the SelectedSourceKey
/// </summary>
[JsonProperty("selectedSourceKey")]
public string SelectedSourceKey { get; set; }
}
}

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -11,7 +11,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// Represents a ISelectableItemsMessenger
/// </summary>
public class ISelectableItemsMessenger<TKey> : MessengerBase
{
{
private readonly ISelectableItems<TKey> itemDevice;
private readonly string _propName;
@@ -34,10 +34,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
base.RegisterActions();
AddAction("/fullStatus", (id, context) =>
SendFullStatus(id)
);
AddAction("/itemsStatus", (id, content) => SendFullStatus(id));
{
SendFullStatus();
});
itemDevice.ItemsUpdated += (sender, args) =>
{
@@ -66,7 +65,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
try
{
@@ -78,7 +77,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
CurrentItem = itemDevice.CurrentItem
};
PostStatusMessage(stateObject, id);
PostStatusMessage(stateObject);
}
catch (Exception e)
{
@@ -92,17 +91,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
{
/// <summary>
/// Gets or sets the Items
/// </summary>
[JsonProperty("items")]
public Dictionary<TKey, ISelectableItem> Items { get; set; }
[JsonProperty("currentItem")]
/// <summary>
/// Gets or sets the CurrentItem
/// </summary>
[JsonProperty("currentItem")]
public TKey CurrentItem { get; set; }
}

View File

@@ -20,9 +20,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
protected override void RegisterActions()
{
AddAction("/status", (id, content) => SendFullStatus(id));
AddAction("/shutdownPromptStatus", (id, content) => SendFullStatus(id));
AddAction("/status", (id, content) =>
{
SendFullStatus();
});
AddAction("/setShutdownPromptSeconds", (id, content) =>
{
@@ -67,7 +68,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
};
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var status = new IShutdownPromptTimerStateMessage
{
@@ -76,7 +77,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
PercentageRemaining = _room.ShutdownPromptTimer.PercentFeedback.UShortValue
};
PostStatusMessage(status, id);
PostStatusMessage(status);
}
}
@@ -86,22 +87,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class IShutdownPromptTimerStateMessage : DeviceStateMessageBase
{
[JsonProperty("secondsRemaining")]
/// <summary>
/// Gets or sets the SecondsRemaining
/// </summary>
[JsonProperty("secondsRemaining")]
public int SecondsRemaining { get; set; }
[JsonProperty("percentageRemaining")]
/// <summary>
/// Gets or sets the PercentageRemaining
/// </summary>
[JsonProperty("percentageRemaining")]
public int PercentageRemaining { get; set; }
[JsonProperty("shutdownPromptSeconds")]
/// <summary>
/// Gets or sets the ShutdownPromptSeconds
/// </summary>
[JsonProperty("shutdownPromptSeconds")]
public int ShutdownPromptSeconds { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.CrestronIO;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -23,9 +23,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/switchedOutputStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/on", (id, content) =>
{
@@ -44,14 +42,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new ISwitchedOutputStateMessage
{
IsOn = device.OutputIsOnFeedback.BoolValue
};
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -60,10 +58,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class ISwitchedOutputStateMessage : DeviceStateMessageBase
{
[JsonProperty("isOn")]
/// <summary>
/// Gets or sets the IsOn
/// </summary>
[JsonProperty("isOn")]
public bool IsOn { get; set; }
}
}

View File

@@ -20,9 +20,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
protected override void RegisterActions()
{
AddAction("/status", (id, content) => SendFullStatus(id));
AddAction("/techPasswordStatus", (id, content) => SendFullStatus(id));
AddAction("/status", (id, content) =>
{
SendFullStatus();
});
AddAction("/validateTechPassword", (id, content) =>
{
@@ -54,14 +55,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
};
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var status = new ITechPasswordStateMessage
{
TechPasswordLength = _room.TechPasswordLength
};
PostStatusMessage(status, id);
PostStatusMessage(status);
}
}

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -22,9 +22,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/temperatureStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/setTemperatureUnitsToCelcius", (id, content) =>
{
@@ -40,7 +38,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
device.TemperatureInCFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
// format the temperature to a string with one decimal place
var tempString = string.Format("{0}.{1}", device.TemperatureFeedback.UShortValue / 10, device.TemperatureFeedback.UShortValue % 10);
@@ -51,7 +49,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
TemperatureInCelsius = device.TemperatureInCFeedback.BoolValue
};
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -60,16 +58,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class ITemperatureSensorStateMessage : DeviceStateMessageBase
{
[JsonProperty("temperature")]
/// <summary>
/// Gets or sets the Temperature
/// </summary>
[JsonProperty("temperature")]
public string Temperature { get; set; }
[JsonProperty("temperatureInCelsius")]
/// <summary>
/// Gets or sets the TemperatureInCelsius
/// </summary>
[JsonProperty("temperatureInCelsius")]
public bool TemperatureInCelsius { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Lighting;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -35,9 +35,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/lightingStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/selectScene", (id, content) =>
{
@@ -45,14 +43,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
lightingScenesDevice.SelectScene(s);
});
if (!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
if(!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
return;
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new LightingBaseStateMessage
{
@@ -60,7 +58,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
};
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -69,17 +67,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class LightingBaseStateMessage : DeviceStateMessageBase
{
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Scenes
/// </summary>
[JsonProperty("scenes", NullValueHandling = NullValueHandling.Ignore)]
public List<LightingScene> Scenes { get; set; }
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CurrentLightingScene
/// </summary>
[JsonProperty("currentLightingScene", NullValueHandling = NullValueHandling.Ignore)]
public LightingScene CurrentLightingScene { get; set; }
}
}

View File

@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -159,13 +159,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
message.Name = _device.Name;
var token = JToken.FromObject(message);
var token = JToken.FromObject(message);
PostStatusMessage(token, MessagePath, clientId);
}
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");
}
}
@@ -188,7 +188,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
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");
}
}

View File

@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Handler for press/hold/release messages
/// </summary>
public static class PressAndHoldHandler
{
private const long ButtonHeartbeatInterval = 1000;
@@ -29,21 +26,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
private static void AddTimer(string deviceKey, Action<bool> action)
{
Debug.LogDebug("Attempting to add timer for {deviceKey}", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to add timer for {deviceKey}", deviceKey);
if (_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
{
Debug.LogDebug("Timer for {deviceKey} already exists", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} already exists", deviceKey);
return;
}
Debug.LogDebug("Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Adding timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
action(true);
cancelTimer = new CTimer(o =>
{
Debug.LogDebug("Timer expired for {deviceKey}", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer expired for {deviceKey}", deviceKey);
action(false);
@@ -55,30 +52,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
private static void ResetTimer(string deviceKey, Action<bool> action)
{
Debug.LogDebug("Attempting to reset timer for {deviceKey}", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to reset timer for {deviceKey}", deviceKey);
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
{
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
return;
}
Debug.LogDebug("Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Resetting timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
cancelTimer.Reset(ButtonHeartbeatInterval);
}
private static void StopTimer(string deviceKey, Action<bool> action)
{
Debug.LogDebug("Attempting to stop timer for {deviceKey}", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to stop timer for {deviceKey}", deviceKey);
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
{
Debug.LogDebug("Timer for {deviceKey} not found", deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
return;
}
Debug.LogDebug("Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Stopping timer for {deviceKey} with due time {dueTime}", deviceKey, ButtonHeartbeatInterval);
action(false);
cancelTimer.Stop();
@@ -87,15 +84,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
public static Action<string, Action<bool>> GetPressAndHoldHandler(string value)
{
Debug.LogDebug("Getting press and hold handler for {value}", value);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Getting press and hold handler for {value}", value);
if (!_pushedActionHandlers.TryGetValue(value, out Action<string, Action<bool>> handler))
{
Debug.LogDebug("Press and hold handler for {value} not found", value);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Press and hold handler for {value} not found", value);
return null;
}
Debug.LogDebug("Got handler for {value}", value);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Got handler for {value}", value);
return handler;
}
@@ -107,7 +104,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
var msg = content.ToObject<MobileControlSimpleContent<string>>();
Debug.LogDebug("Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Handling press and hold message of {type} for {deviceKey}", msg.Value, deviceKey);
var timerHandler = GetPressAndHoldHandler(msg.Value);

View File

@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Core.Logging;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Room.Config;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -31,14 +31,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
var events = _room.GetScheduledEvents();
SendFullStatus(events, id);
});
AddAction("/scheduledEventsStatus", (id, content) =>
{
var events = _room.GetScheduledEvents();
SendFullStatus(events, id);
SendFullStatus(events);
});
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
@@ -62,11 +55,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
catch (Exception ex)
{
this.LogException(ex, "Exception saving event");
this.LogException(ex,"Exception saving event");
}
}
private void SendFullStatus(List<ScheduledEventConfig> events, string id = null)
private void SendFullStatus(List<ScheduledEventConfig> events)
{
var message = new RoomEventScheduleStateMessage
@@ -74,7 +67,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
ScheduleEvents = events,
};
PostStatusMessage(message, id);
PostStatusMessage(message);
}
}

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Shades;
using System;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -22,8 +22,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/shadesStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/shadeUp", (id, content) =>
{
@@ -76,7 +75,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
private void SendFullStatus(string id = null)
private void SendFullStatus()
{
var state = new ShadeBaseStateMessage();
@@ -86,7 +85,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
state.IsClosed = feedbackDevice.ShadeIsClosedFeedback.BoolValue;
}
PostStatusMessage(state, id);
PostStatusMessage(state);
}
}
@@ -95,11 +94,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class ShadeBaseStateMessage : DeviceStateMessageBase
{
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MiddleButtonLabel
/// </summary>
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
public string MiddleButtonLabel { get; set; }
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]

View File

@@ -1,10 +1,10 @@
using System;
using System.Threading.Tasks;
using Crestron.SimplSharp;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Monitoring;
using System;
using System.Threading.Tasks;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -56,37 +56,36 @@ namespace PepperDash.Essentials.AppServer.Messengers
SendSystemMonitorStatusMessage();
}
private void SendFullStatusMessage(string id = null)
private void SendFullStatusMessage()
{
SendSystemMonitorStatusMessage(id);
SendSystemMonitorStatusMessage();
foreach (var p in systemMonitor.ProgramStatusFeedbackCollection)
{
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo), id);
PostStatusMessage(JToken.FromObject(p.Value.ProgramInfo));
}
}
private void SendSystemMonitorStatusMessage(string id = null)
private void SendSystemMonitorStatusMessage()
{
// This takes a while, launch a new thread
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
{
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
}), id
})
));
}
protected override void RegisterActions()
{
AddAction("/fullStatus", (id, content) => SendFullStatusMessage(id));
AddAction("/systemStatus", (id, content) => SendFullStatusMessage(id));
AddAction("/fullStatus", (id, content) => SendFullStatusMessage());
}
}
@@ -95,45 +94,40 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class SystemMonitorStateMessage
{
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the TimeZone
/// </summary>
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
public int TimeZone { get; set; }
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the TimeZoneName
/// </summary>
[JsonProperty("timeZoneName", NullValueHandling = NullValueHandling.Ignore)]
public string TimeZoneName { get; set; }
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the IoControllerVersion
/// </summary>
[JsonProperty("ioControllerVersion", NullValueHandling = NullValueHandling.Ignore)]
public string IoControllerVersion { get; set; }
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the SnmpVersion
/// </summary>
[JsonProperty("snmpVersion", NullValueHandling = NullValueHandling.Ignore)]
public string SnmpVersion { get; set; }
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the BacnetVersion
/// </summary>
[JsonProperty("bacnetVersion", NullValueHandling = NullValueHandling.Ignore)]
public string BacnetVersion { get; set; }
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the ControllerVersion
/// </summary>
[JsonProperty("controllerVersion", NullValueHandling = NullValueHandling.Ignore)]
public string ControllerVersion { get; set; }
}
}

View File

@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <summary>
/// SendFullStatus method
/// </summary>
public void SendFullStatus(string id = null)
public void SendFullStatus()
{
var messageObj = new TwoWayDisplayBaseStateMessage
{
@@ -31,17 +31,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
CurrentInput = _display.CurrentInputFeedback.StringValue
};
PostStatusMessage(messageObj, id);
PostStatusMessage(messageObj);
}
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/displayStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
//_display.PowerIsOnFeedback.OutputChange += PowerIsOnFeedbackOnOutputChange;
_display.CurrentInputFeedback.OutputChange += CurrentInputFeedbackOnOutputChange;
_display.IsCoolingDownFeedback.OutputChange += IsCoolingFeedbackOnOutputChange;
_display.IsWarmingUpFeedback.OutputChange += IsWarmingFeedbackOnOutputChange;
@@ -56,6 +55,16 @@ 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)
{
PostStatusMessage(JToken.FromObject(new
@@ -87,11 +96,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
//[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
//public bool? PowerState { get; set; }
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CurrentInput
/// </summary>
[JsonProperty("currentInput", NullValueHandling = NullValueHandling.Ignore)]
public string CurrentInput { get; set; }
}
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Crestron.SimplSharp;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
@@ -13,6 +9,9 @@ using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials.AppServer.Messengers
{
@@ -152,8 +151,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
PostStatusMessage(state);
SendFullStatus();
}
catch (Exception ex)
} catch (Exception ex)
{
this.LogError(ex, "Error sending codec ready status");
}
@@ -171,8 +169,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
AddAction("/isReady", (id, content) => SendIsReady());
AddAction("/fullStatus", (id, content) => SendFullStatus(id));
AddAction("/codecStatus", (id, content) => SendFullStatus(id));
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/dial", (id, content) =>
{
@@ -372,8 +369,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
};
PostStatusMessage(state);
}
catch (Exception ex)
} catch (Exception ex)
{
this.LogError(ex, "Error posting sharing source");
}
@@ -389,8 +385,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
};
PostStatusMessage(state);
}
catch (Exception ex)
} catch (Exception ex)
{
this.LogError(ex, "Error posting sharing content");
}
@@ -440,8 +435,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
MapCameraActions();
PostSelectedCamera();
}
catch (Exception ex)
} catch(Exception ex)
{
this.LogError(ex, "Exception handling camera selected event");
}
@@ -786,14 +780,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
}
}
protected virtual void SendFullStatus(string id = null)
protected virtual void SendFullStatus()
{
if (!Codec.IsReady)
{
return;
}
Task.Run(() => PostStatusMessage(GetStatus(), id));
CrestronInvoke.BeginInvoke((o) => PostStatusMessage(GetStatus()));
}
private void PostReceivingContent(bool receivingContent)
@@ -806,8 +800,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
};
PostStatusMessage(state);
}
catch (Exception ex)
} catch(Exception ex)
{
this.LogError(ex, "Error posting receiving content");
}
@@ -956,25 +949,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("cameraSupportsOffMode", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraSupportsOffMode { get; set; }
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CurrentDialString
/// </summary>
[JsonProperty("currentDialString", NullValueHandling = NullValueHandling.Ignore)]
public string CurrentDialString { get; set; }
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CurrentDirectory
/// </summary>
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
public CodecDirectory CurrentDirectory { get; set; }
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DirectorySelectedFolderName
/// </summary>
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
public string DirectorySelectedFolderName { get; set; }
[JsonProperty("hasCameras", NullValueHandling = NullValueHandling.Ignore)]
@@ -995,11 +985,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("initialPhonebookSyncComplete", NullValueHandling = NullValueHandling.Ignore)]
public bool? InitialPhonebookSyncComplete { get; set; }
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Info
/// </summary>
[JsonProperty("info", NullValueHandling = NullValueHandling.Ignore)]
public VideoCodecInfo Info { get; set; }
[JsonProperty("isInCall", NullValueHandling = NullValueHandling.Ignore)]
@@ -1011,18 +1000,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("isZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsZoomRoom { get; set; }
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MeetingInfo
/// </summary>
[JsonProperty("meetingInfo", NullValueHandling = NullValueHandling.Ignore)]
public MeetingInfo MeetingInfo { get; set; }
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Presets
/// </summary>
[JsonProperty("presets", NullValueHandling = NullValueHandling.Ignore)]
public List<CodecRoomPreset> Presets { get; set; }
[JsonProperty("privacyModeIsOn", NullValueHandling = NullValueHandling.Ignore)]
@@ -1037,11 +1024,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("sharingContentIsOn", NullValueHandling = NullValueHandling.Ignore)]
public bool? SharingContentIsOn { get; set; }
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the SharingSource
/// </summary>
[JsonProperty("sharingSource", NullValueHandling = NullValueHandling.Ignore)]
public string SharingSource { get; set; }
[JsonProperty("showCamerasWhenNotInCall", NullValueHandling = NullValueHandling.Ignore)]
@@ -1071,26 +1057,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
[JsonProperty("cameraOffSupported", NullValueHandling = NullValueHandling.Ignore)]
public bool? CameraOffIsSupported { get; set; }
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CameraMode
/// </summary>
[JsonProperty("cameraMode", NullValueHandling = NullValueHandling.Ignore)]
public string CameraMode { get; set; }
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Cameras
/// </summary>
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
public List<CameraBase> Cameras { get; set; }
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the SelectedCamera
/// </summary>
[JsonProperty("selectedCamera", NullValueHandling = NullValueHandling.Ignore)]
public Camera SelectedCamera { get; set; }
public Camera SelectedCamera { get; set; }
}
/// <summary>
@@ -1098,28 +1081,25 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class Camera
{
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Key
/// </summary>
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; set; }
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Name
/// </summary>
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("isFarEnd", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsFarEnd { get; set; }
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Capabilities
/// </summary>
[JsonProperty("capabilities", NullValueHandling = NullValueHandling.Ignore)]
public CameraCapabilities Capabilities { get; set; }
}
@@ -1155,31 +1135,27 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
public class PasswordPromptEventMessage : VideoCodecBaseEventMessage
{
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Message
/// </summary>
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
public string Message { get; set; }
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the LastAttemptWasIncorrect
/// </summary>
[JsonProperty("lastAttemptWasIncorrect", NullValueHandling = NullValueHandling.Ignore)]
public bool LastAttemptWasIncorrect { get; set; }
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the LoginAttemptFailed
/// </summary>
[JsonProperty("loginAttemptFailed", NullValueHandling = NullValueHandling.Ignore)]
public bool LoginAttemptFailed { get; set; }
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the LoginAttemptCancelled
/// </summary>
[JsonProperty("loginAttemptCancelled", NullValueHandling = NullValueHandling.Ignore)]
public bool LoginAttemptCancelled { get; set; }
}
}

View File

@@ -7,18 +7,16 @@ namespace PepperDash.Essentials
/// </summary>
public class AuthorizationResponse
{
[JsonProperty("authorized")]
/// <summary>
/// Gets or sets the Authorized
/// </summary>
[JsonProperty("authorized")]
public bool Authorized { get; set; }
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Reason
/// </summary>
[JsonProperty("reason", NullValueHandling = NullValueHandling.Ignore)]
public string Reason { get; set; } = null;
}
@@ -27,11 +25,10 @@ namespace PepperDash.Essentials
/// </summary>
public class AuthorizationRequest
{
[JsonProperty("grantCode")]
/// <summary>
/// Gets or sets the GrantCode
/// </summary>
[JsonProperty("grantCode")]
public string GrantCode { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Essentials.Core.Config;
using System.Collections.Generic;
namespace PepperDash.Essentials
@@ -39,11 +39,10 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlRuntimeInfo
{
[JsonProperty("pluginVersion")]
/// <summary>
/// Gets or sets the PluginVersion
/// </summary>
[JsonProperty("pluginVersion")]
public string PluginVersion { get; set; }
[JsonProperty("essentialsVersion")]
@@ -52,11 +51,10 @@ namespace PepperDash.Essentials
[JsonProperty("pepperDashCoreVersion")]
public string PepperDashCoreVersion { get; set; }
[JsonProperty("essentialsPlugins")]
/// <summary>
/// Gets or sets the EssentialsPlugins
/// </summary>
[JsonProperty("essentialsPlugins")]
public List<LoadedAssembly> EssentialsPlugins { get; set; }
}
}

View File

@@ -251,6 +251,8 @@ namespace PepperDash.Essentials
return _wsClient2.IsAlive && IsAuthorized;
});
Debug.SetFileMinimumDebugLevel(Serilog.Events.LogEventLevel.Verbose);
}
private void SetupDefaultRoomMessengers()
@@ -486,15 +488,15 @@ namespace PepperDash.Essentials
messengerAdded = true;
}
if (device is IBasicVolumeWithFeedback)
if (device is IBasicVolumeControls)
{
var deviceKey = device.Key;
this.LogVerbose(
"Adding IBasicVolumeControlWithFeedback for {deviceKey}",
"Adding IBasicVolumeControls for {deviceKey}",
deviceKey
);
var volControlDevice = device as IBasicVolumeWithFeedback;
var volControlDevice = device as IBasicVolumeControls;
var messenger = new DeviceVolumeMessenger(
$"{device.Key}-volume-{Key}",
string.Format("/device/{0}", deviceKey),
@@ -1336,13 +1338,38 @@ namespace PepperDash.Essentials
Log =
{
Output = (data, s) =>
this.LogDebug(
"Message from websocket: {message}",
data
)
{
switch (data.Level)
{
case LogLevel.Trace:
this.LogVerbose(data.Message);
break;
case LogLevel.Debug:
this.LogDebug(data.Message);
break;
case LogLevel.Info:
this.LogInformation(data.Message);
break;
case LogLevel.Warn:
this.LogWarning(data.Message);
break;
case LogLevel.Error:
this.LogError(data.Message);
break;
case LogLevel.Fatal:
this.LogFatal(data.Message);
break;
}
}
}
};
// if Essentials is running on a server, set the log level to the lowest level to get the most detail in the logs
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server)
{
_wsClient2.Log.Level = LogLevel.Trace;
}
_wsClient2.SslConfiguration.EnabledSslProtocols =
System.Security.Authentication.SslProtocols.Tls11
| System.Security.Authentication.SslProtocols.Tls12;
@@ -1484,7 +1511,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Adds an action to the dictionary
/// </summary>
/// <param name="messenger">The messenger for the API command</param>
/// <param name="key">The path of the API command</param>
/// <param name="action">The action to be triggered by the commmand</param>
public void AddAction<T>(T messenger, Action<string, string, JToken> action)
where T : IMobileControlMessenger
@@ -1917,7 +1944,8 @@ namespace PepperDash.Essentials
/// <param name="e"></param>
private void HandleError(object sender, ErrorEventArgs e)
{
this.LogError("Websocket error {0}", e.Message);
this.LogError("Websocket error {message}", e.Message);
this.LogError(e.Exception, "Websocket error");
IsAuthorized = false;
StartServerReconnectTimer();
@@ -1930,7 +1958,7 @@ namespace PepperDash.Essentials
/// <param name="e"></param>
private void HandleClose(object sender, CloseEventArgs e)
{
this.LogDebug(
this.LogInformation(
"Websocket close {code} {reason}, clean={wasClean}",
e.Code,
e.Reason,

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
@@ -20,6 +17,9 @@ using PepperDash.Essentials.Devices.Common.Room;
using PepperDash.Essentials.Devices.Common.VideoCodec;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.WebSocketServer;
using System;
using System.Collections.Generic;
using System.Linq;
using IShades = PepperDash.Essentials.Core.Shades.IShades;
using ShadeBase = PepperDash.Essentials.Devices.Common.Shades.ShadeBase;
@@ -485,7 +485,6 @@ namespace PepperDash.Essentials.RoomBridges
/// Sends the full status of the room to the server
/// </summary>
/// <param name="room"></param>
/// <param name="id"></param>
private void SendFullStatusForClientId(string id, IEssentialsRoom room)
{
//Parent.SendMessageObject(GetFullStatus(room));
@@ -555,7 +554,6 @@ namespace PepperDash.Essentials.RoomBridges
/// <summary>
/// Determines the configuration of the room and the details about the devices associated with the room
/// </summary>
/// <param name="room"></param>
/// <returns></returns>
private RoomConfiguration GetRoomConfiguration(IEssentialsRoom room)
@@ -800,38 +798,31 @@ namespace PepperDash.Essentials.RoomBridges
/// </summary>
public class RoomStateMessage : DeviceStateMessageBase
{
[JsonProperty("configuration", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Configuration
/// </summary>
[JsonProperty("configuration", NullValueHandling = NullValueHandling.Ignore)]
public RoomConfiguration Configuration { get; set; }
[JsonProperty("activityMode", NullValueHandling = NullValueHandling.Ignore)]
public int? ActivityMode { get; set; }
[JsonProperty("advancedSharingActive", NullValueHandling = NullValueHandling.Ignore)]
public bool? AdvancedSharingActive { get; set; }
[JsonProperty("isOn", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsOn { get; set; }
[JsonProperty("isWarmingUp", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsWarmingUp { get; set; }
[JsonProperty("isCoolingDown", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsCoolingDown { get; set; }
[JsonProperty("selectedSourceKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the SelectedSourceKey
/// </summary>
[JsonProperty("selectedSourceKey", NullValueHandling = NullValueHandling.Ignore)]
public string SelectedSourceKey { get; set; }
[JsonProperty("share", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Share
/// </summary>
[JsonProperty("share", NullValueHandling = NullValueHandling.Ignore)]
public ShareState Share { get; set; }
[JsonProperty("volumes", NullValueHandling = NullValueHandling.Ignore)]
@@ -846,16 +837,13 @@ namespace PepperDash.Essentials.RoomBridges
/// </summary>
public class ShareState
{
[JsonProperty("currentShareText", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CurrentShareText
/// </summary>
[JsonProperty("currentShareText", NullValueHandling = NullValueHandling.Ignore)]
public string CurrentShareText { get; set; }
[JsonProperty("enabled", NullValueHandling = NullValueHandling.Ignore)]
public bool? Enabled { get; set; }
[JsonProperty("isSharing", NullValueHandling = NullValueHandling.Ignore)]
public bool? IsSharing { get; set; }
}
@@ -865,156 +853,131 @@ namespace PepperDash.Essentials.RoomBridges
/// </summary>
public class RoomConfiguration
{
//[JsonProperty("shutdownPromptSeconds", NullValueHandling = NullValueHandling.Ignore)]
//public int? ShutdownPromptSeconds { get; set; }
[JsonProperty("hasVideoConferencing", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasVideoConferencing { get; set; }
[JsonProperty("videoCodecIsZoomRoom", NullValueHandling = NullValueHandling.Ignore)]
public bool? VideoCodecIsZoomRoom { get; set; }
[JsonProperty("hasAudioConferencing", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasAudioConferencing { get; set; }
[JsonProperty("hasEnvironmentalControls", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasEnvironmentalControls { get; set; }
[JsonProperty("hasCameraControls", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasCameraControls { get; set; }
[JsonProperty("hasSetTopBoxControls", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasSetTopBoxControls { get; set; }
[JsonProperty("hasRoutingControls", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasRoutingControls { get; set; }
[JsonProperty("touchpanelKeys", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the TouchpanelKeys
/// </summary>
[JsonProperty("touchpanelKeys", NullValueHandling = NullValueHandling.Ignore)]
public List<string> TouchpanelKeys { get; set; }
[JsonProperty("zoomRoomControllerKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the ZoomRoomControllerKey
/// </summary>
[JsonProperty("zoomRoomControllerKey", NullValueHandling = NullValueHandling.Ignore)]
public string ZoomRoomControllerKey { get; set; }
[JsonProperty("ciscoNavigatorKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the CiscoNavigatorKey
/// </summary>
[JsonProperty("ciscoNavigatorKey", NullValueHandling = NullValueHandling.Ignore)]
public string CiscoNavigatorKey { get; set; }
[JsonProperty("videoCodecKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the VideoCodecKey
/// </summary>
[JsonProperty("videoCodecKey", NullValueHandling = NullValueHandling.Ignore)]
public string VideoCodecKey { get; set; }
[JsonProperty("audioCodecKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the AudioCodecKey
/// </summary>
[JsonProperty("audioCodecKey", NullValueHandling = NullValueHandling.Ignore)]
public string AudioCodecKey { get; set; }
[JsonProperty("matrixRoutingKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MatrixRoutingKey
/// </summary>
[JsonProperty("matrixRoutingKey", NullValueHandling = NullValueHandling.Ignore)]
public string MatrixRoutingKey { get; set; }
[JsonProperty("endpointKeys", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the EndpointKeys
/// </summary>
[JsonProperty("endpointKeys", NullValueHandling = NullValueHandling.Ignore)]
public List<string> EndpointKeys { get; set; }
[JsonProperty("accessoryDeviceKeys", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the AccessoryDeviceKeys
/// </summary>
[JsonProperty("accessoryDeviceKeys", NullValueHandling = NullValueHandling.Ignore)]
public List<string> AccessoryDeviceKeys { get; set; }
[JsonProperty("defaultDisplayKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DefaultDisplayKey
/// </summary>
[JsonProperty("defaultDisplayKey", NullValueHandling = NullValueHandling.Ignore)]
public string DefaultDisplayKey { get; set; }
[JsonProperty("destinations", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<eSourceListItemDestinationTypes, string> Destinations { get; set; }
[JsonProperty("environmentalDevices", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the EnvironmentalDevices
/// </summary>
[JsonProperty("environmentalDevices", NullValueHandling = NullValueHandling.Ignore)]
public List<EnvironmentalDeviceConfiguration> EnvironmentalDevices { get; set; }
[JsonProperty("sourceList", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, SourceListItem> SourceList { get; set; }
[JsonProperty("destinationList", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, DestinationListItem> DestinationList { get; set; }
[JsonProperty("audioControlPointList", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the AudioControlPointList
/// </summary>
[JsonProperty("audioControlPointList", NullValueHandling = NullValueHandling.Ignore)]
public AudioControlPointListItem AudioControlPointList { get; set; }
[JsonProperty("cameraList", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, CameraListItem> CameraList { get; set; }
[JsonProperty("defaultPresentationSourceKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DefaultPresentationSourceKey
/// </summary>
[JsonProperty("defaultPresentationSourceKey", NullValueHandling = NullValueHandling.Ignore)]
public string DefaultPresentationSourceKey { get; set; }
[JsonProperty("helpMessage", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the HelpMessage
/// </summary>
[JsonProperty("helpMessage", NullValueHandling = NullValueHandling.Ignore)]
public string HelpMessage { get; set; }
[JsonProperty("techPassword", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the TechPassword
/// </summary>
[JsonProperty("techPassword", NullValueHandling = NullValueHandling.Ignore)]
public string TechPassword { get; set; }
[JsonProperty("uiBehavior", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the UiBehavior
/// </summary>
[JsonProperty("uiBehavior", NullValueHandling = NullValueHandling.Ignore)]
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
[JsonProperty("supportsAdvancedSharing", NullValueHandling = NullValueHandling.Ignore)]
public bool? SupportsAdvancedSharing { get; set; }
[JsonProperty("userCanChangeShareMode", NullValueHandling = NullValueHandling.Ignore)]
public bool? UserCanChangeShareMode { get; set; }
[JsonProperty("roomCombinerKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the RoomCombinerKey
/// </summary>
[JsonProperty("roomCombinerKey", NullValueHandling = NullValueHandling.Ignore)]
public string RoomCombinerKey { get; set; }
public RoomConfiguration()
@@ -1031,19 +994,17 @@ namespace PepperDash.Essentials.RoomBridges
/// </summary>
public class EnvironmentalDeviceConfiguration
{
[JsonProperty("deviceKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
[JsonProperty("deviceKey", NullValueHandling = NullValueHandling.Ignore)]
public string DeviceKey { get; private set; }
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("deviceType", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the DeviceType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("deviceType", NullValueHandling = NullValueHandling.Ignore)]
public eEnvironmentalDeviceTypes DeviceType { get; private set; }
public EnvironmentalDeviceConfiguration(string key, eEnvironmentalDeviceTypes type)
@@ -1070,18 +1031,57 @@ namespace PepperDash.Essentials.RoomBridges
/// </summary>
public class ApiTouchPanelToken
{
[JsonProperty("touchPanels", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the TouchPanels
/// </summary>
[JsonProperty("touchPanels", NullValueHandling = NullValueHandling.Ignore)]
public List<JoinToken> TouchPanels { get; set; } = new List<JoinToken>();
[JsonProperty("userAppUrl", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the UserAppUrl
/// </summary>
[JsonProperty("userAppUrl", NullValueHandling = NullValueHandling.Ignore)]
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
}

View File

@@ -16,6 +16,7 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.DeviceInfo;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.UI;
using Serilog.Events;
using Feedback = PepperDash.Essentials.Core.Feedback;
namespace PepperDash.Essentials.Touchpanel
@@ -190,12 +191,27 @@ namespace PepperDash.Essentials.Touchpanel
RegisterForExtenders();
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);
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);
this.csSubnetMask = System.Net.IPAddress.Parse(csSubnetMask);
this.csIpAddress = System.Net.IPAddress.Parse(csIpAddress);
}
catch (ArgumentException)
{
Debug.LogInformation("This processor does not have a CS LAN", this);
}
catch (InvalidOperationException)
{
Debug.LogInformation("This processor does not have a CS LAN", this);
}
catch (Exception ex)
{
Debug.LogError($"Unexpected exception when checking CS LAN: {ex}", this);
}
}
/// <summary>
@@ -436,7 +452,7 @@ namespace PepperDash.Essentials.Touchpanel
var processorIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, lanAdapterId);
if(csIpAddress == null || csSubnetMask == null || url == null)
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;
@@ -502,7 +518,7 @@ namespace PepperDash.Essentials.Touchpanel
_bridge.UserCodeChanged += UpdateFeedbacks;
_bridge.AppUrlChanged += (s, a) =>
{
this.LogInformation("AppURL changed");
this.LogInformation("AppURL changed: {appURL}", _bridge.AppUrl);
SetAppUrl(_bridge.AppUrl);
UpdateFeedbacks(s, a);
};

View File

@@ -8,32 +8,28 @@ namespace PepperDash.Essentials.Touchpanel
/// </summary>
public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesConfig
{
[JsonProperty("useDirectServer")]
/// <summary>
/// Gets or sets the UseDirectServer
/// </summary>
[JsonProperty("useDirectServer")]
public bool UseDirectServer { get; set; } = false;
[JsonProperty("zoomRoomController")]
/// <summary>
/// Gets or sets the ZoomRoomController
/// </summary>
[JsonProperty("zoomRoomController")]
public bool ZoomRoomController { get; set; } = false;
[JsonProperty("buttonToolbarTimeoutInS")]
/// <summary>
/// Gets or sets the ButtonToolbarTimoutInS
/// </summary>
[JsonProperty("buttonToolbarTimeoutInS")]
public ushort ButtonToolbarTimoutInS { get; set; } = 0;
[JsonProperty("theme")]
/// <summary>
/// Gets or sets the Theme
/// </summary>
[JsonProperty("theme")]
public string Theme { get; set; } = "light";
}
}

View File

@@ -42,11 +42,10 @@ namespace PepperDash.Essentials.Touchpanel
/// </summary>
public class ThemeUpdateMessage : DeviceStateMessageBase
{
[JsonProperty("theme")]
/// <summary>
/// Gets or sets the Theme
/// </summary>
[JsonProperty("theme")]
public string Theme { get; set; }
}
}

View File

@@ -7,18 +7,16 @@ namespace PepperDash.Essentials
/// </summary>
public class UserCodeChangedContent
{
[JsonProperty("userCode")]
/// <summary>
/// Gets or sets the UserCode
/// </summary>
[JsonProperty("userCode")]
public string UserCode { get; set; }
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
/// <summary>
/// Gets or sets the QrChecksum
/// </summary>
[JsonProperty("qrChecksum", NullValueHandling = NullValueHandling.Include)]
public string QrChecksum { get; set; }
}
}

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace PepperDash.Essentials
{
@@ -8,11 +8,10 @@ namespace PepperDash.Essentials
/// </summary>
public class Volumes
{
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Master
/// </summary>
[JsonProperty("master", NullValueHandling = NullValueHandling.Ignore)]
public Volume Master { get; set; }
[JsonProperty("auxFaders", NullValueHandling = NullValueHandling.Ignore)]
@@ -31,11 +30,10 @@ namespace PepperDash.Essentials
/// </summary>
public class Volume
{
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Key
/// </summary>
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; set; }
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
@@ -44,11 +42,10 @@ namespace PepperDash.Essentials
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
public bool? Muted { get; set; }
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Label
/// </summary>
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
public string Label { get; set; }
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
@@ -61,11 +58,10 @@ namespace PepperDash.Essentials
public bool? PrivacyMuted { get; set; }
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the MuteIcon
/// </summary>
[JsonProperty("muteIcon", NullValueHandling = NullValueHandling.Ignore)]
public string MuteIcon { get; set; }
public Volume(string key, int level, bool muted, string label, bool hasMute, string muteIcon)

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp.WebScripting;
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials.WebApiHandlers
{
@@ -51,18 +51,16 @@ namespace PepperDash.Essentials.WebApiHandlers
/// </summary>
public class ActionPath
{
[JsonProperty("messengerKey")]
/// <summary>
/// Gets or sets the MessengerKey
/// </summary>
[JsonProperty("messengerKey")]
public string MessengerKey { get; set; }
[JsonProperty("path")]
/// <summary>
/// Gets or sets the Path
/// </summary>
[JsonProperty("path")]
public string Path { get; set; }
}
}

View File

@@ -148,25 +148,22 @@ namespace PepperDash.Essentials.WebApiHandlers
/// </summary>
public class ClientRequest
{
[JsonProperty("roomKey", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the RoomKey
/// </summary>
[JsonProperty("roomKey", NullValueHandling = NullValueHandling.Ignore)]
public string RoomKey { get; set; }
[JsonProperty("grantCode", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the GrantCode
/// </summary>
[JsonProperty("grantCode", NullValueHandling = NullValueHandling.Ignore)]
public string GrantCode { get; set; }
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Token
/// </summary>
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
public string Token { get; set; }
}
@@ -175,25 +172,22 @@ namespace PepperDash.Essentials.WebApiHandlers
/// </summary>
public class ClientResponse
{
[JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Error
/// </summary>
[JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)]
public string Error { get; set; }
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Token
/// </summary>
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
public string Token { get; set; }
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the Path
/// </summary>
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
public string Path { get; set; }
}
}

View File

@@ -1334,11 +1334,10 @@ namespace PepperDash.Essentials.WebSocketServer
/// </summary>
public class JoinResponse
{
[JsonProperty("clientId")]
/// <summary>
/// Gets or sets the ClientId
/// </summary>
[JsonProperty("clientId")]
public string ClientId { get; set; }
[JsonProperty("roomKey")]
@@ -1347,46 +1346,40 @@ namespace PepperDash.Essentials.WebSocketServer
[JsonProperty("systemUUid")]
public string SystemUuid { get; set; }
[JsonProperty("roomUUid")]
/// <summary>
/// Gets or sets the RoomUuid
/// </summary>
[JsonProperty("roomUUid")]
public string RoomUuid { get; set; }
[JsonProperty("config")]
/// <summary>
/// Gets or sets the Config
/// </summary>
[JsonProperty("config")]
public object Config { get; set; }
[JsonProperty("codeExpires")]
/// <summary>
/// Gets or sets the CodeExpires
/// </summary>
[JsonProperty("codeExpires")]
public DateTime CodeExpires { get; set; }
[JsonProperty("userCode")]
/// <summary>
/// Gets or sets the UserCode
/// </summary>
[JsonProperty("userCode")]
public string UserCode { get; set; }
[JsonProperty("userAppUrl")]
/// <summary>
/// Gets or sets the UserAppUrl
/// </summary>
[JsonProperty("userAppUrl")]
public string UserAppUrl { get; set; }
[JsonProperty("enableDebug")]
/// <summary>
/// Gets or sets the EnableDebug
/// </summary>
[JsonProperty("enableDebug")]
public bool EnableDebug { get; set; }
}
}