diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeApi.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeApi.cs
new file mode 100644
index 00000000..a9ef37b1
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/BridgeApi.cs
@@ -0,0 +1,14 @@
+namespace PepperDash.Essentials.Core.Bridges
+{
+ ///
+ /// Base class for bridge API variants
+ ///
+ public abstract class BridgeApi : EssentialsDevice
+ {
+ protected BridgeApi(string key) :
+ base(key)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
index 19c0f501..0007d556 100644
--- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
+++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs
@@ -1,83 +1,10 @@
extern alias Full;
-
-using System;
-using System.Collections.Generic;
using Crestron.SimplSharp;
-using Crestron.SimplSharp.Reflection;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.EthernetCommunication;
-
-using Full.Newtonsoft.Json;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
//using PepperDash.Essentials.Devices.Common.Cameras;
namespace PepperDash.Essentials.Core.Bridges
{
- ///
- /// Helper methods for bridges
- ///
- public static class BridgeHelper
- {
- public static void PrintJoinMap(string command)
- {
- var targets = command.Split(' ');
-
- var bridgeKey = targets[0].Trim();
-
- var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
-
- if (bridge == null)
- {
- Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
- return;
- }
-
- if (targets.Length > 1)
- {
- var deviceKey = targets[1].Trim();
-
- if (string.IsNullOrEmpty(deviceKey)) return;
- bridge.PrintJoinMapForDevice(deviceKey);
- }
- else
- {
- bridge.PrintJoinMaps();
- }
- }
- public static void JoinmapMarkdown(string command)
- {
- var targets = command.Split(' ');
-
- var bridgeKey = targets[0].Trim();
-
- var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
-
- if (bridge == null)
- {
- Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
- return;
- }
-
- if (targets.Length > 1)
- {
- var deviceKey = targets[1].Trim();
-
- if (string.IsNullOrEmpty(deviceKey)) return;
- bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
- }
- else
- {
- bridge.MarkdownForBridge(bridgeKey);
-
- }
- }
- }
-
-
///
/// Base class for all bridge class variants
///
@@ -91,414 +18,4 @@ namespace PepperDash.Essentials.Core.Bridges
}
}
-
- ///
- /// Base class for bridge API variants
- ///
- public abstract class BridgeApi : EssentialsDevice
- {
- protected BridgeApi(string key) :
- base(key)
- {
-
- }
- }
-
- ///
- /// Bridge API using EISC
- ///
- public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
- {
- public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
-
- public Dictionary JoinMaps { get; private set; }
-
- public BasicTriList Eisc { get; private set; }
-
- public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
- base(dc.Key)
- {
- JoinMaps = new Dictionary();
-
- PropertiesConfig = dc.Properties.ToObject();
- //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- Eisc = eisc;
-
- Eisc.SigChange += Eisc_SigChange;
-
- CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
-
- AddPostActivationAction(LinkDevices);
- AddPostActivationAction(LinkRooms);
- AddPostActivationAction(RegisterEisc);
- }
-
- public override bool CustomActivate()
- {
- CommunicationMonitor.Start();
- return base.CustomActivate();
- }
-
- public override bool Deactivate()
- {
- CommunicationMonitor.Stop();
- return base.Deactivate();
- }
-
- private void LinkDevices()
- {
- Debug.Console(1, this, "Linking Devices...");
-
- if (PropertiesConfig.Devices == null)
- {
- Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
- return;
- }
-
- foreach (var d in PropertiesConfig.Devices)
- {
- var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
-
- if (device == null)
- {
- continue;
- }
-
- Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
-
- if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
- {
- Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
- "{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
- device.Key);
- continue;
- }
-
- var bridge = device as IBridgeAdvanced;
- if (bridge != null)
- {
- bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
- }
- }
- }
-
- private void RegisterEisc()
- {
- if (Eisc.Registered)
- {
- return;
- }
-
- var registerResult = Eisc.Register();
-
- if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
- {
- Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
- return;
- }
-
- Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
- }
-
- public void LinkRooms()
- {
- Debug.Console(1, this, "Linking Rooms...");
-
- if (PropertiesConfig.Rooms == null)
- {
- Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
- return;
- }
-
- foreach (var room in PropertiesConfig.Rooms)
- {
- var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
-
- if (rm == null)
- {
- Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
- "Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
- continue;
- }
-
- rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
- }
- }
-
- ///
- /// Adds a join map
- ///
- ///
- ///
- public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
- {
- if (!JoinMaps.ContainsKey(deviceKey))
- {
- JoinMaps.Add(deviceKey, joinMap);
- }
- else
- {
- Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
- }
- }
-
- ///
- /// Prints all the join maps on this bridge
- ///
- public virtual void PrintJoinMaps()
- {
- Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
-
- foreach (var joinMap in JoinMaps)
- {
- Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
- joinMap.Value.PrintJoinMapInfo();
- }
- }
- ///
- /// Generates markdown for all join maps on this bridge
- ///
- public virtual void MarkdownForBridge(string bridgeKey)
- {
- Debug.Console(0, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
-
- foreach (var joinMap in JoinMaps)
- {
- Debug.Console(0, "Generating markdown for device '{0}':", joinMap.Key);
- joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
- }
- }
-
- ///
- /// Prints the join map for a device by key
- ///
- ///
- public void PrintJoinMapForDevice(string deviceKey)
- {
- var joinMap = JoinMaps[deviceKey];
-
- if (joinMap == null)
- {
- Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
- return;
- }
-
- Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
- joinMap.PrintJoinMapInfo();
- }
- ///
- /// Prints the join map for a device by key
- ///
- ///
- public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
- {
- var joinMap = JoinMaps[deviceKey];
-
- if (joinMap == null)
- {
- Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
- return;
- }
-
- Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
- joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
- }
-
- ///
- /// Used for debugging to trigger an action based on a join number and type
- ///
- ///
- ///
- ///
- public void ExecuteJoinAction(uint join, string type, object state)
- {
- try
- {
- switch (type.ToLower())
- {
- case "digital":
- {
- var uo = Eisc.BooleanOutput[join].UserObject as Action;
- if (uo != null)
- {
- Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
- uo(Convert.ToBoolean(state));
- }
- else
- Debug.Console(2, this, "User Action is null. Nothing to Execute");
- break;
- }
- case "analog":
- {
- var uo = Eisc.BooleanOutput[join].UserObject as Action;
- if (uo != null)
- {
- Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
- uo(Convert.ToUInt16(state));
- }
- else
- Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
- }
- case "serial":
- {
- var uo = Eisc.BooleanOutput[join].UserObject as Action;
- if (uo != null)
- {
- Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
- uo(Convert.ToString(state));
- }
- else
- Debug.Console(2, this, "User Action is null. Nothing to Execute");
- break;
- }
- default:
- {
- Debug.Console(2, "Unknown join type. Use digital/serial/analog");
- break;
- }
- }
- }
- catch (Exception e)
- {
- Debug.Console(1, this, "Error: {0}", e);
- }
-
- }
-
- ///
- /// Handles incoming sig changes
- ///
- ///
- ///
- protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
- {
- try
- {
- if (Debug.Level >= 1)
- Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
- var uo = args.Sig.UserObject;
-
- if (uo == null) return;
-
- Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
- if (uo is Action)
- (uo as Action)(args.Sig.BoolValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.UShortValue);
- else if (uo is Action)
- (uo as Action)(args.Sig.StringValue);
- }
- catch (Exception e)
- {
- Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
- }
- }
-
- #region Implementation of ICommunicationMonitor
-
- public StatusMonitorBase CommunicationMonitor { get; private set; }
-
- #endregion
- }
-
- public class EiscApiPropertiesConfig
- {
- [JsonProperty("control")]
- public EssentialsControlPropertiesConfig Control { get; set; }
-
- [JsonProperty("devices")]
- public List Devices { get; set; }
-
- [JsonProperty("rooms")]
- public List Rooms { get; set; }
-
-
- public class ApiDevicePropertiesConfig
- {
- [JsonProperty("deviceKey")]
- public string DeviceKey { get; set; }
-
- [JsonProperty("joinStart")]
- public uint JoinStart { get; set; }
-
- [JsonProperty("joinMapKey")]
- public string JoinMapKey { get; set; }
- }
-
- public class ApiRoomPropertiesConfig
- {
- [JsonProperty("roomKey")]
- public string RoomKey { get; set; }
-
- [JsonProperty("joinStart")]
- public uint JoinStart { get; set; }
-
- [JsonProperty("joinMapKey")]
- public string JoinMapKey { get; set; }
- }
-
- }
-
- public class EiscApiAdvancedFactory : EssentialsDeviceFactory
- {
- public EiscApiAdvancedFactory()
- {
- TypeNames = new List { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
-
- var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
-
- BasicTriList eisc;
-
- switch (dc.Type.ToLower())
- {
- case "eiscapiadv":
- case "eiscapiadvanced":
- {
- eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
- controlProperties.TcpSshProperties.Address, Global.ControlSystem);
- break;
- }
- case "eiscapiadvancedserver":
- {
- eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
- break;
- }
- case "eiscapiadvancedclient":
- {
- eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
- break;
- }
- case "vceiscapiadv":
- case "vceiscapiadvanced":
- {
- if (string.IsNullOrEmpty(controlProperties.RoomId))
- {
- Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
- eisc = null;
- break;
- }
- eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
- Global.ControlSystem);
- break;
- }
- default:
- eisc = null;
- break;
- }
-
- if (eisc == null)
- {
- return null;
- }
-
- return new EiscApiAdvanced(dc, eisc);
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeHelper.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeHelper.cs
new file mode 100644
index 00000000..a9955378
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/BridgeHelper.cs
@@ -0,0 +1,64 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Bridges
+{
+ ///
+ /// Helper methods for bridges
+ ///
+ public static class BridgeHelper
+ {
+ public static void PrintJoinMap(string command)
+ {
+ var targets = command.Split(' ');
+
+ var bridgeKey = targets[0].Trim();
+
+ var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
+
+ if (bridge == null)
+ {
+ Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
+ return;
+ }
+
+ if (targets.Length > 1)
+ {
+ var deviceKey = targets[1].Trim();
+
+ if (string.IsNullOrEmpty(deviceKey)) return;
+ bridge.PrintJoinMapForDevice(deviceKey);
+ }
+ else
+ {
+ bridge.PrintJoinMaps();
+ }
+ }
+ public static void JoinmapMarkdown(string command)
+ {
+ var targets = command.Split(' ');
+
+ var bridgeKey = targets[0].Trim();
+
+ var bridge = DeviceManager.GetDeviceForKey(bridgeKey) as EiscApiAdvanced;
+
+ if (bridge == null)
+ {
+ Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
+ return;
+ }
+
+ if (targets.Length > 1)
+ {
+ var deviceKey = targets[1].Trim();
+
+ if (string.IsNullOrEmpty(deviceKey)) return;
+ bridge.MarkdownJoinMapForDevice(deviceKey, bridgeKey);
+ }
+ else
+ {
+ bridge.MarkdownForBridge(bridgeKey);
+
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvanced.cs b/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvanced.cs
new file mode 100644
index 00000000..24bc536a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvanced.cs
@@ -0,0 +1,308 @@
+using System;
+using System.Collections.Generic;
+using Crestron.SimplSharp.Reflection;
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Bridges
+{
+ ///
+ /// Bridge API using EISC
+ ///
+ public class EiscApiAdvanced : BridgeApi, ICommunicationMonitor
+ {
+ public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
+
+ public Dictionary JoinMaps { get; private set; }
+
+ public BasicTriList Eisc { get; private set; }
+
+ public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) :
+ base(dc.Key)
+ {
+ JoinMaps = new Dictionary();
+
+ PropertiesConfig = dc.Properties.ToObject();
+ //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString());
+
+ Eisc = eisc;
+
+ Eisc.SigChange += Eisc_SigChange;
+
+ CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Eisc, 120000, 300000);
+
+ AddPostActivationAction(LinkDevices);
+ AddPostActivationAction(LinkRooms);
+ AddPostActivationAction(RegisterEisc);
+ }
+
+ public override bool CustomActivate()
+ {
+ CommunicationMonitor.Start();
+ return base.CustomActivate();
+ }
+
+ public override bool Deactivate()
+ {
+ CommunicationMonitor.Stop();
+ return base.Deactivate();
+ }
+
+ private void LinkDevices()
+ {
+ Debug.Console(1, this, "Linking Devices...");
+
+ if (PropertiesConfig.Devices == null)
+ {
+ Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
+ return;
+ }
+
+ foreach (var d in PropertiesConfig.Devices)
+ {
+ var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
+
+ if (device == null)
+ {
+ continue;
+ }
+
+ Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
+
+ if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
+ {
+ Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
+ "{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
+ device.Key);
+ continue;
+ }
+
+ var bridge = device as IBridgeAdvanced;
+ if (bridge != null)
+ {
+ bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
+ }
+ }
+ }
+
+ private void RegisterEisc()
+ {
+ if (Eisc.Registered)
+ {
+ return;
+ }
+
+ var registerResult = Eisc.Register();
+
+ if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
+ {
+ Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
+ return;
+ }
+
+ Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
+ }
+
+ public void LinkRooms()
+ {
+ Debug.Console(1, this, "Linking Rooms...");
+
+ if (PropertiesConfig.Rooms == null)
+ {
+ Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
+ return;
+ }
+
+ foreach (var room in PropertiesConfig.Rooms)
+ {
+ var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
+
+ if (rm == null)
+ {
+ Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
+ "Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
+ continue;
+ }
+
+ rm.LinkToApi(Eisc, room.JoinStart, room.JoinMapKey, this);
+ }
+ }
+
+ ///
+ /// Adds a join map
+ ///
+ ///
+ ///
+ public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
+ {
+ if (!JoinMaps.ContainsKey(deviceKey))
+ {
+ JoinMaps.Add(deviceKey, joinMap);
+ }
+ else
+ {
+ Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
+ }
+ }
+
+ ///
+ /// Prints all the join maps on this bridge
+ ///
+ public virtual void PrintJoinMaps()
+ {
+ Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
+
+ foreach (var joinMap in JoinMaps)
+ {
+ Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
+ joinMap.Value.PrintJoinMapInfo();
+ }
+ }
+ ///
+ /// Generates markdown for all join maps on this bridge
+ ///
+ public virtual void MarkdownForBridge(string bridgeKey)
+ {
+ Debug.Console(0, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
+
+ foreach (var joinMap in JoinMaps)
+ {
+ Debug.Console(0, "Generating markdown for device '{0}':", joinMap.Key);
+ joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
+ }
+ }
+
+ ///
+ /// Prints the join map for a device by key
+ ///
+ ///
+ public void PrintJoinMapForDevice(string deviceKey)
+ {
+ var joinMap = JoinMaps[deviceKey];
+
+ if (joinMap == null)
+ {
+ Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
+ return;
+ }
+
+ Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
+ joinMap.PrintJoinMapInfo();
+ }
+ ///
+ /// Prints the join map for a device by key
+ ///
+ ///
+ public void MarkdownJoinMapForDevice(string deviceKey, string bridgeKey)
+ {
+ var joinMap = JoinMaps[deviceKey];
+
+ if (joinMap == null)
+ {
+ Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
+ return;
+ }
+
+ Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
+ joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
+ }
+
+ ///
+ /// Used for debugging to trigger an action based on a join number and type
+ ///
+ ///
+ ///
+ ///
+ public void ExecuteJoinAction(uint join, string type, object state)
+ {
+ try
+ {
+ switch (type.ToLower())
+ {
+ case "digital":
+ {
+ var uo = Eisc.BooleanOutput[join].UserObject as Action;
+ if (uo != null)
+ {
+ Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
+ uo(Convert.ToBoolean(state));
+ }
+ else
+ Debug.Console(2, this, "User Action is null. Nothing to Execute");
+ break;
+ }
+ case "analog":
+ {
+ var uo = Eisc.BooleanOutput[join].UserObject as Action;
+ if (uo != null)
+ {
+ Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
+ uo(Convert.ToUInt16(state));
+ }
+ else
+ Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
+ }
+ case "serial":
+ {
+ var uo = Eisc.BooleanOutput[join].UserObject as Action;
+ if (uo != null)
+ {
+ Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
+ uo(Convert.ToString(state));
+ }
+ else
+ Debug.Console(2, this, "User Action is null. Nothing to Execute");
+ break;
+ }
+ default:
+ {
+ Debug.Console(2, "Unknown join type. Use digital/serial/analog");
+ break;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.Console(1, this, "Error: {0}", e);
+ }
+
+ }
+
+ ///
+ /// Handles incoming sig changes
+ ///
+ ///
+ ///
+ protected void Eisc_SigChange(object currentDevice, SigEventArgs args)
+ {
+ try
+ {
+ if (Debug.Level >= 1)
+ Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
+ var uo = args.Sig.UserObject;
+
+ if (uo == null) return;
+
+ Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
+ if (uo is Action)
+ (uo as Action)(args.Sig.BoolValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.UShortValue);
+ else if (uo is Action)
+ (uo as Action)(args.Sig.StringValue);
+ }
+ catch (Exception e)
+ {
+ Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
+ }
+ }
+
+ #region Implementation of ICommunicationMonitor
+
+ public StatusMonitorBase CommunicationMonitor { get; private set; }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvancedFactory.cs b/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvancedFactory.cs
new file mode 100644
index 00000000..8f613dc3
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/EiscApiAdvancedFactory.cs
@@ -0,0 +1,69 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.EthernetCommunication;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Bridges
+{
+ public class EiscApiAdvancedFactory : EssentialsDeviceFactory
+ {
+ public EiscApiAdvancedFactory()
+ {
+ TypeNames = new List { "eiscapiadv", "eiscapiadvanced", "eiscapiadvancedserver", "eiscapiadvancedclient", "vceiscapiadv", "vceiscapiadvanced" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
+
+ var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
+
+ BasicTriList eisc;
+
+ switch (dc.Type.ToLower())
+ {
+ case "eiscapiadv":
+ case "eiscapiadvanced":
+ {
+ eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt,
+ controlProperties.TcpSshProperties.Address, Global.ControlSystem);
+ break;
+ }
+ case "eiscapiadvancedserver":
+ {
+ eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem);
+ break;
+ }
+ case "eiscapiadvancedclient":
+ {
+ eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem);
+ break;
+ }
+ case "vceiscapiadv":
+ case "vceiscapiadvanced":
+ {
+ if (string.IsNullOrEmpty(controlProperties.RoomId))
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
+ eisc = null;
+ break;
+ }
+ eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId,
+ Global.ControlSystem);
+ break;
+ }
+ default:
+ eisc = null;
+ break;
+ }
+
+ if (eisc == null)
+ {
+ return null;
+ }
+
+ return new EiscApiAdvanced(dc, eisc);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/EiscApiPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Bridges/EiscApiPropertiesConfig.cs
new file mode 100644
index 00000000..e4b665c4
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Bridges/EiscApiPropertiesConfig.cs
@@ -0,0 +1,44 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.Bridges
+{
+ public class EiscApiPropertiesConfig
+ {
+ [JsonProperty("control")]
+ public EssentialsControlPropertiesConfig Control { get; set; }
+
+ [JsonProperty("devices")]
+ public List Devices { get; set; }
+
+ [JsonProperty("rooms")]
+ public List Rooms { get; set; }
+
+
+ public class ApiDevicePropertiesConfig
+ {
+ [JsonProperty("deviceKey")]
+ public string DeviceKey { get; set; }
+
+ [JsonProperty("joinStart")]
+ public uint JoinStart { get; set; }
+
+ [JsonProperty("joinMapKey")]
+ public string JoinMapKey { get; set; }
+ }
+
+ public class ApiRoomPropertiesConfig
+ {
+ [JsonProperty("roomKey")]
+ public string RoomKey { get; set; }
+
+ [JsonProperty("joinStart")]
+ public uint JoinStart { get; set; }
+
+ [JsonProperty("joinMapKey")]
+ public string JoinMapKey { get; set; }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Bridges/IBridge.cs b/src/PepperDash.Essentials.Core/Bridges/IBridgeAdvanced.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Bridges/IBridge.cs
rename to src/PepperDash.Essentials.Core/Bridges/IBridgeAdvanced.cs
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs
index 2f6050b6..1616d899 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs
@@ -53,52 +53,4 @@ namespace PepperDash.Essentials.Core
throw new NotImplementedException();
}
}
-
- ///
- /// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
- /// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
- /// and then returns the enum value using Enum.Parse. NOTE: Does not write
- ///
- public class ComSpecPropsJsonConverter : JsonConverter
- {
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(ComPort.eComBaudRates)
- || objectType == typeof(ComPort.eComDataBits)
- || objectType == typeof(ComPort.eComParityType)
- || objectType == typeof(ComPort.eComHardwareHandshakeType)
- || objectType == typeof(ComPort.eComSoftwareHandshakeType)
- || objectType == typeof(ComPort.eComProtocolType)
- || objectType == typeof(ComPort.eComStopBits);
- }
-
- public override bool CanRead { get { return true; } }
-
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- //Debug.Console(2, "ReadJson type: " + objectType.Name);
- if (objectType == typeof(ComPort.eComBaudRates))
- return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
- else if (objectType == typeof(ComPort.eComDataBits))
- return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
- else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
- return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
- else if (objectType == typeof(ComPort.eComParityType))
- return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
- else if (objectType == typeof(ComPort.eComProtocolType))
- return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
- else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
- return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
- else if (objectType == typeof(ComPort.eComStopBits))
- return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
- return null;
- }
-
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- throw new NotImplementedException();
- }
- }
-
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecPropsJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecPropsJsonConverter.cs
new file mode 100644
index 00000000..fa0857e7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecPropsJsonConverter.cs
@@ -0,0 +1,53 @@
+extern alias Full;
+using System;
+using Crestron.SimplSharpPro;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// The gist of this converter: The comspec JSON comes in with normal values that need to be converted
+ /// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value
+ /// and then returns the enum value using Enum.Parse. NOTE: Does not write
+ ///
+ public class ComSpecPropsJsonConverter : JsonConverter
+ {
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(ComPort.eComBaudRates)
+ || objectType == typeof(ComPort.eComDataBits)
+ || objectType == typeof(ComPort.eComParityType)
+ || objectType == typeof(ComPort.eComHardwareHandshakeType)
+ || objectType == typeof(ComPort.eComSoftwareHandshakeType)
+ || objectType == typeof(ComPort.eComProtocolType)
+ || objectType == typeof(ComPort.eComStopBits);
+ }
+
+ public override bool CanRead { get { return true; } }
+
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ //Debug.Console(2, "ReadJson type: " + objectType.Name);
+ if (objectType == typeof(ComPort.eComBaudRates))
+ return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
+ else if (objectType == typeof(ComPort.eComDataBits))
+ return Enum.Parse(typeof(ComPort.eComDataBits), "ComspecDataBits" + reader.Value, true);
+ else if (objectType == typeof(ComPort.eComHardwareHandshakeType))
+ return Enum.Parse(typeof(ComPort.eComHardwareHandshakeType), "ComspecHardwareHandshake" + reader.Value, true);
+ else if (objectType == typeof(ComPort.eComParityType))
+ return Enum.Parse(typeof(ComPort.eComParityType), "ComspecParity" + reader.Value, true);
+ else if (objectType == typeof(ComPort.eComProtocolType))
+ return Enum.Parse(typeof(ComPort.eComProtocolType), "ComspecProtocol" + reader.Value, true);
+ else if (objectType == typeof(ComPort.eComSoftwareHandshakeType))
+ return Enum.Parse(typeof(ComPort.eComSoftwareHandshakeType), "ComspecSoftwareHandshake" + reader.Value, true);
+ else if (objectType == typeof(ComPort.eComStopBits))
+ return Enum.Parse(typeof(ComPort.eComStopBits), "ComspecStopBits" + reader.Value, true);
+ return null;
+ }
+
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
index 892caa92..c045b994 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs
@@ -174,64 +174,4 @@ namespace PepperDash.Essentials.Core
}
}
}
-
- ///
- ///
- ///
- public class EssentialsControlPropertiesConfig :
- PepperDash.Core.ControlPropertiesConfig
- {
-
- [JsonConverter(typeof(ComSpecJsonConverter))]
- public ComPort.ComPortSpec ComParams { get; set; }
-
- public string RoomId { get; set; }
-
- public string CresnetId { get; set; }
-
- ///
- /// Attempts to provide uint conversion of string CresnetId
- ///
- public uint CresnetIdInt
- {
- get
- {
- try
- {
- return Convert.ToUInt32(CresnetId, 16);
- }
- catch (Exception)
- {
- throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
- }
- }
- }
-
- public string InfinetId { get; set; }
-
- ///
- /// Attepmts to provide uiont conversion of string InifinetId
- ///
- public uint InfinetIdInt
- {
- get
- {
- try
- {
- return Convert.ToUInt32(InfinetId, 16);
- }
- catch (Exception)
- {
- throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
- }
- }
- }
- }
-
- public class IrControlSpec
- {
- public string PortDeviceKey { get; set; }
- public uint PortNumber { get; set; }
- public string File { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs
index db06d2aa..5e5e5d3c 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs
@@ -1,11 +1,9 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
@@ -54,33 +52,4 @@ namespace PepperDash.Essentials.Core
Communication.SendText(s + LineEnding);
}
}
-
- public class ConsoleCommMockDevicePropertiesConfig
- {
- public string LineEnding { get; set; }
- public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
-
- public ConsoleCommMockDevicePropertiesConfig()
- {
- LineEnding = "\x0a";
- }
- }
-
- public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory
- {
- public ConsoleCommMockDeviceFactory()
- {
- TypeNames = new List() { "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(
- dc.Properties.ToString());
- return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm);
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDeviceFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDeviceFactory.cs
new file mode 100644
index 00000000..ee3b4c72
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDeviceFactory.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory
+ {
+ public ConsoleCommMockDeviceFactory()
+ {
+ TypeNames = new List() { "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(
+ dc.Properties.ToString());
+ return new ConsoleCommMockDevice(dc.Key, dc.Name, props, comm);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevicePropertiesConfig.cs b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevicePropertiesConfig.cs
new file mode 100644
index 00000000..c95c8872
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevicePropertiesConfig.cs
@@ -0,0 +1,13 @@
+namespace PepperDash.Essentials.Core
+{
+ public class ConsoleCommMockDevicePropertiesConfig
+ {
+ public string LineEnding { get; set; }
+ public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
+
+ public ConsoleCommMockDevicePropertiesConfig()
+ {
+ LineEnding = "\x0a";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/EssentialsControlPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Comm and IR/EssentialsControlPropertiesConfig.cs
new file mode 100644
index 00000000..ffd7ea7e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/EssentialsControlPropertiesConfig.cs
@@ -0,0 +1,60 @@
+extern alias Full;
+using System;
+using Crestron.SimplSharpPro;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public class EssentialsControlPropertiesConfig :
+ PepperDash.Core.ControlPropertiesConfig
+ {
+
+ [JsonConverter(typeof(ComSpecJsonConverter))]
+ public ComPort.ComPortSpec ComParams { get; set; }
+
+ public string RoomId { get; set; }
+
+ public string CresnetId { get; set; }
+
+ ///
+ /// Attempts to provide uint conversion of string CresnetId
+ ///
+ public uint CresnetIdInt
+ {
+ get
+ {
+ try
+ {
+ return Convert.ToUInt32(CresnetId, 16);
+ }
+ catch (Exception)
+ {
+ throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
+ }
+ }
+ }
+
+ public string InfinetId { get; set; }
+
+ ///
+ /// Attepmts to provide uiont conversion of string InifinetId
+ ///
+ public uint InfinetIdInt
+ {
+ get
+ {
+ try
+ {
+ return Convert.ToUInt32(InfinetId, 16);
+ }
+ catch (Exception)
+ {
+ throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs
index 8ce6a8c5..4316e562 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs
@@ -1,7 +1,6 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using Crestron.SimplSharp.CrestronSockets;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
@@ -127,18 +126,4 @@ namespace PepperDash.Essentials.Core
});
}
}
-
- public class GenericCommFactory : EssentialsDeviceFactory
- {
- public GenericCommFactory()
- {
- TypeNames = new List() { "genericComm" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
- return new GenericComm(dc);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericCommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericCommFactory.cs
new file mode 100644
index 00000000..b7fdd484
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericCommFactory.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class GenericCommFactory : EssentialsDeviceFactory
+ {
+ public GenericCommFactory()
+ {
+ TypeNames = new List() { "genericComm" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
+ return new GenericComm(dc);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs
index 31342a94..ca8cf829 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs
@@ -100,16 +100,4 @@ namespace PepperDash.Essentials.Core
#endregion
}
- public class GenericHttpClientEventArgs : EventArgs
- {
- public string ResponseText { get; private set; }
- public string RequestPath { get; private set; }
- public HTTP_CALLBACK_ERROR Error { get; set; }
- public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
- {
- ResponseText = response;
- RequestPath = request;
- Error = error;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClientEventArgs.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClientEventArgs.cs
new file mode 100644
index 00000000..0341ef2a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClientEventArgs.cs
@@ -0,0 +1,18 @@
+using System;
+using Crestron.SimplSharp.Net.Http;
+
+namespace PepperDash.Essentials.Core
+{
+ public class GenericHttpClientEventArgs : EventArgs
+ {
+ public string ResponseText { get; private set; }
+ public string RequestPath { get; private set; }
+ public HTTP_CALLBACK_ERROR Error { get; set; }
+ public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
+ {
+ ResponseText = response;
+ RequestPath = request;
+ Error = error;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs b/src/PepperDash.Essentials.Core/Comm and IR/IComPortsDevice.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs
rename to src/PepperDash.Essentials.Core/Comm and IR/IComPortsDevice.cs
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
index b682af71..7066478a 100644
--- a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
+++ b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs
@@ -220,18 +220,4 @@ namespace PepperDash.Essentials.Core
}
}*/
}
-
- ///
- /// Wrapper to help in IR port creation
- ///
- public class IrOutPortConfig
- {
- public IROutputPort Port { get; set; }
- public string FileName { get; set; }
-
- public IrOutPortConfig()
- {
- FileName = "";
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IrControlSpec.cs b/src/PepperDash.Essentials.Core/Comm and IR/IrControlSpec.cs
new file mode 100644
index 00000000..b2537d1d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/IrControlSpec.cs
@@ -0,0 +1,9 @@
+namespace PepperDash.Essentials.Core
+{
+ public class IrControlSpec
+ {
+ public string PortDeviceKey { get; set; }
+ public uint PortNumber { get; set; }
+ public string File { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IrOutPortConfig.cs b/src/PepperDash.Essentials.Core/Comm and IR/IrOutPortConfig.cs
new file mode 100644
index 00000000..0a48987b
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Comm and IR/IrOutPortConfig.cs
@@ -0,0 +1,18 @@
+using Crestron.SimplSharpPro;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Wrapper to help in IR port creation
+ ///
+ public class IrOutPortConfig
+ {
+ public IROutputPort Port { get; set; }
+ public string FileName { get; set; }
+
+ public IrOutPortConfig()
+ {
+ FileName = "";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs
index ba21ae38..01f1d01f 100644
--- a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs
+++ b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs
@@ -1,6 +1,4 @@
extern alias Full;
-
-using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
@@ -49,34 +47,4 @@ namespace PepperDash.Essentials.Core.Config
public DeviceConfig() {}
}
-
- ///
- ///
- ///
- public class DevicePropertiesConverter : JsonConverter
- {
-
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(JToken);
- }
-
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- return JToken.ReadFrom(reader);
- }
-
- public override bool CanWrite
- {
- get
- {
- return false;
- }
- }
-
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- throw new NotImplementedException("SOD OFF HOSER");
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/DevicePropertiesConverter.cs b/src/PepperDash.Essentials.Core/Config/DevicePropertiesConverter.cs
new file mode 100644
index 00000000..88b45cea
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Config/DevicePropertiesConverter.cs
@@ -0,0 +1,37 @@
+extern alias Full;
+using System;
+using Full::Newtonsoft.Json;
+using Full::Newtonsoft.Json.Linq;
+
+namespace PepperDash.Essentials.Core.Config
+{
+ ///
+ ///
+ ///
+ public class DevicePropertiesConverter : JsonConverter
+ {
+
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(JToken);
+ }
+
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ return JToken.ReadFrom(reader);
+ }
+
+ public override bool CanWrite
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException("SOD OFF HOSER");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigStatusEventArgs.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigStatusEventArgs.cs
new file mode 100644
index 00000000..7335bd6c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigStatusEventArgs.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Config
+{
+ public class ConfigStatusEventArgs : EventArgs
+ {
+ public eUpdateStatus UpdateStatus { get; private set; }
+
+ public ConfigStatusEventArgs(eUpdateStatus status)
+ {
+ UpdateStatus = status;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs
index 71783373..72962ff7 100644
--- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs
+++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs
@@ -200,26 +200,4 @@ namespace PepperDash.Essentials.Core.Config
}
}
-
- public enum eUpdateStatus
- {
- UpdateStarted,
- ConfigFileReceived,
- ArchivingConfigs,
- DeletingLocalConfig,
- WritingConfigFile,
- RestartingProgram,
- UpdateSucceeded,
- UpdateFailed
- }
-
- public class ConfigStatusEventArgs : EventArgs
- {
- public eUpdateStatus UpdateStatus { get; private set; }
-
- public ConfigStatusEventArgs(eUpdateStatus status)
- {
- UpdateStatus = status;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs
index 16b1886b..a07aa0c8 100644
--- a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs
+++ b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs
@@ -61,14 +61,4 @@ namespace PepperDash.Essentials.Core.Config
Rooms = new List();
}
}
-
- ///
- ///
- ///
- public class SystemTemplateConfigs
- {
- public EssentialsConfig System { get; set; }
-
- public EssentialsConfig Template { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/SystemTemplateConfigs.cs b/src/PepperDash.Essentials.Core/Config/Essentials/SystemTemplateConfigs.cs
new file mode 100644
index 00000000..58e604fb
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Config/Essentials/SystemTemplateConfigs.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core.Config
+{
+ ///
+ ///
+ ///
+ public class SystemTemplateConfigs
+ {
+ public EssentialsConfig System { get; set; }
+
+ public EssentialsConfig Template { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/eUpdateStatus.cs b/src/PepperDash.Essentials.Core/Config/Essentials/eUpdateStatus.cs
new file mode 100644
index 00000000..bf855283
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Config/Essentials/eUpdateStatus.cs
@@ -0,0 +1,14 @@
+namespace PepperDash.Essentials.Core.Config
+{
+ public enum eUpdateStatus
+ {
+ UpdateStarted,
+ ConfigFileReceived,
+ ArchivingConfigs,
+ DeletingLocalConfig,
+ WritingConfigFile,
+ RestartingProgram,
+ UpdateSucceeded,
+ UpdateFailed
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs
index 820abde5..ca8a6574 100644
--- a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs
+++ b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs
@@ -1,7 +1,6 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
@@ -51,61 +50,4 @@ namespace PepperDash.Essentials.Core.Config
RuntimeInfo = new RuntimeInfo();
}
}
-
-
- ///
- /// Represents runtime information about the program/processor
- ///
- public class RuntimeInfo
- {
- ///
- /// The name of the running application
- ///
- [JsonProperty("appName")]
- public string AppName {get; set;}
- //{
- // get
- // {
- // return Assembly.GetExecutingAssembly().GetName().Name;
- // }
- //}
-
- ///
- /// The Assembly version of the running application
- ///
- [JsonProperty("assemblyVersion")]
- public string AssemblyVersion {get; set;}
- //{
- // get
- // {
- // var version = Assembly.GetExecutingAssembly().GetName().Version;
- // return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
- // }
- //}
-
- /// ,
- /// The OS Version of the processor (Firmware Version)
- ///
- [JsonProperty("osVersion")]
- public string OsVersion {get; set;}
- //{
- // get
- // {
- // return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
- // }
- //}
-
- ///
- /// The information gathered by the processor at runtime about it's NICs and their IP addresses.
- ///
- [JsonProperty("ipInfo")]
- public Dictionary IpInfo
- {
- get
- {
- return Global.EthernetAdapterInfoCollection;
- }
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Config/RuntimeInfo.cs b/src/PepperDash.Essentials.Core/Config/RuntimeInfo.cs
new file mode 100644
index 00000000..4fa91660
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Config/RuntimeInfo.cs
@@ -0,0 +1,61 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.Config
+{
+ ///
+ /// Represents runtime information about the program/processor
+ ///
+ public class RuntimeInfo
+ {
+ ///
+ /// The name of the running application
+ ///
+ [JsonProperty("appName")]
+ public string AppName {get; set;}
+ //{
+ // get
+ // {
+ // return Assembly.GetExecutingAssembly().GetName().Name;
+ // }
+ //}
+
+ ///
+ /// The Assembly version of the running application
+ ///
+ [JsonProperty("assemblyVersion")]
+ public string AssemblyVersion {get; set;}
+ //{
+ // get
+ // {
+ // var version = Assembly.GetExecutingAssembly().GetName().Version;
+ // return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
+ // }
+ //}
+
+ /// ,
+ /// The OS Version of the processor (Firmware Version)
+ ///
+ [JsonProperty("osVersion")]
+ public string OsVersion {get; set;}
+ //{
+ // get
+ // {
+ // return Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
+ // }
+ //}
+
+ ///
+ /// The information gathered by the processor at runtime about it's NICs and their IP addresses.
+ ///
+ [JsonProperty("ipInfo")]
+ public Dictionary IpInfo
+ {
+ get
+ {
+ return Global.EthernetAdapterInfoCollection;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2NIoControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2NIoControllerFactory.cs
new file mode 100644
index 00000000..ad283514
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2NIoControllerFactory.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public class C2NIoControllerFactory : EssentialsDeviceFactory
+ {
+ public C2NIoControllerFactory()
+ {
+ TypeNames = new List() { "c2nio" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
+
+ return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
+ }
+
+ static C2nIo GetC2NIoDevice(DeviceConfig dc)
+ {
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ var cresnetId = control.CresnetIdInt;
+ var branchId = control.ControlPortNumber;
+ var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
+
+ if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
+ return new C2nIo(cresnetId, Global.ControlSystem);
+ }
+ var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
+
+ if (cresnetBridge != null)
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
+ return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
+ }
+ Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs
index f1f1891d..5cff3bd2 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs
@@ -1,9 +1,7 @@
using System;
-using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
@@ -65,42 +63,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
#endregion
}
-
- public class C2NIoControllerFactory : EssentialsDeviceFactory
- {
- public C2NIoControllerFactory()
- {
- TypeNames = new List() { "c2nio" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
-
- return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
- }
-
- static C2nIo GetC2NIoDevice(DeviceConfig dc)
- {
- var control = CommFactory.GetControlPropertiesConfig(dc);
- var cresnetId = control.CresnetIdInt;
- var branchId = control.ControlPortNumber;
- var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
-
- if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
- return new C2nIo(cresnetId, Global.ControlSystem);
- }
- var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
-
- if (cresnetBridge != null)
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
- return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
- }
- Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
- return null;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Configuration.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Configuration.cs
new file mode 100644
index 00000000..1e1e75dd
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Configuration.cs
@@ -0,0 +1,11 @@
+extern alias Full;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class CenCi31Configuration
+ {
+ [JsonProperty("card")]
+ public string Card { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs
index 7e29e0e0..3dd7b899 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs
@@ -3,9 +3,7 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
-using Full.Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
@@ -85,34 +83,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
DeviceManager.AddDevice(device);
}
}
-
- public class CenCi31Configuration
- {
- [JsonProperty("card")]
- public string Card { get; set; }
- }
-
- public class CenCi31ControllerFactory : EssentialsDeviceFactory
- {
- public CenCi31ControllerFactory()
- {
- TypeNames = new List {"cenci31"};
- }
- #region Overrides of EssentialsDeviceFactory
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory attempting to build new CEN-CI-1");
-
- var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
- var ipId = controlProperties.IpIdInt;
-
- var cardCage = new CenCi31(ipId, Global.ControlSystem);
- var config = dc.Properties.ToObject();
-
- return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
- }
-
- #endregion
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31ControllerFactory.cs
new file mode 100644
index 00000000..84d6258d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31ControllerFactory.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.ThreeSeriesCards;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class CenCi31ControllerFactory : EssentialsDeviceFactory
+ {
+ public CenCi31ControllerFactory()
+ {
+ TypeNames = new List {"cenci31"};
+ }
+ #region Overrides of EssentialsDeviceFactory
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory attempting to build new CEN-CI-1");
+
+ var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
+ var ipId = controlProperties.IpIdInt;
+
+ var cardCage = new CenCi31(ipId, Global.ControlSystem);
+ var config = dc.Properties.ToObject();
+
+ return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Configuration.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Configuration.cs
new file mode 100644
index 00000000..92d76f6f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Configuration.cs
@@ -0,0 +1,12 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class CenCi33Configuration
+ {
+ [JsonProperty("cards")]
+ public Dictionary Cards { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs
index d1eb0166..a067bfa5 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs
@@ -3,9 +3,7 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
-using Full.Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
@@ -100,34 +98,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
}
}
}
-
- public class CenCi33Configuration
- {
- [JsonProperty("cards")]
- public Dictionary Cards { get; set; }
- }
-
- public class CenCi33ControllerFactory : EssentialsDeviceFactory
- {
- public CenCi33ControllerFactory()
- {
- TypeNames = new List {"cenci33"};
- }
- #region Overrides of EssentialsDeviceFactory
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory attempting to build new CEN-CI-3");
-
- var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
- var ipId = controlProperties.IpIdInt;
-
- var cardCage = new CenCi33(ipId, Global.ControlSystem);
- var config = dc.Properties.ToObject();
-
- return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
- }
-
- #endregion
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33ControllerFactory.cs
new file mode 100644
index 00000000..65841df7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33ControllerFactory.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.ThreeSeriesCards;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class CenCi33ControllerFactory : EssentialsDeviceFactory
+ {
+ public CenCi33ControllerFactory()
+ {
+ TypeNames = new List {"cenci33"};
+ }
+ #region Overrides of EssentialsDeviceFactory
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory attempting to build new CEN-CI-3");
+
+ var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
+ var ipId = controlProperties.IpIdInt;
+
+ var cardCage = new CenCi33(ipId, Global.ControlSystem);
+ var config = dc.Properties.ToObject();
+
+ return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageConfiguration.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageConfiguration.cs
new file mode 100644
index 00000000..31414509
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageConfiguration.cs
@@ -0,0 +1,12 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class InternalCardCageConfiguration
+ {
+ [JsonProperty("cards")]
+ public Dictionary Cards { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs
index 97286945..bbf03ea1 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs
@@ -3,9 +3,7 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
-using Full.Newtonsoft.Json;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
@@ -108,36 +106,4 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards
}
}
}
-
- public class InternalCardCageConfiguration
- {
- [JsonProperty("cards")]
- public Dictionary Cards { get; set; }
- }
-
- public class InternalCardCageControllerFactory : EssentialsDeviceFactory
- {
- public InternalCardCageControllerFactory()
- {
- TypeNames = new List {"internalcardcage"};
- }
- #region Overrides of EssentialsDeviceFactory
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
-
- if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
- {
- Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
- return null;
- }
-
- var config = dc.Properties.ToObject();
-
- return new InternalCardCageController(dc.Key, dc.Name, config);
- }
-
- #endregion
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageControllerFactory.cs
new file mode 100644
index 00000000..2387320a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageControllerFactory.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO.Cards
+{
+ public class InternalCardCageControllerFactory : EssentialsDeviceFactory
+ {
+ public InternalCardCageControllerFactory()
+ {
+ TypeNames = new List {"internalcardcage"};
+ }
+ #region Overrides of EssentialsDeviceFactory
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
+
+ if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
+ return null;
+ }
+
+ var config = dc.Properties.ToObject();
+
+ return new InternalCardCageController(dc.Key, dc.Name, config);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCn2Controller.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs
rename to src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCn2Controller.cs
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs
index 794fe609..45abc53d 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs
@@ -1,9 +1,7 @@
using System;
-using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
@@ -39,42 +37,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
-
- public class DinIo8ControllerFactory : EssentialsDeviceFactory
- {
- public DinIo8ControllerFactory()
- {
- TypeNames = new List() { "DinIo8" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new DinIo8 Device");
-
- return new DinIo8Controller(dc.Key, GetDinIo8Device, dc);
- }
-
- static DinIo8 GetDinIo8Device(DeviceConfig dc)
- {
- var control = CommFactory.GetControlPropertiesConfig(dc);
- var cresnetId = control.CresnetIdInt;
- var branchId = control.ControlPortNumber;
- var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
-
- if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
- return new DinIo8(cresnetId, Global.ControlSystem);
- }
- var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
-
- if (cresnetBridge != null)
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
- return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]);
- }
- Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
- return null;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8ControllerFactory.cs
new file mode 100644
index 00000000..859313bb
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8ControllerFactory.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public class DinIo8ControllerFactory : EssentialsDeviceFactory
+ {
+ public DinIo8ControllerFactory()
+ {
+ TypeNames = new List() { "DinIo8" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new DinIo8 Device");
+
+ return new DinIo8Controller(dc.Key, GetDinIo8Device, dc);
+ }
+
+ static DinIo8 GetDinIo8Device(DeviceConfig dc)
+ {
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ var cresnetId = control.CresnetIdInt;
+ var branchId = control.ControlPortNumber;
+ var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
+
+ if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
+ return new DinIo8(cresnetId, Global.ControlSystem);
+ }
+ var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
+
+ if (cresnetBridge != null)
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
+ return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]);
+ }
+ Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs
index 50647126..fc32bf48 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs
@@ -1,14 +1,9 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Essentials.Core.Config;
-
-
-using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
@@ -40,30 +35,4 @@ namespace PepperDash.Essentials.Core
#endregion
}
-
- public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory
- {
- public CenIoDigIn104ControllerFactory()
- {
- TypeNames = new List() { "ceniodigin104" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
-
- var control = CommFactory.GetControlPropertiesConfig(dc);
- if (control == null)
- {
- Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
- return null;
- }
- var ipid = control.IpIdInt;
- if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
-
- Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
- return null;
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104ControllerFactory.cs
new file mode 100644
index 00000000..397285e8
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104ControllerFactory.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory
+ {
+ public CenIoDigIn104ControllerFactory()
+ {
+ TypeNames = new List() { "ceniodigin104" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
+
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ if (control == null)
+ {
+ Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
+ return null;
+ }
+ var ipid = control.IpIdInt;
+ if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
+
+ Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAbalogInputDeviceFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAbalogInputDeviceFactory.cs
new file mode 100644
index 00000000..8f694117
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAbalogInputDeviceFactory.cs
@@ -0,0 +1,29 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public class GenericVersiportAbalogInputDeviceFactory : EssentialsDeviceFactory
+ {
+ public GenericVersiportAbalogInputDeviceFactory()
+ {
+ TypeNames = new List() { "versiportanaloginput" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
+
+ var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
+
+ if (props == null) return null;
+
+ var portDevice = new GenericVersiportAnalogInputDevice(dc.Key, dc.Name, GenericVersiportAnalogInputDevice.GetVersiportDigitalInput, props);
+
+ return portDevice;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs
index 5da79bbf..2c9a5bbb 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs
@@ -1,7 +1,6 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
@@ -185,26 +183,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
}
-
-
- public class GenericVersiportAbalogInputDeviceFactory : EssentialsDeviceFactory
- {
- public GenericVersiportAbalogInputDeviceFactory()
- {
- TypeNames = new List() { "versiportanaloginput" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- if (props == null) return null;
-
- var portDevice = new GenericVersiportAnalogInputDevice(dc.Key, dc.Name, GenericVersiportAnalogInputDevice.GetVersiportDigitalInput, props);
-
- return portDevice;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDevice.cs
similarity index 84%
rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs
rename to src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDevice.cs
index fd215545..c8df179e 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDevice.cs
@@ -1,7 +1,6 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
@@ -145,26 +143,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
}
-
-
- public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory
- {
- public GenericVersiportDigitalInputDeviceFactory()
- {
- TypeNames = new List() { "versiportinput" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- if (props == null) return null;
-
- var portDevice = new GenericVersiportDigitalInputDevice(dc.Key, dc.Name, GenericVersiportDigitalInputDevice.GetVersiportDigitalInput, props);
-
- return portDevice;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDeviceFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDeviceFactory.cs
new file mode 100644
index 00000000..17bf8343
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportDigitalInputDeviceFactory.cs
@@ -0,0 +1,29 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public class GenericVersiportDigitalInputDeviceFactory : EssentialsDeviceFactory
+ {
+ public GenericVersiportDigitalInputDeviceFactory()
+ {
+ TypeNames = new List() { "versiportinput" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
+
+ var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
+
+ if (props == null) return null;
+
+ var portDevice = new GenericVersiportDigitalInputDevice(dc.Key, dc.Name, GenericVersiportDigitalInputDevice.GetVersiportDigitalInput, props);
+
+ return portDevice;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs
index d994a11c..96eaf6cb 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs
@@ -1,14 +1,9 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Essentials.Core.Config;
-
-
-using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
@@ -52,42 +47,4 @@ namespace PepperDash.Essentials.Core
#endregion
}
-
- ///
- /// CEN-IO-IR-104 controller fatory
- ///
- public class CenIoIr104ControllerFactory : EssentialsDeviceFactory
- {
- ///
- /// Constructor
- ///
- public CenIoIr104ControllerFactory()
- {
- TypeNames = new List() { "cenioir104" };
- }
-
- ///
- /// Build device CEN-IO-IR-104
- ///
- ///
- ///
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
-
- var control = CommFactory.GetControlPropertiesConfig(dc);
- if (control == null)
- {
- Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
- return null;
- }
-
- var ipid = control.IpIdInt;
- if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
-
- Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
- return null;
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104ControllerFactory.cs
new file mode 100644
index 00000000..be25e153
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104ControllerFactory.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// CEN-IO-IR-104 controller fatory
+ ///
+ public class CenIoIr104ControllerFactory : EssentialsDeviceFactory
+ {
+ ///
+ /// Constructor
+ ///
+ public CenIoIr104ControllerFactory()
+ {
+ TypeNames = new List() { "cenioir104" };
+ }
+
+ ///
+ /// Build device CEN-IO-IR-104
+ ///
+ ///
+ ///
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
+
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ if (control == null)
+ {
+ Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
+ return null;
+ }
+
+ var ipid = control.IpIdInt;
+ if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
+
+ Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs b/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDevice.cs
similarity index 86%
rename from src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs
rename to src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDevice.cs
index 2b3d0fab..9bfd68c2 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDevice.cs
@@ -1,7 +1,6 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -9,7 +8,6 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
@@ -166,26 +164,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
}
-
-
- public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory
- {
- public GenericVersiportDigitalOutputDeviceFactory()
- {
- TypeNames = new List() { "versiportoutput" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
-
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- if (props == null) return null;
-
- var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
-
- return portDevice;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDeviceFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDeviceFactory.cs
new file mode 100644
index 00000000..578b875c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportDigitalOutputDeviceFactory.cs
@@ -0,0 +1,29 @@
+extern alias Full;
+using System.Collections.Generic;
+using Full::Newtonsoft.Json;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory
+ {
+ public GenericVersiportDigitalOutputDeviceFactory()
+ {
+ TypeNames = new List() { "versiportoutput" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
+
+ var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
+
+ if (props == null) return null;
+
+ var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
+
+ return portDevice;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs
index ba13ede8..56fa343a 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs
@@ -1,8 +1,5 @@
-using System.Collections.Generic;
-using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
@@ -42,36 +39,4 @@ namespace PepperDash.Essentials.Core
get { return _ry104.NumberOfRelayPorts; }
}
}
-
- ///
- /// CEN-IO-RY Controller factory
- ///
- public class CenIoRy104ControllerFactory : EssentialsDeviceFactory
- {
- ///
- /// Constructor
- ///
- public CenIoRy104ControllerFactory()
- {
- TypeNames = new List() { "ceniory104" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device");
-
- var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
- if (controlPropertiesConfig == null)
- {
- Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
- return null;
- }
-
- var ipid = controlPropertiesConfig.IpIdInt;
- if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem));
-
- Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid);
- return null;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104ControllerFactory.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104ControllerFactory.cs
new file mode 100644
index 00000000..d12a6356
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104ControllerFactory.cs
@@ -0,0 +1,39 @@
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// CEN-IO-RY Controller factory
+ ///
+ public class CenIoRy104ControllerFactory : EssentialsDeviceFactory
+ {
+ ///
+ /// Constructor
+ ///
+ public CenIoRy104ControllerFactory()
+ {
+ TypeNames = new List() { "ceniory104" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device");
+
+ var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
+ if (controlPropertiesConfig == null)
+ {
+ Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
+ return null;
+ }
+
+ var ipid = controlPropertiesConfig.IpIdInt;
+ if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem));
+
+ Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs
index 19f8e0df..8f3e53ac 100644
--- a/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -18,9 +17,4 @@ namespace PepperDash.Essentials.Core.CrestronIO
void On();
void Off();
}
-
- public interface ISwitchedOutputCollection
- {
- Dictionary SwitchedOutputs { get; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutputCollection.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutputCollection.cs
new file mode 100644
index 00000000..74a84ef4
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutputCollection.cs
@@ -0,0 +1,9 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.CrestronIO
+{
+ public interface ISwitchedOutputCollection
+ {
+ Dictionary SwitchedOutputs { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs
index d9650e63..b1d5e46b 100644
--- a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs
+++ b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs
@@ -1,10 +1,8 @@
using System;
using System.Linq;
using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Core.JsonStandardObjects;
-using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core
{
@@ -170,46 +168,6 @@ namespace PepperDash.Essentials.Core
#endregion
}
- public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
- {
- protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware)
- {
- }
- protected CrestronGenericBridgeableBaseDevice(string key, string name)
- : base(key, name)
- {
- }
-
-
- public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
- }
-
-
- //***********************************************************************************
- public class CrestronGenericBaseDeviceEventIds
- {
- public const uint IsOnline = 1;
- public const uint IpConnectionsText =2;
- }
-
- ///
- /// Adds logging to Register() failure
- ///
- public static class GenericBaseExtensions
- {
- public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
- {
- var result = device.Register();
- var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
- Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
- Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
- //if (result != eDeviceRegistrationUnRegistrationResponse.Success)
- //{
- // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
- //}
- return result;
- }
-
- }
+ //***********************************************************************************
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDeviceEventIds.cs b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDeviceEventIds.cs
new file mode 100644
index 00000000..aa86f2ef
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDeviceEventIds.cs
@@ -0,0 +1,8 @@
+namespace PepperDash.Essentials.Core
+{
+ public class CrestronGenericBaseDeviceEventIds
+ {
+ public const uint IsOnline = 1;
+ public const uint IpConnectionsText =2;
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBridgeableBaseDevice.cs b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBridgeableBaseDevice.cs
new file mode 100644
index 00000000..3448e5d5
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBridgeableBaseDevice.cs
@@ -0,0 +1,21 @@
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.Core
+{
+ public abstract class CrestronGenericBridgeableBaseDevice : CrestronGenericBaseDevice, IBridgeAdvanced
+ {
+ protected CrestronGenericBridgeableBaseDevice(string key, string name, GenericBase hardware) : base(key, name, hardware)
+ {
+ }
+
+ protected CrestronGenericBridgeableBaseDevice(string key, string name)
+ : base(key, name)
+ {
+ }
+
+
+ public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Crestron/GenericBaseExtensions.cs b/src/PepperDash.Essentials.Core/Crestron/GenericBaseExtensions.cs
new file mode 100644
index 00000000..1d2ef108
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Crestron/GenericBaseExtensions.cs
@@ -0,0 +1,25 @@
+using Crestron.SimplSharpPro;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds logging to Register() failure
+ ///
+ public static class GenericBaseExtensions
+ {
+ public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
+ {
+ var result = device.Register();
+ var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
+ Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
+ Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
+ //if (result != eDeviceRegistrationUnRegistrationResponse.Success)
+ //{
+ // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
+ //}
+ return result;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Device Info/DeviceInfoChangeHandler.cs b/src/PepperDash.Essentials.Core/Device Info/DeviceInfoChangeHandler.cs
new file mode 100644
index 00000000..c6775224
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Device Info/DeviceInfoChangeHandler.cs
@@ -0,0 +1,6 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.DeviceInfo
+{
+ public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Device Info/IDeviceInfoProvider.cs b/src/PepperDash.Essentials.Core/Device Info/IDeviceInfoProvider.cs
index ea9c16e6..3ad2ec8b 100644
--- a/src/PepperDash.Essentials.Core/Device Info/IDeviceInfoProvider.cs
+++ b/src/PepperDash.Essentials.Core/Device Info/IDeviceInfoProvider.cs
@@ -11,6 +11,4 @@ namespace PepperDash.Essentials.Core.DeviceInfo
void UpdateDeviceInfo();
}
-
- public delegate void DeviceInfoChangeHandler(IKeyed device, DeviceInfoEventArgs args);
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannel.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannel.cs
index 5a38c703..3a9edf92 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannel.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannel.cs
@@ -1,6 +1,4 @@
using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
@@ -18,30 +16,4 @@ namespace PepperDash.Essentials.Core
void Info(bool pressRelease);
void Exit(bool pressRelease);
}
-
- ///
- ///
- ///
- public static class IChannelExtensions
- {
- public static void LinkButtons(this IChannel dev, BasicTriList triList)
- {
- triList.SetBoolSigAction(123, dev.ChannelUp);
- triList.SetBoolSigAction(124, dev.ChannelDown);
- triList.SetBoolSigAction(125, dev.LastChannel);
- triList.SetBoolSigAction(137, dev.Guide);
- triList.SetBoolSigAction(129, dev.Info);
- triList.SetBoolSigAction(134, dev.Exit);
- }
-
- public static void UnlinkButtons(this IChannel dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(123);
- triList.ClearBoolSigAction(124);
- triList.ClearBoolSigAction(125);
- triList.ClearBoolSigAction(137);
- triList.ClearBoolSigAction(129);
- triList.ClearBoolSigAction(134);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannelExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannelExtensions.cs
new file mode 100644
index 00000000..5e28dcb7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IChannelExtensions.cs
@@ -0,0 +1,30 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public static class IChannelExtensions
+ {
+ public static void LinkButtons(this IChannel dev, BasicTriList triList)
+ {
+ triList.SetBoolSigAction(123, dev.ChannelUp);
+ triList.SetBoolSigAction(124, dev.ChannelDown);
+ triList.SetBoolSigAction(125, dev.LastChannel);
+ triList.SetBoolSigAction(137, dev.Guide);
+ triList.SetBoolSigAction(129, dev.Info);
+ triList.SetBoolSigAction(134, dev.Exit);
+ }
+
+ public static void UnlinkButtons(this IChannel dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(123);
+ triList.ClearBoolSigAction(124);
+ triList.ClearBoolSigAction(125);
+ triList.ClearBoolSigAction(137);
+ triList.ClearBoolSigAction(129);
+ triList.ClearBoolSigAction(134);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColor.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColor.cs
new file mode 100644
index 00000000..633b3b81
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColor.cs
@@ -0,0 +1,13 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public interface IColor
+ {
+ void Red(bool pressRelease);
+ void Green(bool pressRelease);
+ void Yellow(bool pressRelease);
+ void Blue(bool pressRelease);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorFunctions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorExtensions.cs
similarity index 77%
rename from src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorFunctions.cs
rename to src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorExtensions.cs
index 232362e9..76fdfd40 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorFunctions.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IColorExtensions.cs
@@ -6,18 +6,7 @@ using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
- ///
- ///
- ///
- public interface IColor
- {
- void Red(bool pressRelease);
- void Green(bool pressRelease);
- void Yellow(bool pressRelease);
- void Blue(bool pressRelease);
- }
-
- ///
+ ///
///
///
public static class IColorExtensions
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPad.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPad.cs
index a69cfe3b..65f1ef3c 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPad.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPad.cs
@@ -1,5 +1,4 @@
using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
@@ -19,32 +18,4 @@ namespace PepperDash.Essentials.Core
void Menu(bool pressRelease);
void Exit(bool pressRelease);
}
-
- ///
- ///
- ///
- public static class IDPadExtensions
- {
- public static void LinkButtons(this IDPad dev, BasicTriList triList)
- {
- triList.SetBoolSigAction(138, dev.Up);
- triList.SetBoolSigAction(139, dev.Down);
- triList.SetBoolSigAction(140, dev.Left);
- triList.SetBoolSigAction(141, dev.Right);
- triList.SetBoolSigAction(142, dev.Select);
- triList.SetBoolSigAction(130, dev.Menu);
- triList.SetBoolSigAction(134, dev.Exit);
- }
-
- public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(138);
- triList.ClearBoolSigAction(139);
- triList.ClearBoolSigAction(140);
- triList.ClearBoolSigAction(141);
- triList.ClearBoolSigAction(142);
- triList.ClearBoolSigAction(130);
- triList.ClearBoolSigAction(134);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPadExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPadExtensions.cs
new file mode 100644
index 00000000..ddf6eb50
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDPadExtensions.cs
@@ -0,0 +1,32 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public static class IDPadExtensions
+ {
+ public static void LinkButtons(this IDPad dev, BasicTriList triList)
+ {
+ triList.SetBoolSigAction(138, dev.Up);
+ triList.SetBoolSigAction(139, dev.Down);
+ triList.SetBoolSigAction(140, dev.Left);
+ triList.SetBoolSigAction(141, dev.Right);
+ triList.SetBoolSigAction(142, dev.Select);
+ triList.SetBoolSigAction(130, dev.Menu);
+ triList.SetBoolSigAction(134, dev.Exit);
+ }
+
+ public static void UnlinkButtons(this IDPad dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(138);
+ triList.ClearBoolSigAction(139);
+ triList.ClearBoolSigAction(140);
+ triList.ClearBoolSigAction(141);
+ triList.ClearBoolSigAction(142);
+ triList.ClearBoolSigAction(130);
+ triList.ClearBoolSigAction(134);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvr.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvr.cs
index 9e55702c..351fffaf 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvr.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvr.cs
@@ -4,8 +4,6 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
@@ -19,22 +17,4 @@ namespace PepperDash.Essentials.Core
void DvrList(bool pressRelease);
void Record(bool pressRelease);
}
-
- ///
- ///
- ///
- public static class IDvrExtensions
- {
- public static void LinkButtons(this IDvr dev, BasicTriList triList)
- {
- triList.SetBoolSigAction(136, dev.DvrList);
- triList.SetBoolSigAction(152, dev.Record);
- }
-
- public static void UnlinkButtons(this IDvr dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(136);
- triList.ClearBoolSigAction(152);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvrExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvrExtensions.cs
new file mode 100644
index 00000000..e7d9915f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IDvrExtensions.cs
@@ -0,0 +1,22 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public static class IDvrExtensions
+ {
+ public static void LinkButtons(this IDvr dev, BasicTriList triList)
+ {
+ triList.SetBoolSigAction(136, dev.DvrList);
+ triList.SetBoolSigAction(152, dev.Record);
+ }
+
+ public static void UnlinkButtons(this IDvr dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(136);
+ triList.ClearBoolSigAction(152);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControl.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControl.cs
new file mode 100644
index 00000000..6686701b
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControl.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines the ability to power a device on and off
+ ///
+ public interface IHasPowerControl
+ {
+ void PowerOn();
+ void PowerOff();
+ void PowerToggle();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlExtensions.cs
new file mode 100644
index 00000000..17c462dc
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlExtensions.cs
@@ -0,0 +1,36 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public static class IHasPowerControlExtensions
+ {
+ public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
+ {
+ triList.SetSigFalseAction(101, dev.PowerOn);
+ triList.SetSigFalseAction(102, dev.PowerOff);
+ triList.SetSigFalseAction(103, dev.PowerToggle);
+
+ var fbdev = dev as IHasPowerControlWithFeedback;
+ if (fbdev != null)
+ {
+ fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
+ }
+ }
+
+ public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(101);
+ triList.ClearBoolSigAction(102);
+ triList.ClearBoolSigAction(103);
+
+ var fbdev = dev as IHasPowerControlWithFeedback;
+ if (fbdev != null)
+ {
+ fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlWithFeedback.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlWithFeedback.cs
new file mode 100644
index 00000000..f0aa9029
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPowerControlWithFeedback.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds feedback for current power state
+ ///
+ public interface IHasPowerControlWithFeedback : IHasPowerControl
+ {
+ BoolFeedback PowerIsOnFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs
index bb800b44..8ffb57ec 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs
@@ -1,5 +1,4 @@
-using System;
-using PepperDash.Core;
+using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
@@ -12,34 +11,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
void LinkSystemMonitorToAppServer();
}
-
- ///
- /// Describes a MobileSystemController that accepts IEssentialsRoom
- ///
- public interface IMobileControl3 : IMobileControl
- {
- void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
- }
-
- ///
- /// Describes a MobileControl Room Bridge
- ///
- public interface IMobileControlRoomBridge : IKeyed
- {
- event EventHandler UserCodeChanged;
-
- event EventHandler UserPromptedForCode;
-
- event EventHandler ClientJoined;
-
- string UserCode { get; }
-
- string QrCodeUrl { get; }
-
- string QrCodeChecksum { get; }
-
- string McServerUrl { get; }
-
- string RoomName { get; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl3.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl3.cs
new file mode 100644
index 00000000..85e4bd94
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl3.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
+{
+ ///
+ /// Describes a MobileSystemController that accepts IEssentialsRoom
+ ///
+ public interface IMobileControl3 : IMobileControl
+ {
+ void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControlRoomBridge.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControlRoomBridge.cs
new file mode 100644
index 00000000..9cde5f4f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControlRoomBridge.cs
@@ -0,0 +1,27 @@
+using System;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
+{
+ ///
+ /// Describes a MobileControl Room Bridge
+ ///
+ public interface IMobileControlRoomBridge : IKeyed
+ {
+ event EventHandler UserCodeChanged;
+
+ event EventHandler UserPromptedForCode;
+
+ event EventHandler ClientJoined;
+
+ string UserCode { get; }
+
+ string QrCodeUrl { get; }
+
+ string QrCodeChecksum { get; }
+
+ string McServerUrl { get; }
+
+ string RoomName { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumeric.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericExtensions.cs
similarity index 63%
rename from src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumeric.cs
rename to src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericExtensions.cs
index 62ea8b3f..0137cb99 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumeric.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericExtensions.cs
@@ -1,45 +1,10 @@
using Crestron.SimplSharpPro.DeviceSupport;
-using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
- ///
- ///
- ///
- public interface INumericKeypad:IKeyed
- {
- void Digit0(bool pressRelease);
- void Digit1(bool pressRelease);
- void Digit2(bool pressRelease);
- void Digit3(bool pressRelease);
- void Digit4(bool pressRelease);
- void Digit5(bool pressRelease);
- void Digit6(bool pressRelease);
- void Digit7(bool pressRelease);
- void Digit8(bool pressRelease);
- void Digit9(bool pressRelease);
-
- ///
- /// Used to hide/show the button and/or text on the left-hand keypad button
- ///
- bool HasKeypadAccessoryButton1 { get; }
- string KeypadAccessoryButton1Label { get; }
- void KeypadAccessoryButton1(bool pressRelease);
-
- bool HasKeypadAccessoryButton2 { get; }
- string KeypadAccessoryButton2Label { get; }
- void KeypadAccessoryButton2(bool pressRelease);
- }
-
- public interface ISetTopBoxNumericKeypad : INumericKeypad
- {
- void Dash(bool pressRelease);
- void KeypadEnter(bool pressRelease);
- }
-
- ///
+ ///
///
///
public static class INumericExtensions
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericKeypad.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericKeypad.cs
new file mode 100644
index 00000000..a24ddf3d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INumericKeypad.cs
@@ -0,0 +1,32 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public interface INumericKeypad:IKeyed
+ {
+ void Digit0(bool pressRelease);
+ void Digit1(bool pressRelease);
+ void Digit2(bool pressRelease);
+ void Digit3(bool pressRelease);
+ void Digit4(bool pressRelease);
+ void Digit5(bool pressRelease);
+ void Digit6(bool pressRelease);
+ void Digit7(bool pressRelease);
+ void Digit8(bool pressRelease);
+ void Digit9(bool pressRelease);
+
+ ///
+ /// Used to hide/show the button and/or text on the left-hand keypad button
+ ///
+ bool HasKeypadAccessoryButton1 { get; }
+ string KeypadAccessoryButton1Label { get; }
+ void KeypadAccessoryButton1(bool pressRelease);
+
+ bool HasKeypadAccessoryButton2 { get; }
+ string KeypadAccessoryButton2Label { get; }
+ void KeypadAccessoryButton2(bool pressRelease);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPasswordPrompt.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPasswordPrompt.cs
index 6ecdd775..4f8043a0 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPasswordPrompt.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPasswordPrompt.cs
@@ -22,35 +22,4 @@ namespace PepperDash.Essentials.Core
///
void SubmitPassword(string password);
}
-
- public class PasswordPromptEventArgs : EventArgs
- {
- ///
- /// Indicates if the last submitted password was incorrect
- ///
- public bool LastAttemptWasIncorrect { get; private set; }
-
- ///
- /// Indicates that the login attempt has failed
- ///
- public bool LoginAttemptFailed { get; private set; }
-
- ///
- /// Indicates that the process was cancelled and the prompt should be dismissed
- ///
- public bool LoginAttemptCancelled { get; private set; }
-
- ///
- /// A message to be displayed to the user
- ///
- public string Message { get; private set; }
-
- public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
- {
- LastAttemptWasIncorrect = lastAttemptIncorrect;
- LoginAttemptFailed = loginFailed;
- LoginAttemptCancelled = loginCancelled;
- Message = message;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs
index 0fcf32e9..e922eb0c 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs
@@ -4,7 +4,6 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.Fusion;
using PepperDash.Essentials.Core;
@@ -24,54 +23,4 @@ namespace PepperDash.Essentials.Core
void PowerToggle();
BoolFeedback PowerIsOnFeedback { get; }
}
-
- ///
- /// Adds feedback for current power state
- ///
- public interface IHasPowerControlWithFeedback : IHasPowerControl
- {
- BoolFeedback PowerIsOnFeedback { get; }
- }
-
- ///
- /// Defines the ability to power a device on and off
- ///
- public interface IHasPowerControl
- {
- void PowerOn();
- void PowerOff();
- void PowerToggle();
- }
-
- ///
- ///
- ///
- public static class IHasPowerControlExtensions
- {
- public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
- {
- triList.SetSigFalseAction(101, dev.PowerOn);
- triList.SetSigFalseAction(102, dev.PowerOff);
- triList.SetSigFalseAction(103, dev.PowerToggle);
-
- var fbdev = dev as IHasPowerControlWithFeedback;
- if (fbdev != null)
- {
- fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
- }
- }
-
- public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(101);
- triList.ClearBoolSigAction(102);
- triList.ClearBoolSigAction(103);
-
- var fbdev = dev as IHasPowerControlWithFeedback;
- if (fbdev != null)
- {
- fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
- }
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControls.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControls.cs
index a9a92126..872b3a3b 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControls.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControls.cs
@@ -1,6 +1,4 @@
-using Crestron.SimplSharpPro.DeviceSupport;
-
-using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
@@ -37,19 +35,4 @@ namespace PepperDash.Essentials.Core
void DvrList(bool pressRelease);
void Replay(bool pressRelease);
}
-
- public static class ISetTopBoxControlsExtensions
- {
- public static void LinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
- {
- triList.SetBoolSigAction(136, dev.DvrList);
- triList.SetBoolSigAction(152, dev.Replay);
- }
-
- public static void UnlinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(136);
- triList.ClearBoolSigAction(152);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs
new file mode 100644
index 00000000..19e56872
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxControlsExtensions.cs
@@ -0,0 +1,19 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ public static class ISetTopBoxControlsExtensions
+ {
+ public static void LinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
+ {
+ triList.SetBoolSigAction(136, dev.DvrList);
+ triList.SetBoolSigAction(152, dev.Replay);
+ }
+
+ public static void UnlinkButtons(this ISetTopBoxControls dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(136);
+ triList.ClearBoolSigAction(152);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxNumericKeypad.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxNumericKeypad.cs
new file mode 100644
index 00000000..e0ea31f6
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISetTopBoxNumericKeypad.cs
@@ -0,0 +1,8 @@
+namespace PepperDash.Essentials.Core
+{
+ public interface ISetTopBoxNumericKeypad : INumericKeypad
+ {
+ void Dash(bool pressRelease);
+ void KeypadEnter(bool pressRelease);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransport.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransport.cs
index 1189c10b..896e5bbb 100644
--- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransport.cs
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransport.cs
@@ -1,6 +1,4 @@
-using Crestron.SimplSharpPro.DeviceSupport;
-
-namespace PepperDash.Essentials.Core
+namespace PepperDash.Essentials.Core
{
///
///
@@ -16,38 +14,4 @@ namespace PepperDash.Essentials.Core
void Stop(bool pressRelease);
void Record(bool pressRelease);
}
-
- ///
- ///
- ///
- public static class ITransportExtensions
- {
- ///
- /// Attaches to trilist joins: Play:145, Pause:146, Stop:147, ChapPlus:148, ChapMinus:149, Rewind:150, Ffwd:151, Record:154
- ///
- ///
- public static void LinkButtons(this ITransport dev, BasicTriList triList)
- {
- triList.SetBoolSigAction(145, dev.Play);
- triList.SetBoolSigAction(146, dev.Pause);
- triList.SetBoolSigAction(147, dev.Stop);
- triList.SetBoolSigAction(148, dev.ChapPlus);
- triList.SetBoolSigAction(149, dev.ChapMinus);
- triList.SetBoolSigAction(150, dev.Rewind);
- triList.SetBoolSigAction(151, dev.FFwd);
- triList.SetBoolSigAction(154, dev.Record);
- }
-
- public static void UnlinkButtons(this ITransport dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(145);
- triList.ClearBoolSigAction(146);
- triList.ClearBoolSigAction(147);
- triList.ClearBoolSigAction(148);
- triList.ClearBoolSigAction(149);
- triList.ClearBoolSigAction(150);
- triList.ClearBoolSigAction(151);
- triList.ClearBoolSigAction(154);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransportExtensions.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransportExtensions.cs
new file mode 100644
index 00000000..e15733cd
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ITransportExtensions.cs
@@ -0,0 +1,38 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public static class ITransportExtensions
+ {
+ ///
+ /// Attaches to trilist joins: Play:145, Pause:146, Stop:147, ChapPlus:148, ChapMinus:149, Rewind:150, Ffwd:151, Record:154
+ ///
+ ///
+ public static void LinkButtons(this ITransport dev, BasicTriList triList)
+ {
+ triList.SetBoolSigAction(145, dev.Play);
+ triList.SetBoolSigAction(146, dev.Pause);
+ triList.SetBoolSigAction(147, dev.Stop);
+ triList.SetBoolSigAction(148, dev.ChapPlus);
+ triList.SetBoolSigAction(149, dev.ChapMinus);
+ triList.SetBoolSigAction(150, dev.Rewind);
+ triList.SetBoolSigAction(151, dev.FFwd);
+ triList.SetBoolSigAction(154, dev.Record);
+ }
+
+ public static void UnlinkButtons(this ITransport dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(145);
+ triList.ClearBoolSigAction(146);
+ triList.ClearBoolSigAction(147);
+ triList.ClearBoolSigAction(148);
+ triList.ClearBoolSigAction(149);
+ triList.ClearBoolSigAction(150);
+ triList.ClearBoolSigAction(151);
+ triList.ClearBoolSigAction(154);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/PasswordPromptEventArgs.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/PasswordPromptEventArgs.cs
new file mode 100644
index 00000000..0364b090
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/PasswordPromptEventArgs.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ public class PasswordPromptEventArgs : EventArgs
+ {
+ ///
+ /// Indicates if the last submitted password was incorrect
+ ///
+ public bool LastAttemptWasIncorrect { get; private set; }
+
+ ///
+ /// Indicates that the login attempt has failed
+ ///
+ public bool LoginAttemptFailed { get; private set; }
+
+ ///
+ /// Indicates that the process was cancelled and the prompt should be dismissed
+ ///
+ public bool LoginAttemptCancelled { get; private set; }
+
+ ///
+ /// A message to be displayed to the user
+ ///
+ public string Message { get; private set; }
+
+ public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
+ {
+ LastAttemptWasIncorrect = lastAttemptIncorrect;
+ LoginAttemptFailed = loginFailed;
+ LoginAttemptCancelled = loginCancelled;
+ Message = message;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ApiAttribute.cs b/src/PepperDash.Essentials.Core/Devices/ApiAttribute.cs
new file mode 100644
index 00000000..eefa13e8
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/ApiAttribute.cs
@@ -0,0 +1,11 @@
+using System;
+using Crestron.SimplSharp.Reflection;
+
+namespace PepperDash.Essentials.Core
+{
+ [AttributeUsage(AttributeTargets.All)]
+ public class ApiAttribute : CAttribute
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/AudioInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/AudioChangeEventArgs.cs
similarity index 85%
rename from src/PepperDash.Essentials.Core/Devices/AudioInterfaces.cs
rename to src/PepperDash.Essentials.Core/Devices/AudioChangeEventArgs.cs
index 90aa4909..7efaa71c 100644
--- a/src/PepperDash.Essentials.Core/Devices/AudioInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/AudioChangeEventArgs.cs
@@ -8,13 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
{
-
- public enum AudioChangeType
- {
- Mute, Volume
- }
-
- public class AudioChangeEventArgs
+ public class AudioChangeEventArgs
{
public AudioChangeType ChangeType { get; private set; }
public IBasicVolumeControls AudioDevice { get; private set; }
diff --git a/src/PepperDash.Essentials.Core/Devices/AudioChangeType.cs b/src/PepperDash.Essentials.Core/Devices/AudioChangeType.cs
new file mode 100644
index 00000000..28b54d63
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/AudioChangeType.cs
@@ -0,0 +1,7 @@
+namespace PepperDash.Essentials.Core
+{
+ public enum AudioChangeType
+ {
+ Mute, Volume
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ChangeType.cs b/src/PepperDash.Essentials.Core/Devices/ChangeType.cs
new file mode 100644
index 00000000..6f1b7eb9
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/ChangeType.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public enum ChangeType
+ {
+ WillChange, DidChange
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/CodecInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/CodecInterfaces.cs
deleted file mode 100644
index afb1da17..00000000
--- a/src/PepperDash.Essentials.Core/Devices/CodecInterfaces.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-
-namespace PepperDash.Essentials.Core
-{
- ///
- /// Adds control of codec receive volume
- ///
- public interface IReceiveVolume
- {
- // Break this out into 3 interfaces
- void SetReceiveVolume(ushort level);
- void ReceiveMuteOn();
- void ReceiveMuteOff();
- void ReceiveMuteToggle();
- IntFeedback ReceiveLevelFeedback { get; }
- BoolFeedback ReceiveMuteIsOnFeedback { get; }
- }
-
- ///
- /// Adds control of codec transmit volume
- ///
- public interface ITransmitVolume
- {
- void SetTransmitVolume(ushort level);
- void TransmitMuteOn();
- void TransmitMuteOff();
- void TransmitMuteToggle();
- IntFeedback TransmitLevelFeedback { get; }
- BoolFeedback TransmitMuteIsOnFeedback { get; }
- }
-
- ///
- /// Adds control of codec privacy function (microphone mute)
- ///
- public interface IPrivacy
- {
- void PrivacyModeOn();
- void PrivacyModeOff();
- void PrivacyModeToggle();
- BoolFeedback PrivacyModeIsOnFeedback { get; }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ConfigSnippetAttribute.cs b/src/PepperDash.Essentials.Core/Devices/ConfigSnippetAttribute.cs
new file mode 100644
index 00000000..dde6ffd1
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/ConfigSnippetAttribute.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
+ public class ConfigSnippetAttribute : Attribute
+ {
+ private string _ConfigSnippet;
+
+ public ConfigSnippetAttribute(string configSnippet)
+ {
+ //Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
+ _ConfigSnippet = configSnippet;
+ }
+
+ public string ConfigSnippet
+ {
+ get { return _ConfigSnippet; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/DescriptionAttribute.cs b/src/PepperDash.Essentials.Core/Devices/DescriptionAttribute.cs
new file mode 100644
index 00000000..14b85388
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/DescriptionAttribute.cs
@@ -0,0 +1,21 @@
+using System;
+
+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; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceActionWrapper.cs b/src/PepperDash.Essentials.Core/Devices/DeviceActionWrapper.cs
new file mode 100644
index 00000000..b6f46ab9
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/DeviceActionWrapper.cs
@@ -0,0 +1,9 @@
+namespace PepperDash.Essentials.Core
+{
+ public class DeviceActionWrapper
+ {
+ public string DeviceKey { get; set; }
+ public string MethodName { get; set; }
+ public object[] Params { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs
index dafda2a9..74b91dbd 100644
--- a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs
+++ b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs
@@ -295,77 +295,5 @@ namespace PepperDash.Essentials.Core
}
- }
-
- public class DeviceActionWrapper
- {
- public string DeviceKey { get; set; }
- public string MethodName { get; set; }
- public object[] Params { get; set; }
- }
-
- public class PropertyNameType
- {
- object Parent;
-
- [JsonIgnore]
- public PropertyInfo PropInfo { get; private set; }
- public string Name { get { return PropInfo.Name; } }
- public string Type { get { return PropInfo.PropertyType.Name; } }
- public string Value { get
- {
- if (PropInfo.CanRead)
- {
- try
- {
- return PropInfo.GetValue(Parent, null).ToString();
- }
- catch (Exception)
- {
- return null;
- }
- }
- else
- return null;
- } }
-
- public bool CanRead { get { return PropInfo.CanRead; } }
- public bool CanWrite { get { return PropInfo.CanWrite; } }
-
-
- public PropertyNameType(PropertyInfo info, object parent)
- {
- PropInfo = info;
- Parent = parent;
- }
- }
-
- public class MethodNameParams
- {
- [JsonIgnore]
- public MethodInfo MethodInfo { get; private set; }
-
- public string Name { get { return MethodInfo.Name; } }
- public IEnumerable Params { get {
- return MethodInfo.GetParameters().Select(p =>
- new NameType { Name = p.Name, Type = p.ParameterType.Name });
- } }
-
- public MethodNameParams(MethodInfo info)
- {
- MethodInfo = info;
- }
- }
-
- public class NameType
- {
- public string Name { get; set; }
- public string Type { get; set; }
- }
-
- [AttributeUsage(AttributeTargets.All)]
- public class ApiAttribute : CAttribute
- {
-
}
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceUsageEventArgs.cs b/src/PepperDash.Essentials.Core/Devices/DeviceUsageEventArgs.cs
new file mode 100644
index 00000000..2b0b5cd4
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/DeviceUsageEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ public class DeviceUsageEventArgs : EventArgs
+ {
+ public DateTime UsageEndTime { get; set; }
+ public int MinutesUsed { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
index bc8af721..b79d0d45 100644
--- a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
+++ b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs
@@ -1,12 +1,10 @@
using System;
-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;
namespace PepperDash.Essentials.Core
{
@@ -49,97 +47,4 @@ 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 Config Snippet {0}", configSnippet);
- _ConfigSnippet = configSnippet;
- }
-
- public string ConfigSnippet
- {
- get { return _ConfigSnippet; }
- }
- }
-
- ///
- /// Devices the basic needs for a Device Factory
- ///
- public abstract class EssentialsDeviceFactory : IDeviceFactory where T:EssentialsDevice
- {
- #region IDeviceFactory Members
-
- ///
- /// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
- ///
- public List TypeNames { get; protected set; }
-
- ///
- /// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
- ///
- public void LoadTypeFactories()
- {
- foreach (var typeName in TypeNames)
- {
- //Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
- var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
- string description = descriptionAttribute[0].Description;
- var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
- DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
- }
- }
-
- ///
- /// The method that will build the device
- ///
- /// The device config
- /// An instance of the device
- public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
-
- #endregion
- }
-
- ///
- /// Devices the basic needs for a Device Factory
- ///
- public abstract class EssentialsPluginDeviceFactory : EssentialsDeviceFactory, IPluginDeviceFactory where T : EssentialsDevice
- {
- ///
- /// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
- ///
- public string MinimumEssentialsFrameworkVersion { get; protected set; }
- }
-
- public abstract class EssentialsPluginDevelopmentDeviceFactory : EssentialsDeviceFactory, IPluginDevelopmentDeviceFactory where T : EssentialsDevice
- {
- ///
- /// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
- ///
- public string MinimumEssentialsFrameworkVersion { get; protected set; }
-
- public List DevelopmentEssentialsFrameworkVersions { get; protected set; }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsDeviceFactory.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsDeviceFactory.cs
new file mode 100644
index 00000000..89e5169f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/EssentialsDeviceFactory.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Devices the basic needs for a Device Factory
+ ///
+ public abstract class EssentialsDeviceFactory : IDeviceFactory where T:EssentialsDevice
+ {
+ #region IDeviceFactory Members
+
+ ///
+ /// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
+ ///
+ public List TypeNames { get; protected set; }
+
+ ///
+ /// Loads an item to the DeviceFactory.FactoryMethods dictionary for each entry in the TypeNames list
+ ///
+ public void LoadTypeFactories()
+ {
+ foreach (var typeName in TypeNames)
+ {
+ //Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
+ var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
+ string description = descriptionAttribute[0].Description;
+ var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
+ DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
+ }
+ }
+
+ ///
+ /// The method that will build the device
+ ///
+ /// The device config
+ /// An instance of the device
+ public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDevelopmentDeviceFactory.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDevelopmentDeviceFactory.cs
new file mode 100644
index 00000000..bb5281c6
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDevelopmentDeviceFactory.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ public abstract class EssentialsPluginDevelopmentDeviceFactory : EssentialsDeviceFactory, IPluginDevelopmentDeviceFactory where T : EssentialsDevice
+ {
+ ///
+ /// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
+ ///
+ public string MinimumEssentialsFrameworkVersion { get; protected set; }
+
+ public List DevelopmentEssentialsFrameworkVersions { get; protected set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDeviceFactory.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDeviceFactory.cs
new file mode 100644
index 00000000..d74bda2f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/EssentialsPluginDeviceFactory.cs
@@ -0,0 +1,13 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Devices the basic needs for a Device Factory
+ ///
+ public abstract class EssentialsPluginDeviceFactory : EssentialsDeviceFactory, IPluginDeviceFactory where T : EssentialsDevice
+ {
+ ///
+ /// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
+ ///
+ public string MinimumEssentialsFrameworkVersion { get; protected set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs b/src/PepperDash.Essentials.Core/Devices/GenericCommunicationMonitoredDevice.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs
rename to src/PepperDash.Essentials.Core/Devices/GenericCommunicationMonitoredDevice.cs
diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
index 3c35b686..889dead6 100644
--- a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
+++ b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs
@@ -1,13 +1,11 @@
extern alias Full;
using System;
-using System.Collections.Generic;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.Devices
{
@@ -110,31 +108,4 @@ namespace PepperDash.Essentials.Core.Devices
_port.PressRelease(command, pressRelease);
}
}
-
- public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
- {
- public GenericIrControllerJoinMap(uint joinStart) : base(joinStart)
- {
- }
- }
-
- public class GenericIrControllerFactory : EssentialsDeviceFactory
- {
- public GenericIrControllerFactory()
- {
- TypeNames = new List {"genericIrController"};
- }
- #region Overrides of EssentialsDeviceFactory
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new Generic IR Controller Device");
-
- var irPort = IRPortHelper.GetIrOutputPortController(dc);
-
- return new GenericIrController(dc.Key, dc.Name, irPort);
- }
-
- #endregion
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIrControllerFactory.cs b/src/PepperDash.Essentials.Core/Devices/GenericIrControllerFactory.cs
new file mode 100644
index 00000000..68ba7860
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/GenericIrControllerFactory.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Devices
+{
+ public class GenericIrControllerFactory : EssentialsDeviceFactory
+ {
+ public GenericIrControllerFactory()
+ {
+ TypeNames = new List {"genericIrController"};
+ }
+ #region Overrides of EssentialsDeviceFactory
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Generic IR Controller Device");
+
+ var irPort = IRPortHelper.GetIrOutputPortController(dc);
+
+ return new GenericIrController(dc.Key, dc.Name, irPort);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIrControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Devices/GenericIrControllerJoinMap.cs
new file mode 100644
index 00000000..3d86d32c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/GenericIrControllerJoinMap.cs
@@ -0,0 +1,9 @@
+namespace PepperDash.Essentials.Core.Devices
+{
+ public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
+ {
+ public GenericIrControllerJoinMap(uint joinStart) : base(joinStart)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IAttachVideoStatus.cs b/src/PepperDash.Essentials.Core/Devices/IAttachVideoStatus.cs
new file mode 100644
index 00000000..32e8e32a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IAttachVideoStatus.cs
@@ -0,0 +1,12 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Describes a device that can have a video sync providing device attached to it
+ ///
+ public interface IAttachVideoStatus : IKeyed
+ {
+ // Extension methods will depend on this
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IAudioZone.cs b/src/PepperDash.Essentials.Core/Devices/IAudioZone.cs
new file mode 100644
index 00000000..5f0f785c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IAudioZone.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines minimum functionality for an audio zone
+ ///
+ public interface IAudioZone : IBasicVolumeWithFeedback
+ {
+ void SelectInput(ushort input);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IAudioZones.cs b/src/PepperDash.Essentials.Core/Devices/IAudioZones.cs
new file mode 100644
index 00000000..d157b716
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IAudioZones.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Identifies a device that contains audio zones
+ ///
+ public interface IAudioZones : IRouting
+ {
+ Dictionary Zone { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IProjectorInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/IBasicVideoMute.cs
similarity index 56%
rename from src/PepperDash.Essentials.Core/Devices/IProjectorInterfaces.cs
rename to src/PepperDash.Essentials.Core/Devices/IBasicVideoMute.cs
index c0cb33ed..bcb45a65 100644
--- a/src/PepperDash.Essentials.Core/Devices/IProjectorInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IBasicVideoMute.cs
@@ -10,13 +10,4 @@ namespace PepperDash.Essentials.Core
{
void VideoMuteToggle();
}
-
- public interface IBasicVideoMuteWithFeedback : IBasicVideoMute
- {
- BoolFeedback VideoMuteIsOn { get; }
-
- void VideoMuteOn();
- void VideoMuteOff();
-
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IBasicVideoMuteWithFeedback.cs b/src/PepperDash.Essentials.Core/Devices/IBasicVideoMuteWithFeedback.cs
new file mode 100644
index 00000000..67dc21a7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IBasicVideoMuteWithFeedback.cs
@@ -0,0 +1,11 @@
+namespace PepperDash.Essentials.Core
+{
+ public interface IBasicVideoMuteWithFeedback : IBasicVideoMute
+ {
+ BoolFeedback VideoMuteIsOn { get; }
+
+ void VideoMuteOn();
+ void VideoMuteOff();
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IBasicVolumeControls.cs b/src/PepperDash.Essentials.Core/Devices/IBasicVolumeControls.cs
new file mode 100644
index 00000000..58dc3b9f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IBasicVolumeControls.cs
@@ -0,0 +1,16 @@
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines minimal volume and mute control methods
+ ///
+ public interface IBasicVolumeControls
+ {
+ void VolumeUp(bool pressRelease);
+ void VolumeDown(bool pressRelease);
+ void MuteToggle();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IBasicVolumeWithFeedback.cs b/src/PepperDash.Essentials.Core/Devices/IBasicVolumeWithFeedback.cs
new file mode 100644
index 00000000..dc31378f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IBasicVolumeWithFeedback.cs
@@ -0,0 +1,14 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds feedback and direct volume level set to IBasicVolumeControls
+ ///
+ public interface IBasicVolumeWithFeedback : IBasicVolumeControls
+ {
+ BoolFeedback MuteFeedback { get; }
+ void MuteOn();
+ void MuteOff();
+ void SetVolume(ushort level);
+ IntFeedback VolumeLevelFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IDisplayUsage.cs b/src/PepperDash.Essentials.Core/Devices/IDisplayUsage.cs
new file mode 100644
index 00000000..6384e789
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IDisplayUsage.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// For display classes that can provide usage data
+ ///
+ public interface IDisplayUsage
+ {
+ IntFeedback LampHours { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IDspPreset.cs b/src/PepperDash.Essentials.Core/Devices/IDspPreset.cs
index 645339bb..10258bde 100644
--- a/src/PepperDash.Essentials.Core/Devices/IDspPreset.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IDspPreset.cs
@@ -1,15 +1,5 @@
-using System.Collections.Generic;
-
-namespace PepperDash.Essentials.Core
+namespace PepperDash.Essentials.Core
{
- public interface IHasDspPresets
- {
- List Presets { get; }
-
- void RecallPreset(IDspPreset preset);
-
- }
-
public interface IDspPreset
{
string Name { get; }
diff --git a/src/PepperDash.Essentials.Core/Devices/IFullAudioSettings.cs b/src/PepperDash.Essentials.Core/Devices/IFullAudioSettings.cs
new file mode 100644
index 00000000..0fc6111a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IFullAudioSettings.cs
@@ -0,0 +1,41 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public interface IFullAudioSettings : IBasicVolumeWithFeedback
+ {
+ void SetBalance(ushort level);
+ void BalanceLeft(bool pressRelease);
+ void BalanceRight(bool pressRelease);
+
+ void SetBass(ushort level);
+ void BassUp(bool pressRelease);
+ void BassDown(bool pressRelease);
+
+ void SetTreble(ushort level);
+ void TrebleUp(bool pressRelease);
+ void TrebleDown(bool pressRelease);
+
+ bool hasMaxVolume { get; }
+ void SetMaxVolume(ushort level);
+ void MaxVolumeUp(bool pressRelease);
+ void MaxVolumeDown(bool pressRelease);
+
+ bool hasDefaultVolume { get; }
+ void SetDefaultVolume(ushort level);
+ void DefaultVolumeUp(bool pressRelease);
+ void DefaultVolumeDown(bool pressRelease);
+
+ void LoudnessToggle();
+ void MonoToggle();
+
+ BoolFeedback LoudnessFeedback { get; }
+ BoolFeedback MonoFeedback { get; }
+ IntFeedback BalanceFeedback { get; }
+ IntFeedback BassFeedback { get; }
+ IntFeedback TrebleFeedback { get; }
+ IntFeedback MaxVolumeFeedback { get; }
+ IntFeedback DefaultVolumeFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasControlledPowerOutlets.cs b/src/PepperDash.Essentials.Core/Devices/IHasControlledPowerOutlets.cs
new file mode 100644
index 00000000..eb965cf1
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasControlledPowerOutlets.cs
@@ -0,0 +1,17 @@
+using Crestron.SimplSharp;
+using PepperDash.Core;
+
+namespace PepperDash_Essentials_Core.Devices
+{
+ ///
+ /// Interface for any device that contains a collection of IHasPowerReboot Devices
+ ///
+ public interface IHasControlledPowerOutlets : IKeyName
+ {
+ ///
+ /// Collection of IPduOutlets
+ ///
+ ReadOnlyDictionary PduOutlets { get; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasCurrentVolumeControls.cs b/src/PepperDash.Essentials.Core/Devices/IHasCurrentVolumeControls.cs
new file mode 100644
index 00000000..dbe266fd
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasCurrentVolumeControls.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// A class that implements this contains a reference to a current IBasicVolumeControls device.
+ /// The class may have multiple IBasicVolumeControls.
+ ///
+ public interface IHasCurrentVolumeControls
+ {
+ IBasicVolumeControls CurrentVolumeControls { get; }
+ event EventHandler CurrentVolumeDeviceChange;
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasDspPresets.cs b/src/PepperDash.Essentials.Core/Devices/IHasDspPresets.cs
new file mode 100644
index 00000000..e1e697f5
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasDspPresets.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasDspPresets
+ {
+ List Presets { get; }
+
+ void RecallPreset(IDspPreset preset);
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasFeedback.cs b/src/PepperDash.Essentials.Core/Devices/IHasFeedback.cs
new file mode 100644
index 00000000..e755c7f4
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasFeedback.cs
@@ -0,0 +1,14 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ FeedbackCollection Feedbacks { get; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs b/src/PepperDash.Essentials.Core/Devices/IHasFeedbackExtensions.cs
similarity index 84%
rename from src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs
rename to src/PepperDash.Essentials.Core/Devices/IHasFeedbackExtensions.cs
index cc5e1054..54209bab 100644
--- a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IHasFeedbackExtensions.cs
@@ -7,18 +7,7 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
- public interface IHasFeedback : IKeyed
- {
- ///
- /// This method shall return a list of all Output objects on a device,
- /// including all "aggregate" devices.
- ///
- FeedbackCollection Feedbacks { get; }
-
- }
-
-
- public static class IHasFeedbackExtensions
+ public static class IHasFeedbackExtensions
{
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
{
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasMuteControl.cs b/src/PepperDash.Essentials.Core/Devices/IHasMuteControl.cs
new file mode 100644
index 00000000..1e29be69
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasMuteControl.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines basic mute control methods
+ ///
+ public interface IHasMuteControl
+ {
+ void MuteToggle();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasMuteControlWithFeedback.cs b/src/PepperDash.Essentials.Core/Devices/IHasMuteControlWithFeedback.cs
new file mode 100644
index 00000000..b8c9a456
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasMuteControlWithFeedback.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines mute control methods and properties with feedback
+ ///
+ public interface IHasMuteControlWithFeedback : IHasMuteControl
+ {
+ BoolFeedback MuteFeedback { get; }
+ void MuteOn();
+ void MuteOff();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/IHasPowerCycle.cs
similarity index 62%
rename from src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs
rename to src/PepperDash.Essentials.Core/Devices/IHasPowerCycle.cs
index 0f3b3fbf..f5bec208 100644
--- a/src/PepperDash.Essentials.Core/Devices/PduInterfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IHasPowerCycle.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -20,16 +19,4 @@ namespace PepperDash_Essentials_Core.Devices
///
void PowerCycle();
}
-
- ///
- /// Interface for any device that contains a collection of IHasPowerReboot Devices
- ///
- public interface IHasControlledPowerOutlets : IKeyName
- {
- ///
- /// Collection of IPduOutlets
- ///
- ReadOnlyDictionary PduOutlets { get; }
-
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasVolumeControl.cs b/src/PepperDash.Essentials.Core/Devices/IHasVolumeControl.cs
new file mode 100644
index 00000000..7199ded8
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasVolumeControl.cs
@@ -0,0 +1,11 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines basic volume control methods
+ ///
+ public interface IHasVolumeControl
+ {
+ void VolumeUp(bool pressRelease);
+ void VolumeDown(bool pressRelease);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasVolumeControlWithFeedback.cs b/src/PepperDash.Essentials.Core/Devices/IHasVolumeControlWithFeedback.cs
new file mode 100644
index 00000000..1356785d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasVolumeControlWithFeedback.cs
@@ -0,0 +1,11 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines volume control methods and properties with feedback
+ ///
+ public interface IHasVolumeControlWithFeedback : IHasVolumeControl
+ {
+ void SetVolume(ushort level);
+ IntFeedback VolumeLevelFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IHasVolumeDevice.cs b/src/PepperDash.Essentials.Core/Devices/IHasVolumeDevice.cs
new file mode 100644
index 00000000..366a3c0e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IHasVolumeDevice.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// A class that implements this, contains a reference to an IBasicVolumeControls device.
+ /// For example, speakers attached to an audio zone. The speakers can provide reference
+ /// to their linked volume control.
+ ///
+ public interface IHasVolumeDevice
+ {
+ IBasicVolumeControls VolumeDevice { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IMakeModel.cs b/src/PepperDash.Essentials.Core/Devices/IMakeModel.cs
new file mode 100644
index 00000000..bc39a1b7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IMakeModel.cs
@@ -0,0 +1,10 @@
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IMakeModel : IKeyed
+ {
+ string DeviceMake { get; }
+ string DeviceModel { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/FIND HOMES Interfaces.cs b/src/PepperDash.Essentials.Core/Devices/IOnline.cs
similarity index 59%
rename from src/PepperDash.Essentials.Core/Devices/FIND HOMES Interfaces.cs
rename to src/PepperDash.Essentials.Core/Devices/IOnline.cs
index 318f5179..06ae4cff 100644
--- a/src/PepperDash.Essentials.Core/Devices/FIND HOMES Interfaces.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IOnline.cs
@@ -6,8 +6,6 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
-using PepperDash.Core;
-
namespace PepperDash.Essentials.Core
{
@@ -31,26 +29,4 @@ namespace PepperDash.Essentials.Core
//{
// IComPorts ComPortsDevice { get; }
//}
-
- ///
- /// Describes a device that can have a video sync providing device attached to it
- ///
- public interface IAttachVideoStatus : IKeyed
- {
- // Extension methods will depend on this
- }
-
- ///
- /// For display classes that can provide usage data
- ///
- public interface IDisplayUsage
- {
- IntFeedback LampHours { get; }
- }
-
- public interface IMakeModel : IKeyed
- {
- string DeviceMake { get; }
- string DeviceModel { get; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IPrivacy.cs b/src/PepperDash.Essentials.Core/Devices/IPrivacy.cs
new file mode 100644
index 00000000..81ad3a10
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IPrivacy.cs
@@ -0,0 +1,13 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds control of codec privacy function (microphone mute)
+ ///
+ public interface IPrivacy
+ {
+ void PrivacyModeOn();
+ void PrivacyModeOff();
+ void PrivacyModeToggle();
+ BoolFeedback PrivacyModeIsOnFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IReceiveVolume.cs b/src/PepperDash.Essentials.Core/Devices/IReceiveVolume.cs
new file mode 100644
index 00000000..bcbf063a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/IReceiveVolume.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds control of codec receive volume
+ ///
+ public interface IReceiveVolume
+ {
+ // Break this out into 3 interfaces
+ void SetReceiveVolume(ushort level);
+ void ReceiveMuteOn();
+ void ReceiveMuteOff();
+ void ReceiveMuteToggle();
+ IntFeedback ReceiveLevelFeedback { get; }
+ BoolFeedback ReceiveMuteIsOnFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ITransmitVolume.cs b/src/PepperDash.Essentials.Core/Devices/ITransmitVolume.cs
new file mode 100644
index 00000000..1a890279
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/ITransmitVolume.cs
@@ -0,0 +1,15 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Adds control of codec transmit volume
+ ///
+ public interface ITransmitVolume
+ {
+ void SetTransmitVolume(ushort level);
+ void TransmitMuteOn();
+ void TransmitMuteOff();
+ void TransmitMuteToggle();
+ IntFeedback TransmitLevelFeedback { get; }
+ BoolFeedback TransmitMuteIsOnFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IUsageTracking.cs b/src/PepperDash.Essentials.Core/Devices/IUsageTracking.cs
index 05b59366..d83fd20e 100644
--- a/src/PepperDash.Essentials.Core/Devices/IUsageTracking.cs
+++ b/src/PepperDash.Essentials.Core/Devices/IUsageTracking.cs
@@ -1,9 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
-using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
@@ -19,86 +17,4 @@ namespace PepperDash.Essentials.Core
// device.UsageTracker = new UsageTracking();
// }
//}
-
- public class UsageTracking
- {
- public event EventHandler DeviceUsageEnded;
-
- public InUseTracking InUseTracker { get; protected set; }
-
- public bool UsageIsTracked { get; set; }
-
- public bool UsageTrackingStarted { get; protected set; }
- public DateTime UsageStartTime { get; protected set; }
- public DateTime UsageEndTime { get; protected set; }
-
- public Device Parent { get; private set; }
-
- public UsageTracking(Device parent)
- {
- Parent = parent;
-
- InUseTracker = new InUseTracking();
-
- InUseTracker.InUseFeedback.OutputChange += InUseFeedback_OutputChange; //new EventHandler();
- }
-
- void InUseFeedback_OutputChange(object sender, EventArgs e)
- {
- if(InUseTracker.InUseFeedback.BoolValue)
- {
- StartDeviceUsage();
- }
- else
- {
- EndDeviceUsage();
- }
- }
-
-
- ///
- /// Stores the usage start time
- ///
- public void StartDeviceUsage()
- {
- UsageTrackingStarted = true;
- UsageStartTime = DateTime.Now;
- }
-
- ///
- /// Calculates the difference between the usage start and end times, gets the total minutes used and fires an event to pass that info to a consumer
- ///
- public void EndDeviceUsage()
- {
- try
- {
- UsageTrackingStarted = false;
-
- UsageEndTime = DateTime.Now;
-
- if (UsageStartTime != null)
- {
- var timeUsed = UsageEndTime - UsageStartTime;
-
- var handler = DeviceUsageEnded;
-
- if (handler != null)
- {
- Debug.Console(1, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
- handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
- }
- }
- }
- catch (Exception e)
- {
- Debug.Console(1, "Error ending device usage: {0}", e);
- }
- }
- }
-
- public class DeviceUsageEventArgs : EventArgs
- {
- public DateTime UsageEndTime { get; set; }
- public int MinutesUsed { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs b/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs
deleted file mode 100644
index c8a5df39..00000000
--- a/src/PepperDash.Essentials.Core/Devices/IVolumeAndAudioInterfaces.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-
-namespace PepperDash.Essentials.Core
-{
- ///
- /// Defines minimal volume and mute control methods
- ///
- public interface IBasicVolumeControls
- {
- void VolumeUp(bool pressRelease);
- void VolumeDown(bool pressRelease);
- void MuteToggle();
- }
-
- ///
- /// Defines basic volume control methods
- ///
- public interface IHasVolumeControl
- {
- void VolumeUp(bool pressRelease);
- void VolumeDown(bool pressRelease);
- }
-
- ///
- /// Defines volume control methods and properties with feedback
- ///
- public interface IHasVolumeControlWithFeedback : IHasVolumeControl
- {
- void SetVolume(ushort level);
- IntFeedback VolumeLevelFeedback { get; }
- }
-
- ///
- /// Defines basic mute control methods
- ///
- public interface IHasMuteControl
- {
- void MuteToggle();
- }
-
- ///
- /// Defines mute control methods and properties with feedback
- ///
- public interface IHasMuteControlWithFeedback : IHasMuteControl
- {
- BoolFeedback MuteFeedback { get; }
- void MuteOn();
- void MuteOff();
- }
-
- ///
- /// Adds feedback and direct volume level set to IBasicVolumeControls
- ///
- public interface IBasicVolumeWithFeedback : IBasicVolumeControls
- {
- BoolFeedback MuteFeedback { get; }
- void MuteOn();
- void MuteOff();
- void SetVolume(ushort level);
- IntFeedback VolumeLevelFeedback { get; }
- }
-
- ///
- /// A class that implements this contains a reference to a current IBasicVolumeControls device.
- /// The class may have multiple IBasicVolumeControls.
- ///
- public interface IHasCurrentVolumeControls
- {
- IBasicVolumeControls CurrentVolumeControls { get; }
- event EventHandler CurrentVolumeDeviceChange;
- }
-
-
- ///
- ///
- ///
- public interface IFullAudioSettings : IBasicVolumeWithFeedback
- {
- void SetBalance(ushort level);
- void BalanceLeft(bool pressRelease);
- void BalanceRight(bool pressRelease);
-
- void SetBass(ushort level);
- void BassUp(bool pressRelease);
- void BassDown(bool pressRelease);
-
- void SetTreble(ushort level);
- void TrebleUp(bool pressRelease);
- void TrebleDown(bool pressRelease);
-
- bool hasMaxVolume { get; }
- void SetMaxVolume(ushort level);
- void MaxVolumeUp(bool pressRelease);
- void MaxVolumeDown(bool pressRelease);
-
- bool hasDefaultVolume { get; }
- void SetDefaultVolume(ushort level);
- void DefaultVolumeUp(bool pressRelease);
- void DefaultVolumeDown(bool pressRelease);
-
- void LoudnessToggle();
- void MonoToggle();
-
- BoolFeedback LoudnessFeedback { get; }
- BoolFeedback MonoFeedback { get; }
- IntFeedback BalanceFeedback { get; }
- IntFeedback BassFeedback { get; }
- IntFeedback TrebleFeedback { get; }
- IntFeedback MaxVolumeFeedback { get; }
- IntFeedback DefaultVolumeFeedback { get; }
- }
-
- ///
- /// A class that implements this, contains a reference to an IBasicVolumeControls device.
- /// For example, speakers attached to an audio zone. The speakers can provide reference
- /// to their linked volume control.
- ///
- public interface IHasVolumeDevice
- {
- IBasicVolumeControls VolumeDevice { get; }
- }
-
- ///
- /// Identifies a device that contains audio zones
- ///
- public interface IAudioZones : IRouting
- {
- Dictionary Zone { get; }
- }
-
- ///
- /// Defines minimum functionality for an audio zone
- ///
- public interface IAudioZone : IBasicVolumeWithFeedback
- {
- void SelectInput(ushort input);
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/MethodNameParams.cs b/src/PepperDash.Essentials.Core/Devices/MethodNameParams.cs
new file mode 100644
index 00000000..3ba823de
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/MethodNameParams.cs
@@ -0,0 +1,25 @@
+extern alias Full;
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharp.Reflection;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ public class MethodNameParams
+ {
+ [JsonIgnore]
+ public MethodInfo MethodInfo { get; private set; }
+
+ public string Name { get { return MethodInfo.Name; } }
+ public IEnumerable Params { get {
+ return MethodInfo.GetParameters().Select(p =>
+ new NameType { Name = p.Name, Type = p.ParameterType.Name });
+ } }
+
+ public MethodNameParams(MethodInfo info)
+ {
+ MethodInfo = info;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/NameType.cs b/src/PepperDash.Essentials.Core/Devices/NameType.cs
new file mode 100644
index 00000000..14beb894
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/NameType.cs
@@ -0,0 +1,8 @@
+namespace PepperDash.Essentials.Core
+{
+ public class NameType
+ {
+ public string Name { get; set; }
+ public string Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs
index 03e884f0..50e4a667 100644
--- a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs
+++ b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs
@@ -1,12 +1,9 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro;
using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
-using PepperDash.Core;
namespace PepperDash.Essentials.Core.Devices
{
@@ -64,19 +61,4 @@ namespace PepperDash.Essentials.Core.Devices
#endregion
}
-
- public class InRoomPcFactory : EssentialsDeviceFactory
- {
- public InRoomPcFactory()
- {
- TypeNames = new List() { "inroompc" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new InRoomPc Device");
- return new InRoomPc(dc.Key, dc.Name);
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPcFactory.cs b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPcFactory.cs
new file mode 100644
index 00000000..f9c47a81
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPcFactory.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Devices
+{
+ public class InRoomPcFactory : EssentialsDeviceFactory
+ {
+ public InRoomPcFactory()
+ {
+ TypeNames = new List() { "inroompc" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new InRoomPc Device");
+ return new InRoomPc(dc.Key, dc.Name);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs
index a2864d77..2434704f 100644
--- a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs
+++ b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs
@@ -1,12 +1,9 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro;
using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
-using PepperDash.Core;
namespace PepperDash.Essentials.Core.Devices
{
@@ -64,18 +61,4 @@ namespace PepperDash.Essentials.Core.Devices
#endregion
}
-
- public class LaptopFactory : EssentialsDeviceFactory
- {
- public LaptopFactory()
- {
- TypeNames = new List() { "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);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PC/LaptopFactory.cs b/src/PepperDash.Essentials.Core/Devices/PC/LaptopFactory.cs
new file mode 100644
index 00000000..cca7fab6
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/PC/LaptopFactory.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Devices
+{
+ public class LaptopFactory : EssentialsDeviceFactory
+ {
+ public LaptopFactory()
+ {
+ TypeNames = new List() { "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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs b/src/PepperDash.Essentials.Core/Devices/PresentationSourceType.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs
rename to src/PepperDash.Essentials.Core/Devices/PresentationSourceType.cs
diff --git a/src/PepperDash.Essentials.Core/Devices/PropertyNameType.cs b/src/PepperDash.Essentials.Core/Devices/PropertyNameType.cs
new file mode 100644
index 00000000..18aa9e32
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/PropertyNameType.cs
@@ -0,0 +1,43 @@
+extern alias Full;
+using System;
+using Crestron.SimplSharp.Reflection;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ public class PropertyNameType
+ {
+ object Parent;
+
+ [JsonIgnore]
+ public PropertyInfo PropInfo { get; private set; }
+ public string Name { get { return PropInfo.Name; } }
+ public string Type { get { return PropInfo.PropertyType.Name; } }
+ public string Value { get
+ {
+ if (PropInfo.CanRead)
+ {
+ try
+ {
+ return PropInfo.GetValue(Parent, null).ToString();
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+ else
+ return null;
+ } }
+
+ public bool CanRead { get { return PropInfo.CanRead; } }
+ public bool CanWrite { get { return PropInfo.CanWrite; } }
+
+
+ public PropertyNameType(PropertyInfo info, object parent)
+ {
+ PropInfo = info;
+ Parent = parent;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ReconfigurableBridgableDevice.cs b/src/PepperDash.Essentials.Core/Devices/ReconfigurableBridgableDevice.cs
new file mode 100644
index 00000000..12ae0ede
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/ReconfigurableBridgableDevice.cs
@@ -0,0 +1,15 @@
+using Crestron.SimplSharpPro.DeviceSupport;
+using PepperDash.Essentials.Core.Bridges;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Devices
+{
+ public abstract class ReconfigurableBridgableDevice : ReconfigurableDevice, IBridgeAdvanced
+ {
+ protected ReconfigurableBridgableDevice(DeviceConfig config) : base(config)
+ {
+ }
+
+ public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs
index 50bf90bd..b81858d3 100644
--- a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs
+++ b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs
@@ -5,9 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
@@ -67,13 +65,4 @@ namespace PepperDash.Essentials.Core.Devices
ConfigWriter.UpdateDeviceConfig(config);
}
}
-
- public abstract class ReconfigurableBridgableDevice : ReconfigurableDevice, IBridgeAdvanced
- {
- protected ReconfigurableBridgableDevice(DeviceConfig config) : base(config)
- {
- }
-
- public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/SmartObjectBaseTypes.cs b/src/PepperDash.Essentials.Core/Devices/SmartObjectJoinOffsets.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Devices/SmartObjectBaseTypes.cs
rename to src/PepperDash.Essentials.Core/Devices/SmartObjectJoinOffsets.cs
diff --git a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
index 87c66e75..4373f74c 100644
--- a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
+++ b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs
@@ -13,15 +13,7 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
- ///
- ///
- ///
- public enum eSourceListItemType
- {
- Route, Off, Other, SomethingAwesomerThanThese
- }
-
- ///
+ ///
/// Represents an item in a source list - can be deserialized into.
///
public class SourceListItem
@@ -151,28 +143,4 @@ namespace PepperDash.Essentials.Core
}
-
- public class SourceRouteListItem
- {
- [JsonProperty("sourceKey")]
- public string SourceKey { get; set; }
-
- [JsonProperty("destinationKey")]
- public string DestinationKey { get; set; }
-
- [JsonProperty("type")]
- public eRoutingSignalType Type { get; set; }
- }
-
- ///
- /// Defines the valid destination types for SourceListItems in a room
- ///
- public enum eSourceListItemDestinationTypes
- {
- defaultDisplay,
- leftDisplay,
- rightDisplay,
- programAudio,
- codecContent
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/SourceRouteListItem.cs b/src/PepperDash.Essentials.Core/Devices/SourceRouteListItem.cs
new file mode 100644
index 00000000..40233b97
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/SourceRouteListItem.cs
@@ -0,0 +1,17 @@
+extern alias Full;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ public class SourceRouteListItem
+ {
+ [JsonProperty("sourceKey")]
+ public string SourceKey { get; set; }
+
+ [JsonProperty("destinationKey")]
+ public string DestinationKey { get; set; }
+
+ [JsonProperty("type")]
+ public eRoutingSignalType Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/UsageTracking.cs b/src/PepperDash.Essentials.Core/Devices/UsageTracking.cs
new file mode 100644
index 00000000..e0699186
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/UsageTracking.cs
@@ -0,0 +1,81 @@
+using System;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public class UsageTracking
+ {
+ public event EventHandler DeviceUsageEnded;
+
+ public InUseTracking InUseTracker { get; protected set; }
+
+ public bool UsageIsTracked { get; set; }
+
+ public bool UsageTrackingStarted { get; protected set; }
+ public DateTime UsageStartTime { get; protected set; }
+ public DateTime UsageEndTime { get; protected set; }
+
+ public Device Parent { get; private set; }
+
+ public UsageTracking(Device parent)
+ {
+ Parent = parent;
+
+ InUseTracker = new InUseTracking();
+
+ InUseTracker.InUseFeedback.OutputChange += InUseFeedback_OutputChange; //new EventHandler();
+ }
+
+ void InUseFeedback_OutputChange(object sender, EventArgs e)
+ {
+ if(InUseTracker.InUseFeedback.BoolValue)
+ {
+ StartDeviceUsage();
+ }
+ else
+ {
+ EndDeviceUsage();
+ }
+ }
+
+
+ ///
+ /// Stores the usage start time
+ ///
+ public void StartDeviceUsage()
+ {
+ UsageTrackingStarted = true;
+ UsageStartTime = DateTime.Now;
+ }
+
+ ///
+ /// Calculates the difference between the usage start and end times, gets the total minutes used and fires an event to pass that info to a consumer
+ ///
+ public void EndDeviceUsage()
+ {
+ try
+ {
+ UsageTrackingStarted = false;
+
+ UsageEndTime = DateTime.Now;
+
+ if (UsageStartTime != null)
+ {
+ var timeUsed = UsageEndTime - UsageStartTime;
+
+ var handler = DeviceUsageEnded;
+
+ if (handler != null)
+ {
+ Debug.Console(1, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
+ handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.Console(1, "Error ending device usage: {0}", e);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/VolumeDeviceChangeEventArgs.cs b/src/PepperDash.Essentials.Core/Devices/VolumeDeviceChangeEventArgs.cs
index 2171cb73..f4889956 100644
--- a/src/PepperDash.Essentials.Core/Devices/VolumeDeviceChangeEventArgs.cs
+++ b/src/PepperDash.Essentials.Core/Devices/VolumeDeviceChangeEventArgs.cs
@@ -25,12 +25,4 @@ namespace PepperDash.Essentials.Core
Type = type;
}
}
-
- ///
- ///
- ///
- public enum ChangeType
- {
- WillChange, DidChange
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/eSourceListItemDestinationTypes.cs b/src/PepperDash.Essentials.Core/Devices/eSourceListItemDestinationTypes.cs
new file mode 100644
index 00000000..c3c4ee28
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/eSourceListItemDestinationTypes.cs
@@ -0,0 +1,14 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Defines the valid destination types for SourceListItems in a room
+ ///
+ public enum eSourceListItemDestinationTypes
+ {
+ defaultDisplay,
+ leftDisplay,
+ rightDisplay,
+ programAudio,
+ codecContent
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Devices/eSourceListItemType.cs b/src/PepperDash.Essentials.Core/Devices/eSourceListItemType.cs
new file mode 100644
index 00000000..a4f10c65
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Devices/eSourceListItemType.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public enum eSourceListItemType
+ {
+ Route, Off, Other, SomethingAwesomerThanThese
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs
index 7a8eb8b1..570d1f0b 100644
--- a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs
+++ b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -8,7 +7,6 @@ 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;
@@ -216,27 +214,4 @@ namespace PepperDash.Essentials.Core
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
-
- public class BasicIrDisplayFactory : EssentialsDeviceFactory
- {
- public BasicIrDisplayFactory()
- {
- TypeNames = new List() { "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;
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/BasicIrDisplayFactory.cs b/src/PepperDash.Essentials.Core/Display/BasicIrDisplayFactory.cs
new file mode 100644
index 00000000..8035798e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Display/BasicIrDisplayFactory.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class BasicIrDisplayFactory : EssentialsDeviceFactory
+ {
+ public BasicIrDisplayFactory()
+ {
+ TypeNames = new List() { "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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs
index a8de2796..d133bada 100644
--- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs
+++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs
@@ -259,70 +259,4 @@ namespace PepperDash.Essentials.Core
}
}
-
- ///
- ///
- ///
- public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
- {
- public StringFeedback CurrentInputFeedback { get; private set; }
-
- abstract protected Func CurrentInputFeedbackFunc { get; }
-
- public override BoolFeedback PowerIsOnFeedback { get; protected set; }
-
- abstract protected Func PowerIsOnFeedbackFunc { get; }
-
-
- public static MockDisplay DefaultDisplay
- {
- get
- {
- if (_DefaultDisplay == null)
- _DefaultDisplay = new MockDisplay("default", "Default Display");
- return _DefaultDisplay;
- }
- }
- static MockDisplay _DefaultDisplay;
-
- public TwoWayDisplayBase(string key, string name)
- : base(key, name)
- {
- CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
-
- WarmupTime = 7000;
- CooldownTime = 15000;
-
- PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
-
- Feedbacks.Add(CurrentInputFeedback);
- Feedbacks.Add(PowerIsOnFeedback);
-
- PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
-
- }
-
- void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
- {
- if (UsageTracker != null)
- {
- if (PowerIsOnFeedback.BoolValue)
- UsageTracker.StartDeviceUsage();
- else
- UsageTracker.EndDeviceUsage();
- }
- }
-
- public event EventHandler NumericSwitchChange;
-
- ///
- /// Raise an event when the status of a switch object changes.
- ///
- /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
- protected void OnSwitchChange(RoutingNumericEventArgs e)
- {
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs
index d7f36f13..d56ec571 100644
--- a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs
+++ b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -12,7 +11,6 @@ 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
{
@@ -219,19 +217,4 @@ namespace PepperDash.Essentials.Core
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
-
- public class MockDisplayFactory : EssentialsDeviceFactory
- {
- public MockDisplayFactory()
- {
- TypeNames = new List() { "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);
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/MockDisplayFactory.cs b/src/PepperDash.Essentials.Core/Display/MockDisplayFactory.cs
new file mode 100644
index 00000000..4fca7661
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Display/MockDisplayFactory.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class MockDisplayFactory : EssentialsDeviceFactory
+ {
+ public MockDisplayFactory()
+ {
+ TypeNames = new List() { "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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Display/TwoWayDisplayBase.cs b/src/PepperDash.Essentials.Core/Display/TwoWayDisplayBase.cs
new file mode 100644
index 00000000..b8f3bbe1
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Display/TwoWayDisplayBase.cs
@@ -0,0 +1,70 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
+ {
+ public StringFeedback CurrentInputFeedback { get; private set; }
+
+ abstract protected Func CurrentInputFeedbackFunc { get; }
+
+ public override BoolFeedback PowerIsOnFeedback { get; protected set; }
+
+ abstract protected Func PowerIsOnFeedbackFunc { get; }
+
+
+ public static MockDisplay DefaultDisplay
+ {
+ get
+ {
+ if (_DefaultDisplay == null)
+ _DefaultDisplay = new MockDisplay("default", "Default Display");
+ return _DefaultDisplay;
+ }
+ }
+ static MockDisplay _DefaultDisplay;
+
+ public TwoWayDisplayBase(string key, string name)
+ : base(key, name)
+ {
+ CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
+
+ WarmupTime = 7000;
+ CooldownTime = 15000;
+
+ PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
+
+ Feedbacks.Add(CurrentInputFeedback);
+ Feedbacks.Add(PowerIsOnFeedback);
+
+ PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
+
+ }
+
+ void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
+ {
+ if (UsageTracker != null)
+ {
+ if (PowerIsOnFeedback.BoolValue)
+ UsageTracker.StartDeviceUsage();
+ else
+ UsageTracker.EndDeviceUsage();
+ }
+ }
+
+ public event EventHandler NumericSwitchChange;
+
+ ///
+ /// Raise an event when the status of a switch object changes.
+ ///
+ /// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
+ protected void OnSwitchChange(RoutingNumericEventArgs e)
+ {
+ var newEvent = NumericSwitchChange;
+ if (newEvent != null) newEvent(this, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Ethernet/EthernetStatistics.cs b/src/PepperDash.Essentials.Core/Ethernet/EthernetSettings.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Ethernet/EthernetStatistics.cs
rename to src/PepperDash.Essentials.Core/Ethernet/EthernetSettings.cs
diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
index d53aef19..7d0aae73 100644
--- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
+++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
@@ -18,19 +18,6 @@ using PepperDash.Essentials.Core.Touchpanels;
namespace PepperDash.Essentials.Core
{
- public class DeviceFactoryWrapper
- {
- public CType CType { get; set; }
- public string Description { get; set; }
- public Func FactoryMethod { get; set; }
-
- public DeviceFactoryWrapper()
- {
- CType = null;
- Description = "Not Available";
- }
- }
-
public class DeviceFactory
{
public DeviceFactory()
diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactoryWrapper.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactoryWrapper.cs
new file mode 100644
index 00000000..81d8cf9f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactoryWrapper.cs
@@ -0,0 +1,20 @@
+using System;
+using Crestron.SimplSharp.Reflection;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class DeviceFactoryWrapper
+ {
+ public CType CType { get; set; }
+ public string Description { get; set; }
+ public Func FactoryMethod { get; set; }
+
+ public DeviceFactoryWrapper()
+ {
+ CType = null;
+ Description = "Not Available";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Factory/IHasReady.cs b/src/PepperDash.Essentials.Core/Factory/IHasReady.cs
new file mode 100644
index 00000000..1431262d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Factory/IHasReady.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasReady
+ {
+ event EventHandler IsReadyEvent;
+ bool IsReady { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Factory/IsReadyEventArgs.cs b/src/PepperDash.Essentials.Core/Factory/IsReadyEventArgs.cs
new file mode 100644
index 00000000..66729726
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Factory/IsReadyEventArgs.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ public class IsReadyEventArgs : EventArgs
+ {
+ public bool IsReady { get; set; }
+
+ public IsReadyEventArgs(bool data)
+ {
+ IsReady = data;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs
index be8369d2..6066563b 100644
--- a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs
+++ b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs
@@ -7,21 +7,6 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core
{
- public class IsReadyEventArgs : EventArgs
- {
- public bool IsReady { get; set; }
-
- public IsReadyEventArgs(bool data)
- {
- IsReady = data;
- }
- }
-
- public interface IHasReady
- {
- event EventHandler IsReadyEvent;
- bool IsReady { get; }
- }
}
namespace PepperDash_Essentials_Core
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackAnd.cs b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackAnd.cs
new file mode 100644
index 00000000..a7f5b668
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackAnd.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+
+namespace PepperDash.Essentials.Core
+{
+ public class BoolFeedbackAnd : BoolFeedbackLogic
+ {
+ protected override void Evaluate()
+ {
+ var prevValue = ComputedValue;
+ var newValue = OutputsIn.All(o => o.BoolValue);
+ if (newValue == prevValue)
+ {
+ return;
+ }
+ ComputedValue = newValue;
+ Output.FireUpdate();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLinq.cs b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLinq.cs
new file mode 100644
index 00000000..305050c3
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLinq.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ public class BoolFeedbackLinq : BoolFeedbackLogic
+ {
+ readonly Func, bool> _predicate;
+
+ public BoolFeedbackLinq(Func, bool> predicate)
+ : base()
+ {
+ _predicate = predicate;
+ }
+
+ protected override void Evaluate()
+ {
+ var prevValue = ComputedValue;
+ var newValue = _predicate(OutputsIn);
+ if (newValue == prevValue)
+ {
+ return;
+ }
+ ComputedValue = newValue;
+ Output.FireUpdate();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/BoolOutputLogicals.cs b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLogic.cs
similarity index 61%
rename from src/PepperDash.Essentials.Core/Feedbacks/BoolOutputLogicals.cs
rename to src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLogic.cs
index a8dae7b8..1080ad7c 100644
--- a/src/PepperDash.Essentials.Core/Feedbacks/BoolOutputLogicals.cs
+++ b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackLogic.cs
@@ -81,57 +81,4 @@ namespace PepperDash.Essentials.Core
protected abstract void Evaluate();
}
-
- public class BoolFeedbackAnd : BoolFeedbackLogic
- {
- protected override void Evaluate()
- {
- var prevValue = ComputedValue;
- var newValue = OutputsIn.All(o => o.BoolValue);
- if (newValue == prevValue)
- {
- return;
- }
- ComputedValue = newValue;
- Output.FireUpdate();
- }
- }
-
- public class BoolFeedbackOr : BoolFeedbackLogic
- {
- protected override void Evaluate()
- {
- var prevValue = ComputedValue;
- var newValue = OutputsIn.Any(o => o.BoolValue);
- if (newValue == prevValue)
- {
- return;
- }
- ComputedValue = newValue;
- Output.FireUpdate();
- }
- }
-
- public class BoolFeedbackLinq : BoolFeedbackLogic
- {
- readonly Func, bool> _predicate;
-
- public BoolFeedbackLinq(Func, bool> predicate)
- : base()
- {
- _predicate = predicate;
- }
-
- protected override void Evaluate()
- {
- var prevValue = ComputedValue;
- var newValue = _predicate(OutputsIn);
- if (newValue == prevValue)
- {
- return;
- }
- ComputedValue = newValue;
- Output.FireUpdate();
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackOr.cs b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackOr.cs
new file mode 100644
index 00000000..71fdddc6
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackOr.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+
+namespace PepperDash.Essentials.Core
+{
+ public class BoolFeedbackOr : BoolFeedbackLogic
+ {
+ protected override void Evaluate()
+ {
+ var prevValue = ComputedValue;
+ var newValue = OutputsIn.Any(o => o.BoolValue);
+ if (newValue == prevValue)
+ {
+ return;
+ }
+ ComputedValue = newValue;
+ Output.FireUpdate();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackOneShot.cs b/src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackPulse.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackOneShot.cs
rename to src/PepperDash.Essentials.Core/Feedbacks/BoolFeedbackPulse.cs
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/FeedbackBase.cs b/src/PepperDash.Essentials.Core/Feedbacks/Feedback.cs
similarity index 100%
rename from src/PepperDash.Essentials.Core/Feedbacks/FeedbackBase.cs
rename to src/PepperDash.Essentials.Core/Feedbacks/Feedback.cs
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/FeedbackEventArgs.cs b/src/PepperDash.Essentials.Core/Feedbacks/FeedbackEventArgs.cs
index 9a7f5c29..eae75c51 100644
--- a/src/PepperDash.Essentials.Core/Feedbacks/FeedbackEventArgs.cs
+++ b/src/PepperDash.Essentials.Core/Feedbacks/FeedbackEventArgs.cs
@@ -38,11 +38,4 @@ namespace PepperDash.Essentials.Core
Type = eFeedbackEventType.TypeString;
}
}
-
- public enum eFeedbackEventType
- {
- TypeBool,
- TypeInt,
- TypeString
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Feedbacks/eFeedbackEventType.cs b/src/PepperDash.Essentials.Core/Feedbacks/eFeedbackEventType.cs
new file mode 100644
index 00000000..ca9efeee
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Feedbacks/eFeedbackEventType.cs
@@ -0,0 +1,9 @@
+namespace PepperDash.Essentials.Core
+{
+ public enum eFeedbackEventType
+ {
+ TypeBool,
+ TypeInt,
+ TypeString
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/File/FileEventArgs.cs b/src/PepperDash.Essentials.Core/File/FileEventArgs.cs
new file mode 100644
index 00000000..85be05ec
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/File/FileEventArgs.cs
@@ -0,0 +1,9 @@
+namespace PepperDash.Essentials.Core
+{
+ public class FileEventArgs
+ {
+ public FileEventArgs(string data) { Data = data; }
+ public string Data { get; private set; } // readonly
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/File/FileIO.cs b/src/PepperDash.Essentials.Core/File/FileIO.cs
index 51d64230..f17bad52 100644
--- a/src/PepperDash.Essentials.Core/File/FileIO.cs
+++ b/src/PepperDash.Essentials.Core/File/FileIO.cs
@@ -269,10 +269,4 @@ namespace PepperDash.Essentials.Core
}
}
- public class FileEventArgs
- {
- public FileEventArgs(string data) { Data = data; }
- public string Data { get; private set; } // readonly
-
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/ActionResponse.cs b/src/PepperDash.Essentials.Core/Fusion/ActionResponse.cs
new file mode 100644
index 00000000..d9be4aaa
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/ActionResponse.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class ActionResponse
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "ActionID")]
+ public string ActionID { get; set; }
+ //[XmlElement(ElementName = "Parameters")]
+ public List Parameters { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Attendees.cs b/src/PepperDash.Essentials.Core/Fusion/Attendees.cs
new file mode 100644
index 00000000..34ee6857
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Attendees.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Attendees
+ {
+ //[XmlElement(ElementName = "Required")]
+ public Required Required { get; set; }
+ //[XmlElement(ElementName = "Optional")]
+ public Optional Optional { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
index f3827d0a..f8113f9b 100644
--- a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
+++ b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs
@@ -1632,188 +1632,5 @@ namespace PepperDash.Essentials.Core.Fusion
}
- public static class FusionRoomExtensions
- {
- ///
- /// Creates and returns a fusion attribute. The join number will match the established Simpl
- /// standard of 50+, and will generate a 50+ join in the RVI. It calls
- /// FusionRoom.AddSig with join number - 49
- ///
- /// The new attribute
- public static BooleanSigData CreateOffsetBoolSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
- {
- if (number < 50)
- {
- throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
- }
- number -= 49;
- fr.AddSig(eSigType.Bool, number, name, mask);
- return fr.UserDefinedBooleanSigDetails[number];
- }
-
- ///
- /// Creates and returns a fusion attribute. The join number will match the established Simpl
- /// standard of 50+, and will generate a 50+ join in the RVI. It calls
- /// FusionRoom.AddSig with join number - 49
- ///
- /// The new attribute
- public static UShortSigData CreateOffsetUshortSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
- {
- if (number < 50)
- {
- throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
- }
- number -= 49;
- fr.AddSig(eSigType.UShort, number, name, mask);
- return fr.UserDefinedUShortSigDetails[number];
- }
-
- ///
- /// Creates and returns a fusion attribute. The join number will match the established Simpl
- /// standard of 50+, and will generate a 50+ join in the RVI. It calls
- /// FusionRoom.AddSig with join number - 49
- ///
- /// The new attribute
- public static StringSigData CreateOffsetStringSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
- {
- if (number < 50)
- {
- throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
- }
- number -= 49;
- fr.AddSig(eSigType.String, number, name, mask);
- return fr.UserDefinedStringSigDetails[number];
- }
-
- ///
- /// Creates and returns a static asset
- ///
- /// the new asset
- public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type,
- string instanceId)
- {
- try
- {
- Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
-
- fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
- return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
- }
- catch (InvalidOperationException ex)
- {
- Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
- return null;
- }
- catch (Exception e)
- {
- Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
- return null;
- }
- }
-
- public static FusionOccupancySensor CreateOccupancySensorAsset(this FusionRoom fr, uint number, string name,
- string type, string instanceId)
- {
- try
- {
- Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
- instanceId);
-
- fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
- return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
- }
- catch (InvalidOperationException ex)
- {
- Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
- return null;
- }
- catch (Exception e)
- {
- Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
- return null;
- }
- }
- }
-
//************************************************************************************************
- ///
- /// Extensions to enhance Fusion room, asset and signal creation.
- ///
- public static class FusionStaticAssetExtensions
- {
- ///
- /// Tries to set a Fusion asset with the make and model of a device.
- /// If the provided Device is IMakeModel, will set the corresponding parameters on the fusion static asset.
- /// Otherwise, does nothing.
- ///
- public static void TrySetMakeModel(this FusionStaticAsset asset, Device device)
- {
- var mm = device as IMakeModel;
- if (mm != null)
- {
- asset.ParamMake.Value = mm.DeviceMake;
- asset.ParamModel.Value = mm.DeviceModel;
- }
- }
-
- ///
- /// Tries to attach the AssetError input on a Fusion asset to a Device's
- /// CommunicationMonitor.StatusChange event. Does nothing if the device is not
- /// IStatusMonitor
- ///
- ///
- ///
- public static void TryLinkAssetErrorToCommunication(this FusionStaticAsset asset, Device device)
- {
- if (device is ICommunicationMonitor)
- {
- var monitor = (device as ICommunicationMonitor).CommunicationMonitor;
- monitor.StatusChange += (o, a) =>
- {
- // Link connected and error inputs on asset
- asset.Connected.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
- asset.AssetError.InputSig.StringValue = a.Status.ToString();
- };
- // set current value
- asset.Connected.InputSig.BoolValue = monitor.Status == MonitorStatus.IsOk;
- asset.AssetError.InputSig.StringValue = monitor.Status.ToString();
- }
- }
- }
-
- public class RoomInformation
- {
- public RoomInformation()
- {
- FusionCustomProperties = new List();
- }
-
- public string ID { get; set; }
- public string Name { get; set; }
- public string Location { get; set; }
- public string Description { get; set; }
- public string TimeZone { get; set; }
- public string WebcamURL { get; set; }
- public string BacklogMsg { get; set; }
- public string SubErrorMsg { get; set; }
- public string EmailInfo { get; set; }
- public List FusionCustomProperties { get; set; }
- }
-
- public class FusionCustomProperty
- {
- public FusionCustomProperty()
- {
- }
-
- public FusionCustomProperty(string id)
- {
- ID = id;
- }
-
- public string ID { get; set; }
- public string CustomFieldName { get; set; }
- public string CustomFieldType { get; set; }
- public string CustomFieldValue { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Event.cs b/src/PepperDash.Essentials.Core/Fusion/Event.cs
new file mode 100644
index 00000000..7b7e5472
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Event.cs
@@ -0,0 +1,139 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Event
+ {
+ //[XmlElement(ElementName = "MeetingID")]
+ public string MeetingID { get; set; }
+ //[XmlElement(ElementName = "RVMeetingID")]
+ public string RVMeetingID { get; set; }
+ //[XmlElement(ElementName = "Recurring")]
+ public string Recurring { get; set; }
+ //[XmlElement(ElementName = "InstanceID")]
+ public string InstanceID { get; set; }
+ //[XmlElement(ElementName = "dtStart")]
+ public DateTime dtStart { get; set; }
+ //[XmlElement(ElementName = "dtEnd")]
+ public DateTime dtEnd { get; set; }
+ //[XmlElement(ElementName = "Organizer")]
+ public string Organizer { get; set; }
+ //[XmlElement(ElementName = "Attendees")]
+ public Attendees Attendees { get; set; }
+ //[XmlElement(ElementName = "Resources")]
+ public Resources Resources { get; set; }
+ //[XmlElement(ElementName = "IsEvent")]
+ public string IsEvent { get; set; }
+ //[XmlElement(ElementName = "IsRoomViewMeeting")]
+ public string IsRoomViewMeeting { get; set; }
+ //[XmlElement(ElementName = "IsPrivate")]
+ public string IsPrivate { get; set; }
+ //[XmlElement(ElementName = "IsExchangePrivate")]
+ public string IsExchangePrivate { get; set; }
+ //[XmlElement(ElementName = "MeetingTypes")]
+ public MeetingTypes MeetingTypes { get; set; }
+ //[XmlElement(ElementName = "ParticipantCode")]
+ public string ParticipantCode { get; set; }
+ //[XmlElement(ElementName = "PhoneNo")]
+ public string PhoneNo { get; set; }
+ //[XmlElement(ElementName = "WelcomeMsg")]
+ public string WelcomeMsg { get; set; }
+ //[XmlElement(ElementName = "Subject")]
+ public string Subject { get; set; }
+ //[XmlElement(ElementName = "LiveMeeting")]
+ public LiveMeeting LiveMeeting { get; set; }
+ //[XmlElement(ElementName = "ShareDocPath")]
+ public string ShareDocPath { get; set; }
+ //[XmlElement(ElementName = "HaveAttendees")]
+ public string HaveAttendees { get; set; }
+ //[XmlElement(ElementName = "HaveResources")]
+ public string HaveResources { get; set; }
+
+ ///
+ /// Gets the duration of the meeting
+ ///
+ public string DurationInMinutes
+ {
+ get
+ {
+ string duration;
+
+ var timeSpan = dtEnd.Subtract(dtStart);
+ int hours = timeSpan.Hours;
+ double minutes = timeSpan.Minutes;
+ double roundedMinutes = Math.Round(minutes);
+ if (hours > 0)
+ {
+ duration = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
+ }
+ else
+ {
+ duration = string.Format("{0} minutes", roundedMinutes);
+ }
+
+ return duration;
+ }
+ }
+
+ ///
+ /// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
+ ///
+ public string RemainingTime
+ {
+ get
+ {
+ var now = DateTime.Now;
+
+ string remainingTime;
+
+ if (GetInProgress())
+ {
+ var timeSpan = dtEnd.Subtract(now);
+ int hours = timeSpan.Hours;
+ double minutes = timeSpan.Minutes;
+ double roundedMinutes = Math.Round(minutes);
+ if (hours > 0)
+ {
+ remainingTime = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
+ }
+ else
+ {
+ remainingTime = string.Format("{0} minutes", roundedMinutes);
+ }
+
+ return remainingTime;
+ }
+ else
+ return null;
+ }
+
+ }
+
+ ///
+ /// Indicates that the meeting is in progress
+ ///
+ public bool isInProgress
+ {
+ get
+ {
+ return GetInProgress();
+ }
+ }
+
+ ///
+ /// Determines if the meeting is in progress
+ ///
+ /// Returns true if in progress
+ bool GetInProgress()
+ {
+ var now = DateTime.Now;
+
+ if (now > dtStart && now < dtEnd)
+ {
+ return true;
+ }
+ else
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionAsset.cs b/src/PepperDash.Essentials.Core/Fusion/FusionAsset.cs
new file mode 100644
index 00000000..40bf1749
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionAsset.cs
@@ -0,0 +1,32 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class FusionAsset
+ {
+ public uint SlotNumber { get; set; }
+ public string Name { get; set; }
+ public string Type { get; set; }
+ public string InstanceId { get;set; }
+
+ public FusionAsset()
+ {
+
+ }
+
+ public FusionAsset(uint slotNum, string assetName, string type, string instanceId)
+ {
+ SlotNumber = slotNum;
+ Name = assetName;
+ Type = type;
+ if (string.IsNullOrEmpty(instanceId))
+ {
+ InstanceId = Guid.NewGuid().ToString();
+ }
+ else
+ {
+ InstanceId = instanceId;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionCustomProperty.cs b/src/PepperDash.Essentials.Core/Fusion/FusionCustomProperty.cs
new file mode 100644
index 00000000..5b6635f2
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionCustomProperty.cs
@@ -0,0 +1,19 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class FusionCustomProperty
+ {
+ public FusionCustomProperty()
+ {
+ }
+
+ public FusionCustomProperty(string id)
+ {
+ ID = id;
+ }
+
+ public string ID { get; set; }
+ public string CustomFieldName { get; set; }
+ public string CustomFieldType { get; set; }
+ public string CustomFieldValue { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionOccupancySensorAsset.cs b/src/PepperDash.Essentials.Core/Fusion/FusionOccupancySensorAsset.cs
new file mode 100644
index 00000000..93bd94ab
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionOccupancySensorAsset.cs
@@ -0,0 +1,26 @@
+using System;
+using Crestron.SimplSharpPro.Fusion;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class FusionOccupancySensorAsset
+ {
+ // SlotNumber fixed at 4
+
+ public uint SlotNumber { get { return 4; } }
+ public string Name { get { return "Occupancy Sensor"; } }
+ public eAssetType Type { get; set; }
+ public string InstanceId { get; set; }
+
+ public FusionOccupancySensorAsset()
+ {
+ }
+
+ public FusionOccupancySensorAsset(eAssetType type)
+ {
+ Type = type;
+
+ InstanceId = Guid.NewGuid().ToString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionRoomExtensions.cs b/src/PepperDash.Essentials.Core/Fusion/FusionRoomExtensions.cs
new file mode 100644
index 00000000..db33ebdc
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionRoomExtensions.cs
@@ -0,0 +1,110 @@
+using System;
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.Fusion;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public static class FusionRoomExtensions
+ {
+ ///
+ /// Creates and returns a fusion attribute. The join number will match the established Simpl
+ /// standard of 50+, and will generate a 50+ join in the RVI. It calls
+ /// FusionRoom.AddSig with join number - 49
+ ///
+ /// The new attribute
+ public static BooleanSigData CreateOffsetBoolSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
+ {
+ if (number < 50)
+ {
+ throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
+ }
+ number -= 49;
+ fr.AddSig(eSigType.Bool, number, name, mask);
+ return fr.UserDefinedBooleanSigDetails[number];
+ }
+
+ ///
+ /// Creates and returns a fusion attribute. The join number will match the established Simpl
+ /// standard of 50+, and will generate a 50+ join in the RVI. It calls
+ /// FusionRoom.AddSig with join number - 49
+ ///
+ /// The new attribute
+ public static UShortSigData CreateOffsetUshortSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
+ {
+ if (number < 50)
+ {
+ throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
+ }
+ number -= 49;
+ fr.AddSig(eSigType.UShort, number, name, mask);
+ return fr.UserDefinedUShortSigDetails[number];
+ }
+
+ ///
+ /// Creates and returns a fusion attribute. The join number will match the established Simpl
+ /// standard of 50+, and will generate a 50+ join in the RVI. It calls
+ /// FusionRoom.AddSig with join number - 49
+ ///
+ /// The new attribute
+ public static StringSigData CreateOffsetStringSig(this FusionRoom fr, uint number, string name, eSigIoMask mask)
+ {
+ if (number < 50)
+ {
+ throw new ArgumentOutOfRangeException("number", "Cannot be less than 50");
+ }
+ number -= 49;
+ fr.AddSig(eSigType.String, number, name, mask);
+ return fr.UserDefinedStringSigDetails[number];
+ }
+
+ ///
+ /// Creates and returns a static asset
+ ///
+ /// the new asset
+ public static FusionStaticAsset CreateStaticAsset(this FusionRoom fr, uint number, string name, string type,
+ string instanceId)
+ {
+ try
+ {
+ Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
+
+ fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
+ return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
+ }
+ catch (InvalidOperationException ex)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
+ return null;
+ }
+ catch (Exception e)
+ {
+ Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
+ return null;
+ }
+ }
+
+ public static FusionOccupancySensor CreateOccupancySensorAsset(this FusionRoom fr, uint number, string name,
+ string type, string instanceId)
+ {
+ try
+ {
+ Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
+ instanceId);
+
+ fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
+ return fr.UserConfigurableAssetDetails[number].Asset as FusionOccupancySensor;
+ }
+ catch (InvalidOperationException ex)
+ {
+ Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
+ return null;
+ }
+ catch (Exception e)
+ {
+ Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionRoomGuids.cs b/src/PepperDash.Essentials.Core/Fusion/FusionRoomGuids.cs
new file mode 100644
index 00000000..b8570763
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionRoomGuids.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro.Fusion;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ // Helper Classes for GUIDs
+
+ ///
+ /// Stores GUIDs to be written to a file in NVRAM
+ ///
+ public class FusionRoomGuids
+ {
+ public string RoomName { get; set; }
+ public uint IpId { get; set; }
+ public string RoomGuid { get; set; }
+ public FusionOccupancySensorAsset OccupancyAsset { get; set; }
+ public Dictionary StaticAssets { get; set; }
+
+ public FusionRoomGuids()
+ {
+ StaticAssets = new Dictionary();
+ OccupancyAsset = new FusionOccupancySensorAsset();
+ }
+
+ public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary staticAssets)
+ {
+ RoomName = roomName;
+ IpId = ipId;
+ RoomGuid = roomGuid;
+
+ StaticAssets = staticAssets;
+ OccupancyAsset = new FusionOccupancySensorAsset();
+ }
+
+ public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary staticAssets, FusionOccupancySensorAsset occAsset)
+ {
+ RoomName = roomName;
+ IpId = ipId;
+ RoomGuid = roomGuid;
+
+ StaticAssets = staticAssets;
+ OccupancyAsset = occAsset;
+ }
+
+ ///
+ /// Generates a new room GUID prefixed by the program slot number and NIC MAC address
+ ///
+ ///
+ ///
+ public string GenerateNewRoomGuid(uint progSlot, string mac)
+ {
+ Guid roomGuid = Guid.NewGuid();
+
+ return string.Format("{0}-{1}-{2}", progSlot, mac, roomGuid.ToString());
+ }
+
+
+ ///
+ /// Adds an asset to the StaticAssets collection and returns the new asset
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public FusionAsset AddStaticAsset(FusionRoom room, int uid, string assetName, string type, string instanceId)
+ {
+ var slotNum = GetNextAvailableAssetNumber(room);
+
+ Debug.Console(2, "Adding Fusion Asset: {0} of Type: {1} at Slot Number: {2} with GUID: {3}", assetName, type, slotNum, instanceId);
+
+ var tempAsset = new FusionAsset(slotNum, assetName, type, instanceId);
+
+ StaticAssets.Add(uid, tempAsset);
+
+ return tempAsset;
+ }
+
+ ///
+ /// Returns the next available slot number in the Fusion UserConfigurableAssetDetails collection
+ ///
+ ///
+ ///
+ public static uint GetNextAvailableAssetNumber(FusionRoom room)
+ {
+ uint slotNum = 0;
+
+ foreach (var item in room.UserConfigurableAssetDetails)
+ {
+ if(item.Number > slotNum)
+ slotNum = item.Number;
+ }
+
+ if (slotNum < 5)
+ {
+ slotNum = 5;
+ }
+ else
+ slotNum = slotNum + 1;
+
+ Debug.Console(2, "#Next available fusion asset number is: {0}", slotNum);
+
+ return slotNum;
+ }
+
+ }
+
+ //***************************************************************************************************
+
+ //****************************************************************************************************
+ // Helper Classes for XML API
+
+
+ //[XmlRoot(ElementName = "RequestAction")]
+
+ //[XmlRoot(ElementName = "ActionResponse")]
+
+ //[XmlRoot(ElementName = "Parameter")]
+
+ ////[XmlRoot(ElementName = "Parameters")]
+ //public class Parameters
+ //{
+ // //[XmlElement(ElementName = "Parameter")]
+ // public List Parameter { get; set; }
+ //}
+
+ //[XmlRoot(ElementName = "Event")]
+
+ //[XmlRoot(ElementName = "Resources")]
+
+ //[XmlRoot(ElementName = "Rooms")]
+
+ //[XmlRoot(ElementName = "Room")]
+
+ //[XmlRoot(ElementName = "Attendees")]
+
+ //[XmlRoot(ElementName = "Required")]
+
+ //[XmlRoot(ElementName = "Optional")]
+
+ //[XmlRoot(ElementName = "MeetingType")]
+
+ //[XmlRoot(ElementName = "MeetingTypes")]
+
+ //[XmlRoot(ElementName = "LiveMeeting")]
+
+ //[XmlRoot(ElementName = "LiveMeetingURL")]
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionRviDataClasses.cs b/src/PepperDash.Essentials.Core/Fusion/FusionRviDataClasses.cs
deleted file mode 100644
index 99fc0abb..00000000
--- a/src/PepperDash.Essentials.Core/Fusion/FusionRviDataClasses.cs
+++ /dev/null
@@ -1,499 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro.Fusion;
-
-using PepperDash.Core;
-
-namespace PepperDash.Essentials.Core.Fusion
-{
- // Helper Classes for GUIDs
-
- ///
- /// Stores GUIDs to be written to a file in NVRAM
- ///
- public class FusionRoomGuids
- {
- public string RoomName { get; set; }
- public uint IpId { get; set; }
- public string RoomGuid { get; set; }
- public FusionOccupancySensorAsset OccupancyAsset { get; set; }
- public Dictionary StaticAssets { get; set; }
-
- public FusionRoomGuids()
- {
- StaticAssets = new Dictionary();
- OccupancyAsset = new FusionOccupancySensorAsset();
- }
-
- public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary staticAssets)
- {
- RoomName = roomName;
- IpId = ipId;
- RoomGuid = roomGuid;
-
- StaticAssets = staticAssets;
- OccupancyAsset = new FusionOccupancySensorAsset();
- }
-
- public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary staticAssets, FusionOccupancySensorAsset occAsset)
- {
- RoomName = roomName;
- IpId = ipId;
- RoomGuid = roomGuid;
-
- StaticAssets = staticAssets;
- OccupancyAsset = occAsset;
- }
-
- ///
- /// Generates a new room GUID prefixed by the program slot number and NIC MAC address
- ///
- ///
- ///
- public string GenerateNewRoomGuid(uint progSlot, string mac)
- {
- Guid roomGuid = Guid.NewGuid();
-
- return string.Format("{0}-{1}-{2}", progSlot, mac, roomGuid.ToString());
- }
-
-
- ///
- /// Adds an asset to the StaticAssets collection and returns the new asset
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public FusionAsset AddStaticAsset(FusionRoom room, int uid, string assetName, string type, string instanceId)
- {
- var slotNum = GetNextAvailableAssetNumber(room);
-
- Debug.Console(2, "Adding Fusion Asset: {0} of Type: {1} at Slot Number: {2} with GUID: {3}", assetName, type, slotNum, instanceId);
-
- var tempAsset = new FusionAsset(slotNum, assetName, type, instanceId);
-
- StaticAssets.Add(uid, tempAsset);
-
- return tempAsset;
- }
-
- ///
- /// Returns the next available slot number in the Fusion UserConfigurableAssetDetails collection
- ///
- ///
- ///
- public static uint GetNextAvailableAssetNumber(FusionRoom room)
- {
- uint slotNum = 0;
-
- foreach (var item in room.UserConfigurableAssetDetails)
- {
- if(item.Number > slotNum)
- slotNum = item.Number;
- }
-
- if (slotNum < 5)
- {
- slotNum = 5;
- }
- else
- slotNum = slotNum + 1;
-
- Debug.Console(2, "#Next available fusion asset number is: {0}", slotNum);
-
- return slotNum;
- }
-
- }
-
- public class FusionOccupancySensorAsset
- {
- // SlotNumber fixed at 4
-
- public uint SlotNumber { get { return 4; } }
- public string Name { get { return "Occupancy Sensor"; } }
- public eAssetType Type { get; set; }
- public string InstanceId { get; set; }
-
- public FusionOccupancySensorAsset()
- {
- }
-
- public FusionOccupancySensorAsset(eAssetType type)
- {
- Type = type;
-
- InstanceId = Guid.NewGuid().ToString();
- }
- }
-
- public class FusionAsset
- {
- public uint SlotNumber { get; set; }
- public string Name { get; set; }
- public string Type { get; set; }
- public string InstanceId { get;set; }
-
- public FusionAsset()
- {
-
- }
-
- public FusionAsset(uint slotNum, string assetName, string type, string instanceId)
- {
- SlotNumber = slotNum;
- Name = assetName;
- Type = type;
- if (string.IsNullOrEmpty(instanceId))
- {
- InstanceId = Guid.NewGuid().ToString();
- }
- else
- {
- InstanceId = instanceId;
- }
- }
- }
-
- //***************************************************************************************************
-
- public class RoomSchedule
- {
- public List Meetings { get; set; }
-
- public RoomSchedule()
- {
- Meetings = new List();
- }
- }
-
- //****************************************************************************************************
- // Helper Classes for XML API
-
- ///
- /// Data needed to request the local time from the Fusion server
- ///
- public class LocalTimeRequest
- {
- public string RequestID { get; set; }
- }
-
- ///
- /// All the data needed for a full schedule request in a room
- ///
- /// //[XmlRoot(ElementName = "RequestSchedule")]
- public class RequestSchedule
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "Start")]
- public DateTime Start { get; set; }
- //[XmlElement(ElementName = "HourSpan")]
- public double HourSpan { get; set; }
-
- public RequestSchedule(string requestID, string roomID)
- {
- RequestID = requestID;
- RoomID = roomID;
- Start = DateTime.Now;
- HourSpan = 24;
- }
- }
-
-
- //[XmlRoot(ElementName = "RequestAction")]
- public class RequestAction
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "ActionID")]
- public string ActionID { get; set; }
- //[XmlElement(ElementName = "Parameters")]
- public List Parameters { get; set; }
-
- public RequestAction(string roomID, string actionID, List parameters)
- {
- RoomID = roomID;
- ActionID = actionID;
- Parameters = parameters;
- }
- }
-
- //[XmlRoot(ElementName = "ActionResponse")]
- public class ActionResponse
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "ActionID")]
- public string ActionID { get; set; }
- //[XmlElement(ElementName = "Parameters")]
- public List Parameters { get; set; }
- }
-
- //[XmlRoot(ElementName = "Parameter")]
- public class Parameter
- {
- //[XmlAttribute(AttributeName = "ID")]
- public string ID { get; set; }
- //[XmlAttribute(AttributeName = "Value")]
- public string Value { get; set; }
- }
-
- ////[XmlRoot(ElementName = "Parameters")]
- //public class Parameters
- //{
- // //[XmlElement(ElementName = "Parameter")]
- // public List Parameter { get; set; }
- //}
-
- ///
- /// Data structure for a ScheduleResponse from Fusion
- ///
- /// //[XmlRoot(ElementName = "ScheduleResponse")]
- public class ScheduleResponse
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "RoomName")]
- public string RoomName { get; set; }
- //[XmlElement("Event")]
- public List Events { get; set; }
-
- public ScheduleResponse()
- {
- Events = new List();
- }
- }
-
- //[XmlRoot(ElementName = "Event")]
- public class Event
- {
- //[XmlElement(ElementName = "MeetingID")]
- public string MeetingID { get; set; }
- //[XmlElement(ElementName = "RVMeetingID")]
- public string RVMeetingID { get; set; }
- //[XmlElement(ElementName = "Recurring")]
- public string Recurring { get; set; }
- //[XmlElement(ElementName = "InstanceID")]
- public string InstanceID { get; set; }
- //[XmlElement(ElementName = "dtStart")]
- public DateTime dtStart { get; set; }
- //[XmlElement(ElementName = "dtEnd")]
- public DateTime dtEnd { get; set; }
- //[XmlElement(ElementName = "Organizer")]
- public string Organizer { get; set; }
- //[XmlElement(ElementName = "Attendees")]
- public Attendees Attendees { get; set; }
- //[XmlElement(ElementName = "Resources")]
- public Resources Resources { get; set; }
- //[XmlElement(ElementName = "IsEvent")]
- public string IsEvent { get; set; }
- //[XmlElement(ElementName = "IsRoomViewMeeting")]
- public string IsRoomViewMeeting { get; set; }
- //[XmlElement(ElementName = "IsPrivate")]
- public string IsPrivate { get; set; }
- //[XmlElement(ElementName = "IsExchangePrivate")]
- public string IsExchangePrivate { get; set; }
- //[XmlElement(ElementName = "MeetingTypes")]
- public MeetingTypes MeetingTypes { get; set; }
- //[XmlElement(ElementName = "ParticipantCode")]
- public string ParticipantCode { get; set; }
- //[XmlElement(ElementName = "PhoneNo")]
- public string PhoneNo { get; set; }
- //[XmlElement(ElementName = "WelcomeMsg")]
- public string WelcomeMsg { get; set; }
- //[XmlElement(ElementName = "Subject")]
- public string Subject { get; set; }
- //[XmlElement(ElementName = "LiveMeeting")]
- public LiveMeeting LiveMeeting { get; set; }
- //[XmlElement(ElementName = "ShareDocPath")]
- public string ShareDocPath { get; set; }
- //[XmlElement(ElementName = "HaveAttendees")]
- public string HaveAttendees { get; set; }
- //[XmlElement(ElementName = "HaveResources")]
- public string HaveResources { get; set; }
-
- ///
- /// Gets the duration of the meeting
- ///
- public string DurationInMinutes
- {
- get
- {
- string duration;
-
- var timeSpan = dtEnd.Subtract(dtStart);
- int hours = timeSpan.Hours;
- double minutes = timeSpan.Minutes;
- double roundedMinutes = Math.Round(minutes);
- if (hours > 0)
- {
- duration = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
- }
- else
- {
- duration = string.Format("{0} minutes", roundedMinutes);
- }
-
- return duration;
- }
- }
-
- ///
- /// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
- ///
- public string RemainingTime
- {
- get
- {
- var now = DateTime.Now;
-
- string remainingTime;
-
- if (GetInProgress())
- {
- var timeSpan = dtEnd.Subtract(now);
- int hours = timeSpan.Hours;
- double minutes = timeSpan.Minutes;
- double roundedMinutes = Math.Round(minutes);
- if (hours > 0)
- {
- remainingTime = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
- }
- else
- {
- remainingTime = string.Format("{0} minutes", roundedMinutes);
- }
-
- return remainingTime;
- }
- else
- return null;
- }
-
- }
-
- ///
- /// Indicates that the meeting is in progress
- ///
- public bool isInProgress
- {
- get
- {
- return GetInProgress();
- }
- }
-
- ///
- /// Determines if the meeting is in progress
- ///
- /// Returns true if in progress
- bool GetInProgress()
- {
- var now = DateTime.Now;
-
- if (now > dtStart && now < dtEnd)
- {
- return true;
- }
- else
- return false;
- }
- }
-
- //[XmlRoot(ElementName = "Resources")]
- public class Resources
- {
- //[XmlElement(ElementName = "Rooms")]
- public Rooms Rooms { get; set; }
- }
-
- //[XmlRoot(ElementName = "Rooms")]
- public class Rooms
- {
- //[XmlElement(ElementName = "Room")]
- public List Room { get; set; }
- }
-
- //[XmlRoot(ElementName = "Room")]
- public class Room
- {
- //[XmlElement(ElementName = "Name")]
- public string Name { get; set; }
- //[XmlElement(ElementName = "ID")]
- public string ID { get; set; }
- //[XmlElement(ElementName = "MPType")]
- public string MPType { get; set; }
- }
-
- //[XmlRoot(ElementName = "Attendees")]
- public class Attendees
- {
- //[XmlElement(ElementName = "Required")]
- public Required Required { get; set; }
- //[XmlElement(ElementName = "Optional")]
- public Optional Optional { get; set; }
- }
-
- //[XmlRoot(ElementName = "Required")]
- public class Required
- {
- //[XmlElement(ElementName = "Attendee")]
- public List Attendee { get; set; }
- }
-
- //[XmlRoot(ElementName = "Optional")]
- public class Optional
- {
- //[XmlElement(ElementName = "Attendee")]
- public List Attendee { get; set; }
- }
-
- //[XmlRoot(ElementName = "MeetingType")]
- public class MeetingType
- {
- //[XmlAttribute(AttributeName = "ID")]
- public string ID { get; set; }
- //[XmlAttribute(AttributeName = "Value")]
- public string Value { get; set; }
- }
-
- //[XmlRoot(ElementName = "MeetingTypes")]
- public class MeetingTypes
- {
- //[XmlElement(ElementName = "MeetingType")]
- public List MeetingType { get; set; }
- }
-
- //[XmlRoot(ElementName = "LiveMeeting")]
- public class LiveMeeting
- {
- //[XmlElement(ElementName = "URL")]
- public string URL { get; set; }
- //[XmlElement(ElementName = "ID")]
- public string ID { get; set; }
- //[XmlElement(ElementName = "Key")]
- public string Key { get; set; }
- //[XmlElement(ElementName = "Subject")]
- public string Subject { get; set; }
- }
-
- //[XmlRoot(ElementName = "LiveMeetingURL")]
- public class LiveMeetingURL
- {
- //[XmlElement(ElementName = "LiveMeeting")]
- public LiveMeeting LiveMeeting { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionStaticAssetExtensions.cs b/src/PepperDash.Essentials.Core/Fusion/FusionStaticAssetExtensions.cs
new file mode 100644
index 00000000..ed8f5730
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/FusionStaticAssetExtensions.cs
@@ -0,0 +1,50 @@
+using Crestron.SimplSharpPro.Fusion;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ ///
+ /// Extensions to enhance Fusion room, asset and signal creation.
+ ///
+ public static class FusionStaticAssetExtensions
+ {
+ ///
+ /// Tries to set a Fusion asset with the make and model of a device.
+ /// If the provided Device is IMakeModel, will set the corresponding parameters on the fusion static asset.
+ /// Otherwise, does nothing.
+ ///
+ public static void TrySetMakeModel(this FusionStaticAsset asset, Device device)
+ {
+ var mm = device as IMakeModel;
+ if (mm != null)
+ {
+ asset.ParamMake.Value = mm.DeviceMake;
+ asset.ParamModel.Value = mm.DeviceModel;
+ }
+ }
+
+ ///
+ /// Tries to attach the AssetError input on a Fusion asset to a Device's
+ /// CommunicationMonitor.StatusChange event. Does nothing if the device is not
+ /// IStatusMonitor
+ ///
+ ///
+ ///
+ public static void TryLinkAssetErrorToCommunication(this FusionStaticAsset asset, Device device)
+ {
+ if (device is ICommunicationMonitor)
+ {
+ var monitor = (device as ICommunicationMonitor).CommunicationMonitor;
+ monitor.StatusChange += (o, a) =>
+ {
+ // Link connected and error inputs on asset
+ asset.Connected.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
+ asset.AssetError.InputSig.StringValue = a.Status.ToString();
+ };
+ // set current value
+ asset.Connected.InputSig.BoolValue = monitor.Status == MonitorStatus.IsOk;
+ asset.AssetError.InputSig.StringValue = monitor.Status.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/LiveMeeting.cs b/src/PepperDash.Essentials.Core/Fusion/LiveMeeting.cs
new file mode 100644
index 00000000..766bf559
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/LiveMeeting.cs
@@ -0,0 +1,14 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class LiveMeeting
+ {
+ //[XmlElement(ElementName = "URL")]
+ public string URL { get; set; }
+ //[XmlElement(ElementName = "ID")]
+ public string ID { get; set; }
+ //[XmlElement(ElementName = "Key")]
+ public string Key { get; set; }
+ //[XmlElement(ElementName = "Subject")]
+ public string Subject { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/LiveMeetingURL.cs b/src/PepperDash.Essentials.Core/Fusion/LiveMeetingURL.cs
new file mode 100644
index 00000000..16387558
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/LiveMeetingURL.cs
@@ -0,0 +1,8 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class LiveMeetingURL
+ {
+ //[XmlElement(ElementName = "LiveMeeting")]
+ public LiveMeeting LiveMeeting { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/LocalTimeRequest.cs b/src/PepperDash.Essentials.Core/Fusion/LocalTimeRequest.cs
new file mode 100644
index 00000000..7c2fe75c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/LocalTimeRequest.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ ///
+ /// Data needed to request the local time from the Fusion server
+ ///
+ public class LocalTimeRequest
+ {
+ public string RequestID { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/MeetingChangeEventArgs.cs b/src/PepperDash.Essentials.Core/Fusion/MeetingChangeEventArgs.cs
new file mode 100644
index 00000000..4522f268
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/MeetingChangeEventArgs.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class MeetingChangeEventArgs : EventArgs
+ {
+ public Event Meeting { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/MeetingType.cs b/src/PepperDash.Essentials.Core/Fusion/MeetingType.cs
new file mode 100644
index 00000000..0d491391
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/MeetingType.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class MeetingType
+ {
+ //[XmlAttribute(AttributeName = "ID")]
+ public string ID { get; set; }
+ //[XmlAttribute(AttributeName = "Value")]
+ public string Value { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/MeetingTypes.cs b/src/PepperDash.Essentials.Core/Fusion/MeetingTypes.cs
new file mode 100644
index 00000000..a56b6595
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/MeetingTypes.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class MeetingTypes
+ {
+ //[XmlElement(ElementName = "MeetingType")]
+ public List MeetingType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Optional.cs b/src/PepperDash.Essentials.Core/Fusion/Optional.cs
new file mode 100644
index 00000000..541e5834
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Optional.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Optional
+ {
+ //[XmlElement(ElementName = "Attendee")]
+ public List Attendee { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Parameter.cs b/src/PepperDash.Essentials.Core/Fusion/Parameter.cs
new file mode 100644
index 00000000..495f8afc
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Parameter.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Parameter
+ {
+ //[XmlAttribute(AttributeName = "ID")]
+ public string ID { get; set; }
+ //[XmlAttribute(AttributeName = "Value")]
+ public string Value { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionProcessorQueries.cs b/src/PepperDash.Essentials.Core/Fusion/ProcessorProgReg.cs
similarity index 91%
rename from src/PepperDash.Essentials.Core/Fusion/FusionProcessorQueries.cs
rename to src/PepperDash.Essentials.Core/Fusion/ProcessorProgReg.cs
index 62109d97..68a1e259 100644
--- a/src/PepperDash.Essentials.Core/Fusion/FusionProcessorQueries.cs
+++ b/src/PepperDash.Essentials.Core/Fusion/ProcessorProgReg.cs
@@ -50,13 +50,4 @@ namespace PepperDash.Essentials.Core.Fusion
return programs;
}
}
-
- ///
- /// Used in ProcessorProgReg
- ///
- public class ProcessorProgramItem
- {
- public bool Exists { get; set; }
- public string Name { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/ProcessorProgramItem.cs b/src/PepperDash.Essentials.Core/Fusion/ProcessorProgramItem.cs
new file mode 100644
index 00000000..046bd729
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/ProcessorProgramItem.cs
@@ -0,0 +1,11 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ ///
+ /// Used in ProcessorProgReg
+ ///
+ public class ProcessorProgramItem
+ {
+ public bool Exists { get; set; }
+ public string Name { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/RequestAction.cs b/src/PepperDash.Essentials.Core/Fusion/RequestAction.cs
new file mode 100644
index 00000000..f908a946
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/RequestAction.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class RequestAction
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "ActionID")]
+ public string ActionID { get; set; }
+ //[XmlElement(ElementName = "Parameters")]
+ public List Parameters { get; set; }
+
+ public RequestAction(string roomID, string actionID, List parameters)
+ {
+ RoomID = roomID;
+ ActionID = actionID;
+ Parameters = parameters;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/RequestSchedule.cs b/src/PepperDash.Essentials.Core/Fusion/RequestSchedule.cs
new file mode 100644
index 00000000..e47b598e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/RequestSchedule.cs
@@ -0,0 +1,28 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ ///
+ /// All the data needed for a full schedule request in a room
+ ///
+ /// //[XmlRoot(ElementName = "RequestSchedule")]
+ public class RequestSchedule
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "Start")]
+ public DateTime Start { get; set; }
+ //[XmlElement(ElementName = "HourSpan")]
+ public double HourSpan { get; set; }
+
+ public RequestSchedule(string requestID, string roomID)
+ {
+ RequestID = requestID;
+ RoomID = roomID;
+ Start = DateTime.Now;
+ HourSpan = 24;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Required.cs b/src/PepperDash.Essentials.Core/Fusion/Required.cs
new file mode 100644
index 00000000..621052ad
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Required.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Required
+ {
+ //[XmlElement(ElementName = "Attendee")]
+ public List Attendee { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Resources.cs b/src/PepperDash.Essentials.Core/Fusion/Resources.cs
new file mode 100644
index 00000000..3ccc5a06
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Resources.cs
@@ -0,0 +1,8 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Resources
+ {
+ //[XmlElement(ElementName = "Rooms")]
+ public Rooms Rooms { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Room.cs b/src/PepperDash.Essentials.Core/Fusion/Room.cs
new file mode 100644
index 00000000..2b6f23df
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Room.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Room
+ {
+ //[XmlElement(ElementName = "Name")]
+ public string Name { get; set; }
+ //[XmlElement(ElementName = "ID")]
+ public string ID { get; set; }
+ //[XmlElement(ElementName = "MPType")]
+ public string MPType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/RoomInformation.cs b/src/PepperDash.Essentials.Core/Fusion/RoomInformation.cs
new file mode 100644
index 00000000..cc22e064
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/RoomInformation.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class RoomInformation
+ {
+ public RoomInformation()
+ {
+ FusionCustomProperties = new List();
+ }
+
+ public string ID { get; set; }
+ public string Name { get; set; }
+ public string Location { get; set; }
+ public string Description { get; set; }
+ public string TimeZone { get; set; }
+ public string WebcamURL { get; set; }
+ public string BacklogMsg { get; set; }
+ public string SubErrorMsg { get; set; }
+ public string EmailInfo { get; set; }
+ public List FusionCustomProperties { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/RoomSchedule.cs b/src/PepperDash.Essentials.Core/Fusion/RoomSchedule.cs
new file mode 100644
index 00000000..a9305c3b
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/RoomSchedule.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class RoomSchedule
+ {
+ public List Meetings { get; set; }
+
+ public RoomSchedule()
+ {
+ Meetings = new List();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/Rooms.cs b/src/PepperDash.Essentials.Core/Fusion/Rooms.cs
new file mode 100644
index 00000000..d96ce416
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/Rooms.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ public class Rooms
+ {
+ //[XmlElement(ElementName = "Room")]
+ public List Room { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionEventHandlers.cs b/src/PepperDash.Essentials.Core/Fusion/ScheduleChangeEventArgs.cs
similarity index 72%
rename from src/PepperDash.Essentials.Core/Fusion/FusionEventHandlers.cs
rename to src/PepperDash.Essentials.Core/Fusion/ScheduleChangeEventArgs.cs
index 26647a96..56ee345a 100644
--- a/src/PepperDash.Essentials.Core/Fusion/FusionEventHandlers.cs
+++ b/src/PepperDash.Essentials.Core/Fusion/ScheduleChangeEventArgs.cs
@@ -10,9 +10,4 @@ namespace PepperDash.Essentials.Core.Fusion
{
public RoomSchedule Schedule { get; set; }
}
-
- public class MeetingChangeEventArgs : EventArgs
- {
- public Event Meeting { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Fusion/ScheduleResponse.cs b/src/PepperDash.Essentials.Core/Fusion/ScheduleResponse.cs
new file mode 100644
index 00000000..022a20e3
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Fusion/ScheduleResponse.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Fusion
+{
+ ///
+ /// Data structure for a ScheduleResponse from Fusion
+ ///
+ /// //[XmlRoot(ElementName = "ScheduleResponse")]
+ public class ScheduleResponse
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "RoomName")]
+ public string RoomName { get; set; }
+ //[XmlElement("Event")]
+ public List Events { get; set; }
+
+ public ScheduleResponse()
+ {
+ Events = new List();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Global/JobTimer.cs b/src/PepperDash.Essentials.Core/Global/JobTimer.cs
index 83159c12..635e70d1 100644
--- a/src/PepperDash.Essentials.Core/Global/JobTimer.cs
+++ b/src/PepperDash.Essentials.Core/Global/JobTimer.cs
@@ -50,31 +50,4 @@ namespace PepperDash.Essentials.Core
}
}
-
- ///
- ///
- ///
- public class JobTimerItem
- {
- public string Key { get; private set; }
- public Action JobAction { get; private set; }
- public eJobTimerCycleTypes CycleType { get; private set; }
- ///
- ///
- ///
- public DateTime RunNextAt { get; set; }
-
- public JobTimerItem(string key, eJobTimerCycleTypes cycle, Action act)
- {
-
- }
- }
-
- public enum eJobTimerCycleTypes
- {
- RunEveryDay,
- RunEveryHour,
- RunEveryHalfHour,
- RunEveryMinute
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Global/JobTimerItem.cs b/src/PepperDash.Essentials.Core/Global/JobTimerItem.cs
new file mode 100644
index 00000000..737de0d7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Global/JobTimerItem.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public class JobTimerItem
+ {
+ public string Key { get; private set; }
+ public Action JobAction { get; private set; }
+ public eJobTimerCycleTypes CycleType { get; private set; }
+ ///
+ ///
+ ///
+ public DateTime RunNextAt { get; set; }
+
+ public JobTimerItem(string key, eJobTimerCycleTypes cycle, Action act)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Global/Scheduler.cs b/src/PepperDash.Essentials.Core/Global/Scheduler.cs
index 960a56ef..a30079da 100644
--- a/src/PepperDash.Essentials.Core/Global/Scheduler.cs
+++ b/src/PepperDash.Essentials.Core/Global/Scheduler.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
@@ -7,7 +6,6 @@ using Crestron.SimplSharp.Scheduler;
using PepperDash.Core;
using PepperDash.Essentials.Core.Fusion;
-using PepperDash.Essentials.Room.Config;
using Activator = System.Activator;
namespace PepperDash.Essentials.Core
@@ -122,157 +120,4 @@ Recurrence Days: {5}
return EventGroups.TryGetValue(key, out returnValue) ? returnValue : null;
}
}
-
- public static class SchedulerUtilities
- {
- ///
- /// Checks the day of week in eventTime to see if it matches the weekdays defined in the recurrence enum.
- ///
- ///
- ///
- ///
- public static bool CheckIfDayOfWeekMatchesRecurrenceDays(DateTime eventTime, ScheduledEventCommon.eWeekDays recurrence)
- {
- bool isMatch = false;
-
- var dayOfWeek = eventTime.DayOfWeek;
-
- Debug.Console(1, "[Scheduler]: eventTime day of week is: {0}", dayOfWeek);
-
- switch (dayOfWeek)
- {
- case DayOfWeek.Sunday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Sunday) == ScheduledEventCommon.eWeekDays.Sunday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Monday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Monday) == ScheduledEventCommon.eWeekDays.Monday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Tuesday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Tuesday) == ScheduledEventCommon.eWeekDays.Tuesday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Wednesday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Wednesday) == ScheduledEventCommon.eWeekDays.Wednesday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Thursday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Thursday) == ScheduledEventCommon.eWeekDays.Thursday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Friday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Friday) == ScheduledEventCommon.eWeekDays.Friday)
- isMatch = true;
- break;
- }
- case DayOfWeek.Saturday:
- {
- if ((recurrence & ScheduledEventCommon.eWeekDays.Saturday) == ScheduledEventCommon.eWeekDays.Saturday)
- isMatch = true;
- break;
- }
- }
-
- Debug.Console(1, "[Scheduler]: eventTime day of week matches recurrence days: {0}", isMatch);
-
- return isMatch;
- }
-
- public static bool CheckEventTimeForMatch(ScheduledEvent evnt, DateTime time)
- {
- return evnt.DateAndTime.Hour == time.Hour && evnt.DateAndTime.Minute == time.Minute;
- }
-
- public static bool CheckEventRecurrenceForMatch(ScheduledEvent evnt, ScheduledEventCommon.eWeekDays days)
- {
- return evnt.Recurrence.RecurrenceDays == days;
- }
-
- public static void CreateEventFromConfig(ScheduledEventConfig config, ScheduledEventGroup group, ScheduledEvent.UserEventCallBack handler)
- {
- if (group == null)
- {
- Debug.Console(0, "Unable to create event. Group is null");
- return;
- }
- var scheduledEvent = new ScheduledEvent(config.Key, group)
- {
- Acknowledgeable = config.Acknowledgeable,
- Persistent = config.Persistent
- };
-
- scheduledEvent.UserCallBack += handler;
-
- scheduledEvent.DateAndTime.SetFirstDayOfWeek(ScheduledEventCommon.eFirstDayOfWeek.Sunday);
-
- var eventTime = DateTime.Parse(config.Time);
-
- if (DateTime.Now > eventTime)
- {
- eventTime = eventTime.AddDays(1);
- }
-
- Debug.Console(2, "[Scheduler] Current Date day of week: {0} recurrence days: {1}", eventTime.DayOfWeek,
- config.Days);
-
- var dayOfWeekConverted = ConvertDayOfWeek(eventTime);
-
- Debug.Console(1, "[Scheduler] eventTime Day: {0}", dayOfWeekConverted);
-
- while (!dayOfWeekConverted.IsFlagSet(config.Days))
- {
- eventTime = eventTime.AddDays(1);
-
- dayOfWeekConverted = ConvertDayOfWeek(eventTime);
- }
-
- scheduledEvent.DateAndTime.SetAbsoluteEventTime(eventTime);
-
- scheduledEvent.Recurrence.Weekly(config.Days);
-
- if (config.Enable)
- {
- scheduledEvent.Enable();
- }
- else
- {
- scheduledEvent.Disable();
- }
- }
-
- private static ScheduledEventCommon.eWeekDays ConvertDayOfWeek(DateTime eventTime)
- {
- return (ScheduledEventCommon.eWeekDays) Enum.Parse(typeof(ScheduledEventCommon.eWeekDays), eventTime.DayOfWeek.ToString(), true);
- }
-
- private static bool IsFlagSet(this T value, T flag) where T : struct
- {
- CheckIsEnum(true);
-
- var lValue = Convert.ToInt64(value);
- var lFlag = Convert.ToInt64(flag);
-
- return (lValue & lFlag) != 0;
- }
-
- private static void CheckIsEnum(bool withFlags)
- {
- if (!typeof(T).IsEnum)
- throw new ArgumentException(string.Format("Type '{0}' is not an enum", typeof(T).FullName));
- if (withFlags && !Attribute.IsDefined(typeof(T), typeof(FlagsAttribute)))
- throw new ArgumentException(string.Format("Type '{0}' doesn't have the 'Flags' attribute", typeof(T).FullName));
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Global/SchedulerUtilities.cs b/src/PepperDash.Essentials.Core/Global/SchedulerUtilities.cs
new file mode 100644
index 00000000..6598a8a2
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Global/SchedulerUtilities.cs
@@ -0,0 +1,160 @@
+using System;
+using Crestron.SimplSharp.Scheduler;
+using PepperDash.Core;
+using PepperDash.Essentials.Room.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public static class SchedulerUtilities
+ {
+ ///
+ /// Checks the day of week in eventTime to see if it matches the weekdays defined in the recurrence enum.
+ ///
+ ///
+ ///
+ ///
+ public static bool CheckIfDayOfWeekMatchesRecurrenceDays(DateTime eventTime, ScheduledEventCommon.eWeekDays recurrence)
+ {
+ bool isMatch = false;
+
+ var dayOfWeek = eventTime.DayOfWeek;
+
+ Debug.Console(1, "[Scheduler]: eventTime day of week is: {0}", dayOfWeek);
+
+ switch (dayOfWeek)
+ {
+ case DayOfWeek.Sunday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Sunday) == ScheduledEventCommon.eWeekDays.Sunday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Monday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Monday) == ScheduledEventCommon.eWeekDays.Monday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Tuesday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Tuesday) == ScheduledEventCommon.eWeekDays.Tuesday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Wednesday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Wednesday) == ScheduledEventCommon.eWeekDays.Wednesday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Thursday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Thursday) == ScheduledEventCommon.eWeekDays.Thursday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Friday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Friday) == ScheduledEventCommon.eWeekDays.Friday)
+ isMatch = true;
+ break;
+ }
+ case DayOfWeek.Saturday:
+ {
+ if ((recurrence & ScheduledEventCommon.eWeekDays.Saturday) == ScheduledEventCommon.eWeekDays.Saturday)
+ isMatch = true;
+ break;
+ }
+ }
+
+ Debug.Console(1, "[Scheduler]: eventTime day of week matches recurrence days: {0}", isMatch);
+
+ return isMatch;
+ }
+
+ public static bool CheckEventTimeForMatch(ScheduledEvent evnt, DateTime time)
+ {
+ return evnt.DateAndTime.Hour == time.Hour && evnt.DateAndTime.Minute == time.Minute;
+ }
+
+ public static bool CheckEventRecurrenceForMatch(ScheduledEvent evnt, ScheduledEventCommon.eWeekDays days)
+ {
+ return evnt.Recurrence.RecurrenceDays == days;
+ }
+
+ public static void CreateEventFromConfig(ScheduledEventConfig config, ScheduledEventGroup group, ScheduledEvent.UserEventCallBack handler)
+ {
+ if (group == null)
+ {
+ Debug.Console(0, "Unable to create event. Group is null");
+ return;
+ }
+ var scheduledEvent = new ScheduledEvent(config.Key, group)
+ {
+ Acknowledgeable = config.Acknowledgeable,
+ Persistent = config.Persistent
+ };
+
+ scheduledEvent.UserCallBack += handler;
+
+ scheduledEvent.DateAndTime.SetFirstDayOfWeek(ScheduledEventCommon.eFirstDayOfWeek.Sunday);
+
+ var eventTime = DateTime.Parse(config.Time);
+
+ if (DateTime.Now > eventTime)
+ {
+ eventTime = eventTime.AddDays(1);
+ }
+
+ Debug.Console(2, "[Scheduler] Current Date day of week: {0} recurrence days: {1}", eventTime.DayOfWeek,
+ config.Days);
+
+ var dayOfWeekConverted = ConvertDayOfWeek(eventTime);
+
+ Debug.Console(1, "[Scheduler] eventTime Day: {0}", dayOfWeekConverted);
+
+ while (!dayOfWeekConverted.IsFlagSet(config.Days))
+ {
+ eventTime = eventTime.AddDays(1);
+
+ dayOfWeekConverted = ConvertDayOfWeek(eventTime);
+ }
+
+ scheduledEvent.DateAndTime.SetAbsoluteEventTime(eventTime);
+
+ scheduledEvent.Recurrence.Weekly(config.Days);
+
+ if (config.Enable)
+ {
+ scheduledEvent.Enable();
+ }
+ else
+ {
+ scheduledEvent.Disable();
+ }
+ }
+
+ private static ScheduledEventCommon.eWeekDays ConvertDayOfWeek(DateTime eventTime)
+ {
+ return (ScheduledEventCommon.eWeekDays) Enum.Parse(typeof(ScheduledEventCommon.eWeekDays), eventTime.DayOfWeek.ToString(), true);
+ }
+
+ private static bool IsFlagSet(this T value, T flag) where T : struct
+ {
+ CheckIsEnum(true);
+
+ var lValue = Convert.ToInt64(value);
+ var lFlag = Convert.ToInt64(flag);
+
+ return (lValue & lFlag) != 0;
+ }
+
+ private static void CheckIsEnum(bool withFlags)
+ {
+ if (!typeof(T).IsEnum)
+ throw new ArgumentException(string.Format("Type '{0}' is not an enum", typeof(T).FullName));
+ if (withFlags && !Attribute.IsDefined(typeof(T), typeof(FlagsAttribute)))
+ throw new ArgumentException(string.Format("Type '{0}' doesn't have the 'Flags' attribute", typeof(T).FullName));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Global/eJobTimerCycleTypes.cs b/src/PepperDash.Essentials.Core/Global/eJobTimerCycleTypes.cs
new file mode 100644
index 00000000..857e6a5e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Global/eJobTimerCycleTypes.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ public enum eJobTimerCycleTypes
+ {
+ RunEveryDay,
+ RunEveryHour,
+ RunEveryHalfHour,
+ RunEveryMinute
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/InUseTracking/InUseTracking.cs b/src/PepperDash.Essentials.Core/InUseTracking/InUseTracking.cs
index 4bf1a551..94e444c2 100644
--- a/src/PepperDash.Essentials.Core/InUseTracking/InUseTracking.cs
+++ b/src/PepperDash.Essentials.Core/InUseTracking/InUseTracking.cs
@@ -70,23 +70,7 @@ namespace PepperDash.Essentials.Core
}
}
- ///
- /// Wrapper for label/object pair representing in-use status. Allows the same object to
- /// register for in-use with different roles.
- ///
- public class InUseTrackingObject
- {
- public string Label { get; private set; }
- public object User { get; private set; }
-
- public InUseTrackingObject(object user, string label)
- {
- User = user;
- Label = label;
- }
- }
-
- //public class InUseEventArgs
+ //public class InUseEventArgs
//{
// public int EventType { get; private set; }
// public InUseTracking Tracker { get; private set; }
diff --git a/src/PepperDash.Essentials.Core/InUseTracking/InUseTrackingObject.cs b/src/PepperDash.Essentials.Core/InUseTracking/InUseTrackingObject.cs
new file mode 100644
index 00000000..cc3dac45
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/InUseTracking/InUseTrackingObject.cs
@@ -0,0 +1,18 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Wrapper for label/object pair representing in-use status. Allows the same object to
+ /// register for in-use with different roles.
+ ///
+ public class InUseTrackingObject
+ {
+ public string Label { get; private set; }
+ public object User { get; private set; }
+
+ public InUseTrackingObject(object user, string label)
+ {
+ User = user;
+ Label = label;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinData.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinData.cs
new file mode 100644
index 00000000..31e0c22c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinData.cs
@@ -0,0 +1,27 @@
+extern alias Full;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Data describing the join. Can be overridden from configuratino
+ ///
+ public class JoinData
+ {
+ ///
+ /// Join number (based on join offset value)
+ ///
+ [JsonProperty("joinNumber")]
+ public uint JoinNumber { get; set; }
+ ///
+ /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
+ ///
+ [JsonProperty("joinSpan")]
+ public uint JoinSpan { get; set; }
+ ///
+ /// Fusion Attribute Name (optional)
+ ///
+ [JsonProperty("attributeName")]
+ public string AttributeName { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinDataComplete.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinDataComplete.cs
new file mode 100644
index 00000000..88ef339d
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinDataComplete.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using Crestron.SimplSharp.Reflection;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// A class to aggregate the JoinData and JoinMetadata for a join
+ ///
+ public class JoinDataComplete
+ {
+ private uint _joinOffset;
+
+ private JoinData _data;
+ public JoinMetadata Metadata { get; set; }
+ ///
+ /// To store some future information as you please
+ ///
+ public object UserObject { get; private set; }
+
+ public JoinDataComplete(JoinData data, JoinMetadata metadata)
+ {
+ _data = data;
+ Metadata = metadata;
+ }
+
+ public string GetMarkdownFormattedData(string stringFormatter, int descriptionLen)
+ {
+
+ //Fixed Width Headers
+ var joinNumberLen = String.Format("Join Number").Length;
+ var joinSpanLen = String.Format("Join Span").Length;
+ var typeLen = String.Format("AnalogDigitalSerial").Length;
+ var capabilitiesLen = String.Format("ToFromFusion").Length;
+
+ //Track which one failed, if it did
+ const string placeholder = "unknown";
+ var dataArray = new Dictionary
+ {
+ {"joinNumber", placeholder.PadRight(joinNumberLen, ' ')},
+ {"joinSpan", placeholder.PadRight(joinSpanLen, ' ')},
+ {"description", placeholder.PadRight(descriptionLen, ' ')},
+ {"joinType", placeholder.PadRight(typeLen, ' ')},
+ {"capabilities", placeholder.PadRight(capabilitiesLen, ' ')}
+ };
+
+
+ try
+ {
+ dataArray["joinNumber"] = String.Format("{0}", JoinNumber.ToString(CultureInfo.InvariantCulture).ReplaceIfNullOrEmpty(placeholder)).PadRight(joinNumberLen, ' ');
+ dataArray["joinSpan"] = String.Format("{0}", JoinSpan.ToString(CultureInfo.InvariantCulture).ReplaceIfNullOrEmpty(placeholder)).PadRight(joinSpanLen, ' ');
+ dataArray["description"] = String.Format("{0}", Metadata.Description.ReplaceIfNullOrEmpty(placeholder)).PadRight(descriptionLen, ' ');
+ dataArray["joinType"] = String.Format("{0}", Metadata.JoinType.ToString().ReplaceIfNullOrEmpty(placeholder)).PadRight(typeLen, ' ');
+ dataArray["capabilities"] = String.Format("{0}", Metadata.JoinCapabilities.ToString().ReplaceIfNullOrEmpty(placeholder)).PadRight(capabilitiesLen, ' ');
+
+ return String.Format(stringFormatter,
+ dataArray["joinNumber"],
+ dataArray["joinSpan"],
+ dataArray["description"],
+ dataArray["joinType"],
+ dataArray["capabilities"]);
+
+ }
+ catch (Exception e)
+ {
+ //Don't Throw - we don't want to kill the system if this falls over - it's not mission critical. Print the error, use placeholder data
+ var errorKey = string.Empty;
+ foreach (var item in dataArray)
+ {
+ if (item.Value.TrimEnd() == placeholder) continue;
+ errorKey = item.Key;
+ break;
+ }
+ Debug.Console(0, "Unable to decode join metadata {1}- {0}", e.Message, !String.IsNullOrEmpty(errorKey) ? (' ' + errorKey) : String.Empty);
+ return String.Format(stringFormatter,
+ dataArray["joinNumber"],
+ dataArray["joinSpan"],
+ dataArray["description"],
+ dataArray["joinType"],
+ dataArray["capabilities"]);
+ }
+ }
+
+
+ ///
+ /// Sets the join offset value
+ ///
+ ///
+ public void SetJoinOffset(uint joinOffset)
+ {
+ _joinOffset = joinOffset;
+ }
+
+ ///
+ /// The join number (including the offset)
+ ///
+ public uint JoinNumber
+ {
+ get { return _data.JoinNumber+ _joinOffset; }
+ set { _data.JoinNumber = value; }
+ }
+
+ public uint JoinSpan
+ {
+ get { return _data.JoinSpan; }
+ }
+
+ public string AttributeName
+ {
+ get { return _data.AttributeName; }
+ }
+
+ public void SetCustomJoinData(JoinData customJoinData)
+ {
+ _data = customJoinData;
+ }
+
+ public string GetNameAttribute(MemberInfo memberInfo)
+ {
+ var name = string.Empty;
+ var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
+
+ if (attribute == null) return name;
+
+ name = attribute.Name;
+ Debug.Console(2, "JoinName Attribute value: {0}", name);
+ return name;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
index e16640ce..b62582c7 100644
--- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs
@@ -3,86 +3,14 @@
using System;
using System.Collections.Generic;
using System.Data;
-using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using Crestron.SimplSharp.Reflection;
-using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp;
using PepperDash.Core;
-using PepperDash.Essentials.Core.Config;
-
-using Full.Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
- public static class JoinMapHelper
- {
- ///
- /// Attempts to get the serialized join map from config
- ///
- ///
- ///
- public static string GetSerializedJoinMapForDevice(string joinMapKey)
- {
- if (string.IsNullOrEmpty(joinMapKey))
- return null;
-
- var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
-
- return joinMap.ToString();
- }
-
- ///
- /// Attempts to get the serialized join map from config
- ///
- ///
- ///
- public static string GetJoinMapForDevice(string joinMapKey)
- {
- return GetSerializedJoinMapForDevice(joinMapKey);
- }
-
- ///
- /// Attempts to find a custom join map by key and returns it deserialized if found
- ///
- ///
- ///
- public static Dictionary TryGetJoinMapAdvancedForDevice(string joinMapKey)
- {
- try
- {
- if (string.IsNullOrEmpty(joinMapKey))
- return null;
-
- if (!ConfigReader.ConfigObject.JoinMaps.ContainsKey(joinMapKey))
- {
- Debug.Console(2, "No Join Map found in config with key: '{0}'", joinMapKey);
- return null;
- }
-
- Debug.Console(2, "Attempting to load custom join map with key: {0}", joinMapKey);
-
- var joinMapJToken = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
-
- if (joinMapJToken == null)
- return null;
-
- var joinMapData = joinMapJToken.ToObject>();
-
- return joinMapData;
- }
- catch (Exception e)
- {
- Debug.Console(2, "Error getting join map for key: '{0}'. Error: {1}", joinMapKey, e);
- return null;
- }
- }
-
- }
-
///
/// Base class for join maps
///
@@ -173,491 +101,4 @@ namespace PepperDash.Essentials.Core
return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
}
}
-
- ///
- /// Base class for join maps
- ///
- public abstract class JoinMapBaseAdvanced
- {
- protected uint JoinOffset;
-
- ///
- /// The collection of joins and associated metadata
- ///
- public Dictionary Joins { get; private set; }
-
- protected JoinMapBaseAdvanced(uint joinStart)
- {
- Joins = new Dictionary();
-
- JoinOffset = joinStart - 1;
- }
-
- protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
- {
- AddJoins(type);
- }
-
- protected void AddJoins(Type type)
- {
- var fields =
- type.GetCType()
- .GetFields(BindingFlags.Public | BindingFlags.Instance)
- .Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
-
- foreach (var field in fields)
- {
- var childClass = Convert.ChangeType(this, type, null);
-
- var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
-
- if (value == null)
- {
- Debug.Console(0, "Unable to cast base class to {0}", type.Name);
- continue;
- }
-
- value.SetJoinOffset(JoinOffset);
-
- var joinName = value.GetNameAttribute(field);
-
- if (String.IsNullOrEmpty(joinName)) continue;
-
- Joins.Add(joinName, value);
- }
-
-
- if (Debug.Level > 0)
- {
- PrintJoinMapInfo();
- }
- }
-
- ///
- /// Prints the join information to console
- ///
- public void PrintJoinMapInfo()
- {
- Debug.Console(0, "{0}:\n", GetType().Name);
-
- // Get the joins of each type and print them
- Debug.Console(0, "Digitals:");
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- PrintJoinList(GetSortedJoins(digitals));
-
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- PrintJoinList(GetSortedJoins(analogs));
-
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- PrintJoinList(GetSortedJoins(serials));
-
- }
- ///
- /// Prints the join information to console
- ///
- public void MarkdownJoinMapInfo(string deviceKey, string bridgeKey)
- {
- var pluginType = GetType().Name;
-
- Debug.Console(0, "{0}:\n", pluginType);
-
- var sb = new StringBuilder();
-
- sb.AppendLine(String.Format("# {0}", GetType().Name));
- sb.AppendLine(String.Format("Generated from '{0}' on bridge '{1}'", deviceKey, bridgeKey));
- sb.AppendLine();
- sb.AppendLine("## Digitals");
- // Get the joins of each type and print them
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- var digitalSb = AppendJoinList(GetSortedJoins(digitals));
- digitalSb.AppendLine("## Analogs");
- digitalSb.AppendLine();
-
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- var analogSb = AppendJoinList(GetSortedJoins(analogs));
- analogSb.AppendLine("## Serials");
- analogSb.AppendLine();
-
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- var serialSb = AppendJoinList(GetSortedJoins(serials));
-
- sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
- sb.Append(digitalSb).Append(analogSb).Append(serialSb);
-
- WriteJoinmapMarkdown(sb, pluginType, bridgeKey, deviceKey);
-
- }
-
- private static void WriteJoinmapMarkdown(StringBuilder stringBuilder, string pluginType, string bridgeKey, string deviceKey)
- {
- var fileName = String.Format("{0}{1}{2}__{3}__{4}.md", Global.FilePathPrefix, "joinMaps/", pluginType, bridgeKey, deviceKey);
-
- using (var sw = new StreamWriter(fileName))
- {
- sw.WriteLine(stringBuilder.ToString());
- Debug.Console(0, "Joinmap Readme generated and written to {0}", fileName);
- }
-
- }
-
- ///
- /// Returns a sorted list by JoinNumber
- ///
- ///
- ///
- List> GetSortedJoins(Dictionary joins)
- {
- var sortedJoins = joins.ToList();
-
- sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
-
- return sortedJoins;
- }
-
- void PrintJoinList(List> joins)
- {
- foreach (var join in joins)
- {
- Debug.Console(0,
- @"Join Number: {0} | JoinSpan: '{1}' | JoinName: {2} | Description: '{3}' | Type: '{4}' | Capabilities: '{5}'",
- join.Value.JoinNumber,
- join.Value.JoinSpan,
- join.Key,
- String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
- join.Value.Metadata.JoinType.ToString(),
- join.Value.Metadata.JoinCapabilities.ToString());
- }
- }
-
- static StringBuilder AppendJoinList(List> joins)
- {
- var sb = new StringBuilder();
- const string stringFormatter = "| {0} | {1} | {2} | {3} | {4} |";
- const int joinNumberLen = 11;
- const int joinSpanLen = 9;
- const int typeLen = 19;
- const int capabilitiesLen = 12;
- var descriptionLen = (from @join in joins select @join.Value into j select j.Metadata.Description.Length).Concat(new[] {11}).Max();
-
- //build header
- sb.AppendLine(String.Format(stringFormatter,
- String.Format("Join Number").PadRight(joinNumberLen, ' '),
- String.Format("Join Span").PadRight(joinSpanLen, ' '),
- String.Format("Description").PadRight(descriptionLen, ' '),
- String.Format("Type").PadRight(typeLen, ' '),
- String.Format("Capabilities").PadRight(capabilitiesLen, ' ')));
- //build table seperator
- sb.AppendLine(String.Format(stringFormatter,
- new String('-', joinNumberLen),
- new String('-', joinSpanLen),
- new String('-', descriptionLen),
- new String('-', typeLen),
- new String('-', capabilitiesLen)));
-
- foreach (var join in joins)
- {
- sb.AppendLine(join.Value.GetMarkdownFormattedData(stringFormatter, descriptionLen));
- }
- sb.AppendLine();
- return sb;
- }
-
- ///
- /// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
- ///
- ///
- public void SetCustomJoinData(Dictionary joinData)
- {
- foreach (var customJoinData in joinData)
- {
- var join = Joins[customJoinData.Key];
-
- if (join != null)
- {
- join.SetCustomJoinData(customJoinData.Value);
- }
- else
- {
- Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
- }
- }
-
- PrintJoinMapInfo();
- }
-
- /////
- ///// Returns the join number for the join with the specified key
- /////
- /////
- /////
- //public uint GetJoinForKey(string key)
- //{
- // return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
- //}
-
-
- /////
- ///// Returns the join span for the join with the specified key
- /////
- /////
- /////
- //public uint GetJoinSpanForKey(string key)
- //{
- // return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
- //}
- }
-
- ///
- /// Read = Provides feedback to SIMPL
- /// Write = Responds to sig values from SIMPL
- ///
- [Flags]
- public enum eJoinCapabilities
- {
- None = 0,
- ToSIMPL = 1,
- FromSIMPL = 2,
- ToFromSIMPL = ToSIMPL | FromSIMPL,
- ToFusion = 4,
- FromFusion = 8,
- ToFromFusion = ToFusion | FromFusion,
- }
-
- [Flags]
- public enum eJoinType
- {
- None = 0,
- Digital = 1,
- Analog = 2,
- Serial = 4,
- DigitalAnalog = Digital | Analog,
- DigitalSerial = Digital | Serial,
- AnalogSerial = Analog | Serial,
- DigitalAnalogSerial = Digital | Analog | Serial,
- }
-
- ///
- /// Metadata describing the join
- ///
- public class JoinMetadata
- {
- private string _description;
-
- ///
- /// Join number (based on join offset value)
- ///
- [JsonProperty("joinNumber")]
- [Obsolete]
- public uint JoinNumber { get; set; }
- ///
- /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
- ///
- [Obsolete]
- [JsonProperty("joinSpan")]
- public uint JoinSpan { get; set; }
-
- ///
- /// A label for the join to better describe its usage
- ///
- [Obsolete("Use Description instead")]
- [JsonProperty("label")]
- public string Label { get { return _description; } set { _description = value; } }
-
- ///
- /// A description for the join to better describe its usage
- ///
- [JsonProperty("description")]
- public string Description { get { return _description; } set { _description = value; } }
- ///
- /// Signal type(s)
- ///
- [JsonProperty("joinType")]
- public eJoinType JoinType { get; set; }
- ///
- /// Indicates whether the join is read and/or write
- ///
- [JsonProperty("joinCapabilities")]
- public eJoinCapabilities JoinCapabilities { get; set; }
- ///
- /// Indicates a set of valid values (particularly if this translates to an enum
- ///
- [JsonProperty("validValues")]
- public string[] ValidValues { get; set; }
-
- }
-
- ///
- /// Data describing the join. Can be overridden from configuratino
- ///
- public class JoinData
- {
- ///
- /// Join number (based on join offset value)
- ///
- [JsonProperty("joinNumber")]
- public uint JoinNumber { get; set; }
- ///
- /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
- ///
- [JsonProperty("joinSpan")]
- public uint JoinSpan { get; set; }
- ///
- /// Fusion Attribute Name (optional)
- ///
- [JsonProperty("attributeName")]
- public string AttributeName { get; set; }
- }
-
- ///
- /// A class to aggregate the JoinData and JoinMetadata for a join
- ///
- public class JoinDataComplete
- {
- private uint _joinOffset;
-
- private JoinData _data;
- public JoinMetadata Metadata { get; set; }
- ///
- /// To store some future information as you please
- ///
- public object UserObject { get; private set; }
-
- public JoinDataComplete(JoinData data, JoinMetadata metadata)
- {
- _data = data;
- Metadata = metadata;
- }
-
- public string GetMarkdownFormattedData(string stringFormatter, int descriptionLen)
- {
-
- //Fixed Width Headers
- var joinNumberLen = String.Format("Join Number").Length;
- var joinSpanLen = String.Format("Join Span").Length;
- var typeLen = String.Format("AnalogDigitalSerial").Length;
- var capabilitiesLen = String.Format("ToFromFusion").Length;
-
- //Track which one failed, if it did
- const string placeholder = "unknown";
- var dataArray = new Dictionary
- {
- {"joinNumber", placeholder.PadRight(joinNumberLen, ' ')},
- {"joinSpan", placeholder.PadRight(joinSpanLen, ' ')},
- {"description", placeholder.PadRight(descriptionLen, ' ')},
- {"joinType", placeholder.PadRight(typeLen, ' ')},
- {"capabilities", placeholder.PadRight(capabilitiesLen, ' ')}
- };
-
-
- try
- {
- dataArray["joinNumber"] = String.Format("{0}", JoinNumber.ToString(CultureInfo.InvariantCulture).ReplaceIfNullOrEmpty(placeholder)).PadRight(joinNumberLen, ' ');
- dataArray["joinSpan"] = String.Format("{0}", JoinSpan.ToString(CultureInfo.InvariantCulture).ReplaceIfNullOrEmpty(placeholder)).PadRight(joinSpanLen, ' ');
- dataArray["description"] = String.Format("{0}", Metadata.Description.ReplaceIfNullOrEmpty(placeholder)).PadRight(descriptionLen, ' ');
- dataArray["joinType"] = String.Format("{0}", Metadata.JoinType.ToString().ReplaceIfNullOrEmpty(placeholder)).PadRight(typeLen, ' ');
- dataArray["capabilities"] = String.Format("{0}", Metadata.JoinCapabilities.ToString().ReplaceIfNullOrEmpty(placeholder)).PadRight(capabilitiesLen, ' ');
-
- return String.Format(stringFormatter,
- dataArray["joinNumber"],
- dataArray["joinSpan"],
- dataArray["description"],
- dataArray["joinType"],
- dataArray["capabilities"]);
-
- }
- catch (Exception e)
- {
- //Don't Throw - we don't want to kill the system if this falls over - it's not mission critical. Print the error, use placeholder data
- var errorKey = string.Empty;
- foreach (var item in dataArray)
- {
- if (item.Value.TrimEnd() == placeholder) continue;
- errorKey = item.Key;
- break;
- }
- Debug.Console(0, "Unable to decode join metadata {1}- {0}", e.Message, !String.IsNullOrEmpty(errorKey) ? (' ' + errorKey) : String.Empty);
- return String.Format(stringFormatter,
- dataArray["joinNumber"],
- dataArray["joinSpan"],
- dataArray["description"],
- dataArray["joinType"],
- dataArray["capabilities"]);
- }
- }
-
-
- ///
- /// Sets the join offset value
- ///
- ///
- public void SetJoinOffset(uint joinOffset)
- {
- _joinOffset = joinOffset;
- }
-
- ///
- /// The join number (including the offset)
- ///
- public uint JoinNumber
- {
- get { return _data.JoinNumber+ _joinOffset; }
- set { _data.JoinNumber = value; }
- }
-
- public uint JoinSpan
- {
- get { return _data.JoinSpan; }
- }
-
- public string AttributeName
- {
- get { return _data.AttributeName; }
- }
-
- public void SetCustomJoinData(JoinData customJoinData)
- {
- _data = customJoinData;
- }
-
- public string GetNameAttribute(MemberInfo memberInfo)
- {
- var name = string.Empty;
- var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute));
-
- if (attribute == null) return name;
-
- name = attribute.Name;
- Debug.Console(2, "JoinName Attribute value: {0}", name);
- return name;
- }
- }
-
-
-
- [AttributeUsage(AttributeTargets.All)]
- public class JoinNameAttribute : CAttribute
- {
- private string _Name;
-
- public JoinNameAttribute(string name)
- {
- Debug.Console(2, "Setting Attribute Name: {0}", name);
- _Name = name;
- }
-
- public string Name
- {
- get { return _Name; }
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBaseAdvanced.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBaseAdvanced.cs
new file mode 100644
index 00000000..f6786413
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBaseAdvanced.cs
@@ -0,0 +1,253 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp.CrestronIO;
+using Crestron.SimplSharp.Reflection;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Base class for join maps
+ ///
+ public abstract class JoinMapBaseAdvanced
+ {
+ protected uint JoinOffset;
+
+ ///
+ /// The collection of joins and associated metadata
+ ///
+ public Dictionary Joins { get; private set; }
+
+ protected JoinMapBaseAdvanced(uint joinStart)
+ {
+ Joins = new Dictionary();
+
+ JoinOffset = joinStart - 1;
+ }
+
+ protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart)
+ {
+ AddJoins(type);
+ }
+
+ protected void AddJoins(Type type)
+ {
+ var fields =
+ type.GetCType()
+ .GetFields(BindingFlags.Public | BindingFlags.Instance)
+ .Where(f => f.IsDefined(typeof (JoinNameAttribute), true));
+
+ foreach (var field in fields)
+ {
+ var childClass = Convert.ChangeType(this, type, null);
+
+ var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields.
+
+ if (value == null)
+ {
+ Debug.Console(0, "Unable to cast base class to {0}", type.Name);
+ continue;
+ }
+
+ value.SetJoinOffset(JoinOffset);
+
+ var joinName = value.GetNameAttribute(field);
+
+ if (String.IsNullOrEmpty(joinName)) continue;
+
+ Joins.Add(joinName, value);
+ }
+
+
+ if (Debug.Level > 0)
+ {
+ PrintJoinMapInfo();
+ }
+ }
+
+ ///
+ /// Prints the join information to console
+ ///
+ public void PrintJoinMapInfo()
+ {
+ Debug.Console(0, "{0}:\n", GetType().Name);
+
+ // Get the joins of each type and print them
+ Debug.Console(0, "Digitals:");
+ var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
+ PrintJoinList(GetSortedJoins(digitals));
+
+ Debug.Console(0, "Analogs:");
+ var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
+ PrintJoinList(GetSortedJoins(analogs));
+
+ Debug.Console(0, "Serials:");
+ var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Serial Joins", serials.Count);
+ PrintJoinList(GetSortedJoins(serials));
+
+ }
+ ///
+ /// Prints the join information to console
+ ///
+ public void MarkdownJoinMapInfo(string deviceKey, string bridgeKey)
+ {
+ var pluginType = GetType().Name;
+
+ Debug.Console(0, "{0}:\n", pluginType);
+
+ var sb = new StringBuilder();
+
+ sb.AppendLine(String.Format("# {0}", GetType().Name));
+ sb.AppendLine(String.Format("Generated from '{0}' on bridge '{1}'", deviceKey, bridgeKey));
+ sb.AppendLine();
+ sb.AppendLine("## Digitals");
+ // Get the joins of each type and print them
+ var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
+ var digitalSb = AppendJoinList(GetSortedJoins(digitals));
+ digitalSb.AppendLine("## Analogs");
+ digitalSb.AppendLine();
+
+ Debug.Console(0, "Analogs:");
+ var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
+ var analogSb = AppendJoinList(GetSortedJoins(analogs));
+ analogSb.AppendLine("## Serials");
+ analogSb.AppendLine();
+
+ Debug.Console(0, "Serials:");
+ var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
+ Debug.Console(2, "Found {0} Serial Joins", serials.Count);
+ var serialSb = AppendJoinList(GetSortedJoins(serials));
+
+ sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
+ sb.Append(digitalSb).Append(analogSb).Append(serialSb);
+
+ WriteJoinmapMarkdown(sb, pluginType, bridgeKey, deviceKey);
+
+ }
+
+ private static void WriteJoinmapMarkdown(StringBuilder stringBuilder, string pluginType, string bridgeKey, string deviceKey)
+ {
+ var fileName = String.Format("{0}{1}{2}__{3}__{4}.md", Global.FilePathPrefix, "joinMaps/", pluginType, bridgeKey, deviceKey);
+
+ using (var sw = new StreamWriter(fileName))
+ {
+ sw.WriteLine(stringBuilder.ToString());
+ Debug.Console(0, "Joinmap Readme generated and written to {0}", fileName);
+ }
+
+ }
+
+ ///
+ /// Returns a sorted list by JoinNumber
+ ///
+ ///
+ ///
+ List> GetSortedJoins(Dictionary joins)
+ {
+ var sortedJoins = joins.ToList();
+
+ sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber));
+
+ return sortedJoins;
+ }
+
+ void PrintJoinList(List> joins)
+ {
+ foreach (var join in joins)
+ {
+ Debug.Console(0,
+ @"Join Number: {0} | JoinSpan: '{1}' | JoinName: {2} | Description: '{3}' | Type: '{4}' | Capabilities: '{5}'",
+ join.Value.JoinNumber,
+ join.Value.JoinSpan,
+ join.Key,
+ String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
+ join.Value.Metadata.JoinType.ToString(),
+ join.Value.Metadata.JoinCapabilities.ToString());
+ }
+ }
+
+ static StringBuilder AppendJoinList(List> joins)
+ {
+ var sb = new StringBuilder();
+ const string stringFormatter = "| {0} | {1} | {2} | {3} | {4} |";
+ const int joinNumberLen = 11;
+ const int joinSpanLen = 9;
+ const int typeLen = 19;
+ const int capabilitiesLen = 12;
+ var descriptionLen = (from @join in joins select @join.Value into j select j.Metadata.Description.Length).Concat(new[] {11}).Max();
+
+ //build header
+ sb.AppendLine(String.Format(stringFormatter,
+ String.Format("Join Number").PadRight(joinNumberLen, ' '),
+ String.Format("Join Span").PadRight(joinSpanLen, ' '),
+ String.Format("Description").PadRight(descriptionLen, ' '),
+ String.Format("Type").PadRight(typeLen, ' '),
+ String.Format("Capabilities").PadRight(capabilitiesLen, ' ')));
+ //build table seperator
+ sb.AppendLine(String.Format(stringFormatter,
+ new String('-', joinNumberLen),
+ new String('-', joinSpanLen),
+ new String('-', descriptionLen),
+ new String('-', typeLen),
+ new String('-', capabilitiesLen)));
+
+ foreach (var join in joins)
+ {
+ sb.AppendLine(join.Value.GetMarkdownFormattedData(stringFormatter, descriptionLen));
+ }
+ sb.AppendLine();
+ return sb;
+ }
+
+ ///
+ /// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom
+ ///
+ ///
+ public void SetCustomJoinData(Dictionary joinData)
+ {
+ foreach (var customJoinData in joinData)
+ {
+ var join = Joins[customJoinData.Key];
+
+ if (join != null)
+ {
+ join.SetCustomJoinData(customJoinData.Value);
+ }
+ else
+ {
+ Debug.Console(2, "No matching key found in join map for: '{0}'", customJoinData.Key);
+ }
+ }
+
+ PrintJoinMapInfo();
+ }
+
+ /////
+ ///// Returns the join number for the join with the specified key
+ /////
+ /////
+ /////
+ //public uint GetJoinForKey(string key)
+ //{
+ // return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0;
+ //}
+
+
+ /////
+ ///// Returns the join span for the join with the specified key
+ /////
+ /////
+ /////
+ //public uint GetJoinSpanForKey(string key)
+ //{
+ // return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0;
+ //}
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapHelper.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapHelper.cs
new file mode 100644
index 00000000..c1610f7b
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapHelper.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public static class JoinMapHelper
+ {
+ ///
+ /// Attempts to get the serialized join map from config
+ ///
+ ///
+ ///
+ public static string GetSerializedJoinMapForDevice(string joinMapKey)
+ {
+ if (string.IsNullOrEmpty(joinMapKey))
+ return null;
+
+ var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
+
+ return joinMap.ToString();
+ }
+
+ ///
+ /// Attempts to get the serialized join map from config
+ ///
+ ///
+ ///
+ public static string GetJoinMapForDevice(string joinMapKey)
+ {
+ return GetSerializedJoinMapForDevice(joinMapKey);
+ }
+
+ ///
+ /// Attempts to find a custom join map by key and returns it deserialized if found
+ ///
+ ///
+ ///
+ public static Dictionary TryGetJoinMapAdvancedForDevice(string joinMapKey)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(joinMapKey))
+ return null;
+
+ if (!ConfigReader.ConfigObject.JoinMaps.ContainsKey(joinMapKey))
+ {
+ Debug.Console(2, "No Join Map found in config with key: '{0}'", joinMapKey);
+ return null;
+ }
+
+ Debug.Console(2, "Attempting to load custom join map with key: {0}", joinMapKey);
+
+ var joinMapJToken = ConfigReader.ConfigObject.JoinMaps[joinMapKey];
+
+ if (joinMapJToken == null)
+ return null;
+
+ var joinMapData = joinMapJToken.ToObject>();
+
+ return joinMapData;
+ }
+ catch (Exception e)
+ {
+ Debug.Console(2, "Error getting join map for key: '{0}'. Error: {1}", joinMapKey, e);
+ return null;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMetadata.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMetadata.cs
new file mode 100644
index 00000000..e4ae111a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMetadata.cs
@@ -0,0 +1,56 @@
+extern alias Full;
+using System;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Metadata describing the join
+ ///
+ public class JoinMetadata
+ {
+ private string _description;
+
+ ///
+ /// Join number (based on join offset value)
+ ///
+ [JsonProperty("joinNumber")]
+ [Obsolete]
+ public uint JoinNumber { get; set; }
+ ///
+ /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range
+ ///
+ [Obsolete]
+ [JsonProperty("joinSpan")]
+ public uint JoinSpan { get; set; }
+
+ ///
+ /// A label for the join to better describe its usage
+ ///
+ [Obsolete("Use Description instead")]
+ [JsonProperty("label")]
+ public string Label { get { return _description; } set { _description = value; } }
+
+ ///
+ /// A description for the join to better describe its usage
+ ///
+ [JsonProperty("description")]
+ public string Description { get { return _description; } set { _description = value; } }
+ ///
+ /// Signal type(s)
+ ///
+ [JsonProperty("joinType")]
+ public eJoinType JoinType { get; set; }
+ ///
+ /// Indicates whether the join is read and/or write
+ ///
+ [JsonProperty("joinCapabilities")]
+ public eJoinCapabilities JoinCapabilities { get; set; }
+ ///
+ /// Indicates a set of valid values (particularly if this translates to an enum
+ ///
+ [JsonProperty("validValues")]
+ public string[] ValidValues { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinNameAttribute.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinNameAttribute.cs
new file mode 100644
index 00000000..b60a673f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinNameAttribute.cs
@@ -0,0 +1,23 @@
+using System;
+using Crestron.SimplSharp.Reflection;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ [AttributeUsage(AttributeTargets.All)]
+ public class JoinNameAttribute : CAttribute
+ {
+ private string _Name;
+
+ public JoinNameAttribute(string name)
+ {
+ Debug.Console(2, "Setting Attribute Name: {0}", name);
+ _Name = name;
+ }
+
+ public string Name
+ {
+ get { return _Name; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/eJoinCapabilities.cs b/src/PepperDash.Essentials.Core/JoinMaps/eJoinCapabilities.cs
new file mode 100644
index 00000000..885f59ab
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/eJoinCapabilities.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Read = Provides feedback to SIMPL
+ /// Write = Responds to sig values from SIMPL
+ ///
+ [Flags]
+ public enum eJoinCapabilities
+ {
+ None = 0,
+ ToSIMPL = 1,
+ FromSIMPL = 2,
+ ToFromSIMPL = ToSIMPL | FromSIMPL,
+ ToFusion = 4,
+ FromFusion = 8,
+ ToFromFusion = ToFusion | FromFusion,
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/JoinMaps/eJoinType.cs b/src/PepperDash.Essentials.Core/JoinMaps/eJoinType.cs
new file mode 100644
index 00000000..07c91e30
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/JoinMaps/eJoinType.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace PepperDash.Essentials.Core
+{
+ [Flags]
+ public enum eJoinType
+ {
+ None = 0,
+ Digital = 1,
+ Analog = 2,
+ Serial = 4,
+ DigitalAnalog = Digital | Analog,
+ DigitalSerial = Digital | Serial,
+ AnalogSerial = Analog | Serial,
+ DigitalAnalogSerial = Digital | Analog | Serial,
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/License/EssentialsLicenseManager.cs b/src/PepperDash.Essentials.Core/License/EssentialsLicenseManager.cs
deleted file mode 100644
index 4afb85bf..00000000
--- a/src/PepperDash.Essentials.Core/License/EssentialsLicenseManager.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharp.CrestronDataStore;
-
-using PepperDash.Essentials.Core;
-
-using PepperDash.Core;
-
-
-namespace PepperDash.Essentials.License
-{
- public abstract class LicenseManager
- {
- public BoolFeedback LicenseIsValid { get; protected set; }
- public StringFeedback LicenseMessage { get; protected set; }
- public StringFeedback LicenseLog { get; protected set; }
-
- protected LicenseManager()
- {
- CrestronConsole.AddNewConsoleCommand(
- s => CrestronConsole.ConsoleCommandResponse(GetStatusString()),
- "licensestatus", "shows license and related data",
- ConsoleAccessLevelEnum.AccessOperator);
- }
-
- protected abstract string GetStatusString();
- }
-
- public class MockEssentialsLicenseManager : LicenseManager
- {
- ///
- /// Returns the singleton mock license manager for this app
- ///
- public static MockEssentialsLicenseManager Manager
- {
- get
- {
- if (_Manager == null)
- _Manager = new MockEssentialsLicenseManager();
- return _Manager;
- }
- }
- static MockEssentialsLicenseManager _Manager;
-
- bool IsValid;
-
- MockEssentialsLicenseManager() : base()
- {
- LicenseIsValid = new BoolFeedback("LicenseIsValid",
- () => { return IsValid; });
- CrestronConsole.AddNewConsoleCommand(
- s => SetFromConsole(s.Equals("true", StringComparison.OrdinalIgnoreCase)),
- "mocklicense", "true or false for testing", ConsoleAccessLevelEnum.AccessOperator);
-
- bool valid;
- var err = CrestronDataStoreStatic.GetGlobalBoolValue("MockLicense", out valid);
- if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
- SetIsValid(valid);
- else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
- CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", false);
- else
- CrestronConsole.PrintLine("Error restoring Mock License setting: {0}", err);
- }
-
- void SetIsValid(bool isValid)
- {
- IsValid = isValid;
- CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", isValid);
- Debug.Console(0, "Mock License is{0} valid", IsValid ? "" : " not");
- LicenseIsValid.FireUpdate();
- }
-
- void SetFromConsole(bool isValid)
- {
- SetIsValid(isValid);
- }
-
- protected override string GetStatusString()
- {
- return string.Format("License Status: {0}", IsValid ? "Valid" : "Not Valid");
- }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/License/LicenseManager.cs b/src/PepperDash.Essentials.Core/License/LicenseManager.cs
new file mode 100644
index 00000000..8cfa8730
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/License/LicenseManager.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using PepperDash.Essentials.Core;
+
+
+namespace PepperDash.Essentials.License
+{
+ public abstract class LicenseManager
+ {
+ public BoolFeedback LicenseIsValid { get; protected set; }
+ public StringFeedback LicenseMessage { get; protected set; }
+ public StringFeedback LicenseLog { get; protected set; }
+
+ protected LicenseManager()
+ {
+ CrestronConsole.AddNewConsoleCommand(
+ s => CrestronConsole.ConsoleCommandResponse(GetStatusString()),
+ "licensestatus", "shows license and related data",
+ ConsoleAccessLevelEnum.AccessOperator);
+ }
+
+ protected abstract string GetStatusString();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/License/MockEssentialsLicenseManager.cs b/src/PepperDash.Essentials.Core/License/MockEssentialsLicenseManager.cs
new file mode 100644
index 00000000..1cadde1c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/License/MockEssentialsLicenseManager.cs
@@ -0,0 +1,63 @@
+using System;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.CrestronDataStore;
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+
+namespace PepperDash.Essentials.License
+{
+ public class MockEssentialsLicenseManager : LicenseManager
+ {
+ ///
+ /// Returns the singleton mock license manager for this app
+ ///
+ public static MockEssentialsLicenseManager Manager
+ {
+ get
+ {
+ if (_Manager == null)
+ _Manager = new MockEssentialsLicenseManager();
+ return _Manager;
+ }
+ }
+ static MockEssentialsLicenseManager _Manager;
+
+ bool IsValid;
+
+ MockEssentialsLicenseManager() : base()
+ {
+ LicenseIsValid = new BoolFeedback("LicenseIsValid",
+ () => { return IsValid; });
+ CrestronConsole.AddNewConsoleCommand(
+ s => SetFromConsole(s.Equals("true", StringComparison.OrdinalIgnoreCase)),
+ "mocklicense", "true or false for testing", ConsoleAccessLevelEnum.AccessOperator);
+
+ bool valid;
+ var err = CrestronDataStoreStatic.GetGlobalBoolValue("MockLicense", out valid);
+ if (err == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
+ SetIsValid(valid);
+ else if (err == CrestronDataStore.CDS_ERROR.CDS_RECORD_NOT_FOUND)
+ CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", false);
+ else
+ CrestronConsole.PrintLine("Error restoring Mock License setting: {0}", err);
+ }
+
+ void SetIsValid(bool isValid)
+ {
+ IsValid = isValid;
+ CrestronDataStoreStatic.SetGlobalBoolValue("MockLicense", isValid);
+ Debug.Console(0, "Mock License is{0} valid", IsValid ? "" : " not");
+ LicenseIsValid.FireUpdate();
+ }
+
+ void SetFromConsole(bool isValid)
+ {
+ SetIsValid(isValid);
+ }
+
+ protected override string GetStatusString()
+ {
+ return string.Format("License Status: {0}", IsValid ? "Valid" : "Not Valid");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/ILightingLoad.cs b/src/PepperDash.Essentials.Core/Lighting/ILightingLoad.cs
new file mode 100644
index 00000000..24890793
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Lighting/ILightingLoad.cs
@@ -0,0 +1,15 @@
+namespace PepperDash.Essentials.Core.Lighting
+{
+ ///
+ /// Requiremnts for controlling a lighting load
+ ///
+ public interface ILightingLoad
+ {
+ void SetLoadLevel(int level);
+ void Raise();
+ void Lower();
+
+ IntFeedback LoadLevelFeedback { get; }
+ BoolFeedback LoadIsOnFeedback { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/ILightingMasterRaiseLower.cs b/src/PepperDash.Essentials.Core/Lighting/ILightingMasterRaiseLower.cs
new file mode 100644
index 00000000..da4308c3
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Lighting/ILightingMasterRaiseLower.cs
@@ -0,0 +1,12 @@
+namespace PepperDash.Essentials.Core.Lighting
+{
+ ///
+ /// Requirements for a device that implements master raise/lower
+ ///
+ public interface ILightingMasterRaiseLower
+ {
+ void MasterRaise();
+ void MasterLower();
+ void MasterRaiseLowerStop();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/ILightingScenes.cs b/src/PepperDash.Essentials.Core/Lighting/ILightingScenes.cs
new file mode 100644
index 00000000..09f3d8b7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Lighting/ILightingScenes.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core.Lighting
+{
+ ///
+ /// Requirements for a device that implements lighting scene control
+ ///
+ public interface ILightingScenes
+ {
+ event EventHandler LightingSceneChange;
+
+ List LightingScenes { get; }
+
+ void SelectScene(LightingScene scene);
+
+ LightingScene CurrentLightingScene { get; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/Lighting Interfaces.cs b/src/PepperDash.Essentials.Core/Lighting/Lighting Interfaces.cs
deleted file mode 100644
index 6c0eaad3..00000000
--- a/src/PepperDash.Essentials.Core/Lighting/Lighting Interfaces.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-
-using PepperDash.Core;
-
-namespace PepperDash.Essentials.Core.Lighting
-{
- ///
- /// Requirements for a device that implements lighting scene control
- ///
- public interface ILightingScenes
- {
- event EventHandler LightingSceneChange;
-
- List LightingScenes { get; }
-
- void SelectScene(LightingScene scene);
-
- LightingScene CurrentLightingScene { get; }
-
- }
-
- ///
- /// Requirements for a device that implements master raise/lower
- ///
- public interface ILightingMasterRaiseLower
- {
- void MasterRaise();
- void MasterLower();
- void MasterRaiseLowerStop();
- }
-
- ///
- /// Requiremnts for controlling a lighting load
- ///
- public interface ILightingLoad
- {
- void SetLoadLevel(int level);
- void Raise();
- void Lower();
-
- IntFeedback LoadLevelFeedback { get; }
- BoolFeedback LoadIsOnFeedback { get; }
- }
-
- public class LightingSceneChangeEventArgs : EventArgs
- {
- public LightingScene CurrentLightingScene { get; private set; }
-
- public LightingSceneChangeEventArgs(LightingScene scene)
- {
- CurrentLightingScene = scene;
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs
index 5bb677a2..addb0cd9 100644
--- a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs
+++ b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs
@@ -136,34 +136,4 @@ namespace PepperDash.Essentials.Core.Lighting
return joinMap;
}
}
-
- public class LightingScene
- {
- [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
- public string Name { get; set; }
- [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
- public string ID { get; set; }
- bool _IsActive;
- [JsonProperty("isActive", NullValueHandling = NullValueHandling.Ignore)]
- public bool IsActive
- {
- get
- {
- return _IsActive;
- }
- set
- {
- _IsActive = value;
- IsActiveFeedback.FireUpdate();
- }
- }
-
- [JsonIgnore]
- public BoolFeedback IsActiveFeedback { get; set; }
-
- public LightingScene()
- {
- IsActiveFeedback = new BoolFeedback(new Func(() => IsActive));
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingScene.cs b/src/PepperDash.Essentials.Core/Lighting/LightingScene.cs
new file mode 100644
index 00000000..b4d521aa
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Lighting/LightingScene.cs
@@ -0,0 +1,36 @@
+extern alias Full;
+using System;
+using Full::Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.Lighting
+{
+ public class LightingScene
+ {
+ [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
+ public string Name { get; set; }
+ [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
+ public string ID { get; set; }
+ bool _IsActive;
+ [JsonProperty("isActive", NullValueHandling = NullValueHandling.Ignore)]
+ public bool IsActive
+ {
+ get
+ {
+ return _IsActive;
+ }
+ set
+ {
+ _IsActive = value;
+ IsActiveFeedback.FireUpdate();
+ }
+ }
+
+ [JsonIgnore]
+ public BoolFeedback IsActiveFeedback { get; set; }
+
+ public LightingScene()
+ {
+ IsActiveFeedback = new BoolFeedback(new Func(() => IsActive));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingSceneChangeEventArgs.cs b/src/PepperDash.Essentials.Core/Lighting/LightingSceneChangeEventArgs.cs
new file mode 100644
index 00000000..aaed1350
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Lighting/LightingSceneChangeEventArgs.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Lighting
+{
+ public class LightingSceneChangeEventArgs : EventArgs
+ {
+ public LightingScene CurrentLightingScene { get; private set; }
+
+ public LightingSceneChangeEventArgs(LightingScene scene)
+ {
+ CurrentLightingScene = scene;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Microphone Privacy/KeyedDevice.cs b/src/PepperDash.Essentials.Core/Microphone Privacy/KeyedDevice.cs
new file mode 100644
index 00000000..e340694c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Microphone Privacy/KeyedDevice.cs
@@ -0,0 +1,7 @@
+namespace PepperDash.Essentials.Core.Privacy
+{
+ public class KeyedDevice
+ {
+ public string DeviceKey { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs
index 55b458a7..0900bfd8 100644
--- a/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs
+++ b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyController.cs
@@ -6,7 +6,6 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.CrestronIO;
@@ -234,21 +233,4 @@ namespace PepperDash.Essentials.Core.Privacy
}
}
}
-
- public class MicrophonePrivacyControllerFactory : EssentialsDeviceFactory
- {
- public MicrophonePrivacyControllerFactory()
- {
- TypeNames = new List() { "microphoneprivacycontroller" };
- }
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new MIcrophonePrivacyController Device");
- var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString());
-
- return new Core.Privacy.MicrophonePrivacyController(dc.Key, props);
- }
- }
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerConfig.cs b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerConfig.cs
index 1c172090..3d35b1c4 100644
--- a/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerConfig.cs
+++ b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerConfig.cs
@@ -14,9 +14,4 @@ namespace PepperDash.Essentials.Core.Privacy
public KeyedDevice GreenLedRelay { get; set; }
public KeyedDevice RedLedRelay { get; set; }
}
-
- public class KeyedDevice
- {
- public string DeviceKey { get; set; }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerFactory.cs b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerFactory.cs
new file mode 100644
index 00000000..e3a036c6
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Microphone Privacy/MicrophonePrivacyControllerFactory.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Privacy
+{
+ public class MicrophonePrivacyControllerFactory : EssentialsDeviceFactory
+ {
+ public MicrophonePrivacyControllerFactory()
+ {
+ TypeNames = new List() { "microphoneprivacycontroller" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new MIcrophonePrivacyController Device");
+ var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString());
+
+ return new Core.Privacy.MicrophonePrivacyController(dc.Key, props);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/CommunicationMonitorConfig.cs b/src/PepperDash.Essentials.Core/Monitoring/CommunicationMonitorConfig.cs
new file mode 100644
index 00000000..d44c7de8
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/CommunicationMonitorConfig.cs
@@ -0,0 +1,18 @@
+namespace PepperDash.Essentials.Core
+{
+ public class CommunicationMonitorConfig
+ {
+ public int PollInterval { get; set; }
+ public int TimeToWarning { get; set; }
+ public int TimeToError { get; set; }
+ public string PollString { get; set; }
+
+ public CommunicationMonitorConfig()
+ {
+ PollInterval = 30000;
+ TimeToWarning = 120000;
+ TimeToError = 300000;
+ PollString = "";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/GenericCommunicationMonitor.cs b/src/PepperDash.Essentials.Core/Monitoring/GenericCommunicationMonitor.cs
index edb4c31b..14d31d9c 100644
--- a/src/PepperDash.Essentials.Core/Monitoring/GenericCommunicationMonitor.cs
+++ b/src/PepperDash.Essentials.Core/Monitoring/GenericCommunicationMonitor.cs
@@ -244,21 +244,4 @@ namespace PepperDash.Essentials.Core
}
}
}
-
-
- public class CommunicationMonitorConfig
- {
- public int PollInterval { get; set; }
- public int TimeToWarning { get; set; }
- public int TimeToError { get; set; }
- public string PollString { get; set; }
-
- public CommunicationMonitorConfig()
- {
- PollInterval = 30000;
- TimeToWarning = 120000;
- TimeToError = 300000;
- PollString = "";
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/ICommunicationMonitor.cs b/src/PepperDash.Essentials.Core/Monitoring/ICommunicationMonitor.cs
new file mode 100644
index 00000000..dced2e7f
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/ICommunicationMonitor.cs
@@ -0,0 +1,10 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Represents a class that has a basic communication monitoring
+ ///
+ public interface ICommunicationMonitor
+ {
+ StatusMonitorBase CommunicationMonitor { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/IStatusMonitor.cs b/src/PepperDash.Essentials.Core/Monitoring/IStatusMonitor.cs
new file mode 100644
index 00000000..4ffbed39
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/IStatusMonitor.cs
@@ -0,0 +1,16 @@
+using System;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IStatusMonitor
+ {
+ IKeyed Parent { get; }
+ event EventHandler StatusChange;
+ MonitorStatus Status { get; }
+ string Message { get; }
+ BoolFeedback IsOnlineFeedback { get; set; }
+ void Start();
+ void Stop();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/Interfaces.cs b/src/PepperDash.Essentials.Core/Monitoring/Interfaces.cs
deleted file mode 100644
index 6e4a847e..00000000
--- a/src/PepperDash.Essentials.Core/Monitoring/Interfaces.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-
-using System;
-
-using PepperDash.Core;
-
-
-namespace PepperDash.Essentials.Core
-{
- public interface IStatusMonitor
- {
- IKeyed Parent { get; }
- event EventHandler StatusChange;
- MonitorStatus Status { get; }
- string Message { get; }
- BoolFeedback IsOnlineFeedback { get; set; }
- void Start();
- void Stop();
- }
-
-
- ///
- /// Represents a class that has a basic communication monitoring
- ///
- public interface ICommunicationMonitor
- {
- StatusMonitorBase CommunicationMonitor { get; }
- }
-
- ///
- /// StatusUnknown = 0, IsOk = 1, InWarning = 2, InError = 3
- ///
- public enum MonitorStatus
- {
- StatusUnknown = 0,
- IsOk = 1,
- InWarning = 2,
- InError = 3
- }
-
- public class MonitorStatusChangeEventArgs : EventArgs
- {
- public MonitorStatus Status { get; private set; }
- public string Message { get; private set; }
-
- public MonitorStatusChangeEventArgs(MonitorStatus status)
- {
- Status = status;
- Message = status == MonitorStatus.IsOk ? "" : status.ToString();
- }
-
- public MonitorStatusChangeEventArgs(MonitorStatus status, string message)
- {
- Status = status;
- Message = message;
- }
- }
-}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/MonitorStatus.cs b/src/PepperDash.Essentials.Core/Monitoring/MonitorStatus.cs
new file mode 100644
index 00000000..2b67a509
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/MonitorStatus.cs
@@ -0,0 +1,13 @@
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// StatusUnknown = 0, IsOk = 1, InWarning = 2, InError = 3
+ ///
+ public enum MonitorStatus
+ {
+ StatusUnknown = 0,
+ IsOk = 1,
+ InWarning = 2,
+ InError = 3
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/MonitorStatusChangeEventArgs.cs b/src/PepperDash.Essentials.Core/Monitoring/MonitorStatusChangeEventArgs.cs
new file mode 100644
index 00000000..71b6da3c
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/MonitorStatusChangeEventArgs.cs
@@ -0,0 +1,24 @@
+
+using System;
+
+
+namespace PepperDash.Essentials.Core
+{
+ public class MonitorStatusChangeEventArgs : EventArgs
+ {
+ public MonitorStatus Status { get; private set; }
+ public string Message { get; private set; }
+
+ public MonitorStatusChangeEventArgs(MonitorStatus status)
+ {
+ Status = status;
+ Message = status == MonitorStatus.IsOk ? "" : status.ToString();
+ }
+
+ public MonitorStatusChangeEventArgs(MonitorStatus status, string message)
+ {
+ Status = status;
+ Message = message;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/ProgramInfo.cs b/src/PepperDash.Essentials.Core/Monitoring/ProgramInfo.cs
new file mode 100644
index 00000000..08a0e74a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/ProgramInfo.cs
@@ -0,0 +1,89 @@
+extern alias Full;
+using Crestron.SimplSharpPro.Diagnostics;
+using Full::Newtonsoft.Json;
+using Full::Newtonsoft.Json.Converters;
+
+namespace PepperDash.Essentials.Core.Monitoring
+{
+ ///
+ /// Class for serializing program slot information
+ ///
+ public class ProgramInfo
+ {
+ // Shared properties
+
+ [JsonProperty("programNumber")]
+ public uint ProgramNumber { get; private set; }
+
+ [JsonConverter(typeof (StringEnumConverter))]
+ [JsonProperty("operatingState")]
+ public eProgramOperatingState OperatingState { get; set; }
+
+ [JsonConverter(typeof (StringEnumConverter))]
+ [JsonProperty("registrationState")]
+ public eProgramRegistrationState RegistrationState { get; set; }
+
+ [JsonProperty("programFile")]
+ public string ProgramFile { get; set; }
+
+ [JsonProperty("friendlyName")]
+ public string FriendlyName { get; set; }
+
+ [JsonProperty("compilerRevision")]
+ public string CompilerRevision { get; set; }
+
+ [JsonProperty("compileTime")]
+ public string CompileTime { get; set; }
+
+ [JsonProperty("include4Dat")]
+ public string Include4Dat { get; set; }
+
+ // SIMPL Windows properties
+ [JsonProperty("systemName")]
+ public string SystemName { get; set; }
+
+ [JsonProperty("crestronDb")]
+ public string CrestronDb { get; set; }
+
+ [JsonProperty("environment")]
+ public string Environment { get; set; }
+
+ [JsonProperty("programmer")]
+ public string Programmer { get; set; }
+
+
+ // SSP Properties
+ [JsonProperty("applicationName")]
+ public string ApplicationName { get; set; }
+
+ [JsonProperty("programTool")]
+ public string ProgramTool { get; set; }
+
+ [JsonProperty("minFirmwareVersion")]
+ public string MinFirmwareVersion { get; set; }
+
+ [JsonProperty("plugInVersion")]
+ public string PlugInVersion { get; set; }
+
+ public ProgramInfo(uint number)
+ {
+ ProgramNumber = number;
+
+ ProgramFile = "";
+ FriendlyName = "";
+ CompilerRevision = "";
+ CompileTime = "";
+ Include4Dat = "";
+
+ SystemName = "";
+ CrestronDb = "";
+ Environment = "";
+ Programmer = "";
+
+ ApplicationName = "";
+ ProgramTool = "";
+ MinFirmwareVersion = "";
+ PlugInVersion = "";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/ProgramInfoEventArgs.cs b/src/PepperDash.Essentials.Core/Monitoring/ProgramInfoEventArgs.cs
new file mode 100644
index 00000000..00cac85e
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Monitoring/ProgramInfoEventArgs.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace PepperDash.Essentials.Core.Monitoring
+{
+ public class ProgramInfoEventArgs : EventArgs
+ {
+ public ProgramInfo ProgramInfo;
+
+ public ProgramInfoEventArgs(ProgramInfo progInfo)
+ {
+ ProgramInfo = progInfo;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
index b9d25127..3cc71e85 100644
--- a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
+++ b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs
@@ -8,7 +8,6 @@ using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.Diagnostics;
using PepperDash.Core;
using Full.Newtonsoft.Json;
-using Full.Newtonsoft.Json.Converters;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core.Monitoring
@@ -664,96 +663,4 @@ namespace PepperDash.Essentials.Core.Monitoring
}
}
}
-
- ///
- /// Class for serializing program slot information
- ///
- public class ProgramInfo
- {
- // Shared properties
-
- [JsonProperty("programNumber")]
- public uint ProgramNumber { get; private set; }
-
- [JsonConverter(typeof (StringEnumConverter))]
- [JsonProperty("operatingState")]
- public eProgramOperatingState OperatingState { get; set; }
-
- [JsonConverter(typeof (StringEnumConverter))]
- [JsonProperty("registrationState")]
- public eProgramRegistrationState RegistrationState { get; set; }
-
- [JsonProperty("programFile")]
- public string ProgramFile { get; set; }
-
- [JsonProperty("friendlyName")]
- public string FriendlyName { get; set; }
-
- [JsonProperty("compilerRevision")]
- public string CompilerRevision { get; set; }
-
- [JsonProperty("compileTime")]
- public string CompileTime { get; set; }
-
- [JsonProperty("include4Dat")]
- public string Include4Dat { get; set; }
-
- // SIMPL Windows properties
- [JsonProperty("systemName")]
- public string SystemName { get; set; }
-
- [JsonProperty("crestronDb")]
- public string CrestronDb { get; set; }
-
- [JsonProperty("environment")]
- public string Environment { get; set; }
-
- [JsonProperty("programmer")]
- public string Programmer { get; set; }
-
-
- // SSP Properties
- [JsonProperty("applicationName")]
- public string ApplicationName { get; set; }
-
- [JsonProperty("programTool")]
- public string ProgramTool { get; set; }
-
- [JsonProperty("minFirmwareVersion")]
- public string MinFirmwareVersion { get; set; }
-
- [JsonProperty("plugInVersion")]
- public string PlugInVersion { get; set; }
-
- public ProgramInfo(uint number)
- {
- ProgramNumber = number;
-
- ProgramFile = "";
- FriendlyName = "";
- CompilerRevision = "";
- CompileTime = "";
- Include4Dat = "";
-
- SystemName = "";
- CrestronDb = "";
- Environment = "";
- Programmer = "";
-
- ApplicationName = "";
- ProgramTool = "";
- MinFirmwareVersion = "";
- PlugInVersion = "";
- }
- }
-
- public class ProgramInfoEventArgs : EventArgs
- {
- public ProgramInfo ProgramInfo;
-
- public ProgramInfoEventArgs(ProgramInfo progInfo)
- {
- ProgramInfo = progInfo;
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseControllerFactory.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseControllerFactory.cs
new file mode 100644
index 00000000..190e298a
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseControllerFactory.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory
+ {
+ public GlsOccupancySensorBaseControllerFactory()
+ {
+ TypeNames = new List { "glsoirccn" };
+ }
+
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new GlsOirOccupancySensorController Device");
+
+ return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc);
+ }
+
+ private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
+ {
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ var cresnetId = control.CresnetIdInt;
+ var branchId = control.ControlPortNumber;
+ var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
+
+ if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
+ return new GlsOirCCn(cresnetId, Global.ControlSystem);
+ }
+ var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
+
+ if (cresnetBridge != null)
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
+ return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
+ }
+ Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
+ return null;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs
index dd6b3605..1c582915 100644
--- a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs
+++ b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
@@ -239,46 +238,4 @@ namespace PepperDash.Essentials.Core
}
}
-
- public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory
- {
- public GlsOdtOccupancySensorControllerFactory()
- {
- TypeNames = new List { "glsodtccn" };
- }
-
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
-
- return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
- }
-
- private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)
- {
- var control = CommFactory.GetControlPropertiesConfig(dc);
- var cresnetId = control.CresnetIdInt;
- var branchId = control.ControlPortNumber;
- var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
-
- if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
- return new GlsOdtCCn(cresnetId, Global.ControlSystem);
- }
- var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
-
- if (cresnetBridge != null)
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
- return new GlsOdtCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
- }
- Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
- return null;
- }
- }
-
-
-
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorControllerFactory.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorControllerFactory.cs
new file mode 100644
index 00000000..04567ad7
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorControllerFactory.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using Crestron.SimplSharpPro.GeneralIO;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory
+ {
+ public GlsOdtOccupancySensorControllerFactory()
+ {
+ TypeNames = new List { "glsodtccn" };
+ }
+
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
+
+ return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc);
+ }
+
+ private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)
+ {
+ var control = CommFactory.GetControlPropertiesConfig(dc);
+ var cresnetId = control.CresnetIdInt;
+ var branchId = control.ControlPortNumber;
+ var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
+
+ if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
+ return new GlsOdtCCn(cresnetId, Global.ControlSystem);
+ }
+ var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
+
+ if (cresnetBridge != null)
+ {
+ Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey);
+ return new GlsOdtCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
+ }
+ Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs
index 573d94ac..52be60dc 100644
--- a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs
+++ b/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs
@@ -1,8 +1,6 @@
using System;
-using System.Collections.Generic;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
-using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
@@ -37,44 +35,4 @@ namespace PepperDash.Essentials.Core
#endregion
}
-
- public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory
- {
- public GlsOccupancySensorBaseControllerFactory()
- {
- TypeNames = new List { "glsoirccn" };
- }
-
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new GlsOirOccupancySensorController Device");
-
- return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc);
- }
-
- private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc)
- {
- var control = CommFactory.GetControlPropertiesConfig(dc);
- var cresnetId = control.CresnetIdInt;
- var branchId = control.ControlPortNumber;
- var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
-
- if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
- return new GlsOirCCn(cresnetId, Global.ControlSystem);
- }
- var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
-
- if (cresnetBridge != null)
- {
- Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey);
- return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]);
- }
- Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
- return null;
- }
-
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs b/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs
index dfa4fef1..f42563f0 100644
--- a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs
+++ b/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs
@@ -1,12 +1,10 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
@@ -88,22 +86,4 @@ namespace PepperDash.Essentials.Core
_aggregatedOccupancyStatus.ClearOutputs();
}
}
-
- public class OccupancyAggregatorFactory : EssentialsDeviceFactory
- {
- public OccupancyAggregatorFactory()
- {
- TypeNames = new List { "occupancyAggregator", "occAggregate" };
- }
-
-
- public override EssentialsDevice BuildDevice(DeviceConfig dc)
- {
- Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
-
- var config = dc.Properties.ToObject();
-
- return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config);
- }
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorFactory.cs b/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorFactory.cs
new file mode 100644
index 00000000..905d6a72
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorFactory.cs
@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core
+{
+ public class OccupancyAggregatorFactory : EssentialsDeviceFactory
+ {
+ public OccupancyAggregatorFactory()
+ {
+ TypeNames = new List { "occupancyAggregator", "occAggregate" };
+ }
+
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
+
+ var config = dc.Properties.ToObject();
+
+ return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionController.cs b/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionController.cs
new file mode 100644
index 00000000..b856deed
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionController.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ /// Describes the functionality of a device that can provide partition state either manually via user input or optionally via a sensor state
+ ///
+ public interface IPartitionController : IPartitionStateProvider
+ {
+ List AdjacentRoomKeys { get; }
+
+ void SetPartitionStatePresent();
+
+ void SetPartitionStateNotPresent();
+
+ void ToggglePartitionState();
+
+ void SetManualMode();
+
+ void SetAutoMode();
+ }
+}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionStateProvider.cs b/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionStateProvider.cs
index adb420b7..c5c0fde0 100644
--- a/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionStateProvider.cs
+++ b/src/PepperDash.Essentials.Core/PartitionSensor/IPartitionStateProvider.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
@@ -15,22 +14,4 @@ namespace PepperDash.Essentials.Core
{
BoolFeedback PartitionPresentFeedback { get; }
}
-
- ///
- /// Describes the functionality of a device that can provide partition state either manually via user input or optionally via a sensor state
- ///
- public interface IPartitionController : IPartitionStateProvider
- {
- List AdjacentRoomKeys { get; }
-
- void SetPartitionStatePresent();
-
- void SetPartitionStateNotPresent();
-
- void ToggglePartitionState();
-
- void SetManualMode();
-
- void SetAutoMode();
- }
}
\ No newline at end of file
diff --git a/src/PepperDash.Essentials.Core/Plugins/IPluginDevelopmentDeviceFactory.cs b/src/PepperDash.Essentials.Core/Plugins/IPluginDevelopmentDeviceFactory.cs
new file mode 100644
index 00000000..699a8388
--- /dev/null
+++ b/src/PepperDash.Essentials.Core/Plugins/IPluginDevelopmentDeviceFactory.cs
@@ -0,0 +1,9 @@
+using System.Collections.Generic;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IPluginDevelopmentDeviceFactory : IPluginDeviceFactory
+ {
+ List