mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 03:54:51 +00:00
Compare commits
3 Commits
feature/Ge
...
1.4.35-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a77772e84 | ||
|
|
8ba6e5dd06 | ||
|
|
c3fb023967 |
@@ -80,10 +80,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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates each of the device factories to load thier device types
|
||||
/// </summary>
|
||||
void LoadDeviceTypesFromFactories()
|
||||
{
|
||||
// Instantiate the Device Factories
|
||||
new CoreDeviceFactory();
|
||||
new DmDeviceFactory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -290,9 +302,6 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
public void LoadDevices()
|
||||
{
|
||||
// Instantiate the Device Factories
|
||||
new CoreDeviceFactory();
|
||||
|
||||
|
||||
// Build the processor wrapper class
|
||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||
@@ -364,10 +373,9 @@ namespace PepperDash.Essentials
|
||||
// Then associated library factories
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf);
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
||||
/// </summary>
|
||||
[Description("Generic communication wrapper class for any IBasicCommunication type")]
|
||||
public class GenericComm : ReconfigurableBridgableDevice
|
||||
{
|
||||
EssentialsControlPropertiesConfig PropertiesConfig;
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
using Crestron.SimplSharpPro;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
public class C2nRthsController:CrestronGenericBridgeableBaseDevice
|
||||
[Description("Wrapper class for the C2N-RTHS sensor")]
|
||||
public class C2nRthsController : CrestronGenericBridgeableBaseDevice
|
||||
{
|
||||
private readonly C2nRths _device;
|
||||
|
||||
@@ -65,4 +69,22 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
trilist.StringInput[joinMap.Name].StringValue = Name;
|
||||
}
|
||||
}
|
||||
|
||||
public class C2nRthsControllerFactory : EssentialsDeviceFactory<C2nRthsController>
|
||||
{
|
||||
public C2nRthsControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "c2nrths" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
|
||||
return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -13,7 +15,8 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// Wrapper class for CEN-IO-DIGIN-104 digital input module
|
||||
/// </summary>
|
||||
public class CenIoDigIn104Controller : Device, IDigitalInputPorts
|
||||
[Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")]
|
||||
public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts
|
||||
{
|
||||
public CenIoDi104 Di104 { get; private set; }
|
||||
|
||||
@@ -37,4 +40,23 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory<CenIoDigIn104Controller>
|
||||
{
|
||||
public CenIoDigIn104ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "ceniodigin104" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipid = control.IpIdInt;
|
||||
|
||||
return new CenIoDigIn104Controller(dc.Key, dc.Name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
{
|
||||
public class StatusSignController:CrestronGenericBridgeableBaseDevice
|
||||
[Description("Wrapper class for the Crestron StatusSign device")]
|
||||
public class StatusSignController : CrestronGenericBridgeableBaseDevice
|
||||
{
|
||||
private readonly StatusSign _device;
|
||||
|
||||
@@ -158,4 +161,22 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
device.SetColor(redBrightness, greenBrightness, blueBrightness);
|
||||
}
|
||||
}
|
||||
|
||||
public class StatusSignControllerFactory : EssentialsDeviceFactory<StatusSignController>
|
||||
{
|
||||
public StatusSignControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "statussign" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new StatusSign Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
|
||||
return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
||||
/// </summary>
|
||||
[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; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Devices the basic needs for a Device Factory
|
||||
/// </summary>
|
||||
@@ -46,7 +82,10 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
foreach (var typeName in TypeNames)
|
||||
{
|
||||
DeviceFactory.AddFactoryForType(typeName, 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<DeviceConfig, IKeyed> FactoryMethod { get; set; }
|
||||
|
||||
public DeviceFactoryWrapper()
|
||||
{
|
||||
CType = null;
|
||||
Description = "Not Available";
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// A dictionary of factory methods, keyed by config types, added by plugins.
|
||||
/// These methods are looked up and called by GetDevice in this class.
|
||||
/// </summary>
|
||||
static Dictionary<string, Func<DeviceConfig, IKeyed>> FactoryMethods =
|
||||
new Dictionary<string, Func<DeviceConfig, IKeyed>>(StringComparer.OrdinalIgnoreCase);
|
||||
static Dictionary<string, DeviceFactoryWrapper> FactoryMethods =
|
||||
new Dictionary<string, DeviceFactoryWrapper>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a plugin factory method
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public static void AddFactoryForType(string type, Func<DeviceConfig, IKeyed> method)
|
||||
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> 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<DeviceConfig, IKeyed> 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The factory method for Core "things". Also iterates the Factory methods that have
|
||||
/// been loaded from plugins
|
||||
@@ -52,76 +80,70 @@ 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);
|
||||
}
|
||||
|
||||
// Check "core" types
|
||||
//if (typeName == "genericcomm")
|
||||
//{
|
||||
// Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
// return new GenericComm(dc);
|
||||
//}
|
||||
if (typeName == "ceniodigin104")
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipid = control.IpIdInt;
|
||||
|
||||
return new CenIoDigIn104Controller(key, name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem));
|
||||
}
|
||||
if (typeName == "statussign")
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
|
||||
return new StatusSignController(key, name, new StatusSign(cresnetId, Global.ControlSystem));
|
||||
}
|
||||
if (typeName == "c2nrths")
|
||||
{
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var cresnetId = control.CresnetIdInt;
|
||||
|
||||
return new C2nRthsController(key, name, new C2nRths(cresnetId, Global.ControlSystem));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints the type names fromt the FactoryMethods collection.
|
||||
/// Prints the type names and associated metadata from the FactoryMethods collection.
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
public static void GetDeviceFactoryTypes(string filter)
|
||||
{
|
||||
List<string> typeNames = new List<string>();
|
||||
Dictionary<string, DeviceFactoryWrapper> types = new Dictionary<string, DeviceFactoryWrapper>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Responsible for loading all of the device types
|
||||
/// Responsible for loading all of the device types for this library
|
||||
/// </summary>
|
||||
public class CoreDeviceFactory
|
||||
{
|
||||
public CoreDeviceFactory()
|
||||
{
|
||||
var genComm = new GenericCommFactory() as IDeviceFactory;
|
||||
genComm.LoadTypeFactories();
|
||||
Debug.Console(1, "Essentials.Core Factory Adding Types...");
|
||||
|
||||
//cast to IDeviceFactory isn't explicitly required here...but will be when instantiating using reflection, which I'm assuming is the next step
|
||||
var genCommFactory = new GenericCommFactory() as IDeviceFactory;
|
||||
genCommFactory.LoadTypeFactories();
|
||||
|
||||
var c2nRthsFactory = new C2nRthsControllerFactory() as IDeviceFactory;
|
||||
c2nRthsFactory.LoadTypeFactories();
|
||||
|
||||
var statusSignFactory = new StatusSignControllerFactory() as IDeviceFactory;
|
||||
statusSignFactory.LoadTypeFactories();
|
||||
|
||||
var cenIoControllerFactory = new CenIoDigIn104ControllerFactory() as IDeviceFactory;
|
||||
cenIoControllerFactory.LoadTypeFactories();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
void LoadTypeFactories();
|
||||
}
|
||||
|
||||
@@ -260,4 +260,29 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AirMediaControllerFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
public AirMediaControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "am200", "am300" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var type = dc.Type.ToLower();
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new AirMedia Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<AirMediaPropertiesConfig>(dc.Properties.ToString());
|
||||
AmX00 amDevice = null;
|
||||
if (type == "am200")
|
||||
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
|
||||
else if (type == "am300")
|
||||
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
|
||||
|
||||
return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.DM.Config;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
@@ -18,6 +19,7 @@ namespace PepperDash.Essentials.DM
|
||||
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
|
||||
///
|
||||
/// </summary>
|
||||
[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; }
|
||||
@@ -1275,4 +1277,41 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public class DmChassisControllerFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
public DmChassisControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "dmmd8x8", "dmmd8x8rps", "dmmd8x8cpu3", "dmmd8x8cpu3rps",
|
||||
"dmmd16x16", "dmmd16x16rps", "dmmd16x16cpu3", "dmmd16x16cpu3rps",
|
||||
"dmmd32x32", "dmmd32x32rps", "dmmd32x32cpu3", "dmmd32x32cpu3rps",
|
||||
"dmmd64x64", "dmmd128x128" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var type = dc.Type.ToLower();
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new DmChassisController Device");
|
||||
|
||||
if (type.StartsWith("dmmd8x") || type.StartsWith("dmmd16x") || type.StartsWith("dmmd32x"))
|
||||
{
|
||||
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(dc.Properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmChassisController.
|
||||
GetDmChassisController(dc.Key, dc.Name, type, props);
|
||||
}
|
||||
else if (type.StartsWith("dmmd128x") || type.StartsWith("dmmd64x"))
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(dc.Properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmBladeChassisController.
|
||||
GetDmChassisController(dc.Key, dc.Name, type, props);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,85 +17,27 @@ using PepperDash.Essentials.DM.Endpoints.DGEs;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public class DeviceFactory
|
||||
/// <summary>
|
||||
/// Responsible for loading the type factories for this library
|
||||
/// </summary>
|
||||
public class DmDeviceFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
public DmDeviceFactory()
|
||||
{
|
||||
Debug.Console(1, "Essentials.DM Factory Adding Types...");
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var dmChassisFactory = new DmChassisControllerFactory() as IDeviceFactory;
|
||||
dmChassisFactory.LoadTypeFactories();
|
||||
|
||||
if (typeName.StartsWith("am"))
|
||||
{
|
||||
if (typeName == "am200" || typeName == "am300")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<AirMediaPropertiesConfig>(properties.ToString());
|
||||
AmX00 amDevice = null;
|
||||
if (typeName == "am200")
|
||||
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
|
||||
else if (typeName == "am300")
|
||||
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
|
||||
var dmTxFactory = new DmTxControllerFactory() as IDeviceFactory;
|
||||
dmTxFactory.LoadTypeFactories();
|
||||
|
||||
return new AirMediaController(key, name, amDevice, dc, props);
|
||||
}
|
||||
}
|
||||
else if (typeName.StartsWith("dmmd8x") || typeName.StartsWith("dmmd16x") || typeName.StartsWith("dmmd32x"))
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmChassisController.
|
||||
GetDmChassisController(key, name, type, props);
|
||||
}
|
||||
else if (typeName.StartsWith("dmmd128x") || typeName.StartsWith("dmmd64x")) {
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmBladeChassisController.
|
||||
GetDmChassisController(key, name, type, props);
|
||||
}
|
||||
// Hand off to DmTxHelper class
|
||||
else if (typeName.StartsWith("dmtx")) {
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(key, name, type, props);
|
||||
}
|
||||
|
||||
// Hand off to DmRmcHelper class
|
||||
else if (typeName.StartsWith("dmrmc")) {
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DmRmcPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props);
|
||||
}
|
||||
|
||||
else if (typeName.Equals("hdmd4x14ke")) {
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.HdMdNxM4kEPropertiesConfig>(properties.ToString());
|
||||
return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props);
|
||||
}
|
||||
|
||||
else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce") || typeName.Equals("hdmd200c1ge")) {
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(properties.ToString());
|
||||
|
||||
if (typeName.Equals("hdmd400ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd300ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd200ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd200c1ge"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
var dmRxFactory = new DmRmcControllerFactory() as IDeviceFactory;
|
||||
dmRxFactory.LoadTypeFactories();
|
||||
|
||||
var hdMdFactory = new HdMdxxxCEControllerFactory() as IDeviceFactory;
|
||||
hdMdFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
[Description("Wrapper class for all HD-MD variants")]
|
||||
public class HdMdxxxCEController : CrestronGenericBridgeableBaseDevice, IRouting//, IComPorts
|
||||
{
|
||||
/// <summary>
|
||||
@@ -268,4 +270,40 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
public ControlPropertiesConfig Control { get; set; }
|
||||
}
|
||||
|
||||
public class HdMdxxxCEControllerFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
public HdMdxxxCEControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "hdmd400ce", "hdmd300ce", "hdmd200ce", "hdmd200c1ge"};
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var typeName = dc.Type.ToLower();
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new HD-MD Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
if (typeName.Equals("hdmd400ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd300ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd200ce"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else if (typeName.Equals("hdmd200c1ge"))
|
||||
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
|
||||
new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,9 +13,11 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.DM.Config;
|
||||
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; }
|
||||
@@ -281,4 +283,25 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
public class DmRmcControllerFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
public DmRmcControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s",
|
||||
"dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var type = dc.Type.ToLower();
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new DM-RMC Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DmRmcPropertiesConfig>(dc.Properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(dc.Key, dc.Name, type, props);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,8 @@ using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.DM.Config;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.DM
|
||||
{
|
||||
@@ -146,6 +148,7 @@ namespace PepperDash.Essentials.DM
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Description("Wrapper class for all DM-TX variants")]
|
||||
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice
|
||||
{
|
||||
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
|
||||
@@ -319,12 +322,25 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
}
|
||||
//public enum ePdtHdcpSupport
|
||||
//{
|
||||
// HdcpOff = 0,
|
||||
// Hdcp1 = 1,
|
||||
// Hdcp2 = 2,
|
||||
// Hdcp2_2= 3,
|
||||
// Auto = 99
|
||||
//}
|
||||
}
|
||||
|
||||
public class DmTxControllerFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
public DmTxControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", "dmtx401c", "dmtx401s" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var type = dc.Type.ToLower();
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new DM-TX Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject
|
||||
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString());
|
||||
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user