mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge remote-tracking branch 'origin/feature-2.0.0/room-combiner-updates' into feature-2.0.0/video-codec-interface-uiextensions
This commit is contained in:
@@ -15,10 +15,8 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
|||||||
/// <example>
|
/// <example>
|
||||||
/// See MockDisplay for example implemntation
|
/// See MockDisplay for example implemntation
|
||||||
/// </example>
|
/// </example>
|
||||||
public interface IHasInputs<TKey, TSelector>: IKeyName
|
public interface IHasInputs<T, TSelector>: IKeyName
|
||||||
{
|
{
|
||||||
ISelectableItems<TKey> Inputs { get; }
|
ISelectableItems<T> Inputs { get; }
|
||||||
|
|
||||||
void SetInput(TSelector selector);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
|||||||
Dictionary<TKey, ISelectableItem> Items { get; set; }
|
Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||||
|
|
||||||
[JsonProperty("currentItem")]
|
[JsonProperty("currentItem")]
|
||||||
string CurrentItem { get; set; }
|
TKey CurrentItem { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,29 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
private bool isInAutoMode;
|
private bool isInAutoMode;
|
||||||
|
|
||||||
private bool partitionPresent;
|
private bool _partitionPresent;
|
||||||
|
|
||||||
|
public bool PartitionPresent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _partitionPresent;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_partitionPresent == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_partitionPresent = value;
|
||||||
|
|
||||||
|
if (PartitionPresentFeedback != null)
|
||||||
|
{
|
||||||
|
PartitionPresentFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public EssentialsPartitionController(string key, string name, IPartitionStateProvider sensor, bool defaultToManualMode, List<string> adjacentRoomKeys)
|
public EssentialsPartitionController(string key, string name, IPartitionStateProvider sensor, bool defaultToManualMode, List<string> adjacentRoomKeys)
|
||||||
{
|
{
|
||||||
@@ -42,7 +64,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
SetManualMode();
|
SetManualMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetManualMode();
|
SetManualMode();
|
||||||
}
|
}
|
||||||
@@ -85,11 +107,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
isInAutoMode = false;
|
isInAutoMode = false;
|
||||||
if (PartitionPresentFeedback != null)
|
if (PartitionPresentFeedback != null)
|
||||||
{
|
{
|
||||||
PartitionPresentFeedback.SetValueFunc(() => partitionPresent);
|
PartitionPresentFeedback.SetValueFunc(() => _partitionPresent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartitionPresentFeedback = new BoolFeedback(() => partitionPresent);
|
PartitionPresentFeedback = new BoolFeedback(() => _partitionPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_partitionSensor != null)
|
if (_partitionSensor != null)
|
||||||
@@ -103,7 +125,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (!isInAutoMode)
|
if (!isInAutoMode)
|
||||||
{
|
{
|
||||||
partitionPresent = true;
|
PartitionPresent = true;
|
||||||
PartitionPresentFeedback.FireUpdate();
|
PartitionPresentFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +134,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (!isInAutoMode)
|
if (!isInAutoMode)
|
||||||
{
|
{
|
||||||
partitionPresent = false;
|
PartitionPresent = false;
|
||||||
PartitionPresentFeedback.FireUpdate();
|
PartitionPresentFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +143,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (!isInAutoMode)
|
if (!isInAutoMode)
|
||||||
{
|
{
|
||||||
partitionPresent = !partitionPresent;
|
PartitionPresent = !PartitionPresent;
|
||||||
PartitionPresentFeedback.FireUpdate();
|
PartitionPresentFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using Newtonsoft.Json;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
@@ -13,7 +9,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPartitionStateProvider : IKeyName
|
public interface IPartitionStateProvider : IKeyName
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
BoolFeedback PartitionPresentFeedback { get; }
|
BoolFeedback PartitionPresentFeedback { get; }
|
||||||
|
|
||||||
|
[JsonProperty("partitionPresent")]
|
||||||
|
bool PartitionPresent { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -21,6 +21,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPartitionController : IPartitionStateProvider
|
public interface IPartitionController : IPartitionStateProvider
|
||||||
{
|
{
|
||||||
|
[JsonProperty("adjacentRoomKeys")]
|
||||||
List<string> AdjacentRoomKeys { get; }
|
List<string> AdjacentRoomKeys { get; }
|
||||||
|
|
||||||
void SetPartitionStatePresent();
|
void SetPartitionStatePresent();
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,33 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
private List<IEssentialsRoom> _rooms;
|
private List<IEssentialsRoom> _rooms;
|
||||||
|
|
||||||
private bool isInAutoMode;
|
public List<IKeyName> Rooms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _rooms.Cast<IKeyName>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isInAutoMode;
|
||||||
|
|
||||||
|
public bool IsInAutoMode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _isInAutoMode;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == _isInAutoMode)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isInAutoMode = value;
|
||||||
|
IsInAutoModeFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private CTimer _scenarioChangeDebounceTimer;
|
private CTimer _scenarioChangeDebounceTimer;
|
||||||
|
|
||||||
@@ -36,14 +62,14 @@ namespace PepperDash.Essentials.Core
|
|||||||
_scenarioChangeDebounceTimeSeconds = _propertiesConfig.ScenarioChangeDebounceTimeSeconds;
|
_scenarioChangeDebounceTimeSeconds = _propertiesConfig.ScenarioChangeDebounceTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsInAutoModeFeedback = new BoolFeedback(() => isInAutoMode);
|
IsInAutoModeFeedback = new BoolFeedback(() => _isInAutoMode);
|
||||||
|
|
||||||
// default to auto mode
|
// default to auto mode
|
||||||
isInAutoMode = true;
|
IsInAutoMode = true;
|
||||||
|
|
||||||
if (_propertiesConfig.defaultToManualMode)
|
if (_propertiesConfig.defaultToManualMode)
|
||||||
{
|
{
|
||||||
isInAutoMode = false;
|
IsInAutoMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsInAutoModeFeedback.FireUpdate();
|
IsInAutoModeFeedback.FireUpdate();
|
||||||
@@ -56,7 +82,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
SetRooms();
|
SetRooms();
|
||||||
|
|
||||||
if (isInAutoMode)
|
if (IsInAutoMode)
|
||||||
{
|
{
|
||||||
DetermineRoomCombinationScenario();
|
DetermineRoomCombinationScenario();
|
||||||
}
|
}
|
||||||
@@ -201,20 +227,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public void SetAutoMode()
|
public void SetAutoMode()
|
||||||
{
|
{
|
||||||
isInAutoMode = true;
|
IsInAutoMode = true;
|
||||||
IsInAutoModeFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetManualMode()
|
public void SetManualMode()
|
||||||
{
|
{
|
||||||
isInAutoMode = false;
|
IsInAutoMode = false;
|
||||||
IsInAutoModeFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleMode()
|
public void ToggleMode()
|
||||||
{
|
{
|
||||||
isInAutoMode = !isInAutoMode;
|
IsInAutoMode = !IsInAutoMode;
|
||||||
IsInAutoModeFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IRoomCombinationScenario> RoomCombinationScenarios { get; private set; }
|
public List<IRoomCombinationScenario> RoomCombinationScenarios { get; private set; }
|
||||||
@@ -233,7 +256,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public void SetRoomCombinationScenario(string scenarioKey)
|
public void SetRoomCombinationScenario(string scenarioKey)
|
||||||
{
|
{
|
||||||
if (isInAutoMode)
|
if (IsInAutoMode)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "Cannot set room combination scenario when in auto mode. Set to auto mode first.");
|
Debug.LogMessage(LogEventLevel.Information, this, "Cannot set room combination scenario when in auto mode. Set to auto mode first.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using Newtonsoft.Json;
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
@@ -21,13 +18,21 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current room combination scenario
|
/// The current room combination scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("currentScenario")]
|
||||||
IRoomCombinationScenario CurrentScenario { get; }
|
IRoomCombinationScenario CurrentScenario { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When true, indicates the current mode is auto mode
|
/// When true, indicates the current mode is auto mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
BoolFeedback IsInAutoModeFeedback {get;}
|
BoolFeedback IsInAutoModeFeedback {get;}
|
||||||
|
|
||||||
|
[JsonProperty("isInAutoMode")]
|
||||||
|
bool IsInAutoMode { get; }
|
||||||
|
|
||||||
|
[JsonProperty("rooms")]
|
||||||
|
List<IKeyName> Rooms { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets auto mode
|
/// Sets auto mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -46,11 +51,13 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The available room combinatino scenarios
|
/// The available room combinatino scenarios
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("roomCombinationScenarios")]
|
||||||
List<IRoomCombinationScenario> RoomCombinationScenarios { get; }
|
List<IRoomCombinationScenario> RoomCombinationScenarios { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The partition
|
/// The partition
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("partitions")]
|
||||||
List<IPartitionController> Partitions { get; }
|
List<IPartitionController> Partitions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,8 +78,12 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// When true, indicates that this room combination scenario is active
|
/// When true, indicates that this room combination scenario is active
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
BoolFeedback IsActiveFeedback { get; }
|
BoolFeedback IsActiveFeedback { get; }
|
||||||
|
|
||||||
|
[JsonProperty("isActive")]
|
||||||
|
bool IsActive { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activates this room combination scenario
|
/// Activates this room combination scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -86,11 +97,13 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The state of the partitions that would activate this scenario
|
/// The state of the partitions that would activate this scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("partitionStates")]
|
||||||
List<PartitionState> PartitionStates { get; }
|
List<PartitionState> PartitionStates { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mapping of UIs by key to rooms by key
|
/// The mapping of UIs by key to rooms by key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("uiMap")]
|
||||||
Dictionary<string, string> UiMap { get; set; }
|
Dictionary<string, string> UiMap { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,20 +16,41 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a room combination scenario
|
/// Represents a room combination scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoomCombinationScenario: IRoomCombinationScenario
|
public class RoomCombinationScenario: IRoomCombinationScenario, IKeyName
|
||||||
{
|
{
|
||||||
private RoomCombinationScenarioConfig _config;
|
private RoomCombinationScenarioConfig _config;
|
||||||
|
|
||||||
|
[JsonProperty("key")]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("partitionStates")]
|
||||||
public List<PartitionState> PartitionStates { get; private set; }
|
public List<PartitionState> PartitionStates { get; private set; }
|
||||||
|
|
||||||
|
[JsonProperty("uiMap")]
|
||||||
public Dictionary<string, string> UiMap { get; set; }
|
public Dictionary<string, string> UiMap { get; set; }
|
||||||
|
|
||||||
private bool _isActive;
|
private bool _isActive;
|
||||||
|
|
||||||
|
[JsonProperty("isActive")]
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get { return _isActive; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == _isActive)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isActive = value;
|
||||||
|
IsActiveFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public BoolFeedback IsActiveFeedback { get; private set; }
|
public BoolFeedback IsActiveFeedback { get; private set; }
|
||||||
|
|
||||||
private List<DeviceActionWrapper> activationActions;
|
private List<DeviceActionWrapper> activationActions;
|
||||||
@@ -67,8 +88,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_isActive = true;
|
IsActive = true;
|
||||||
IsActiveFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
@@ -83,8 +103,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_isActive = false;
|
IsActive = false;
|
||||||
IsActiveFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
|
|
||||||
public class MockDisplayInput : ISelectableItem
|
public class MockDisplayInput : ISelectableItem
|
||||||
{
|
{
|
||||||
private IHasInputs<string, string> _parent;
|
private MockDisplay _parent;
|
||||||
|
|
||||||
|
|
||||||
private bool _isSelected;
|
private bool _isSelected;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user