diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs
index db10c959..04f60378 100644
--- a/PepperDashEssentials/ControlSystem.cs
+++ b/PepperDashEssentials/ControlSystem.cs
@@ -81,10 +81,22 @@ namespace PepperDash.Essentials
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
+ LoadDeviceTypesFromFactories();
+
if (!Debug.DoNotLoadOnNextBoot)
GoWithLoad();
}
+ ///
+ /// Instantiates each of the device factories to load thier device types
+ ///
+ void LoadDeviceTypesFromFactories()
+ {
+ // Instantiate the Device Factories
+ new CoreDeviceFactory();
+ new DmDeviceFactory();
+ }
+
///
@@ -291,9 +303,6 @@ namespace PepperDash.Essentials
///
public void LoadDevices()
{
- // Instantiate the Device Factories
- new CoreDeviceFactory();
-
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs
index 0b33e619..41438832 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs
@@ -15,6 +15,7 @@ namespace PepperDash.Essentials.Core
///
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
///
+ [Description("Generic communication wrapper class for any IBasicCommunication type")]
public class GenericComm : ReconfigurableBridgableDevice
{
EssentialsControlPropertiesConfig PropertiesConfig;
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs
index c764a5f7..214c5ecf 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs
@@ -10,6 +10,7 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
+ [Description("Wrapper class for the C2N-RTHS sensor")]
public class C2nRthsController : CrestronGenericBridgeableBaseDevice
{
private readonly C2nRths _device;
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs
index 1ac8d0e3..8510dd9d 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs
@@ -15,6 +15,7 @@ namespace PepperDash.Essentials.Core
///
/// Wrapper class for CEN-IO-DIGIN-104 digital input module
///
+ [Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")]
public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts
{
public CenIoDi104 Di104 { get; private set; }
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs
index efdf9b7d..10a18372 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs
@@ -10,6 +10,7 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
+ [Description("Wrapper class for the Crestron StatusSign device")]
public class StatusSignController : CrestronGenericBridgeableBaseDevice
{
private readonly StatusSign _device;
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs
index 4e144ff0..410c7a48 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
+using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
@@ -12,6 +13,7 @@ namespace PepperDash.Essentials.Core
///
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
///
+ [Description("The base Essentials Device Class")]
public abstract class EssentialsDevice : Device
{
protected EssentialsDevice(string key)
@@ -27,6 +29,40 @@ namespace PepperDash.Essentials.Core
}
}
+ [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
+ public class DescriptionAttribute : Attribute
+ {
+ private string _Description;
+
+ public DescriptionAttribute(string description)
+ {
+ Debug.Console(2, "Setting Description: {0}", description);
+ _Description = description;
+ }
+
+ public string Description
+ {
+ get { return _Description; }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
+ public class ConfigSnippetAttribute : Attribute
+ {
+ private string _ConfigSnippet;
+
+ public ConfigSnippetAttribute(string configSnippet)
+ {
+ Debug.Console(2, "Setting Description {0}", configSnippet);
+ _ConfigSnippet = configSnippet;
+ }
+
+ public string ConfigSnippet
+ {
+ get { return _ConfigSnippet; }
+ }
+ }
+
///
/// Devices the basic needs for a Device Factory
///
@@ -46,7 +82,10 @@ namespace PepperDash.Essentials.Core
{
foreach (var typeName in TypeNames)
{
- DeviceFactory.AddFactoryForType(typeName.ToLower(), BuildDevice);
+ Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
+ var attributes = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
+ string description = attributes[0].Description;
+ DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
}
}
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
index c4698736..15188965 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
@@ -5,6 +5,7 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
+using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
@@ -13,26 +14,53 @@ using PepperDash.Essentials.Core.Touchpanels;
namespace PepperDash.Essentials.Core
{
+ public class DeviceFactoryWrapper
+ {
+ public CType CType { get; set; }
+ public string Description { get; set; }
+ public Func FactoryMethod { get; set; }
+
+ public DeviceFactoryWrapper()
+ {
+ CType = null;
+ Description = "Not Available";
+ }
+ }
+
public class DeviceFactory
{
///
/// A dictionary of factory methods, keyed by config types, added by plugins.
/// These methods are looked up and called by GetDevice in this class.
///
- static Dictionary> FactoryMethods =
- new Dictionary>(StringComparer.OrdinalIgnoreCase);
+ static Dictionary FactoryMethods =
+ new Dictionary(StringComparer.OrdinalIgnoreCase);
///
/// Adds a plugin factory method
///
///
///
- public static void AddFactoryForType(string type, Func method)
+ public static void AddFactoryForType(string typeName, Func method)
{
- Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", type);
- DeviceFactory.FactoryMethods.Add(type, method);
+ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
+ DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
}
+ public static void AddFactoryForType(string typeName, string description, CType cType, Func method)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
+
+ if(FactoryMethods.ContainsKey(typeName))
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add type: '{0}'. Already exists in DeviceFactory", typeName);
+ return;
+ }
+
+ var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method };
+ DeviceFactory.FactoryMethods.Add(typeName, wrapper);
+ }
+
///
/// The factory method for Core "things". Also iterates the Factory methods that have
/// been loaded from plugins
@@ -52,34 +80,45 @@ namespace PepperDash.Essentials.Core
if (FactoryMethods.ContainsKey(typeName))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type);
- return FactoryMethods[typeName](dc);
+ return FactoryMethods[typeName].FactoryMethod(dc);
}
return null;
}
///
- /// Prints the type names fromt the FactoryMethods collection.
+ /// Prints the type names and associated metadata from the FactoryMethods collection.
///
///
public static void GetDeviceFactoryTypes(string filter)
{
- List typeNames = new List();
+ Dictionary types = new Dictionary();
if (!string.IsNullOrEmpty(filter))
{
- typeNames = FactoryMethods.Keys.Where(k => k.Contains(filter)).ToList();
+ types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
}
else
{
- typeNames = FactoryMethods.Keys.ToList();
+ types = FactoryMethods;
}
Debug.Console(0, "Device Types:");
- foreach (var type in typeNames)
+ foreach (var type in types)
{
- Debug.Console(0, "type: '{0}'", type);
+ var description = type.Value.Description;
+ var cType = "Not Specified by Plugin";
+
+ if(type.Value.CType != null)
+ {
+ cType = type.Value.CType.FullName;
+ }
+
+ Debug.Console(0,
+ @"Type: '{0}'
+ CType: '{1}'
+ Description: {2}", type.Key, cType, description);
}
}
}
@@ -91,6 +130,8 @@ namespace PepperDash.Essentials.Core
{
public CoreDeviceFactory()
{
+ Debug.Console(1, "Essentials.Core Factory Adding Types...");
+
var genCommFactory = new GenericCommFactory() as IDeviceFactory;
genCommFactory.LoadTypeFactories();
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs
index ef792868..91e073f2 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/IDeviceFactory.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
+using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Core
public interface IDeviceFactory
{
///
- /// Will be called when the plugin is loaded by Essentials. Must add any new types to the DeviceFactory using DeviceFactory.AddFactoryForType() for each new type
+ /// Loads all the types to the DeviceFactory
///
void LoadTypeFactories();
}
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
index 8fa8696f..bc39e51a 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs
@@ -19,6 +19,7 @@ namespace PepperDash.Essentials.DM
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
///
+ [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 128x128")]
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback
{
public DMChassisPropertiesConfig PropertiesConfig { get; set; }
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs
index 3dcfb6b6..6e10ae61 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DeviceFactory.cs
@@ -24,6 +24,8 @@ namespace PepperDash.Essentials.DM
{
public DmDeviceFactory()
{
+ Debug.Console(1, "Essentials.DM Factory Adding Types...");
+
var dmChassisFactory = new DmChassisControllerFactory() as IDeviceFactory;
dmChassisFactory.LoadTypeFactories();
diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs
index 63929938..000202dc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs
@@ -19,6 +19,7 @@ namespace PepperDash.Essentials.DM
///
/// Represent both a transmitter and receiver pair of the HD-MD-400-C-E / HD-MD-300-C-E / HD-MD-200-C-E kits
///
+ [Description("Wrapper class for all HD-MD variants")]
public class HdMdxxxCEController : CrestronGenericBridgeableBaseDevice, IRouting//, IComPorts
{
///
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
index 08708d97..f36b513e 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
@@ -17,6 +17,7 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM
{
+ [Description("Wrapper class for all DM-RMC variants")]
public abstract class DmRmcControllerBase : CrestronGenericBridgeableBaseDevice
{
public virtual StringFeedback VideoOutputResolutionFeedback { get; protected set; }
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
index b741dfe5..f5d59354 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
@@ -148,6 +148,7 @@ namespace PepperDash.Essentials.DM
///
///
///
+ [Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }