mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-12 20:14:49 +00:00
Compare commits
5 Commits
developmen
...
1.4.35-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3562bf22d | ||
|
|
2839e4676c | ||
|
|
8a77772e84 | ||
|
|
8ba6e5dd06 | ||
|
|
c3fb023967 |
@@ -21,7 +21,7 @@ using PepperDash.Essentials.AppServer.Messengers;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class MobileControlSystemController : Device
|
||||
public class MobileControlSystemController : EssentialsDevice
|
||||
{
|
||||
WebSocketClient WSClient;
|
||||
|
||||
@@ -865,4 +865,20 @@ namespace PepperDash.Essentials
|
||||
CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url\r");
|
||||
}
|
||||
}
|
||||
|
||||
public class MobileControlSystemControllerFactory : EssentialsDeviceFactory<MobileControlSystemController>
|
||||
{
|
||||
public MobileControlSystemControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "appserver" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new MobileControlSystemController Device");
|
||||
var props = JsonConvert.DeserializeObject<MobileControlConfig>(dc.Properties.ToString());
|
||||
return new MobileControlSystemController(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class MobileControlBridgeBase: Device
|
||||
public abstract class MobileControlBridgeBase: EssentialsDevice
|
||||
{
|
||||
public MobileControlSystemController Parent { get; private set; }
|
||||
|
||||
|
||||
@@ -825,4 +825,35 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
EISC.StringInput[JoinMap.ServerUrl.JoinNumber].StringValue = Parent.Config.ClientAppUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public class MobileControlSIMPLRoomBridgeFactory : EssentialsDeviceFactory<MobileControlSIMPLRoomBridge>
|
||||
{
|
||||
public MobileControlSIMPLRoomBridgeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mobilecontrolbridge-ddvc01", "mobilecontrolbridge-simpl" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new MobileControlSIMPLRoomBridge Device");
|
||||
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(dc.Key, dc.Name, comm.IpIdInt);
|
||||
bridge.AddPreActivationAction(() =>
|
||||
{
|
||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
||||
if (parent == null)
|
||||
{
|
||||
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
|
||||
}
|
||||
Debug.Console(0, bridge, "Linking to parent controller");
|
||||
bridge.AddParent(parent);
|
||||
parent.AddBridge(bridge);
|
||||
});
|
||||
|
||||
return bridge;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,30 +15,17 @@ using Crestron.SimplSharpPro.EthernetCommunication;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for loading all of the device types for this library
|
||||
/// </summary>
|
||||
public class BridgeFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
public BridgeFactory()
|
||||
{
|
||||
// ? why is this static JTA 2018-06-13?
|
||||
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
var propAnon = new { };
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
//Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
|
||||
|
||||
if (typeName == "eiscapi")
|
||||
{
|
||||
return new EiscApi(dc);
|
||||
}
|
||||
|
||||
return null;
|
||||
var bridgeFactory = new BridgeFactory() as IDeviceFactory;
|
||||
bridgeFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,10 +80,29 @@ 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();
|
||||
new UiDeviceFactory();
|
||||
|
||||
new DeviceFactory();
|
||||
new BridgeFactory();
|
||||
|
||||
new PepperDash.Essentials.Devices.Common.DeviceFactory();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -290,9 +309,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"));
|
||||
@@ -356,33 +372,15 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
// Try local factories first
|
||||
var newDev = DeviceFactory.GetDevice(devConf);
|
||||
IKeyed newDev = null;
|
||||
|
||||
if (newDev == null)
|
||||
newDev = BridgeFactory.GetDevice(devConf);
|
||||
|
||||
// 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);
|
||||
|
||||
//if (newDev == null) // might want to consider the ability to override an essentials "type"
|
||||
//{
|
||||
// // iterate plugin factories
|
||||
// foreach (var f in FactoryObjects)
|
||||
// {
|
||||
// var cresFactory = f as IGetCrestronDevice;
|
||||
// if (cresFactory != null)
|
||||
// {
|
||||
// newDev = cresFactory.GetDevice(devConf, this);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
|
||||
if (newDev != null)
|
||||
DeviceManager.AddDevice(newDev);
|
||||
|
||||
@@ -6,11 +6,12 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class Amplifier : Device, IRoutingSinkNoSwitching
|
||||
public class Amplifier : EssentialsDevice, IRoutingSinkNoSwitching
|
||||
{
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
@@ -54,4 +55,18 @@ namespace PepperDash.Essentials
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class AmplifierFactory : EssentialsDeviceFactory<Amplifier>
|
||||
{
|
||||
public AmplifierFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "amplifier" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Amplifier Device");
|
||||
return new Amplifier(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,88 +10,34 @@ using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Room.MobileControl;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class DeviceFactory
|
||||
/// <summary>
|
||||
/// Responsible for loading all of the device types for this library
|
||||
/// </summary>
|
||||
public class DeviceFactory
|
||||
{
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
var name = dc.Name;
|
||||
var type = dc.Type;
|
||||
var properties = dc.Properties;
|
||||
public DeviceFactory()
|
||||
{
|
||||
var ampFactory = new AmplifierFactory() as IDeviceFactory;
|
||||
ampFactory.LoadTypeFactories();
|
||||
|
||||
var typeName = dc.Type.ToLower();
|
||||
var mockDisplayFactory = new MockDisplayFactory() as IDeviceFactory;
|
||||
mockDisplayFactory.LoadTypeFactories();
|
||||
|
||||
if (typeName == "amplifier")
|
||||
{
|
||||
return new Amplifier(dc.Key, dc.Name);
|
||||
}
|
||||
else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw"))
|
||||
{
|
||||
return UiDeviceFactory.GetUiDevice(dc);
|
||||
}
|
||||
var consoleCommMockFactroy = new ConsoleCommMockDeviceFactory() as IDeviceFactory;
|
||||
consoleCommMockFactroy.LoadTypeFactories();
|
||||
|
||||
else if (typeName == "mockdisplay")
|
||||
{
|
||||
return new MockDisplay(key, name);
|
||||
}
|
||||
var mcSystemControllerFactory = new MobileControlSystemControllerFactory() as IDeviceFactory;
|
||||
mcSystemControllerFactory.LoadTypeFactories();
|
||||
|
||||
else if (typeName == "generic")
|
||||
{
|
||||
return new Device(key, name);
|
||||
}
|
||||
var mcSIMPLRoomBridgeFactory = new MobileControlSIMPLRoomBridgeFactory() as IDeviceFactory;
|
||||
mcSIMPLRoomBridgeFactory.LoadTypeFactories();
|
||||
|
||||
//// MOVE into something else???
|
||||
//else if (typeName == "basicirdisplay")
|
||||
//{
|
||||
// var ir = IRPortHelper.GetIrPort(properties);
|
||||
// if (ir != null)
|
||||
// return new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||
//}
|
||||
|
||||
else if (typeName == "commmock")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new ConsoleCommMockDevice(key, name, props, comm);
|
||||
}
|
||||
|
||||
else if (typeName == "appserver")
|
||||
{
|
||||
var props = JsonConvert.DeserializeObject<MobileControlConfig>(properties.ToString());
|
||||
return new MobileControlSystemController(key, name, props);
|
||||
}
|
||||
|
||||
else if (typeName == "mobilecontrolbridge-ddvc01")
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(key, name, comm.IpIdInt);
|
||||
bridge.AddPreActivationAction(() =>
|
||||
{
|
||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
||||
if (parent == null)
|
||||
{
|
||||
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
|
||||
}
|
||||
Debug.Console(0, bridge, "Linking to parent controller");
|
||||
bridge.AddParent(parent);
|
||||
parent.AddBridge(bridge);
|
||||
});
|
||||
|
||||
return bridge;
|
||||
}
|
||||
|
||||
else if (typeName == "roomonwhenoccupancydetectedfeature")
|
||||
{
|
||||
return new RoomOnToDefaultSourceWhenOccupied(dc);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
var roomOnToDefSourceWhenOcc = new RoomOnToDefaultSourceWhenOccupiedFactory() as IDeviceFactory;
|
||||
roomOnToDefSourceWhenOcc.LoadTypeFactories();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,173 +18,18 @@ using PepperDash.Essentials.DM.Endpoints.DGEs;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for loading all of the UI device types for this library
|
||||
/// </summary>
|
||||
public class UiDeviceFactory
|
||||
{
|
||||
public static IKeyed GetUiDevice(DeviceConfig config)
|
||||
public UiDeviceFactory()
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(config);
|
||||
var dgeControllerFactory = new DgeControllerFactory() as IDeviceFactory;
|
||||
dgeControllerFactory.LoadTypeFactories();
|
||||
|
||||
var typeName = config.Type.ToLower();
|
||||
|
||||
EssentialsTouchpanelController panelController = null;
|
||||
|
||||
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
|
||||
|
||||
if (typeName.Contains("dge"))
|
||||
{
|
||||
Dge100 dgeDevice = null;
|
||||
if (typeName == "dge100")
|
||||
dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
|
||||
else if (typeName == "dmdge200c")
|
||||
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
|
||||
|
||||
if (dgeDevice == null)
|
||||
{
|
||||
Debug.Console(1, "Unable to create DGE device");
|
||||
return null;
|
||||
}
|
||||
|
||||
var dgeController = new DgeController(config.Key + "-comPorts", config.Name, dgeDevice, config, props);
|
||||
|
||||
DeviceManager.AddDevice(dgeController);
|
||||
|
||||
panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine,
|
||||
props.ProjectName, props.SgdFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
|
||||
}
|
||||
|
||||
panelController.AddPostActivationAction(() =>
|
||||
{
|
||||
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
|
||||
// Then the sub drivers
|
||||
|
||||
// spin up different room drivers depending on room type
|
||||
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
{
|
||||
|
||||
// Header Driver
|
||||
Debug.Console(0, panelController, "Adding header driver");
|
||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||
|
||||
// AV Driver
|
||||
Debug.Console(0, panelController, "Adding huddle space AV driver");
|
||||
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding environment driver");
|
||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||
|
||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||
}
|
||||
|
||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||
|
||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||
|
||||
if (panelController.Panel is TswFt5ButtonSystem)
|
||||
{
|
||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||
// Wire up hard keys
|
||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||
if(mainDriver.EnvironmentDriver != null)
|
||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||
mainDriver.EnvironmentDriver.Toggle();
|
||||
}
|
||||
});
|
||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
}
|
||||
}
|
||||
//else if (room is EssentialsPresentationRoom)
|
||||
//{
|
||||
// Debug.Console(0, panelController, "Adding presentation room driver");
|
||||
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
|
||||
// avDriver.CurrentRoom = room as EssentialsPresentationRoom;
|
||||
// avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
// mainDriver.AvDriver = avDriver ;
|
||||
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||
// panelController.LoadAndShowDriver(mainDriver);
|
||||
|
||||
// if (panelController.Panel is TswFt5ButtonSystem)
|
||||
// {
|
||||
// var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||
// // Wire up hard keys
|
||||
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
||||
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
// }
|
||||
//}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
|
||||
|
||||
// Header Driver
|
||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||
|
||||
// AV Driver
|
||||
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
|
||||
|
||||
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
|
||||
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
||||
avDriver.SetVideoCodecDriver(codecDriver);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding environment driver");
|
||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||
|
||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||
}
|
||||
|
||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||
|
||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||
|
||||
if (panelController.Panel is TswFt5ButtonSystem)
|
||||
{
|
||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||
// Wire up hard keys
|
||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
|
||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||
if (mainDriver.EnvironmentDriver != null)
|
||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||
mainDriver.EnvironmentDriver.Toggle();
|
||||
}
|
||||
});
|
||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
|
||||
}
|
||||
});
|
||||
|
||||
return panelController;
|
||||
var essentialsTouchpanelControllerFactory = new EssentialsTouchpanelControllerFactory() as IDeviceFactory;
|
||||
essentialsTouchpanelControllerFactory.LoadTypeFactories();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsTouchpanelController : Device, IHasBasicTriListWithSmartObject
|
||||
public class EssentialsTouchpanelController : EssentialsDevice, IHasBasicTriListWithSmartObject
|
||||
{
|
||||
public BasicTriListWithSmartObject Panel { get; private set; }
|
||||
|
||||
@@ -197,4 +198,132 @@ namespace PepperDash.Essentials
|
||||
(uo as Action<bool>)(args.Button.State == eButtonState.Pressed);
|
||||
}
|
||||
}
|
||||
|
||||
public class EssentialsTouchpanelControllerFactory : EssentialsDeviceFactory<EssentialsTouchpanelController>
|
||||
{
|
||||
public EssentialsTouchpanelControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "tsw550", "tsw750", "tsw1050", "tsw560", "tsw760", "tsw1060", "xpanel" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
|
||||
var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt);
|
||||
|
||||
panelController.AddPostActivationAction(() =>
|
||||
{
|
||||
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
|
||||
// Then the sub drivers
|
||||
|
||||
// spin up different room drivers depending on room type
|
||||
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey);
|
||||
if (room is EssentialsHuddleSpaceRoom)
|
||||
{
|
||||
|
||||
// Header Driver
|
||||
Debug.Console(0, panelController, "Adding header driver");
|
||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||
|
||||
// AV Driver
|
||||
Debug.Console(0, panelController, "Adding huddle space AV driver");
|
||||
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding environment driver");
|
||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||
|
||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||
}
|
||||
|
||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||
|
||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||
|
||||
if (panelController.Panel is TswFt5ButtonSystem)
|
||||
{
|
||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||
// Wire up hard keys
|
||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
|
||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||
if (mainDriver.EnvironmentDriver != null)
|
||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||
mainDriver.EnvironmentDriver.Toggle();
|
||||
}
|
||||
});
|
||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
}
|
||||
}
|
||||
else if (room is EssentialsHuddleVtc1Room)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
|
||||
|
||||
// Header Driver
|
||||
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
|
||||
|
||||
// AV Driver
|
||||
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
|
||||
|
||||
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
|
||||
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
|
||||
avDriver.SetVideoCodecDriver(codecDriver);
|
||||
avDriver.DefaultRoomKey = props.DefaultRoomKey;
|
||||
mainDriver.AvDriver = avDriver;
|
||||
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
|
||||
|
||||
// Environment Driver
|
||||
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
|
||||
{
|
||||
Debug.Console(0, panelController, "Adding environment driver");
|
||||
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
|
||||
|
||||
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
|
||||
}
|
||||
|
||||
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
|
||||
|
||||
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
|
||||
|
||||
if (panelController.Panel is TswFt5ButtonSystem)
|
||||
{
|
||||
var tsw = panelController.Panel as TswFt5ButtonSystem;
|
||||
// Wire up hard keys
|
||||
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
|
||||
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
|
||||
if (mainDriver.EnvironmentDriver != null)
|
||||
tsw.Lights.UserObject = new Action<bool>(b =>
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
|
||||
mainDriver.EnvironmentDriver.Toggle();
|
||||
}
|
||||
});
|
||||
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
|
||||
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
|
||||
}
|
||||
});
|
||||
|
||||
return panelController;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,117 +123,6 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
var bridge = device as IBridgeAdvanced;
|
||||
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
}
|
||||
|
||||
//if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
|
||||
//{
|
||||
// (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is IBridgeAdvanced)
|
||||
//{
|
||||
// Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key);
|
||||
// (device as IBridgeAdvanced).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
//}
|
||||
//else if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
|
||||
//{
|
||||
// (device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is GenericComm)
|
||||
//{
|
||||
// (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is CameraBase)
|
||||
//{
|
||||
// (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is PepperDash.Essentials.Core.DisplayBase)
|
||||
//{
|
||||
// (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmChassisController)
|
||||
//{
|
||||
// (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmBladeChassisController)
|
||||
//{
|
||||
// (device as DmBladeChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmpsRoutingController)
|
||||
//{
|
||||
// (device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmpsAudioOutputController)
|
||||
//{
|
||||
// (device as DmpsAudioOutputController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmTxControllerBase)
|
||||
//{
|
||||
// (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DmRmcControllerBase)
|
||||
//{
|
||||
// (device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is GenericRelayDevice)
|
||||
//{
|
||||
// (device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is IRSetTopBoxBase)
|
||||
//{
|
||||
// (device as IRSetTopBoxBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is IDigitalInput)
|
||||
//{
|
||||
// (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is AppleTV)
|
||||
//{
|
||||
// (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is HdMdxxxCEController)
|
||||
//{
|
||||
// (device as HdMdxxxCEController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is LightingBase)
|
||||
//{
|
||||
// (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is DigitalLogger)
|
||||
//{
|
||||
// (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController)
|
||||
//{
|
||||
// (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is StatusSignController)
|
||||
//{
|
||||
// (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
//else if (device is C2nRthsController)
|
||||
//{
|
||||
// (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||
// continue;
|
||||
//}
|
||||
}
|
||||
|
||||
Debug.Console(1, this, "Devices Linked.");
|
||||
@@ -403,5 +292,19 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
|
||||
}
|
||||
|
||||
public class EiscApiFactory : EssentialsDeviceFactory<EiscApi>
|
||||
{
|
||||
public EiscApiFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "eiscapi" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new EiscApi Device");
|
||||
|
||||
return new EiscApi(dc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,12 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class ConsoleCommMockDevice : Device, ICommunicationMonitor
|
||||
public class ConsoleCommMockDevice : EssentialsDevice, ICommunicationMonitor
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
@@ -71,4 +73,21 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
||||
{
|
||||
public ConsoleCommMockDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "commmock" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Comm Mock Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
@@ -63,4 +64,19 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class InRoomPcFactory : EssentialsDeviceFactory<InRoomPc>
|
||||
{
|
||||
public InRoomPcFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "inroompc" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new InRoomPc Device");
|
||||
return new InRoomPc(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Core;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
|
||||
{
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||
public string IconName { get; set; }
|
||||
@@ -63,4 +64,18 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class LaptopFactory : EssentialsDeviceFactory<Laptop>
|
||||
{
|
||||
public LaptopFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "laptop" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Laptop Device");
|
||||
return new Core.Devices.Laptop(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ 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;
|
||||
|
||||
@@ -208,4 +209,27 @@ namespace PepperDash.Essentials.Core
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -182,4 +182,19 @@ namespace PepperDash.Essentials.Core
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
|
||||
{
|
||||
public MockDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockdisplay" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Mock Display Device");
|
||||
return new MockDisplay(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -522,4 +522,19 @@ namespace PepperDash.Essentials.Core
|
||||
[JsonProperty("enableSaturday")]
|
||||
public bool EnableSaturday { get; set; }
|
||||
}
|
||||
|
||||
public class RoomOnToDefaultSourceWhenOccupiedFactory : EssentialsDeviceFactory<RoomOnToDefaultSourceWhenOccupied>
|
||||
{
|
||||
public RoomOnToDefaultSourceWhenOccupiedFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "roomonwhenoccupancydetectedfeature" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new RoomOnToDefaultSourceWhenOccupied Device");
|
||||
return new RoomOnToDefaultSourceWhenOccupied(dc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -260,4 +260,29 @@ namespace PepperDash.Essentials.DM.AirMedia
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AirMediaControllerFactory : EssentialsDeviceFactory<AirMediaController>
|
||||
{
|
||||
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<DmChassisController>
|
||||
{
|
||||
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<HdMdxxxCEController>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,4 +63,37 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class DgeControllerFactory : EssentialsDeviceFactory<DgeController>
|
||||
{
|
||||
public DgeControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "dge100", "dmdge200c" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
var typeName = dc.Type.ToLower();
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString());
|
||||
|
||||
Debug.Console(1, "Factory Attempting to create new DgeControllerm Device");
|
||||
|
||||
Dge100 dgeDevice = null;
|
||||
if (typeName == "dge100")
|
||||
dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
|
||||
else if (typeName == "dmdge200c")
|
||||
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
|
||||
|
||||
if (dgeDevice == null)
|
||||
{
|
||||
Debug.Console(1, "Unable to create DGE device");
|
||||
return null;
|
||||
}
|
||||
|
||||
var dgeController = new DgeController(dc.Key + "-comPorts", dc.Name, dgeDevice, dc, props);
|
||||
|
||||
return dgeController;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<DmRmcControllerBase>
|
||||
{
|
||||
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<DmTxControllerBase>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
@@ -13,7 +15,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
/// <summary>
|
||||
/// Represents and audio endpoint
|
||||
/// </summary>
|
||||
public class GenericAudioOut : Device, IRoutingSinkNoSwitching
|
||||
public class GenericAudioOut : EssentialsDevice, IRoutingSinkNoSwitching
|
||||
{
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
|
||||
@@ -98,4 +100,20 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
}
|
||||
|
||||
public class GenericAudioOutWithVolumeFactory : EssentialsDeviceFactory<GenericAudioOutWithVolume>
|
||||
{
|
||||
public GenericAudioOutWithVolumeFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericaudiooutwithvolume" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new GenericAudioOutWithVolumeFactory Device");
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(dc.Key, dc.Name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,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.Devices.Common.Codec;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
@@ -244,4 +245,22 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CameraViscaFactory : EssentialsDeviceFactory<CameraVisca>
|
||||
{
|
||||
public CameraViscaFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "cameravisca" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CameraVisca Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<Cameras.CameraPropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new Cameras.CameraVisca(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using Crestron.SimplSharpPro.Gateways;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
@@ -112,4 +114,20 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
Ethernet, EthernetShared, Cresnet
|
||||
}
|
||||
|
||||
public class CenRfgwControllerFactory : EssentialsDeviceFactory<CenRfgwController>
|
||||
{
|
||||
public CenRfgwControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "cenrfgwex", "cenerfgwpoe" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device");
|
||||
return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name,
|
||||
dc.Properties.Value<string>("id"), dc.Properties.Value<string>("gatewayType"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
@@ -373,4 +374,22 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
||||
public TesiraForteControlPoint ControlPoint { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class BiampTesiraForteDspFactory : EssentialsDeviceFactory<BiampTesiraForteDsp>
|
||||
{
|
||||
public BiampTesiraForteDspFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "biamptesira" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new BiampTesira Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new BiampTesiraForteDsp(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||
{
|
||||
public abstract class DspBase : Device
|
||||
public abstract class DspBase : EssentialsDevice
|
||||
{
|
||||
public Dictionary<string, DspControlPoint> LevelControlPoints { get; private set; }
|
||||
|
||||
|
||||
@@ -5,13 +5,18 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
public class IRBlurayBase : EssentialsDevice, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
{
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
|
||||
@@ -311,4 +316,30 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class IRBlurayBaseFactory : EssentialsDeviceFactory<IRBlurayBase>
|
||||
{
|
||||
public IRBlurayBaseFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "discplayer", "bluray" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new IRBlurayPlayer Device");
|
||||
|
||||
if (dc.Properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(dc.Key, dc.Name, irCont);
|
||||
}
|
||||
else if (dc.Properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", dc.Key);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,12 +18,51 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||
using PepperDash.Essentials.Devices.Common.Environment;
|
||||
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common
|
||||
{
|
||||
public class DeviceFactory
|
||||
{
|
||||
public DeviceFactory()
|
||||
{
|
||||
var appleTVFactory = new AppleTVFactory() as IDeviceFactory;
|
||||
appleTVFactory.LoadTypeFactories();
|
||||
|
||||
var analogWayLCFactory = new AnalogWayLiveCoreFactory() as IDeviceFactory;
|
||||
analogWayLCFactory.LoadTypeFactories();
|
||||
|
||||
var basicIrDisplayFactory = new BasicIrDisplayFactory() as IDeviceFactory;
|
||||
basicIrDisplayFactory.LoadTypeFactories();
|
||||
|
||||
var biampTesiraFactory = new BiampTesiraForteDspFactory() as IDeviceFactory;
|
||||
biampTesiraFactory.LoadTypeFactories();
|
||||
|
||||
var cameraViscaFactory = new Cameras.CameraViscaFactory() as IDeviceFactory;
|
||||
cameraViscaFactory.LoadTypeFactories();
|
||||
|
||||
var cenRfGwFactory = new CenRfgwControllerFactory() as IDeviceFactory;
|
||||
cenRfGwFactory.LoadTypeFactories();
|
||||
|
||||
var irBlurayFactory = new IRBlurayBaseFactory() as IDeviceFactory;
|
||||
irBlurayFactory.LoadTypeFactories();
|
||||
|
||||
var digitalLoggerFactory = new DigitalLoggerFactory() as IDeviceFactory;
|
||||
digitalLoggerFactory.LoadTypeFactories();
|
||||
|
||||
var genericAudioOutFactory = new GenericAudioOutWithVolumeFactory() as IDeviceFactory;
|
||||
genericAudioOutFactory.LoadTypeFactories();
|
||||
|
||||
var genericSourceFactory = new GenericSourceFactory() as IDeviceFactory;
|
||||
genericSourceFactory.LoadTypeFactories();
|
||||
|
||||
var inRoomPcFactory = new Core.Devices.InRoomPcFactory() as IDeviceFactory;
|
||||
inRoomPcFactory.LoadTypeFactories();
|
||||
|
||||
var laptopFactory = new Core.Devices.LaptopFactory() as IDeviceFactory;
|
||||
laptopFactory.LoadTypeFactories();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static IKeyed GetDevice(DeviceConfig dc)
|
||||
{
|
||||
var key = dc.Key;
|
||||
@@ -36,100 +75,8 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
var typeName = dc.Type.ToLower();
|
||||
var groupName = dc.Group.ToLower();
|
||||
|
||||
if (typeName == "appletv")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new AppleTV(key, name, irCont);
|
||||
}
|
||||
else if (typeName == "analogwaylivecore")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<AnalogWayLiveCorePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new AnalogWayLiveCore(key, name, comm, props);
|
||||
}
|
||||
else if (typeName == "basicirdisplay")
|
||||
{
|
||||
var ir = IRPortHelper.GetIrPort(properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(key, name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
else if (typeName == "biamptesira")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<BiampTesiraFortePropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new BiampTesiraForteDsp(key, name, comm, props);
|
||||
}
|
||||
|
||||
|
||||
else if (typeName == "cameravisca")
|
||||
{
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<Cameras.CameraPropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new Cameras.CameraVisca(key, name, comm, props);
|
||||
}
|
||||
|
||||
else if (typeName == "cenrfgwex")
|
||||
{
|
||||
return CenRfgwController.GetNewExGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (typeName == "cenerfgwpoe")
|
||||
{
|
||||
return CenRfgwController.GetNewErGatewayController(key, name,
|
||||
properties.Value<string>("id"), properties.Value<string>("gatewayType"));
|
||||
}
|
||||
|
||||
else if (groupName == "discplayer") // (typeName == "irbluray")
|
||||
{
|
||||
if (properties["control"]["method"].Value<string>() == "ir")
|
||||
{
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new IRBlurayBase(key, name, irCont);
|
||||
}
|
||||
else if (properties["control"]["method"].Value<string>() == "com")
|
||||
{
|
||||
Debug.Console(0, "[{0}] COM Device type not implemented YET!", key);
|
||||
}
|
||||
}
|
||||
else if (typeName == "digitallogger")
|
||||
{
|
||||
// var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = JsonConvert.DeserializeObject<DigitalLoggerPropertiesConfig>(
|
||||
properties.ToString());
|
||||
return new DigitalLogger(key, name, props);
|
||||
}
|
||||
else if (typeName == "genericaudiooutwithvolume")
|
||||
{
|
||||
var zone = dc.Properties.Value<uint>("zone");
|
||||
return new GenericAudioOutWithVolume(key, name,
|
||||
dc.Properties.Value<string>("volumeDeviceKey"), zone);
|
||||
}
|
||||
|
||||
else if (groupName == "genericsource")
|
||||
{
|
||||
return new GenericSource(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "inroompc")
|
||||
{
|
||||
return new Core.Devices.InRoomPc(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "laptop")
|
||||
{
|
||||
return new Core.Devices.Laptop(key, name);
|
||||
}
|
||||
|
||||
else if (typeName == "bluejeanspc")
|
||||
// TODO: Continue from here
|
||||
if (typeName == "bluejeanspc")
|
||||
{
|
||||
return new SoftCodec.BlueJeansPc(key, 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 GenericSource : Device, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
public class GenericSource : EssentialsDevice, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||
{
|
||||
|
||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeNoControls; } }
|
||||
@@ -39,4 +40,19 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class GenericSourceFactory : EssentialsDeviceFactory<GenericSource>
|
||||
{
|
||||
public GenericSourceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericsource" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Source Device");
|
||||
return new GenericSource(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 AnalogWayLiveCore : Device
|
||||
public class AnalogWayLiveCore : 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 AnalogWayLiveCoreFactory : EssentialsDeviceFactory<AnalogWayLiveCore>
|
||||
{
|
||||
public AnalogWayLiveCoreFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "analogwaylivecore" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new AnalogWayLiveCore Device");
|
||||
var comm = CommFactory.CreateCommForDevice(dc);
|
||||
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<AnalogWayLiveCorePropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new AnalogWayLiveCore(dc.Key, dc.Name, comm, props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using Crestron.SimplSharp.Net.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
|
||||
|
||||
@@ -338,4 +339,20 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DigitalLoggerFactory : EssentialsDeviceFactory<DigitalLogger>
|
||||
{
|
||||
public DigitalLoggerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "digitallogger" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new DigitalLogger Device");
|
||||
var props = JsonConvert.DeserializeObject<DigitalLoggerPropertiesConfig>(
|
||||
dc.Properties.ToString());
|
||||
return new DigitalLogger(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using PepperDash_Essentials_Core.Devices;
|
||||
@@ -167,4 +168,20 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
trilist.SetBoolSigAction(joinMap.PlayPause, Play);
|
||||
}
|
||||
}
|
||||
|
||||
public class AppleTVFactory : EssentialsDeviceFactory<AppleTV>
|
||||
{
|
||||
public AppleTVFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "appletv" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new AppleTV Device");
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
return new AppleTV(dc.Key, dc.Name, irCont);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user