mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 18:54:52 +00:00
docs: add XML comments for messengers
This commit is contained in:
@@ -3,29 +3,51 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the content of a source selection message
|
||||
/// </summary>
|
||||
public class SourceSelectMessageContent
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the key of the source list item to select
|
||||
/// </summary>
|
||||
[JsonProperty("sourceListItemKey")]
|
||||
public string SourceListItemKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the key of the source list containing the item
|
||||
/// </summary>
|
||||
[JsonProperty("sourceListKey")]
|
||||
public string SourceListKey { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a direct routing operation between a source and destination
|
||||
/// </summary>
|
||||
public class DirectRoute
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the key of the source device
|
||||
/// </summary>
|
||||
[JsonProperty("sourceKey")]
|
||||
public string SourceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the key of the destination device
|
||||
/// </summary>
|
||||
[JsonProperty("destinationKey")]
|
||||
public string DestinationKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of routing signal (Audio, Video, etc.)
|
||||
/// </summary>
|
||||
[JsonProperty("signalType")]
|
||||
public eRoutingSignalType SignalType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Delegate for press and hold actions with boolean state parameter
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="b">The state of the press and hold action</param>
|
||||
public delegate void PressAndHoldAction(bool b);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,35 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.AppServer;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using System.Linq;
|
||||
using DisplayBase = PepperDash.Essentials.Devices.Common.Displays.DisplayBase;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for display devices
|
||||
/// </summary>
|
||||
public class DisplayBaseMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The display device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly DisplayBase display;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DisplayBaseMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing display control messages</param>
|
||||
/// <param name="device">The display device to control</param>
|
||||
public DisplayBaseMessenger(string key, string messagePath, DisplayBase device) : base(key, messagePath, device)
|
||||
{
|
||||
display = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,15 +4,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for devices with channel control functionality
|
||||
/// </summary>
|
||||
public class IChannelMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The channel control device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly IChannel channelDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IChannelMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing channel control messages</param>
|
||||
/// <param name="device">The device that implements channel control functionality</param>
|
||||
public IChannelMessenger(string key, string messagePath, IChannel device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
channelDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,14 +4,25 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement IColor interface
|
||||
/// </summary>
|
||||
public class IColorMessenger : MessengerBase
|
||||
{
|
||||
private readonly IColor colorDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IColorMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements IColor</param>
|
||||
public IColorMessenger(string key, string messagePath, IColor device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
colorDevice = device as IColor;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,15 +4,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for devices with directional pad functionality
|
||||
/// </summary>
|
||||
public class IDPadMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The directional pad device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly IDPad dpadDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IDPadMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing directional pad messages</param>
|
||||
/// <param name="device">The device that implements directional pad functionality</param>
|
||||
public IDPadMessenger(string key, string messagePath, IDPad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dpadDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,14 +4,25 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement IDvr interface
|
||||
/// </summary>
|
||||
public class IDvrMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDvr dvrDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IDvrMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements IDvr</param>
|
||||
public IDvrMessenger(string key, string messagePath, IDvr device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dvrDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,14 +4,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for devices with power control functionality
|
||||
/// </summary>
|
||||
public class IHasPowerMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The power control device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly IHasPowerControl powerDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IHasPowerMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing power control messages</param>
|
||||
/// <param name="device">The device that implements power control functionality</param>
|
||||
public IHasPowerMessenger(string key, string messagePath, IHasPowerControl device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
powerDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,14 +4,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for devices with numeric keypad functionality
|
||||
/// </summary>
|
||||
public class INumericKeypadMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The numeric keypad device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly INumericKeypad keypadDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the INumericKeypadMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing numeric keypad messages</param>
|
||||
/// <param name="device">The device that implements numeric keypad functionality</param>
|
||||
public INumericKeypadMessenger(string key, string messagePath, INumericKeypad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
keypadDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -4,14 +4,25 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement ISetTopBoxControls interface
|
||||
/// </summary>
|
||||
public class ISetTopBoxControlsMessenger : MessengerBase
|
||||
{
|
||||
private readonly ISetTopBoxControls stbDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ISetTopBoxControlsMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements ISetTopBoxControls</param>
|
||||
public ISetTopBoxControlsMessenger(string key, string messagePath, ISetTopBoxControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
stbDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -32,6 +43,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for set top box controls
|
||||
/// </summary>
|
||||
public class SetTopBoxControlsState : DeviceStateMessageBase
|
||||
{
|
||||
|
||||
|
||||
@@ -4,14 +4,28 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger that provides mobile control interface for devices with transport control functionality
|
||||
/// </summary>
|
||||
public class ITransportMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The transport control device this messenger is associated with
|
||||
/// </summary>
|
||||
private readonly ITransport transportDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ITransportMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing transport control messages</param>
|
||||
/// <param name="device">The device that implements transport control functionality</param>
|
||||
public ITransportMessenger(string key, string messagePath, ITransport device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
transportDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -29,6 +29,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
codec.CallStatusChange += Codec_CallStatusChange;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling audio codec operations.
|
||||
/// Includes call control, status reporting, and audio codec management.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for camera control operations.
|
||||
/// Handles camera movement, zoom, preset management, and camera status reporting.
|
||||
/// </summary>
|
||||
public class CameraBaseMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -45,6 +49,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling camera control operations.
|
||||
/// Includes camera movement, zoom, preset management, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Timers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
using System.Timers;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Facilitates communication of device information by providing mechanisms for status updates and device
|
||||
/// information reporting.
|
||||
/// <summary>
|
||||
/// Facilitates communication of device information by providing mechanisms for status updates and device
|
||||
/// information reporting.
|
||||
/// </summary>
|
||||
/// <remarks>The <see cref="DeviceInfoMessenger"/> class integrates with an <see
|
||||
/// cref="IDeviceInfoProvider"/> to manage device-specific information. It uses a debounce timer to limit the
|
||||
@@ -21,42 +21,42 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
private readonly Timer debounceTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceInfoMessenger"/> class, which facilitates communication
|
||||
/// of device information.
|
||||
/// </summary>
|
||||
/// <remarks>The messenger uses a debounce timer to limit the frequency of certain operations. The
|
||||
/// timer is initialized with a 1-second interval and is disabled by default.</remarks>
|
||||
/// <param name="key">A unique identifier for the messenger instance.</param>
|
||||
/// <param name="messagePath">The path used for sending and receiving messages.</param>
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceInfoMessenger"/> class, which facilitates communication
|
||||
/// of device information.
|
||||
/// </summary>
|
||||
/// <remarks>The messenger uses a debounce timer to limit the frequency of certain operations. The
|
||||
/// timer is initialized with a 1-second interval and is disabled by default.</remarks>
|
||||
/// <param name="key">A unique identifier for the messenger instance.</param>
|
||||
/// <param name="messagePath">The path used for sending and receiving messages.</param>
|
||||
/// <param name="device">An implementation of <see cref="IDeviceInfoProvider"/> that provides device-specific information.</param>
|
||||
public DeviceInfoMessenger(string key, string messagePath, IDeviceInfoProvider device) : base(key, messagePath, device as Device)
|
||||
{
|
||||
_deviceInfoProvider = device;
|
||||
|
||||
debounceTimer = new Timer(1000)
|
||||
{
|
||||
Enabled = false,
|
||||
AutoReset = false
|
||||
debounceTimer = new Timer(1000)
|
||||
{
|
||||
Enabled = false,
|
||||
AutoReset = false
|
||||
};
|
||||
|
||||
debounceTimer.Elapsed += DebounceTimer_Elapsed;
|
||||
}
|
||||
|
||||
private void DebounceTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
deviceInfo = _deviceInfoProvider.DeviceInfo
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions and event handlers for device information updates and status reporting.
|
||||
/// </summary>
|
||||
/// <remarks>This method sets up actions for handling device status updates and reporting full
|
||||
/// device status. It also subscribes to the <see cref="IDeviceInfoProvider.DeviceInfoChanged"/> event to
|
||||
/// trigger debounced updates when the device information changes.</remarks>
|
||||
}
|
||||
|
||||
private void DebounceTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
deviceInfo = _deviceInfoProvider.DeviceInfo
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions and event handlers for device information updates and status reporting.
|
||||
/// </summary>
|
||||
/// <remarks>This method sets up actions for handling device status updates and reporting full
|
||||
/// device status. It also subscribes to the <see cref="IDeviceInfoProvider.DeviceInfoChanged"/> event to
|
||||
/// trigger debounced updates when the device information changes.</remarks>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -76,14 +76,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a message containing the state information of a device, including detailed device information.
|
||||
/// <summary>
|
||||
/// Represents a message containing the state information of a device, including detailed device information.
|
||||
/// </summary>
|
||||
/// <remarks>This class is used to encapsulate the state of a device along with its associated
|
||||
/// information. It extends <see cref="DeviceStateMessageBase"/> to provide additional details about the
|
||||
/// device.</remarks>
|
||||
public class DeviceInfoStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the device information.
|
||||
/// </summary>
|
||||
[JsonProperty("deviceInfo")]
|
||||
public DeviceInfo DeviceInfo { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for device preset management operations.
|
||||
/// Handles preset selection, recall, and preset list management.
|
||||
/// </summary>
|
||||
public class DevicePresetsModelMessenger : MessengerBase
|
||||
{
|
||||
private readonly ITvPresetsProvider _presetsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DevicePresetsModelMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="messagePath">The message path for preset control messages.</param>
|
||||
/// <param name="presetsDevice">The device that provides preset functionality.</param>
|
||||
public DevicePresetsModelMessenger(string key, string messagePath, ITvPresetsProvider presetsDevice)
|
||||
: base(key, messagePath, presetsDevice as Device)
|
||||
{
|
||||
@@ -40,6 +50,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling device preset operations.
|
||||
/// Includes preset selection, recall, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
@@ -83,17 +97,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a preset channel message for device preset operations.
|
||||
/// </summary>
|
||||
public class PresetChannelMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the preset channel information.
|
||||
/// </summary>
|
||||
[JsonProperty("preset")]
|
||||
public PresetChannel Preset;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device key associated with the preset.
|
||||
/// </summary>
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a preset state message containing favorite presets.
|
||||
/// </summary>
|
||||
public class PresetStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of favorite preset channels.
|
||||
/// </summary>
|
||||
[JsonProperty("favorites", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<PresetChannel> Favorites { get; set; } = new List<PresetChannel>();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for device volume control operations.
|
||||
/// Handles volume level adjustment, mute control, and volume status reporting.
|
||||
/// </summary>
|
||||
public class DeviceVolumeMessenger : MessengerBase
|
||||
{
|
||||
private readonly IBasicVolumeWithFeedback _localDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceVolumeMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="messagePath">The message path for volume control messages.</param>
|
||||
/// <param name="device">The device that provides volume control functionality.</param>
|
||||
public DeviceVolumeMessenger(string key, string messagePath, IBasicVolumeWithFeedback device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
@@ -48,6 +58,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling volume control operations.
|
||||
/// Includes volume level adjustment, mute control, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendStatus());
|
||||
@@ -142,29 +156,56 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a volume state message containing volume information.
|
||||
/// </summary>
|
||||
public class VolumeStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the volume information.
|
||||
/// </summary>
|
||||
[JsonProperty("volume", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Volume Volume { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents volume control information including level, mute status, and units.
|
||||
/// </summary>
|
||||
public class Volume
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the volume level.
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the device has mute capability.
|
||||
/// </summary>
|
||||
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasMute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the device is currently muted.
|
||||
/// </summary>
|
||||
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? Muted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the volume label for display purposes.
|
||||
/// </summary>
|
||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the raw volume value as a string.
|
||||
/// </summary>
|
||||
[JsonProperty("rawValue", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RawValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the volume level units.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonProperty("units", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eVolumeLevelUnits? Units { get; set; }
|
||||
|
||||
@@ -2,12 +2,22 @@
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic messenger for basic device communication
|
||||
/// </summary>
|
||||
public class GenericMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="device">Device to communicate with</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
public GenericMessenger(string key, EssentialsDevice device, string messagePath) : base(key, messagePath, device)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
@@ -6,15 +6,29 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for communication monitoring operations.
|
||||
/// Handles communication status reporting and monitoring feedback.
|
||||
/// </summary>
|
||||
public class ICommunicationMonitorMessenger : MessengerBase
|
||||
{
|
||||
private readonly ICommunicationMonitor _communicationMonitor;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ICommunicationMonitorMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="messagePath">The message path for communication monitor messages.</param>
|
||||
/// <param name="device">The device that provides communication monitoring functionality.</param>
|
||||
public ICommunicationMonitorMessenger(string key, string messagePath, ICommunicationMonitor device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
_communicationMonitor = device;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling communication monitoring operations.
|
||||
/// Includes full status reporting for communication monitoring data.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -50,11 +64,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
public class CommunicationMonitorState : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the communication monitor properties.
|
||||
/// </summary>
|
||||
[JsonProperty("commMonitor", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CommunicationMonitorProps CommunicationMonitor { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the properties of a communication monitor.
|
||||
/// </summary>
|
||||
public class CommunicationMonitorProps
|
||||
{ /// <summary>
|
||||
/// For devices that implement ICommunicationMonitor, reports the online status of the device
|
||||
|
||||
@@ -1,20 +1,34 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for DSP preset management operations.
|
||||
/// Handles DSP preset selection, recall, and preset list management.
|
||||
/// </summary>
|
||||
public class IDspPresetsMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDspPresets device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IDspPresetsMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="messagePath">The message path for DSP preset control messages.</param>
|
||||
/// <param name="device">The device that provides DSP preset functionality.</param>
|
||||
public IDspPresetsMessenger(string key, string messagePath, IDspPresets device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling DSP preset operations.
|
||||
/// Includes preset selection, recall, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -42,8 +56,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a DSP presets state message containing available presets.
|
||||
/// </summary>
|
||||
public class IHasDspPresetsStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the dictionary of available DSP presets.
|
||||
/// </summary>
|
||||
[JsonProperty("presets")]
|
||||
public Dictionary<string, IKeyName> Presets { get; set; }
|
||||
}
|
||||
|
||||
@@ -5,14 +5,25 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement IHasCurrentSourceInfoChange interface
|
||||
/// </summary>
|
||||
public class IHasCurrentSourceInfoMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasCurrentSourceInfoChange sourceDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IHasCurrentSourceInfoMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements IHasCurrentSourceInfoChange</param>
|
||||
public IHasCurrentSourceInfoMessenger(string key, string messagePath, IHasCurrentSourceInfoChange device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
sourceDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -46,11 +57,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for current source information
|
||||
/// </summary>
|
||||
public class CurrentSourceStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the current source key
|
||||
/// </summary>
|
||||
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CurrentSourceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current source information
|
||||
/// </summary>
|
||||
[JsonProperty("currentSource")]
|
||||
public SourceListItem CurrentSource { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement IHasInputs interface
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">Type of the key used for inputs</typeparam>
|
||||
public class IHasInputsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
private readonly IHasInputs<TKey> itemDevice;
|
||||
{
|
||||
private readonly IHasInputs<TKey> itemDevice;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a messenger for a device that implements IHasInputs<typeparamref name="TKey"/>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements IHasInputs</param>
|
||||
public IHasInputsMessenger(string key, string messagePath, IHasInputs<TKey> device) : base(key, messagePath, device)
|
||||
{
|
||||
itemDevice = device;
|
||||
itemDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -83,17 +88,34 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for devices with inputs
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">Type of the key used for inputs</typeparam>
|
||||
public class IHasInputsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs")]
|
||||
public Inputs<TKey> Inputs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of inputs
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">Type of the key used for inputs</typeparam>
|
||||
public class Inputs<TKey>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the items dictionary
|
||||
/// </summary>
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current item
|
||||
/// </summary>
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
@@ -5,16 +5,29 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for power control operations with feedback.
|
||||
/// Handles power on/off commands and power state feedback reporting.
|
||||
/// </summary>
|
||||
public class IHasPowerControlWithFeedbackMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasPowerControlWithFeedback _powerControl;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IHasPowerControlWithFeedbackMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="messagePath">The message path for power control messages.</param>
|
||||
/// <param name="powerControl">The device that provides power control functionality.</param>
|
||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||
: base(key, messagePath, powerControl as IKeyName)
|
||||
{
|
||||
_powerControl = powerControl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the full power control status to connected clients.
|
||||
/// </summary>
|
||||
public void SendFullStatus()
|
||||
{
|
||||
var messageObj = new PowerControlWithFeedbackStateMessage
|
||||
@@ -25,6 +38,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
PostStatusMessage(messageObj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling power control operations.
|
||||
/// Includes power on, power off, power toggle, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -44,8 +61,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a power control state message containing power state information.
|
||||
/// </summary>
|
||||
public class PowerControlWithFeedbackStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the power state of the device.
|
||||
/// </summary>
|
||||
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? PowerState { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement IHasScheduleAwareness interface
|
||||
/// </summary>
|
||||
public class IHasScheduleAwarenessMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the schedule source device
|
||||
/// </summary>
|
||||
public IHasScheduleAwareness ScheduleSource { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IHasScheduleAwarenessMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="scheduleSource">Device that implements IHasScheduleAwareness</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
public IHasScheduleAwarenessMessenger(string key, IHasScheduleAwareness scheduleSource, string messagePath)
|
||||
: base(key, messagePath, scheduleSource as IKeyName)
|
||||
{
|
||||
@@ -19,6 +31,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
ScheduleSource.CodecSchedule.MeetingEventChange += new EventHandler<MeetingEventArgs>(CodecSchedule_MeetingEventChange);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
||||
@@ -55,26 +68,50 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Full schedule message containing meetings and warning minutes
|
||||
/// </summary>
|
||||
public class FullScheduleMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of meetings
|
||||
/// </summary>
|
||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Meeting> Meetings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the meeting warning minutes
|
||||
/// </summary>
|
||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MeetingWarningMinutes { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message containing meeting change information
|
||||
/// </summary>
|
||||
public class MeetingChangeMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the meeting change details
|
||||
/// </summary>
|
||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public MeetingChange MeetingChange { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a meeting change with type and meeting details
|
||||
/// </summary>
|
||||
public class MeetingChange
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the change type
|
||||
/// </summary>
|
||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ChangeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the meeting details
|
||||
/// </summary>
|
||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement ILevelControls interface
|
||||
/// </summary>
|
||||
public class ILevelControlsMessenger : MessengerBase
|
||||
{
|
||||
private ILevelControls levelControlsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ILevelControlsMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements ILevelControls</param>
|
||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
levelControlsDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -74,17 +85,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for level controls
|
||||
/// </summary>
|
||||
public class LevelControlStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the level controls
|
||||
/// </summary>
|
||||
[JsonProperty("levelControls")]
|
||||
public Dictionary<string, Volume> Levels { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request message for level control operations
|
||||
/// </summary>
|
||||
public class LevelControlRequestMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the control key
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public ushort? Level { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using 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
|
||||
{
|
||||
@@ -16,11 +16,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
public class IMatrixRoutingMessenger : MessengerBase
|
||||
{
|
||||
private readonly IMatrixRouting matrixDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IMatrixRoutingMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements IMatrixRouting</param>
|
||||
public IMatrixRoutingMessenger(string key, string messagePath, IMatrixRouting device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
matrixDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -82,86 +90,159 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for matrix routing information
|
||||
/// </summary>
|
||||
public class MatrixStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the outputs dictionary
|
||||
/// </summary>
|
||||
[JsonProperty("outputs")]
|
||||
public Dictionary<string, RoutingOutput> Outputs;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the inputs dictionary
|
||||
/// </summary>
|
||||
[JsonProperty("inputs")]
|
||||
public Dictionary<string, RoutingInput> Inputs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a routing input slot
|
||||
/// </summary>
|
||||
public class RoutingInput
|
||||
{
|
||||
private IRoutingInputSlot _input;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the transmit device key
|
||||
/// </summary>
|
||||
[JsonProperty("txDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string TxDeviceKey => _input?.TxDeviceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the slot number
|
||||
/// </summary>
|
||||
[JsonProperty("slotNumber", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? SlotNumber => _input?.SlotNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported signal types
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[JsonProperty("supportedSignalTypes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eRoutingSignalType? SupportedSignalTypes => _input?.SupportedSignalTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name
|
||||
/// </summary>
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name => _input?.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the online status
|
||||
/// </summary>
|
||||
[JsonProperty("isOnline", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsOnline => _input?.IsOnline.BoolValue;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the video sync detected status
|
||||
/// </summary>
|
||||
[JsonProperty("videoSyncDetected", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
public bool? VideoSyncDetected => _input?.VideoSyncDetected;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key
|
||||
/// </summary>
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key => _input?.Key;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RoutingInput class
|
||||
/// </summary>
|
||||
/// <param name="input">The input slot</param>
|
||||
public RoutingInput(IRoutingInputSlot input)
|
||||
{
|
||||
_input = input;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a routing output slot
|
||||
/// </summary>
|
||||
public class RoutingOutput
|
||||
{
|
||||
private IRoutingOutputSlot _output;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RoutingOutput class
|
||||
/// </summary>
|
||||
/// <param name="output">The output slot</param>
|
||||
public RoutingOutput(IRoutingOutputSlot output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the receive device key
|
||||
/// </summary>
|
||||
[JsonProperty("rxDeviceKey")]
|
||||
public string RxDeviceKey => _output.RxDeviceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current routes
|
||||
/// </summary>
|
||||
[JsonProperty("currentRoutes")]
|
||||
public Dictionary<string, RoutingInput> CurrentRoutes => _output.CurrentRoutes.ToDictionary(kvp => kvp.Key.ToString(), kvp => new RoutingInput(kvp.Value));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the slot number
|
||||
/// </summary>
|
||||
[JsonProperty("slotNumber")]
|
||||
public int SlotNumber => _output.SlotNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported signal types
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[JsonProperty("supportedSignalTypes")]
|
||||
public eRoutingSignalType SupportedSignalTypes => _output.SupportedSignalTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name => _output.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key => _output.Key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request for matrix routing
|
||||
/// </summary>
|
||||
public class MatrixRouteRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the output key
|
||||
/// </summary>
|
||||
[JsonProperty("outputKey")]
|
||||
public string OutputKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the input key
|
||||
/// </summary>
|
||||
[JsonProperty("inputKey")]
|
||||
public string InputKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the route type
|
||||
/// </summary>
|
||||
[JsonProperty("routeType")]
|
||||
public eRoutingSignalType RouteType { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement ISelectableItems interface
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">Type of the key used for selectable items</typeparam>
|
||||
public class ISelectableItemsMessenger<TKey> : MessengerBase
|
||||
{
|
||||
{
|
||||
private readonly ISelectableItems<TKey> itemDevice;
|
||||
|
||||
private readonly string _propName;
|
||||
@@ -16,16 +20,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Constructs a messenger for a device that implements ISelectableItems<typeparamref name="TKey"/>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="propName"></param>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="device">Device that implements ISelectableItems</param>
|
||||
/// <param name="propName">Property name for JSON serialization</param>
|
||||
public ISelectableItemsMessenger(string key, string messagePath, ISelectableItems<TKey> device, string propName) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
itemDevice = device;
|
||||
_propName = propName;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -83,11 +88,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for selectable items
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">Type of the key used for selectable items</typeparam>
|
||||
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the items dictionary
|
||||
/// </summary>
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current item
|
||||
/// </summary>
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,16 +4,26 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Messenger for devices that implement ITechPassword interface
|
||||
/// </summary>
|
||||
public class ITechPasswordMessenger : MessengerBase
|
||||
{
|
||||
private readonly ITechPassword _room;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ITechPasswordMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
/// <param name="room">Room that implements ITechPassword</param>
|
||||
public ITechPasswordMessenger(string key, string messagePath, ITechPassword room)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
|
||||
@@ -64,23 +74,44 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State message for tech password information
|
||||
/// </summary>
|
||||
public class ITechPasswordStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the tech password length
|
||||
/// </summary>
|
||||
[JsonProperty("techPasswordLength", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? TechPasswordLength { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event message for tech password validation result
|
||||
/// </summary>
|
||||
public class ITechPasswordEventMessage : DeviceEventMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether the password is valid
|
||||
/// </summary>
|
||||
[JsonProperty("isValid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsValid { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Content for setting tech password
|
||||
/// </summary>
|
||||
internal class SetTechPasswordContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the old password
|
||||
/// </summary>
|
||||
[JsonProperty("oldPassword")]
|
||||
public string OldPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the new password
|
||||
/// </summary>
|
||||
[JsonProperty("newPassword")]
|
||||
public string NewPassword { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,41 +1,57 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a messaging bridge
|
||||
/// Provides a messaging bridge between mobile control clients and Essentials devices.
|
||||
/// This abstract base class handles message routing, action registration, and status updates.
|
||||
/// </summary>
|
||||
public abstract class MessengerBase : EssentialsDevice, IMobileControlMessenger
|
||||
{
|
||||
/// <summary>
|
||||
/// The device that this messenger is associated with
|
||||
/// </summary>
|
||||
protected IKeyName _device;
|
||||
|
||||
/// <summary>
|
||||
/// List of interfaces implemented by the associated device
|
||||
/// </summary>
|
||||
private readonly List<string> _deviceInterfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of registered actions, keyed by path
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, Action<string, JToken>> _actions = new Dictionary<string, Action<string, JToken>>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key of the associated device
|
||||
/// </summary>
|
||||
public string DeviceKey => _device?.Key ?? "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Gets the mobile control app server controller
|
||||
/// </summary>
|
||||
|
||||
public IMobileControl AppServerController { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the message path for this messenger
|
||||
/// </summary>
|
||||
public string MessagePath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Initializes a new instance of the MessengerBase class
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing messages</param>
|
||||
/// <exception cref="ArgumentException">Thrown when messagePath is null or empty</exception>
|
||||
protected MessengerBase(string key, string messagePath)
|
||||
: base(key)
|
||||
{
|
||||
@@ -47,6 +63,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
MessagePath = messagePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MessengerBase class with an associated device
|
||||
/// </summary>
|
||||
/// <param name="key">The unique key for this messenger</param>
|
||||
/// <param name="messagePath">The message path for routing messages</param>
|
||||
/// <param name="device">The device to associate with this messenger</param>
|
||||
protected MessengerBase(string key, string messagePath, IKeyName device)
|
||||
: this(key, messagePath)
|
||||
{
|
||||
@@ -56,7 +78,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the interfaces implmented on the device
|
||||
/// Gets the interfaces implented on the device
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <returns></returns>
|
||||
@@ -93,6 +115,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
action(id, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an action to be executed when a message is received at the specified path
|
||||
/// </summary>
|
||||
/// <param name="path">The path to register the action for</param>
|
||||
/// <param name="action">The action to execute when the path is matched</param>
|
||||
protected void AddAction(string path, Action<string, JToken> action)
|
||||
{
|
||||
if (_actions.ContainsKey(path))
|
||||
@@ -104,11 +131,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
_actions.Add(path, action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all registered action paths
|
||||
/// </summary>
|
||||
/// <returns>A list of action paths</returns>
|
||||
public List<string> GetActionPaths()
|
||||
{
|
||||
return _actions.Keys.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes an action from the specified path
|
||||
/// </summary>
|
||||
/// <param name="path">The path to remove the action from</param>
|
||||
protected void RemoveAction(string path)
|
||||
{
|
||||
if (!_actions.ContainsKey(path))
|
||||
@@ -122,7 +157,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Implemented in extending classes. Wire up API calls and feedback here
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected virtual void RegisterActions()
|
||||
{
|
||||
|
||||
@@ -131,8 +165,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// <summary>
|
||||
/// Helper for posting status message
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="message">The device state message to post</param>
|
||||
/// <param name="clientId">Optional client ID to send the message to a specific client</param>
|
||||
protected void PostStatusMessage(DeviceStateMessageBase message, string clientId = null)
|
||||
{
|
||||
try
|
||||
@@ -153,16 +187,22 @@ 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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts a status message with a specific message type
|
||||
/// </summary>
|
||||
/// <param name="type">The message type to send</param>
|
||||
/// <param name="deviceState">The device state message to post</param>
|
||||
/// <param name="clientId">Optional client ID to send the message to a specific client</param>
|
||||
protected void PostStatusMessage(string type, DeviceStateMessageBase deviceState, string clientId = null)
|
||||
{
|
||||
try
|
||||
@@ -182,10 +222,16 @@ 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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts a status message with JSON content
|
||||
/// </summary>
|
||||
/// <param name="content">The JSON content to send</param>
|
||||
/// <param name="type">The message type (defaults to MessagePath if empty)</param>
|
||||
/// <param name="clientId">Optional client ID to send the message to a specific client</param>
|
||||
protected void PostStatusMessage(JToken content, string type = "", string clientId = null)
|
||||
{
|
||||
try
|
||||
@@ -198,6 +244,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts an event message for the device
|
||||
/// </summary>
|
||||
/// <param name="message">The device event message to post</param>
|
||||
protected void PostEventMessage(DeviceEventMessageBase message)
|
||||
{
|
||||
message.Key = _device.Key;
|
||||
@@ -211,6 +261,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts an event message with a specific event type
|
||||
/// </summary>
|
||||
/// <param name="message">The device event message to post</param>
|
||||
/// <param name="eventType">The event type to use</param>
|
||||
protected void PostEventMessage(DeviceEventMessageBase message, string eventType)
|
||||
{
|
||||
message.Key = _device.Key;
|
||||
@@ -226,6 +281,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts an event message with only an event type
|
||||
/// </summary>
|
||||
/// <param name="eventType">The event type to post</param>
|
||||
protected void PostEventMessage(string eventType)
|
||||
{
|
||||
AppServerController?.SendMessageObject(new MobileControlMessage
|
||||
@@ -237,6 +296,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for device messages containing common properties like key, name, and message type
|
||||
/// </summary>
|
||||
public abstract class DeviceMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -257,21 +319,28 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
[JsonProperty("messageType")]
|
||||
public string MessageType => GetType().Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the base path for the message
|
||||
/// </summary>
|
||||
[JsonProperty("messageBasePath")]
|
||||
public string MessageBasePath { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for state messages that includes the type of message and the implmented interfaces
|
||||
/// Base class for state messages that includes the type of message and the implemented interfaces
|
||||
/// </summary>
|
||||
public class DeviceStateMessageBase : DeviceMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The interfaces implmented by the device sending the messsage
|
||||
/// The interfaces implented by the device sending the messsage
|
||||
/// </summary>
|
||||
[JsonProperty("interfaces")]
|
||||
public List<string> Interfaces { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the interfaces implemented by the device
|
||||
/// </summary>
|
||||
/// <param name="interfaces">List of interface names to set</param>
|
||||
public void SetInterfaces(List<string> interfaces)
|
||||
{
|
||||
Interfaces = interfaces;
|
||||
|
||||
@@ -1,19 +1,34 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Static handler for managing press and hold button actions with automatic timeout functionality
|
||||
/// </summary>
|
||||
public static class PressAndHoldHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// The interval in milliseconds for button heartbeat timeout
|
||||
/// </summary>
|
||||
private const long ButtonHeartbeatInterval = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of active timers for pressed actions, keyed by device key
|
||||
/// </summary>
|
||||
private static readonly Dictionary<string, CTimer> _pushedActions = new Dictionary<string, CTimer>();
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of action handlers for different button states
|
||||
/// </summary>
|
||||
private static readonly Dictionary<string, Action<string, Action<bool>>> _pushedActionHandlers;
|
||||
|
||||
/// <summary>
|
||||
/// Static constructor that initializes the action handlers for different button states
|
||||
/// </summary>
|
||||
static PressAndHoldHandler()
|
||||
{
|
||||
_pushedActionHandlers = new Dictionary<string, Action<string, Action<bool>>>
|
||||
@@ -24,6 +39,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a timer for a device key and executes the action with true state
|
||||
/// </summary>
|
||||
/// <param name="deviceKey">The unique key for the device</param>
|
||||
/// <param name="action">The action to execute with boolean state</param>
|
||||
private static void AddTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to add timer for {deviceKey}", deviceKey);
|
||||
@@ -50,6 +70,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
_pushedActions.Add(deviceKey, cancelTimer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets an existing timer for the specified device key
|
||||
/// </summary>
|
||||
/// <param name="deviceKey">The unique key for the device</param>
|
||||
/// <param name="action">The action associated with the timer</param>
|
||||
private static void ResetTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to reset timer for {deviceKey}", deviceKey);
|
||||
@@ -65,6 +90,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
cancelTimer.Reset(ButtonHeartbeatInterval);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops and removes the timer for the specified device key
|
||||
/// </summary>
|
||||
/// <param name="deviceKey">The unique key for the device</param>
|
||||
/// <param name="action">The action to execute with false state before stopping</param>
|
||||
private static void StopTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to stop timer for {deviceKey}", deviceKey);
|
||||
@@ -82,6 +112,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
_pushedActions.Remove(deviceKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the appropriate press and hold handler for the specified value
|
||||
/// </summary>
|
||||
/// <param name="value">The button state value (pressed, held, released)</param>
|
||||
/// <returns>The handler action for the specified state, or null if not found</returns>
|
||||
public static Action<string, Action<bool>> GetPressAndHoldHandler(string value)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Getting press and hold handler for {value}", value);
|
||||
@@ -97,6 +132,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
return handler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles press and hold messages by parsing the content and executing the appropriate handler
|
||||
/// </summary>
|
||||
/// <param name="deviceKey">The unique key for the device</param>
|
||||
/// <param name="content">The JSON content containing the button state</param>
|
||||
/// <param name="action">The action to execute with boolean state</param>
|
||||
public static void HandlePressAndHold(string deviceKey, JToken content, Action<bool> action)
|
||||
{
|
||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
|
||||
@@ -1,32 +1,39 @@
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// SIMPL messenger for audio-only conference devices that provides audio calling functionality
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class SIMPLAtcMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The EISC (Ethernet Intersystem Communication) device
|
||||
/// </summary>
|
||||
private readonly BasicTriList _eisc;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the join map for SIMPL ATC operations
|
||||
/// </summary>
|
||||
public SIMPLAtcJoinMap JoinMap { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The current active call item for audio calls
|
||||
/// </summary>
|
||||
private readonly CodecActiveCallItem _currentCallItem;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Initializes a new instance of the SIMPLAtcMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="eisc"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="eisc">The EISC device for communication</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
public SIMPLAtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
@@ -38,7 +45,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Sends the current status of the audio conference device to connected clients
|
||||
/// </summary>
|
||||
private void SendFullStatus()
|
||||
{
|
||||
@@ -53,9 +60,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Registers actions and feedback handlers for the SIMPL ATC messenger
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
//EISC.SetStringSigAction(SCurrentDialString, s => PostStatusMessage(new { currentDialString = s }));
|
||||
@@ -133,7 +139,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Sends the current calls list to connected clients
|
||||
/// </summary>
|
||||
private void SendCallsList()
|
||||
{
|
||||
@@ -145,9 +151,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turns the
|
||||
/// Gets the current call list based on the call status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>A list containing the current call item if connected, or an empty list if disconnected</returns>
|
||||
private List<CodecActiveCallItem> GetCurrentCallList()
|
||||
{
|
||||
return _currentCallItem.Status == eCodecCallStatus.Disconnected
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for camera control operations in SIMPL-based systems.
|
||||
/// Handles camera movement, zoom, preset management, and mode control.
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class SIMPLCameraMessenger : MessengerBase
|
||||
{
|
||||
@@ -16,7 +20,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
private readonly CameraControllerJoinMap _joinMap;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SIMPLCameraMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="eisc">The basic tri-list for SIMPL communication.</param>
|
||||
/// <param name="messagePath">The message path for camera control messages.</param>
|
||||
/// <param name="joinStart">The starting join number for SIMPL signal mapping.</param>
|
||||
public SIMPLCameraMessenger(string key, BasicTriList eisc, string messagePath, uint joinStart)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
@@ -32,6 +42,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling camera control operations.
|
||||
/// Includes camera movement, zoom, preset management, and mode control actions.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendCameraFullMessageObject());
|
||||
|
||||
@@ -1,19 +1,35 @@
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for direct routing operations in SIMPL-based systems.
|
||||
/// Handles source selection, destination routing, and advanced sharing mode functionality.
|
||||
/// </summary>
|
||||
public class SimplDirectRouteMessenger : MessengerBase
|
||||
{
|
||||
private readonly BasicTriList _eisc;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the join map for SIMPL direct route actions.
|
||||
/// </summary>
|
||||
public MobileControlSIMPLRunDirectRouteActionJoinMap JoinMap { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dictionary of destination items for routing operations.
|
||||
/// </summary>
|
||||
public Dictionary<string, DestinationListItem> DestinationList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SimplDirectRouteMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="eisc">The basic tri-list for SIMPL communication.</param>
|
||||
/// <param name="messagePath">The message path for routing messages.</param>
|
||||
public SimplDirectRouteMessenger(string key, BasicTriList eisc, string messagePath) : base(key, messagePath)
|
||||
{
|
||||
_eisc = eisc;
|
||||
@@ -25,6 +41,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling direct route messaging operations.
|
||||
/// Includes audio source selection, full status reporting, and advanced sharing mode controls.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
Debug.Console(2, "********** Direct Route Messenger CustomRegisterWithAppServer **********");
|
||||
@@ -92,6 +112,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers routing actions for each destination in the destination list.
|
||||
/// Sets up feedback handlers and source selection actions for individual destinations.
|
||||
/// </summary>
|
||||
public void RegisterForDestinationPaths()
|
||||
{
|
||||
//handle routing feedback from SIMPL
|
||||
@@ -114,6 +138,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Updates the source selection for a specific destination and posts a status message.
|
||||
/// </summary>
|
||||
/// <param name="sourceKey">The key of the selected source.</param>
|
||||
/// <param name="destKey">The key of the destination being updated.</param>
|
||||
private void UpdateSourceForDestination(string sourceKey, string destKey)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
|
||||
@@ -6,21 +6,34 @@ using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for routing operations in SIMPL-based systems.
|
||||
/// Handles source selection and routing status feedback.
|
||||
/// </summary>
|
||||
public class SIMPLRouteMessenger : MessengerBase
|
||||
{
|
||||
private readonly BasicTriList _eisc;
|
||||
|
||||
private readonly uint _joinStart;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the string join mappings for SIMPL routing operations.
|
||||
/// </summary>
|
||||
public class StringJoin
|
||||
{
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// Join number for current source information (1).
|
||||
/// </summary>
|
||||
public const uint CurrentSource = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SIMPLRouteMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="eisc">The basic tri-list for SIMPL communication.</param>
|
||||
/// <param name="messagePath">The message path for routing messages.</param>
|
||||
/// <param name="joinStart">The starting join number for SIMPL signal mapping.</param>
|
||||
public SIMPLRouteMessenger(string key, BasicTriList eisc, string messagePath, uint joinStart)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
@@ -30,6 +43,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
_eisc.SetStringSigAction(_joinStart + StringJoin.CurrentSource, SendRoutingFullMessageObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling routing operations and status reporting.
|
||||
/// Includes full status requests and source selection actions.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus",
|
||||
@@ -43,6 +60,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters this messenger from the mobile control app server.
|
||||
/// Removes all registered actions and clears SIMPL signal actions.
|
||||
/// </summary>
|
||||
/// <param name="appServerController">The mobile control app server controller.</param>
|
||||
public void CustomUnregisterWithAppServer(IMobileControl appServerController)
|
||||
{
|
||||
appServerController.RemoveAction(MessagePath + "/fullStatus");
|
||||
|
||||
@@ -1,33 +1,51 @@
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// SIMPL messenger for video conference devices that provides video calling and camera control functionality
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class SIMPLVtcMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The EISC (Ethernet Intersystem Communication) device
|
||||
/// </summary>
|
||||
private readonly BasicTriList _eisc;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the join map for SIMPL VTC operations
|
||||
/// </summary>
|
||||
public SIMPLVtcJoinMap JoinMap { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current active call item for video calls
|
||||
/// </summary>
|
||||
private readonly CodecActiveCallItem _currentCallItem;
|
||||
|
||||
/// <summary>
|
||||
/// The incoming call item for video calls
|
||||
/// </summary>
|
||||
private CodecActiveCallItem _incomingCallItem;
|
||||
|
||||
/// <summary>
|
||||
/// The previous directory length for tracking changes
|
||||
/// </summary>
|
||||
private ushort _previousDirectoryLength = 701;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Initializes a new instance of the SIMPLVtcMessenger class
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="eisc"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="key">Unique identifier for the messenger</param>
|
||||
/// <param name="eisc">The EISC device for communication</param>
|
||||
/// <param name="messagePath">Path for message routing</param>
|
||||
public SIMPLVtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
@@ -39,9 +57,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Registers actions and feedback handlers for the SIMPL VTC messenger
|
||||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
_eisc.SetStringSigAction(JoinMap.HookState.JoinNumber, s =>
|
||||
|
||||
@@ -1,20 +1,34 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for shade control operations.
|
||||
/// Handles shade open, close, and stop commands for shades that support these operations.
|
||||
/// </summary>
|
||||
public class IShadesOpenCloseStopMessenger : MessengerBase
|
||||
{
|
||||
private readonly IShadesOpenCloseStop device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IShadesOpenCloseStopMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="shades">The shade device that provides open/close/stop functionality.</param>
|
||||
/// <param name="messagePath">The message path for shade control messages.</param>
|
||||
public IShadesOpenCloseStopMessenger(string key, IShadesOpenCloseStop shades, string messagePath)
|
||||
: base(key, messagePath, shades as IKeyName)
|
||||
{
|
||||
device = shades;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling shade control operations.
|
||||
/// Includes shade open, close, stop, and full status reporting.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
@@ -86,14 +100,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a shade state message containing shade status and control information.
|
||||
/// </summary>
|
||||
public class ShadeBaseStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the label for the middle button control.
|
||||
/// </summary>
|
||||
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MiddleButtonLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the shade is open.
|
||||
/// </summary>
|
||||
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsOpen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the shade is closed.
|
||||
/// </summary>
|
||||
[JsonProperty("isClosed", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsClosed { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging capabilities for system monitoring operations.
|
||||
/// Handles system performance metrics, program status reporting, and monitoring data communication.
|
||||
/// </summary>
|
||||
public class SystemMonitorMessenger : MessengerBase
|
||||
{
|
||||
private readonly SystemMonitorController systemMonitor;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SystemMonitorMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier for this messenger instance.</param>
|
||||
/// <param name="sysMon">The system monitor controller for monitoring operations.</param>
|
||||
/// <param name="messagePath">The message path for system monitor messages.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when sysMon is null.</exception>
|
||||
public SystemMonitorMessenger(string key, SystemMonitorController sysMon, string messagePath)
|
||||
: base(key, messagePath, sysMon)
|
||||
{
|
||||
@@ -66,7 +77,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
private void SendSystemMonitorStatusMessage()
|
||||
{
|
||||
// This takes a while, launch a new thread
|
||||
|
||||
|
||||
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
|
||||
{
|
||||
|
||||
@@ -80,29 +91,54 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions for handling system monitor operations.
|
||||
/// Includes full status reporting for system monitoring data.
|
||||
/// </summary>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatusMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the system monitor state message containing system information and version details.
|
||||
/// </summary>
|
||||
public class SystemMonitorStateMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the system time zone offset.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int TimeZone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the system time zone name.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string TimeZoneName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IO controller version information.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string IoControllerVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SNMP version information.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SnmpVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BACnet version information.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string BacnetVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the controller version information.
|
||||
/// </summary>
|
||||
[JsonProperty("timeZone", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ControllerVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,14 +4,26 @@ using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mobile control message that can be sent between clients and the system
|
||||
/// </summary>
|
||||
public class MobileControlMessage : IMobileControlMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the message type/path for routing
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client ID this message is intended for (null for broadcast)
|
||||
/// </summary>
|
||||
[JsonProperty("clientId")]
|
||||
public string ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the JSON content of the message
|
||||
/// </summary>
|
||||
[JsonProperty("content")]
|
||||
public JToken Content { get; set; }
|
||||
}
|
||||
|
||||
@@ -2,8 +2,15 @@
|
||||
|
||||
namespace PepperDash.Essentials.AppServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic container for simple mobile control message content with a single value
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the value contained in the message</typeparam>
|
||||
public class MobileControlSimpleContent<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the message content
|
||||
/// </summary>
|
||||
[JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public T Value { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user