mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
chore: move all files to file-scoped namespace
This commit is contained in:
parent
aaa5b0532b
commit
3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions
|
|
@ -8,16 +8,16 @@ namespace PepperDash.Essentials.AppServer
|
|||
/// </summary>
|
||||
public class SourceSelectMessageContent
|
||||
{
|
||||
|
||||
[JsonProperty("sourceListItemKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SourceListItemKey
|
||||
/// </summary>
|
||||
[JsonProperty("sourceListItemKey")]
|
||||
public string SourceListItemKey { get; set; }
|
||||
[JsonProperty("sourceListKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SourceListKey
|
||||
/// </summary>
|
||||
[JsonProperty("sourceListKey")]
|
||||
|
||||
public string SourceListKey { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -27,20 +27,20 @@ namespace PepperDash.Essentials.AppServer
|
|||
public class DirectRoute
|
||||
{
|
||||
|
||||
[JsonProperty("sourceKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SourceKey
|
||||
/// </summary>
|
||||
[JsonProperty("sourceKey")]
|
||||
public string SourceKey { get; set; }
|
||||
[JsonProperty("destinationKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the DestinationKey
|
||||
/// </summary>
|
||||
[JsonProperty("destinationKey")]
|
||||
public string DestinationKey { get; set; }
|
||||
[JsonProperty("signalType")]
|
||||
/// <summary>
|
||||
/// Gets or sets the SignalType
|
||||
/// </summary>
|
||||
[JsonProperty("signalType")]
|
||||
public eRoutingSignalType SignalType { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -52,4 +52,4 @@ namespace PepperDash.Essentials.AppServer
|
|||
/// Delegate for PressAndHoldAction
|
||||
/// </summary>
|
||||
public delegate void PressAndHoldAction(bool b);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,18 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
{
|
||||
private readonly DisplayBase display;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="DisplayBaseMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public DisplayBaseMessenger(string key, string messagePath, DisplayBase device) : base(key, messagePath, device)
|
||||
{
|
||||
display = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -60,4 +67,4 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,11 +11,18 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
{
|
||||
private readonly IChannel channelDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IChannelMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IChannelMessenger(string key, string messagePath, IChannel device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
channelDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -10,11 +10,19 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class IColorMessenger : MessengerBase
|
||||
{
|
||||
private readonly IColor colorDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IColorMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></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();
|
||||
|
|
|
|||
|
|
@ -10,12 +10,19 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class IDPadMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDPad dpadDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IDPadMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IDPadMessenger(string key, string messagePath, IDPad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dpadDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
|
@ -10,11 +11,20 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class IDvrMessenger : MessengerBase
|
||||
{
|
||||
private readonly IDvr dvrDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IDvrMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IDvrMessenger(string key, string messagePath, IDvr device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
dvrDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -24,4 +34,4 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,20 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class IHasPowerMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasPowerControl powerDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IHasPowerMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IHasPowerMessenger(string key, string messagePath, IHasPowerControl device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
powerDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -10,11 +10,20 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class INumericKeypadMessenger : MessengerBase
|
||||
{
|
||||
private readonly INumericKeypad keypadDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="INumericKeypadMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public INumericKeypadMessenger(string key, string messagePath, INumericKeypad device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
keypadDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
|
@ -10,11 +11,20 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class ISetTopBoxControlsMessenger : MessengerBase
|
||||
{
|
||||
private readonly ISetTopBoxControls stbDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="ISetTopBoxControlsMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public ISetTopBoxControlsMessenger(string key, string messagePath, ISetTopBoxControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
stbDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -35,8 +45,11 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the state of a ISetTopBoxControls device to be sent to mobile clients
|
||||
/// </summary>
|
||||
public class SetTopBoxControlsState : DeviceStateMessageBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.AppServer.Messengers;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
|
@ -10,11 +11,19 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
public class ITransportMessenger : MessengerBase
|
||||
{
|
||||
private readonly ITransport transportDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="ITransportMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public ITransportMessenger(string key, string messagePath, ITransport device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
transportDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -30,4 +39,4 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class DeviceInfoStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the device information associated with this message. This property contains detailed information
|
||||
/// </summary>
|
||||
[JsonProperty("deviceInfo")]
|
||||
public DeviceInfo DeviceInfo { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -169,10 +169,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class VolumeStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("volume", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the Volume
|
||||
/// </summary>
|
||||
[JsonProperty("volume", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Volume Volume { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -181,27 +181,42 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class Volume
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Level
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? Level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HasMute
|
||||
/// </summary>
|
||||
[JsonProperty("hasMute", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? HasMute { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Muted
|
||||
/// </summary>
|
||||
[JsonProperty("muted", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? Muted { get; set; }
|
||||
|
||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Label
|
||||
/// </summary>
|
||||
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Label { get; set; }
|
||||
|
||||
[JsonProperty("rawValue", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the RawValue
|
||||
/// </summary>
|
||||
[JsonProperty("rawValue", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RawValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Units
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonProperty("units", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eVolumeLevelUnits? Units { get; set; }
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(state, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -87,4 +87,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -12,12 +12,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly IDspPresets device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IDspPresetsMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IDspPresetsMessenger(string key, string messagePath, IDspPresets device)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -54,7 +62,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class IHasDspPresetsStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the presets.
|
||||
/// The key is the preset key, and the value is the preset name
|
||||
/// </summary>
|
||||
[JsonProperty("presets")]
|
||||
public Dictionary<string, IKeyName> Presets { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -214,4 +214,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -73,4 +73,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("currentSource")]
|
||||
public SourceListItem CurrentSource { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
itemDevice = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -90,10 +92,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class IHasInputsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("inputs")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs")]
|
||||
public Inputs<TKey> Inputs { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -102,14 +104,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class Inputs<TKey>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Items
|
||||
/// The key is the input key, and the value is the input name
|
||||
/// </summary>
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
[JsonProperty("currentItem")]
|
||||
/// <summary>
|
||||
/// Gets or sets the CurrentItem
|
||||
/// </summary>
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -70,4 +70,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("powerState", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? PowerState { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,114 +5,76 @@ using Newtonsoft.Json.Linq;
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
namespace PepperDash.Essentials.AppServer.Messengers;
|
||||
|
||||
public class IHasScheduleAwarenessMessenger : MessengerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a IHasScheduleAwarenessMessenger
|
||||
/// </summary>
|
||||
public class IHasScheduleAwarenessMessenger : MessengerBase
|
||||
public IHasScheduleAwareness ScheduleSource { get; private set; }
|
||||
|
||||
public IHasScheduleAwarenessMessenger(string key, IHasScheduleAwareness scheduleSource, string messagePath)
|
||||
: base(key, messagePath, scheduleSource as IKeyName)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ScheduleSource
|
||||
/// </summary>
|
||||
public IHasScheduleAwareness ScheduleSource { get; private set; }
|
||||
ScheduleSource = scheduleSource ?? throw new ArgumentNullException("scheduleSource");
|
||||
ScheduleSource.CodecSchedule.MeetingsListHasChanged += new EventHandler<EventArgs>(CodecSchedule_MeetingsListHasChanged);
|
||||
ScheduleSource.CodecSchedule.MeetingEventChange += new EventHandler<MeetingEventArgs>(CodecSchedule_MeetingEventChange);
|
||||
}
|
||||
|
||||
public IHasScheduleAwarenessMessenger(string key, IHasScheduleAwareness scheduleSource, string messagePath)
|
||||
: base(key, messagePath, scheduleSource as IKeyName)
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
||||
}
|
||||
|
||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new MeetingChangeMessage
|
||||
{
|
||||
ScheduleSource = scheduleSource ?? throw new ArgumentNullException("scheduleSource");
|
||||
ScheduleSource.CodecSchedule.MeetingsListHasChanged += new EventHandler<EventArgs>(CodecSchedule_MeetingsListHasChanged);
|
||||
ScheduleSource.CodecSchedule.MeetingEventChange += new EventHandler<MeetingEventArgs>(CodecSchedule_MeetingEventChange);
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
|
||||
|
||||
AddAction("/schedule/status", (id, content) => SendFullScheduleObject(id));
|
||||
}
|
||||
|
||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new MeetingChangeMessage
|
||||
MeetingChange = new MeetingChange
|
||||
{
|
||||
MeetingChange = new MeetingChange
|
||||
{
|
||||
ChangeType = e.ChangeType.ToString(),
|
||||
Meeting = e.Meeting
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
ChangeType = e.ChangeType.ToString(),
|
||||
Meeting = e.Meeting
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private void CodecSchedule_MeetingsListHasChanged(object sender, EventArgs e)
|
||||
private void CodecSchedule_MeetingsListHasChanged(object sender, EventArgs e)
|
||||
{
|
||||
SendFullScheduleObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to send the full schedule data
|
||||
/// </summary>
|
||||
private void SendFullScheduleObject()
|
||||
{
|
||||
PostStatusMessage(new FullScheduleMessage
|
||||
{
|
||||
SendFullScheduleObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to send the full schedule data
|
||||
/// </summary>
|
||||
private void SendFullScheduleObject(string id = null)
|
||||
{
|
||||
PostStatusMessage(new FullScheduleMessage
|
||||
{
|
||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||
}, id);
|
||||
}
|
||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a FullScheduleMessage
|
||||
/// </summary>
|
||||
public class FullScheduleMessage : DeviceStateMessageBase
|
||||
{
|
||||
public class FullScheduleMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Meeting> Meetings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Meetings
|
||||
/// </summary>
|
||||
[JsonProperty("meetings", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Meeting> Meetings { get; set; }
|
||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MeetingWarningMinutes { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingChangeMessage
|
||||
{
|
||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public MeetingChange MeetingChange { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MeetingWarningMinutes
|
||||
/// </summary>
|
||||
[JsonProperty("meetingWarningMinutes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MeetingWarningMinutes { get; set; }
|
||||
}
|
||||
public class MeetingChange
|
||||
{
|
||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ChangeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MeetingChangeMessage
|
||||
/// </summary>
|
||||
public class MeetingChangeMessage
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MeetingChange
|
||||
/// </summary>
|
||||
[JsonProperty("meetingChange", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public MeetingChange MeetingChange { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MeetingChange
|
||||
/// </summary>
|
||||
public class MeetingChange
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ChangeType
|
||||
/// </summary>
|
||||
[JsonProperty("changeType", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ChangeType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Meeting
|
||||
/// </summary>
|
||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
[JsonProperty("meeting", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
|
|
@ -12,12 +12,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly IHumiditySensor device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IHumiditySensorMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public IHumiditySensorMessenger(string key, IHumiditySensor device, string messagePath)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -52,4 +59,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("humidity")]
|
||||
public string Humidity { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -14,11 +14,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private ILevelControls levelControlsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="ILevelControlsMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public ILevelControlsMessenger(string key, string messagePath, ILevelControls device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
levelControlsDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -87,6 +94,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class LevelControlStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Levels
|
||||
/// </summary>
|
||||
[JsonProperty("levelControls")]
|
||||
public Dictionary<string, Volume> Levels { get; set; }
|
||||
}
|
||||
|
|
@ -96,13 +106,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class LevelControlRequestMessage
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Volume
|
||||
/// </summary>
|
||||
[JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public ushort? Level { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,11 +16,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
public class IMatrixRoutingMessenger : MessengerBase
|
||||
{
|
||||
private readonly IMatrixRouting matrixDevice;
|
||||
public IMatrixRoutingMessenger(string key, string messagePath, IMatrixRouting device) : base(key, messagePath, device as IKeyName)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IMatrixRoutingMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="device"></param>
|
||||
public IMatrixRoutingMessenger(string key, string messagePath, IMatrixRouting device) : base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
matrixDevice = device;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -99,9 +108,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class MatrixStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Outputs
|
||||
/// </summary>
|
||||
[JsonProperty("outputs")]
|
||||
public Dictionary<string, RoutingOutput> Outputs;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs")]
|
||||
public Dictionary<string, RoutingInput> Inputs;
|
||||
}
|
||||
|
|
@ -109,33 +124,60 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// <summary>
|
||||
/// Represents a RoutingInput
|
||||
/// </summary>
|
||||
public class RoutingInput
|
||||
public class RoutingInput : IKeyName
|
||||
{
|
||||
private IRoutingInputSlot _input;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TxDeviceKey of the input slot
|
||||
/// </summary>
|
||||
[JsonProperty("txDeviceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string TxDeviceKey => _input?.TxDeviceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SlotNumber of the input slot
|
||||
///
|
||||
/// </summary>
|
||||
[JsonProperty("slotNumber", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? SlotNumber => _input?.SlotNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SupportedSignalTypes of the input slot
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[JsonProperty("supportedSignalTypes", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eRoutingSignalType? SupportedSignalTypes => _input?.SupportedSignalTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Name of the input slot
|
||||
/// </summary>
|
||||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name => _input?.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsOnline of the input slot
|
||||
///
|
||||
/// </summary>
|
||||
[JsonProperty("isOnline", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsOnline => _input?.IsOnline.BoolValue;
|
||||
|
||||
[JsonProperty("videoSyncDetected", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
/// <summary>
|
||||
/// Gets the VideoSyncDetected of the input slot
|
||||
/// </summary>
|
||||
[JsonProperty("videoSyncDetected", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? VideoSyncDetected => _input?.VideoSyncDetected;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Key of the input slot
|
||||
/// </summary>
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key => _input?.Key;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RoutingInput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
public RoutingInput(IRoutingInputSlot input)
|
||||
{
|
||||
_input = input;
|
||||
|
|
@ -145,32 +187,55 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// <summary>
|
||||
/// Represents a RoutingOutput
|
||||
/// </summary>
|
||||
public class RoutingOutput
|
||||
public class RoutingOutput : IKeyName
|
||||
{
|
||||
private IRoutingOutputSlot _output;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RoutingOutput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="output"></param>
|
||||
public RoutingOutput(IRoutingOutputSlot output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the RxDeviceKey of the output slot
|
||||
/// </summary>
|
||||
[JsonProperty("rxDeviceKey")]
|
||||
public string RxDeviceKey => _output.RxDeviceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CurrentRoutes of the output slot
|
||||
/// </summary>
|
||||
[JsonProperty("currentRoutes")]
|
||||
public Dictionary<string, RoutingInput> CurrentRoutes => _output.CurrentRoutes.ToDictionary(kvp => kvp.Key.ToString(), kvp => new RoutingInput(kvp.Value));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SlotNumber of the output slot
|
||||
/// </summary>
|
||||
[JsonProperty("slotNumber")]
|
||||
public int SlotNumber => _output.SlotNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SupportedSignalTypes of the output slot
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[JsonProperty("supportedSignalTypes")]
|
||||
public eRoutingSignalType SupportedSignalTypes => _output.SupportedSignalTypes;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Name of the output slot
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name => _output.Name;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Key of the output slot
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key => _output.Key;
|
||||
}
|
||||
|
|
@ -180,22 +245,23 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class MatrixRouteRequest
|
||||
{
|
||||
[JsonProperty("outputKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the OutputKey
|
||||
/// </summary>
|
||||
[JsonProperty("outputKey")]
|
||||
public string OutputKey { get; set; }
|
||||
|
||||
[JsonProperty("inputKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the InputKey
|
||||
/// </summary>
|
||||
[JsonProperty("inputKey")]
|
||||
public string InputKey { get; set; }
|
||||
|
||||
[JsonProperty("routeType")]
|
||||
/// <summary>
|
||||
/// Gets or sets the RouteType
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[JsonProperty("routeType")]
|
||||
public eRoutingSignalType RouteType { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,4 +101,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public eScreenLiftControlType Type { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -158,4 +158,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -12,12 +12,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly IShutdownPromptTimer _room;
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the <see cref="IShutdownPromptTimerMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="room"></param>
|
||||
public IShutdownPromptTimerMessenger(string key, string messagePath, IShutdownPromptTimer room)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/status", (id, content) => SendFullStatus(id));
|
||||
|
|
@ -104,4 +111,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("shutdownPromptSeconds")]
|
||||
public int ShutdownPromptSeconds { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,12 +13,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
private readonly ISwitchedOutput device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ISwitchedOutputMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public ISwitchedOutputMessenger(string key, ISwitchedOutput device, string messagePath)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -66,4 +74,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("isOn")]
|
||||
public bool IsOn { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,12 +11,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly ITechPassword _room;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for ITechPasswordMessenger
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="room"></param>
|
||||
public ITechPasswordMessenger(string key, string messagePath, ITechPassword room)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
|
||||
|
|
@ -71,6 +78,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class ITechPasswordStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the TechPasswordLength
|
||||
/// </summary>
|
||||
[JsonProperty("techPasswordLength", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? TechPasswordLength { get; set; }
|
||||
}
|
||||
|
|
@ -80,23 +90,26 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class ITechPasswordEventMessage : DeviceEventMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the IsValid
|
||||
/// </summary>
|
||||
[JsonProperty("isValid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsValid { get; set; }
|
||||
}
|
||||
|
||||
internal class SetTechPasswordContent
|
||||
{
|
||||
[JsonProperty("oldPassword")]
|
||||
/// <summary>
|
||||
/// Gets or sets the OldPassword
|
||||
/// </summary>
|
||||
[JsonProperty("oldPassword")]
|
||||
public string OldPassword { get; set; }
|
||||
|
||||
[JsonProperty("newPassword")]
|
||||
/// <summary>
|
||||
/// Gets or sets the NewPassword
|
||||
/// </summary>
|
||||
[JsonProperty("newPassword")]
|
||||
public string NewPassword { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -12,12 +12,20 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly ITemperatureSensor device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ITemperatureSensorMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public ITemperatureSensorMessenger(string key, ITemperatureSensor device, string messagePath)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -72,4 +80,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("temperatureInCelsius")]
|
||||
public bool TemperatureInCelsius { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private ILightingScenes lightingScenesDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ILightingScenesMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public ILightingScenesMessenger(string key, ILightingScenes device, string messagePath)
|
||||
: base(key, messagePath, device as IKeyName)
|
||||
{
|
||||
|
|
@ -31,6 +38,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(state);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -403,4 +403,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -119,4 +119,4 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
timerHandler(deviceKey, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,87 +6,92 @@ using PepperDash.Core.Logging;
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
namespace PepperDash.Essentials.AppServer.Messengers;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RoomEventScheduleMessenger
|
||||
/// </summary>
|
||||
public class RoomEventScheduleMessenger : MessengerBase
|
||||
{
|
||||
private readonly IRoomEventSchedule _room;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RoomEventScheduleMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="room"></param>
|
||||
public RoomEventScheduleMessenger(string key, string messagePath, IRoomEventSchedule room)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/saveScheduledEvents", (id, content) => SaveScheduledEvents(content.ToObject<List<ScheduledEventConfig>>()));
|
||||
AddAction("/status", (id, content) =>
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
AddAction("/scheduledEventsStatus", (id, content) =>
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SaveScheduledEvents(List<ScheduledEventConfig> events)
|
||||
{
|
||||
foreach (var evt in events)
|
||||
{
|
||||
SaveScheduledEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveScheduledEvent(ScheduledEventConfig eventConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
_room.AddOrUpdateScheduledEvent(eventConfig);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogException(ex, "Exception saving event");
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus(List<ScheduledEventConfig> events, string id = null)
|
||||
{
|
||||
|
||||
var message = new RoomEventScheduleStateMessage
|
||||
{
|
||||
ScheduleEvents = events,
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RoomEventScheduleStateMessage
|
||||
/// </summary>
|
||||
public class RoomEventScheduleStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a RoomEventScheduleMessenger
|
||||
/// Gets or sets the ScheduleEvents
|
||||
/// </summary>
|
||||
public class RoomEventScheduleMessenger : MessengerBase
|
||||
{
|
||||
private readonly IRoomEventSchedule _room;
|
||||
|
||||
|
||||
public RoomEventScheduleMessenger(string key, string messagePath, IRoomEventSchedule room)
|
||||
: base(key, messagePath, room as IKeyName)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
#region Overrides of MessengerBase
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/saveScheduledEvents", (id, content) => SaveScheduledEvents(content.ToObject<List<ScheduledEventConfig>>()));
|
||||
AddAction("/status", (id, content) =>
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
AddAction("/scheduledEventsStatus", (id, content) =>
|
||||
{
|
||||
var events = _room.GetScheduledEvents();
|
||||
|
||||
SendFullStatus(events, id);
|
||||
});
|
||||
|
||||
_room.ScheduledEventsChanged += (sender, args) => SendFullStatus(args.ScheduledEvents);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SaveScheduledEvents(List<ScheduledEventConfig> events)
|
||||
{
|
||||
foreach (var evt in events)
|
||||
{
|
||||
SaveScheduledEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveScheduledEvent(ScheduledEventConfig eventConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
_room.AddOrUpdateScheduledEvent(eventConfig);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogException(ex, "Exception saving event");
|
||||
}
|
||||
}
|
||||
|
||||
private void SendFullStatus(List<ScheduledEventConfig> events, string id = null)
|
||||
{
|
||||
|
||||
var message = new RoomEventScheduleStateMessage
|
||||
{
|
||||
ScheduleEvents = events,
|
||||
};
|
||||
|
||||
PostStatusMessage(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a RoomEventScheduleStateMessage
|
||||
/// </summary>
|
||||
public class RoomEventScheduleStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("scheduleEvents")]
|
||||
/// <summary>
|
||||
/// Gets or sets the ScheduleEvents
|
||||
/// </summary>
|
||||
public List<ScheduledEventConfig> ScheduleEvents { get; set; }
|
||||
}
|
||||
}
|
||||
[JsonProperty("scheduleEvents")]
|
||||
public List<ScheduledEventConfig> ScheduleEvents { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly IShadesOpenCloseStop device;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IShadesOpenCloseStopMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="shades"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public IShadesOpenCloseStopMessenger(string key, IShadesOpenCloseStop shades, string messagePath)
|
||||
: base(key, messagePath, shades as IKeyName)
|
||||
{
|
||||
device = shades;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
@ -102,9 +109,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("middleButtonLabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MiddleButtonLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsOpen
|
||||
/// </summary>
|
||||
[JsonProperty("isOpen", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsOpen { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsClosed
|
||||
/// </summary>
|
||||
[JsonProperty("isClosed", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsClosed { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatusMessage(id));
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
private readonly TwoWayDisplayBase _display;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TwoWayDisplayBaseMessenger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
/// <param name="display"></param>
|
||||
public TwoWayDisplayBaseMessenger(string key, string messagePath, TwoWayDisplayBase display)
|
||||
: base(key, messagePath, display)
|
||||
{
|
||||
|
|
@ -34,6 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(messageObj, id);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
|
|
|||
|
|
@ -9,22 +9,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
public class MobileControlMessage : IMobileControlMessage
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("clientId")]
|
||||
/// <summary>
|
||||
/// Gets or sets the ClientId
|
||||
/// </summary>
|
||||
[JsonProperty("clientId")]
|
||||
public string ClientId { get; set; }
|
||||
|
||||
[JsonProperty("content")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Content
|
||||
/// </summary>
|
||||
[JsonProperty("content")]
|
||||
public JToken Content { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer
|
||||
namespace PepperDash.Essentials.AppServer;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MobileControlSimpleContent
|
||||
/// </summary>
|
||||
public class MobileControlSimpleContent<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MobileControlSimpleContent
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public class MobileControlSimpleContent<T>
|
||||
{
|
||||
[JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the Value
|
||||
/// </summary>
|
||||
public T Value { get; set; }
|
||||
}
|
||||
[JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
public T Value { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
|
||||
|
|
@ -553,4 +554,4 @@ namespace PepperDash.Essentials.AppServer
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue