mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 17:54:59 +00:00
Updating more device factories in Essentials and Devices.Common
This commit is contained in:
@@ -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