mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-29 12:24:59 +00:00
Finishes converting all existing types to new DeviceFactory mechanism. #106
This commit is contained in:
@@ -22,13 +22,12 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
public BridgeFactory()
|
||||
{
|
||||
var bridgeFactory = new BridgeFactory() as IDeviceFactory;
|
||||
bridgeFactory.LoadTypeFactories();
|
||||
var eiscApiFactory = new EiscApiFactory() as IDeviceFactory;
|
||||
eiscApiFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class CommBridge : Device
|
||||
{
|
||||
public CommBridgeProperties Properties { get; private set; }
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace PepperDash.Essentials
|
||||
new BridgeFactory();
|
||||
|
||||
new PepperDash.Essentials.Devices.Common.DeviceFactory();
|
||||
|
||||
new PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory();
|
||||
}
|
||||
|
||||
|
||||
@@ -378,8 +378,8 @@ namespace PepperDash.Essentials
|
||||
newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf);
|
||||
|
||||
//
|
||||
if (newDev == null)
|
||||
newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||
//if (newDev == null)
|
||||
// newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf);
|
||||
//
|
||||
|
||||
if (newDev != null)
|
||||
|
||||
@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
@@ -67,4 +68,95 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
|
||||
{
|
||||
public GenericDigitalInputDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "digitalinput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Digtal Input Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
|
||||
IDigitalInputPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IDigitalInputPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
if (cs == null)
|
||||
{
|
||||
Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cs.SupportsVersiport)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfVersiPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
Versiport vp = cs.VersiPorts[props.PortNumber];
|
||||
|
||||
if (!vp.Registered)
|
||||
{
|
||||
var regSuccess = vp.Register();
|
||||
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Versiport");
|
||||
return new GenericVersiportDigitalInputDevice(dc.Key, vp, props);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}",
|
||||
props.PortNumber, props.PortDeviceKey, regSuccess);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cs.SupportsDigitalInput)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
|
||||
|
||||
if (!digitalInput.Registered)
|
||||
{
|
||||
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Digital Input");
|
||||
return new GenericDigitalInputDevice(dc.Key, digitalInput);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
/// <summary>
|
||||
/// Represents a generic digital input deviced tied to a versiport
|
||||
/// </summary>
|
||||
public class GenericVersiportDigitalInputDevice : Device, IDigitalInput
|
||||
public class GenericVersiportDigitalInputDevice : EssentialsDevice, IDigitalInput
|
||||
{
|
||||
public Versiport InputPort { get; private set; }
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
|
||||
namespace PepperDash.Essentials.Core.CrestronIO
|
||||
@@ -101,4 +102,74 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
||||
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
|
||||
{
|
||||
public GenericRelayDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relayoutput" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
|
||||
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
|
||||
var key = dc.Key;
|
||||
|
||||
IRelayPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IRelayPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (cs != null)
|
||||
{
|
||||
// The relay is on a control system processor
|
||||
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The relay is on another device type
|
||||
|
||||
if (props.PortNumber > portDevice.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Relay relay = portDevice.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GenericRelayDevice(key, relay);
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
Debug.Console(0, "Device Types:");
|
||||
|
||||
foreach (var type in types)
|
||||
foreach (var type in types.OrderBy(t => t.Key))
|
||||
{
|
||||
var description = type.Value.Description;
|
||||
var cType = "Not Specified by Plugin";
|
||||
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
|
||||
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Core.Privacy
|
||||
/// Used for applications where one or more microphones with momentary contact closure outputs are used to
|
||||
/// toggle the privacy state of the room. Privacy state feedback is represented
|
||||
/// </summary>
|
||||
public class MicrophonePrivacyController : Device
|
||||
public class MicrophonePrivacyController : EssentialsDevice
|
||||
{
|
||||
MicrophonePrivacyControllerConfig Config;
|
||||
|
||||
@@ -225,4 +226,21 @@ namespace PepperDash.Essentials.Core.Privacy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MicrophonePrivacyControllerFactory : EssentialsDeviceFactory<MicrophonePrivacyController>
|
||||
{
|
||||
public MicrophonePrivacyControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "microphoneprivacycontroller" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new MIcrophonePrivacyController Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Core.Privacy.MicrophonePrivacyControllerConfig>(dc.Properties.ToString());
|
||||
|
||||
return new Core.Privacy.MicrophonePrivacyController(dc.Key, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Core.Shades
|
||||
/// <summary>
|
||||
/// Base class for a shade device
|
||||
/// </summary>
|
||||
public abstract class ShadeBase : Device, IShadesOpenClose
|
||||
public abstract class ShadeBase : EssentialsDevice, IShadesOpenClose
|
||||
{
|
||||
public ShadeBase(string key, string name)
|
||||
: base(key, name)
|
||||
|
||||
@@ -5,13 +5,14 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that contains the shades to be controlled in a room
|
||||
/// </summary>
|
||||
public class ShadeController : Device, IShades
|
||||
public class ShadeController : EssentialsDevice, IShades
|
||||
{
|
||||
ShadeControllerConfigProperties Config;
|
||||
|
||||
@@ -55,4 +56,21 @@ namespace PepperDash.Essentials.Core.Shades
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ShadeControllerFactory : EssentialsDeviceFactory<ShadeController>
|
||||
{
|
||||
public ShadeControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "shadecontroller" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new ShadeController Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Core.Shades.ShadeControllerConfigProperties>(dc.Properties.ToString());
|
||||
|
||||
return new Core.Shades.ShadeController(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
{
|
||||
public abstract class AudioCodecBase : Device, IHasDialer, IUsageTracking, IAudioCodecInfo
|
||||
public abstract class AudioCodecBase : EssentialsDevice, IHasDialer, IUsageTracking, IAudioCodecInfo
|
||||
{
|
||||
|
||||
public event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
@@ -111,4 +112,20 @@ namespace PepperDash.Essentials.Devices.Common.AudioCodec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MockACFactory : EssentialsDeviceFactory<MockAC>
|
||||
{
|
||||
public MockACFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockac" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new MockAc Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<AudioCodec.MockAcPropertiesConfig>(dc.Properties.ToString());
|
||||
return new AudioCodec.MockAC(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
|
||||
@@ -725,4 +726,24 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class AvocorDisplayFactory : EssentialsDeviceFactory<AvocorDisplay>
|
||||
{
|
||||
public AvocorDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "avocorvtf" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new AvocorDisplay(dc.Key, dc.Name, comm, null);
|
||||
else
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,51 +14,20 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
public class DisplayDeviceFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
public DisplayDeviceFactory()
|
||||
{
|
||||
var necFactory = new NecPSXMDisplayFactory() as IDeviceFactory;
|
||||
necFactory.LoadTypeFactories();
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var panasonicThFactory = new PanasonicThDisplayFactory() as IDeviceFactory;
|
||||
panasonicThFactory.LoadTypeFactories();
|
||||
|
||||
try
|
||||
{
|
||||
if (typeName == "necmpsx")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new NecPSXMDisplay(dc.Key, dc.Name, comm);
|
||||
}
|
||||
if (typeName == "panasonicthef")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new PanasonicThefDisplay(dc.Key, dc.Name, comm);
|
||||
}
|
||||
else if(typeName == "samsungmdc")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value<string>());
|
||||
}
|
||||
if (typeName == "avocorvtf")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new AvocorDisplay(dc.Key, dc.Name, comm, null);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, "Displays factory: Exception creating device type {0}, key {1}: \nCONFIG JSON: {2} \nERROR: {3}\n\n",
|
||||
dc.Type, dc.Key, JsonConvert.SerializeObject(dc), e);
|
||||
return null;
|
||||
}
|
||||
var samsungMdcFactory = new SamsungMDCFactory() as IDeviceFactory;
|
||||
samsungMdcFactory.LoadTypeFactories();
|
||||
|
||||
var avocorFactory = new AvocorDisplayFactory() as IDeviceFactory;
|
||||
avocorFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
@@ -361,4 +362,23 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class NecPSXMDisplayFactory : EssentialsDeviceFactory<NecPSXMDisplay>
|
||||
{
|
||||
public NecPSXMDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "necmpsx" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new NecPSXMDisplay(dc.Key, dc.Name, comm);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
@@ -16,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class PanasonicThefDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor
|
||||
public class PanasonicThDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, ICommunicationMonitor
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
@@ -73,7 +74,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
/// <summary>
|
||||
/// Constructor for IBasicCommunication
|
||||
/// </summary>
|
||||
public PanasonicThefDisplay(string key, string name, IBasicCommunication comm)
|
||||
public PanasonicThDisplay(string key, string name, IBasicCommunication comm)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = comm;
|
||||
@@ -82,7 +83,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
/// <summary>
|
||||
/// Constructor for TCP
|
||||
/// </summary>
|
||||
public PanasonicThefDisplay(string key, string name, string hostname, int port)
|
||||
public PanasonicThDisplay(string key, string name, string hostname, int port)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = new GenericTcpIpClient(key + "-tcp", hostname, port, 5000);
|
||||
@@ -93,7 +94,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
/// <summary>
|
||||
/// Constructor for COM
|
||||
/// </summary>
|
||||
public PanasonicThefDisplay(string key, string name, ComPort port, ComPort.ComPortSpec spec)
|
||||
public PanasonicThDisplay(string key, string name, ComPort port, ComPort.ComPortSpec spec)
|
||||
: base(key, name)
|
||||
{
|
||||
Communication = new ComPortController(key + "-com", port, spec);
|
||||
@@ -132,7 +133,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
//};
|
||||
}
|
||||
|
||||
~PanasonicThefDisplay()
|
||||
~PanasonicThDisplay()
|
||||
{
|
||||
PortGather = null;
|
||||
}
|
||||
@@ -343,4 +344,23 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class PanasonicThDisplayFactory : EssentialsDeviceFactory<PanasonicThDisplay>
|
||||
{
|
||||
public PanasonicThDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "panasonicthef" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new PanasonicThDisplay(dc.Key, dc.Name, comm);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,12 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using Feedback = PepperDash.Essentials.Core.Feedback;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
/// <summary>
|
||||
@@ -637,4 +640,23 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class SamsungMDCFactory : EssentialsDeviceFactory<SamsungMDC>
|
||||
{
|
||||
public SamsungMDCFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "samsungmdc" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
if (comm != null)
|
||||
return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value<string>());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,12 @@ using Crestron.SimplSharpPro.Lighting;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
|
||||
{
|
||||
public class Din8sw8Controller : Device, ISwitchedOutputCollection
|
||||
public class Din8sw8Controller : EssentialsDevice, ISwitchedOutputCollection
|
||||
{
|
||||
// Need to figure out some sort of interface to make these switched outputs behave like processor relays so they can be used interchangably
|
||||
|
||||
@@ -85,4 +86,21 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
|
||||
}
|
||||
}
|
||||
|
||||
public class Din8sw8ControllerFactory : EssentialsDeviceFactory<Din8sw8Controller>
|
||||
{
|
||||
public Din8sw8ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "din8sw8" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Din8sw8Controller Device");
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
return new Din8sw8Controller(dc.Key, comm.CresnetIdInt);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
using LightingBase = PepperDash.Essentials.Core.Lighting.LightingBase;
|
||||
@@ -264,4 +265,23 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lutron
|
||||
// public string Username { get; set; }
|
||||
// public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class LutronQuantumAreaFactory : EssentialsDeviceFactory<LutronQuantumArea>
|
||||
{
|
||||
public LutronQuantumAreaFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "lutronqs" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new LutronQuantumArea Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Environment.Lutron.LutronQuantumPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
return new LutronQuantumArea(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
|
||||
@@ -110,4 +111,21 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy
|
||||
public IOPortConfig Close { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class RelayControlledShadeFactory : EssentialsDeviceFactory<RelayControlledShade>
|
||||
{
|
||||
public RelayControlledShadeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "relaycontrolledshade" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Environment.Somfy.RelayControlledShadeConfigProperties>(dc.Properties.ToString());
|
||||
|
||||
return new Environment.Somfy.RelayControlledShade(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,280 +60,56 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
var laptopFactory = new Core.Devices.LaptopFactory() as IDeviceFactory;
|
||||
laptopFactory.LoadTypeFactories();
|
||||
|
||||
var blueJeansPcFactory = new SoftCodec.BlueJeansPcFactory() as IDeviceFactory;
|
||||
blueJeansPcFactory.LoadTypeFactories();
|
||||
|
||||
var mockAcFactory = new AudioCodec.MockACFactory() as IDeviceFactory;
|
||||
mockAcFactory.LoadTypeFactories();
|
||||
|
||||
var mockVcFactory = new VideoCodec.MockVCFactory() as IDeviceFactory;
|
||||
mockVcFactory.LoadTypeFactories();
|
||||
|
||||
var ciscoCodecFactory = new VideoCodec.Cisco.CiscoSparkCodecFactory() as IDeviceFactory;
|
||||
ciscoCodecFactory.LoadTypeFactories();
|
||||
|
||||
var zoomRoomFactory = new VideoCodec.ZoomRoom.ZoomRoomFactory() as IDeviceFactory;
|
||||
zoomRoomFactory.LoadTypeFactories();
|
||||
|
||||
var digitalInputFactory = new GenericDigitalInputDeviceFactory() as IDeviceFactory;
|
||||
digitalInputFactory.LoadTypeFactories();
|
||||
|
||||
var relayFactory = new GenericRelayDeviceFactory() as IDeviceFactory;
|
||||
relayFactory.LoadTypeFactories();
|
||||
|
||||
var micPrivacyFactory = new Core.Privacy.MicrophonePrivacyControllerFactory() as IDeviceFactory;
|
||||
micPrivacyFactory.LoadTypeFactories();
|
||||
|
||||
var rokuFactory = new Roku2Factory() as IDeviceFactory;
|
||||
rokuFactory.LoadTypeFactories();
|
||||
|
||||
var setTopBoxFactory = new IRSetTopBoxBaseFactory() as IDeviceFactory;
|
||||
setTopBoxFactory.LoadTypeFactories();
|
||||
|
||||
var tvOneCorioFactory = new TVOneCorioFactory() as IDeviceFactory;
|
||||
tvOneCorioFactory.LoadTypeFactories();
|
||||
|
||||
var glsOccSensorBaseFactory = new GlsOccupancySensorBaseControllerFactory() as IDeviceFactory;
|
||||
glsOccSensorBaseFactory.LoadTypeFactories();
|
||||
|
||||
var glsOdtOccSensorFactory = new GlsOdtOccupancySensorControllerFactory() as IDeviceFactory;
|
||||
glsOdtOccSensorFactory.LoadTypeFactories();
|
||||
|
||||
var lutronQuantumFactory = new Environment.Lutron.LutronQuantumAreaFactory() as IDeviceFactory;
|
||||
lutronQuantumFactory.LoadTypeFactories();
|
||||
|
||||
var din8sw8ControllerFactory = new Environment.Lighting.Din8sw8ControllerFactory() as IDeviceFactory;
|
||||
din8sw8ControllerFactory.LoadTypeFactories();
|
||||
|
||||
var shadeControllerFactory = new Core.Shades.ShadeControllerFactory() as IDeviceFactory;
|
||||
shadeControllerFactory.LoadTypeFactories();
|
||||
|
||||
var relayControlledShadeFactory = new Environment.Somfy.RelayControlledShadeFactory() as IDeviceFactory;
|
||||
relayControlledShadeFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
var propAnon = new {};
|
||||
JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
// TODO: Continue from here
|
||||
if (typeName == "bluejeanspc")
|
||||
{
|
||||
return new SoftCodec.BlueJeansPc(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "mockvc")
|
||||
{
|
||||
return new VideoCodec.MockVC(dc);
|
||||
}
|
||||
|
||||
else if (typeName == "mockac")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<AudioCodec.MockAcPropertiesConfig>(properties.ToString());
|
||||
return new AudioCodec.MockAC(key, name, props);
|
||||
}
|
||||
|
||||
else if (typeName.StartsWith("ciscospark"))
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm);
|
||||
}
|
||||
|
||||
else if (typeName == "zoomroom")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
return new VideoCodec.ZoomRoom.ZoomRoom(dc, comm);
|
||||
}
|
||||
|
||||
else if (typeName == "digitalinput")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(properties.ToString());
|
||||
|
||||
IDigitalInputPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IDigitalInputPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
if (cs == null)
|
||||
{
|
||||
Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cs.SupportsVersiport)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfVersiPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
Versiport vp = cs.VersiPorts[props.PortNumber];
|
||||
|
||||
if (!vp.Registered)
|
||||
{
|
||||
var regSuccess = vp.Register();
|
||||
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Versiport");
|
||||
return new GenericVersiportDigitalInputDevice(key, vp, props);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}",
|
||||
props.PortNumber, props.PortDeviceKey, regSuccess);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cs.SupportsDigitalInput)
|
||||
{
|
||||
Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber);
|
||||
|
||||
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
|
||||
{
|
||||
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
|
||||
|
||||
if (!digitalInput.Registered)
|
||||
{
|
||||
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
{
|
||||
Debug.Console(1, "Successfully Created Digital Input Device on Digital Input");
|
||||
return new GenericDigitalInputDevice(key, digitalInput);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
|
||||
props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "relayoutput")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<IOPortConfig>(properties.ToString());
|
||||
|
||||
IRelayPorts portDevice;
|
||||
|
||||
if (props.PortDeviceKey == "processor")
|
||||
portDevice = Global.ControlSystem as IRelayPorts;
|
||||
else
|
||||
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
|
||||
|
||||
if (portDevice == null)
|
||||
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
|
||||
else
|
||||
{
|
||||
var cs = (portDevice as CrestronControlSystem);
|
||||
|
||||
if (cs != null)
|
||||
{
|
||||
// The relay is on a control system processor
|
||||
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The relay is on another device type
|
||||
|
||||
if (props.PortNumber > portDevice.NumberOfRelayPorts)
|
||||
{
|
||||
Debug.Console(0, "Port Device: {0} does not have enough relays");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Relay relay = portDevice.RelayPorts[props.PortNumber];
|
||||
|
||||
if (!relay.Registered)
|
||||
{
|
||||
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
|
||||
return new GenericRelayDevice(key, relay);
|
||||
else
|
||||
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GenericRelayDevice(key, relay);
|
||||
}
|
||||
|
||||
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "microphoneprivacycontroller")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Core.Privacy.MicrophonePrivacyControllerConfig>(properties.ToString());
|
||||
|
||||
return new Core.Privacy.MicrophonePrivacyController(key, props);
|
||||
}
|
||||
else if (typeName == "roku")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(key, name, irCont);
|
||||
}
|
||||
|
||||
else if (groupName == "settopbox") //(typeName == "irstbbase")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(key, name, irCont, config);
|
||||
|
||||
//stb.HasDvr = properties.Value<bool>("hasDvr");
|
||||
var listName = properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
}
|
||||
else if (typeName == "tvonecorio")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<TVOneCorioPropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new TVOneCorio(key, name, comm, props);
|
||||
}
|
||||
|
||||
|
||||
else if (typeName == "glsoirccn")
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
GlsOccupancySensorBase occSensor = null;
|
||||
|
||||
occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem);
|
||||
|
||||
if (occSensor != null)
|
||||
return new GlsOccupancySensorBaseController(key, name, occSensor);
|
||||
else
|
||||
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
|
||||
}
|
||||
|
||||
else if (typeName == "glsodtccn")
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem);
|
||||
|
||||
if (occSensor != null)
|
||||
return new GlsOdtOccupancySensorController(key, name, occSensor);
|
||||
else
|
||||
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
|
||||
}
|
||||
|
||||
else if (groupName == "lighting")
|
||||
{
|
||||
if (typeName == "lutronqs")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
|
||||
var props = JsonConvert.DeserializeObject<Environment.Lutron.LutronQuantumPropertiesConfig>(properties.ToString());
|
||||
|
||||
return new Environment.Lutron.LutronQuantumArea(key, name, comm, props);
|
||||
}
|
||||
else if (typeName == "din8sw8")
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
return new Environment.Lighting.Din8sw8Controller(key, comm.CresnetIdInt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (groupName == "environment")
|
||||
{
|
||||
if (typeName == "shadecontroller")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Core.Shades.ShadeControllerConfigProperties>(properties.ToString());
|
||||
|
||||
return new Core.Shades.ShadeController(key, name, props);
|
||||
}
|
||||
else if (typeName == "relaycontrolledshade")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<Environment.Somfy.RelayControlledShadeConfigProperties>(properties.ToString());
|
||||
|
||||
return new Environment.Somfy.RelayControlledShade(key, name, props);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,14 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
|
||||
public class TVOneCorio : Device
|
||||
public class TVOneCorio : EssentialsDevice
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
@@ -238,4 +239,22 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
// public QscDspControlPoint ControlPoint { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class TVOneCorioFactory : EssentialsDeviceFactory<TVOneCorio>
|
||||
{
|
||||
public TVOneCorioFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "tvonecorio" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new TVOneCorio Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<TVOneCorioPropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new TVOneCorio(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.GeneralIO;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
@@ -365,4 +366,38 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory<GlsOccupancySensorBaseController>
|
||||
{
|
||||
public GlsOccupancySensorBaseControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "glsoirccn" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
GlsOccupancySensorBase occSensor = null;
|
||||
|
||||
occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem);
|
||||
|
||||
if (occSensor != null)
|
||||
{
|
||||
return new GlsOccupancySensorBaseController(key, name, occSensor);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.GeneralIO;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
@@ -159,4 +160,37 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory<GlsOdtOccupancySensorController>
|
||||
{
|
||||
public GlsOdtOccupancySensorControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "glsodtccn" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem);
|
||||
|
||||
if (occSensor != null)
|
||||
{
|
||||
return new GlsOdtOccupancySensorController(key, name, occSensor);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
@@ -462,4 +463,27 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
trilist.SetBoolSigAction(joinMap.Record, stbTransport.Record);
|
||||
}
|
||||
}
|
||||
|
||||
public class IRSetTopBoxBaseFactory : EssentialsDeviceFactory<IRSetTopBoxBase>
|
||||
{
|
||||
public IRSetTopBoxBaseFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "settopbox" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new SetTopBox Device");
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(dc.Key, dc.Name, irCont, config);
|
||||
|
||||
var listName = dc.Properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -161,4 +161,19 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class BlueJeansPcFactory : EssentialsDeviceFactory<BlueJeansPc>
|
||||
{
|
||||
public BlueJeansPcFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockvc" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new BlueJeansPc Device");
|
||||
return new SoftCodec.BlueJeansPc(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,11 +8,12 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class Roku2 : Device, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs
|
||||
public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs
|
||||
{
|
||||
[Api]
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
@@ -145,4 +146,21 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class Roku2Factory : EssentialsDeviceFactory<Roku2>
|
||||
{
|
||||
public Roku2Factory()
|
||||
{
|
||||
TypeNames = new List<string>() { "roku" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Roku Device");
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new Roku2(dc.Key, dc.Name, irCont);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1843,4 +1843,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
}
|
||||
}
|
||||
|
||||
public class CiscoSparkCodecFactory : EssentialsDeviceFactory<CiscoSparkCodec>
|
||||
{
|
||||
public CiscoSparkCodecFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "ciscospark", "ciscowebex", "ciscowebexpro", "ciscoroomkit" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Cisco Codec Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -770,4 +770,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
_AutoAnswerEnabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class MockVCFactory : EssentialsDeviceFactory<MockVC>
|
||||
{
|
||||
public MockVCFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockvc" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new MockVC Device");
|
||||
return new VideoCodec.MockVC(dc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1676,4 +1676,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
InitialSyncComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class ZoomRoomFactory : EssentialsDeviceFactory<ZoomRoom>
|
||||
{
|
||||
public ZoomRoomFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "zoomroom" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new ZoomRoom Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
return new VideoCodec.ZoomRoom.ZoomRoom(dc, comm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user