mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
fix: room combiner messenger sends disableAutoMode property
This commit is contained in:
@@ -62,6 +62,17 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether automatic mode is disabled.
|
||||
/// </summary>
|
||||
public bool DisableAutoMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _propertiesConfig.DisableAutoMode;
|
||||
}
|
||||
}
|
||||
|
||||
private CTimer _scenarioChangeDebounceTimer;
|
||||
|
||||
private int _scenarioChangeDebounceTimeSeconds = 10; // default to 10s
|
||||
|
||||
@@ -28,9 +28,20 @@ namespace PepperDash.Essentials.Core
|
||||
[JsonIgnore]
|
||||
BoolFeedback IsInAutoModeFeedback {get;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the automatic mode is disabled.
|
||||
/// </summary>
|
||||
[JsonProperty("disableAutoMode")]
|
||||
bool DisableAutoMode { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the system is operating in automatic mode.
|
||||
/// </summary>
|
||||
[JsonProperty("isInAutoMode")]
|
||||
bool IsInAutoMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of rooms associated with the current object.
|
||||
/// </summary>
|
||||
[JsonProperty("rooms")]
|
||||
List<IKeyName> Rooms { get; }
|
||||
|
||||
@@ -74,6 +85,13 @@ namespace PepperDash.Essentials.Core
|
||||
void SetRoomCombinationScenario(string scenarioKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a scenario for combining rooms, including activation, deactivation, and associated state.
|
||||
/// </summary>
|
||||
/// <remarks>This interface defines the behavior for managing room combination scenarios, including
|
||||
/// activation and deactivation, tracking the active state, and managing related partition states and UI mappings.
|
||||
/// Implementations of this interface are expected to handle the logic for room combinations based on the provided
|
||||
/// partition states and UI mappings.</remarks>
|
||||
public interface IRoomCombinationScenario : IKeyName
|
||||
{
|
||||
/// <summary>
|
||||
@@ -82,6 +100,9 @@ namespace PepperDash.Essentials.Core
|
||||
[JsonIgnore]
|
||||
BoolFeedback IsActiveFeedback { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the entity is active.
|
||||
/// </summary>
|
||||
[JsonProperty("isActive")]
|
||||
bool IsActive { get; }
|
||||
|
||||
|
||||
@@ -8,16 +8,42 @@ using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides messaging functionality for managing room combination scenarios and partition states in an <see
|
||||
/// cref="IEssentialsRoomCombiner"/> instance. Enables external systems to interact with the room combiner via
|
||||
/// predefined actions and status updates.
|
||||
/// </summary>
|
||||
/// <remarks>This class facilitates communication with an <see cref="IEssentialsRoomCombiner"/> by
|
||||
/// exposing actions for toggling modes, managing partitions, and setting room combination scenarios. It also
|
||||
/// listens for feedback changes and broadcasts status updates to connected systems. Typical usage involves
|
||||
/// registering actions for external commands and handling feedback events to synchronize state changes.</remarks>
|
||||
public class IEssentialsRoomCombinerMessenger : MessengerBase
|
||||
{
|
||||
private readonly IEssentialsRoomCombiner _roomCombiner;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IEssentialsRoomCombinerMessenger"/> class, which facilitates
|
||||
/// messaging for an <see cref="IEssentialsRoomCombiner"/> instance.
|
||||
/// </summary>
|
||||
/// <remarks>This class is designed to enable communication and interaction with an <see
|
||||
/// cref="IEssentialsRoomCombiner"/> through the specified messaging path. Ensure that the <paramref
|
||||
/// name="roomCombiner"/> parameter is not null when creating an instance.</remarks>
|
||||
/// <param name="key">The unique key identifying this messenger instance.</param>
|
||||
/// <param name="messagePath">The path used for messaging operations.</param>
|
||||
/// <param name="roomCombiner">The <see cref="IEssentialsRoomCombiner"/> instance associated with this messenger.</param>
|
||||
public IEssentialsRoomCombinerMessenger(string key, string messagePath, IEssentialsRoomCombiner roomCombiner)
|
||||
: base(key, messagePath, roomCombiner as IKeyName)
|
||||
{
|
||||
_roomCombiner = roomCombiner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers actions and event handlers for managing room combination scenarios and partition states.
|
||||
/// </summary>
|
||||
/// <remarks>This method sets up various actions that can be triggered via specific endpoints,
|
||||
/// such as toggling modes, setting room combination scenarios, and managing partition states. It also
|
||||
/// subscribes to feedback events to update the status when changes occur in room combination scenarios or
|
||||
/// partition states.</remarks>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/fullStatus", (id, content) => SendFullStatus());
|
||||
@@ -107,6 +133,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
var message = new IEssentialsRoomCombinerStateMessage
|
||||
{
|
||||
DisableAutoMode = _roomCombiner.DisableAutoMode,
|
||||
IsInAutoMode = _roomCombiner.IsInAutoMode,
|
||||
CurrentScenario = _roomCombiner.CurrentScenario,
|
||||
Rooms = rooms,
|
||||
@@ -132,20 +159,48 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the state message for a room combiner system, providing information about the current configuration,
|
||||
/// operational mode, and associated rooms, partitions, and scenarios.
|
||||
/// </summary>
|
||||
/// <remarks>This class is used to encapsulate the state of a room combiner system, including its current
|
||||
/// mode of operation, active room combination scenario, and the list of rooms and partitions involved. It is
|
||||
/// typically serialized and transmitted to communicate the state of the system.</remarks>
|
||||
public class IEssentialsRoomCombinerStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether automatic mode is disabled.
|
||||
/// </summary>
|
||||
[JsonProperty("disableAutoMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool DisableAutoMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the system is operating in automatic mode.
|
||||
/// </summary>
|
||||
[JsonProperty("isInAutoMode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool IsInAutoMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current room combination scenario.
|
||||
/// </summary>
|
||||
[JsonProperty("currentScenario", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public IRoomCombinationScenario CurrentScenario { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of rooms associated with the entity.
|
||||
/// </summary>
|
||||
[JsonProperty("rooms", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<IKeyName> Rooms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of room combination scenarios.
|
||||
/// </summary>
|
||||
[JsonProperty("roomCombinationScenarios", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<IRoomCombinationScenario> RoomCombinationScenarios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of partition controllers.
|
||||
/// </summary>
|
||||
[JsonProperty("partitions", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<IPartitionController> Partitions { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user