mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-26 19:04:47 +00:00
progress on component room classes and interfaces
This commit is contained in:
@@ -434,7 +434,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
Device room = null;
|
||||
|
||||
if (roomConfig.Type != "componentRoom")
|
||||
if (roomConfig.Type.ToLower() != "componentroom")
|
||||
{
|
||||
room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
|
||||
}
|
||||
@@ -451,11 +451,14 @@ namespace PepperDash.Essentials
|
||||
// default to no join map key
|
||||
string fusionJoinMapKey = string.Empty;
|
||||
|
||||
if (room.Config.Properties["fusion"] != null)
|
||||
|
||||
var essRoom = room as EssentialsRoomBase;
|
||||
|
||||
if (essRoom.Config.Properties["fusion"] != null)
|
||||
{
|
||||
Debug.Console(2, "Custom Fusion config found. Using custom values");
|
||||
|
||||
var fusionConfig = room.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
|
||||
var fusionConfig = essRoom.Config.Properties["fusion"].ToObject<EssentialsRoomFusionConfig>();
|
||||
|
||||
if (fusionConfig != null)
|
||||
{
|
||||
@@ -468,7 +471,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(essRoom, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
@@ -479,7 +482,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)essRoom, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
@@ -491,11 +494,11 @@ namespace PepperDash.Essentials
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion");
|
||||
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
|
||||
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)essRoom, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
CreateMobileControlBridge(essRoom);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -601,7 +604,7 @@ namespace PepperDash.Essentials
|
||||
return ((logoDark != null && logoDark == "system") ||
|
||||
(logoLight != null && logoLight == "system") || (logo != null && logo == "system"));
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Unable to find logo information in any room config: {0}", e);
|
||||
return false;
|
||||
|
||||
@@ -246,8 +246,11 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public class DeviceActionWrapper
|
||||
{
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey { get; set; }
|
||||
[JsonProperty("methodName")]
|
||||
public string MethodName { get; set; }
|
||||
[JsonProperty("params")]
|
||||
public object[] Params { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace PepperDash.Essentials.Core.Interfaces.Components
|
||||
/// </summary>
|
||||
public interface IComponentRoom : IKeyed
|
||||
{
|
||||
List<IRoomComponent> Components { get; }
|
||||
List<IActivatableComponent> Components { get; }
|
||||
List<IRoomActivityComponent> Activities { get; }
|
||||
|
||||
List<IRoomComponent> GetRoomComponentsOfType(Type type);
|
||||
List<T> GetRoomComponentsOfType<T>();
|
||||
List<IRoomActivityComponent> GetOrderedActvities();
|
||||
}
|
||||
|
||||
@@ -41,11 +41,15 @@ namespace PepperDash.Essentials.Core.Interfaces.Components
|
||||
/// </summary>
|
||||
public interface IRoomActivityComponent : IRoomComponent
|
||||
{
|
||||
BoolFeedback IsEnabledFeedback { get; }
|
||||
|
||||
bool Enable { set; }
|
||||
string Label { get; }
|
||||
string Icon { get; }
|
||||
IRoomComponent Component { get; }
|
||||
IRoomBehaviourGroupComponent Component { get; }
|
||||
int Order { get; }
|
||||
|
||||
|
||||
void StartActivity();
|
||||
void EndActivity();
|
||||
}
|
||||
@@ -53,27 +57,37 @@ namespace PepperDash.Essentials.Core.Interfaces.Components
|
||||
/// <summary>
|
||||
/// Describes a room component that can be "used" by a user
|
||||
/// </summary>
|
||||
public interface IUsableRoomComponent
|
||||
public interface IActivatableComponent : IRoomComponent
|
||||
{
|
||||
bool InUse { get; }
|
||||
BoolFeedback ActivatedFeedback { get; }
|
||||
|
||||
void StartUse();
|
||||
void EndUse();
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room behaviour component
|
||||
/// Describes a room behaviour component. Is able to contain a collection of components that aggregate
|
||||
/// together to behave as one
|
||||
/// </summary>
|
||||
public interface IRoomBehaviourComponent : IUsableRoomComponent
|
||||
public interface IRoomBehaviourGroupComponent
|
||||
{
|
||||
List<IActivatableComponent> Components { get; }
|
||||
|
||||
void ActivateComponents();
|
||||
void DeactivateComponents();
|
||||
}
|
||||
|
||||
public interface IRoomBehaviourComponent : IActivatableComponent
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes a room device component
|
||||
/// </summary>
|
||||
public interface IRoomDeviceComponent : IUsableRoomComponent
|
||||
public interface IRoomDeviceComponent<T> : IActivatableComponent where T : EssentialsDevice
|
||||
{
|
||||
|
||||
public T Device { get; }
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,8 @@ namespace PepperDash.Essentials.Core.Room
|
||||
public string ComponentKey { get; set; }
|
||||
[JsonProperty("order")]
|
||||
public int Order { get; set; }
|
||||
[JsonProperty("selectAction")]
|
||||
public DeviceActionWrapper SelectAction { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,7 +51,8 @@ namespace PepperDash.Essentials.Core.Room
|
||||
/// </summary>
|
||||
public class RoomDeviceBehaviourConfig : RoomComponentConfig
|
||||
{
|
||||
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,7 +75,7 @@ namespace PepperDash.Essentials.Core.Room
|
||||
{
|
||||
public ComponentRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||
|
||||
public List<IRoomComponent> Components { get; private set; }
|
||||
public List<IActivatableComponent> Components { get; private set; }
|
||||
public List<IRoomActivityComponent> Activities { get; private set; }
|
||||
|
||||
public ComponentRoom(DeviceConfig config)
|
||||
@@ -80,23 +83,32 @@ namespace PepperDash.Essentials.Core.Room
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertiesConfig = JsonConvert.DeserializeObject<ComponentRoomPropertiesConfig>
|
||||
(config.Properties.ToString());
|
||||
PropertiesConfig = config.Properties.ToObject<ComponentRoomPropertiesConfig>();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, this, "Error building ComponentRoom: \n{0}", e);
|
||||
}
|
||||
|
||||
BuildComponents();
|
||||
}
|
||||
|
||||
public List<IRoomComponent> GetRoomComponentsOfType(Type componentType)
|
||||
private void BuildComponents()
|
||||
{
|
||||
// TODO: Figure this out later
|
||||
return Components;
|
||||
//var results = Components.OfType<componentType>();
|
||||
//return results;
|
||||
//return Components.Where(c => c != null && type.IsAssignableFrom(c.GetType()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a set of IRoomComponent that matches the specified Type
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public List<T> GetRoomComponentsOfType<T>() where T : IActivatableComponent
|
||||
{
|
||||
return Components.OfType<T>().ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user