diff --git a/src/ICommandBuilder.cs b/src/ICommandBuilder.cs index 8d9c5c4..3712c23 100644 --- a/src/ICommandBuilder.cs +++ b/src/ICommandBuilder.cs @@ -1,4 +1,4 @@ -namespace PanasonicProjectorEpi +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { public interface ICommandBuilder { diff --git a/src/IpCommandBuilder.cs b/src/IpCommandBuilder.cs index a6c222b..eaa0c93 100644 --- a/src/IpCommandBuilder.cs +++ b/src/IpCommandBuilder.cs @@ -1,25 +1,25 @@ using System; -namespace PanasonicProjectorEpi -{ - public class IpCommandBuilder:ICommandBuilder - { - private const string CommandWithParameterOnly = "00{0}:{1}"; - private const string CommandOnly = "00{0}"; - - public string Delimiter - { - get { return "\r"; } - } - - public string GetCommand(string cmd, string parameter) - { - return String.Format("00{0}:{1}{2}", cmd, parameter, Delimiter); - } - - public string GetCommand(string cmd) - { - return String.Format("00{0}{1}", cmd, Delimiter); - } - } +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + public class IpCommandBuilder:ICommandBuilder + { + private const string CommandWithParameterOnly = "00{0}:{1}"; + private const string CommandOnly = "00{0}"; + + public string Delimiter + { + get { return "\r"; } + } + + public string GetCommand(string cmd, string parameter) + { + return String.Format("00{0}:{1}{2}", cmd, parameter, Delimiter); + } + + public string GetCommand(string cmd) + { + return String.Format("00{0}{1}", cmd, Delimiter); + } + } } \ No newline at end of file diff --git a/src/PanasonicInput.cs b/src/PanasonicInput.cs index b46edc7..7ac1481 100644 --- a/src/PanasonicInput.cs +++ b/src/PanasonicInput.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -namespace PanasonicProjectorEpi +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { #if SERIES4 public class PanasonicInputs : ISelectableItems diff --git a/src/PanasonicIpStatusMonitor.cs b/src/PanasonicIpStatusMonitor.cs index c07fb2f..8f54fdc 100644 --- a/src/PanasonicIpStatusMonitor.cs +++ b/src/PanasonicIpStatusMonitor.cs @@ -1,28 +1,28 @@ -using PepperDash.Core; +using PepperDash.Core; using PepperDash.Essentials.Core; -namespace PanasonicProjectorEpi -{ - public class PanasonicStatusMonitor : StatusMonitorBase - { - public PanasonicStatusMonitor(IKeyed parent, ICommunicationReceiver coms, long warningTime, long errorTime) - : base(parent, warningTime, errorTime) - { - coms.TextReceived += (sender, args) => - { - Status = MonitorStatus.IsOk; - ResetErrorTimers(); - }; - } - - public override void Start() - { - StartErrorTimers(); - } - - public override void Stop() - { - StopErrorTimers(); - } - } +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + public class PanasonicStatusMonitor : StatusMonitorBase + { + public PanasonicStatusMonitor(IKeyed parent, ICommunicationReceiver coms, long warningTime, long errorTime) + : base(parent, warningTime, errorTime) + { + coms.TextReceived += (sender, args) => + { + Status = MonitorStatus.IsOk; + ResetErrorTimers(); + }; + } + + public override void Start() + { + StartErrorTimers(); + } + + public override void Stop() + { + StopErrorTimers(); + } + } } \ No newline at end of file diff --git a/src/PanasonicProjectorController.cs b/src/PanasonicProjectorController.cs index 5b4f1b1..f909498 100644 --- a/src/PanasonicProjectorController.cs +++ b/src/PanasonicProjectorController.cs @@ -11,17 +11,11 @@ using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.DeviceTypeInterfaces; -namespace PanasonicProjectorEpi +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { /// /// Plugin device template for third party devices that use IBasicCommunication /// - /// - /// Rename the class to match the device plugin being developed. - /// - /// - /// "EssentialsPluginDeviceTemplate" renamed to "SamsungMdcDevice" - /// public class PanasonicProjectorController : TwoWayDisplayBase, IBridgeAdvanced, ICommunicationMonitor #if SERIES4 ,IHasInputs diff --git a/src/PanasonicProjectorControllerConfig.cs b/src/PanasonicProjectorControllerConfig.cs index ef8ebcd..8175888 100644 --- a/src/PanasonicProjectorControllerConfig.cs +++ b/src/PanasonicProjectorControllerConfig.cs @@ -1,28 +1,28 @@ -using System.Collections.Generic; -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; using PepperDash.Essentials.Core; -namespace PanasonicProjectorEpi -{ - /// - /// Plugin device configuration object - /// - /// - /// Rename the class to match the device plugin being created - /// - [ConfigSnippet("\"properties\":{\"control\":{}")] - public class PanasonicProjectorControllerConfig - { - [JsonProperty("control")] - public EssentialsControlPropertiesConfig Control { get; set; } - - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("warmupTimeInSeconds")] - public long WarmupTimeInSeconds { get; set; } - - [JsonProperty("cooldownTimeInSeconds")] - public long CooldownTimeInSeconds { get; set; } - } +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + /// + /// Plugin device configuration object + /// + /// + /// Rename the class to match the device plugin being created + /// + [ConfigSnippet("\"properties\":{\"control\":{}")] + public class PanasonicProjectorControllerConfig + { + [JsonProperty("control")] + public EssentialsControlPropertiesConfig Control { get; set; } + + [JsonProperty("id")] + public string Id { get; set; } + + [JsonProperty("warmupTimeInSeconds")] + public long WarmupTimeInSeconds { get; set; } + + [JsonProperty("cooldownTimeInSeconds")] + public long CooldownTimeInSeconds { get; set; } + } } \ No newline at end of file diff --git a/src/PanasonicProjectorControllerFactory.cs b/src/PanasonicProjectorControllerFactory.cs index e76d3cc..86f206e 100644 --- a/src/PanasonicProjectorControllerFactory.cs +++ b/src/PanasonicProjectorControllerFactory.cs @@ -1,81 +1,55 @@ -using System.Collections.Generic; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using Crestron.SimplSharpPro.UI; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using System.Collections.Generic; + +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + /// + /// Plugin device factory for devices that use IBasicCommunication + /// + public class PanasonicProjectorControllerFactory : EssentialsPluginDeviceFactory + { + /// + /// Plugin device factory constructor + /// + public PanasonicProjectorControllerFactory() + { + // Set the minimum Essentials Framework Version + MinimumEssentialsFrameworkVersion = "1.7.5"; + + // In the constructor we initialize the list with the typenames that will build an instance of this device + TypeNames = new List { "panasonicProjector" }; + } + + /// + /// Builds and returns an instance of EssentialsPluginDeviceTemplate + /// + /// device configuration + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type); + + // get the plugin device properties configuration object & check for null + var propertiesConfig = dc.Properties.ToObject(); + if (propertiesConfig == null) + { + Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); + return null; + } + + // attempt build the plugin device comms device & check for null + var comms = CommFactory.CreateCommForDevice(dc); + + if (comms != null) + { + return new PanasonicProjectorController(dc.Key, dc.Name, propertiesConfig, comms); + } + + Debug.Console(1, "[{0}] Factory Notice: No control object present for device {1}", dc.Key, dc.Name); + return null; + } + } +} -namespace PanasonicProjectorEpi -{ - /// - /// Plugin device factory for devices that use IBasicCommunication - /// - /// - /// Rename the class to match the device plugin being developed - /// - /// - /// "PanasonicProjectorControllerFactory" renamed to "MyDeviceFactory" - /// - public class PanasonicProjectorControllerFactory : EssentialsPluginDeviceFactory - { - /// - /// Plugin device factory constructor - /// - /// - /// Update the MinimumEssentialsFrameworkVersion & TypeNames as needed when creating a plugin - /// - /// - /// Set the minimum Essentials Framework Version - /// - /// MinimumEssentialsFrameworkVersion = "1.6.4; - /// - /// In the constructor we initialize the list with the typenames that will build an instance of this device - /// - /// TypeNames = new List() { "SamsungMdc", "SamsungMdcDisplay" }; - /// - /// - public PanasonicProjectorControllerFactory() - { - // Set the minimum Essentials Framework Version - MinimumEssentialsFrameworkVersion = "1.7.5"; - - // In the constructor we initialize the list with the typenames that will build an instance of this device - TypeNames = new List { "panasonicProjector" }; - } - - /// - /// Builds and returns an instance of EssentialsPluginDeviceTemplate - /// - /// device configuration - /// plugin device or null - /// - /// The example provided below takes the device key, name, properties config and the comms device created. - /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device. - /// - /// - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type); - - // get the plugin device properties configuration object & check for null - var propertiesConfig = dc.Properties.ToObject(); - if (propertiesConfig == null) - { - Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); - return null; - } - - // attempt build the plugin device comms device & check for null - var comms = CommFactory.CreateCommForDevice(dc); - - if (comms != null) - { - return new PanasonicProjectorController(dc.Key, dc.Name, propertiesConfig, comms); - } - - Debug.Console(1, "[{0}] Factory Notice: No control object present for device {1}", dc.Key, dc.Name); - return null; - } - } -} - \ No newline at end of file diff --git a/src/QueueMessage.cs b/src/QueueMessage.cs index 96cb3f6..edafbee 100644 --- a/src/QueueMessage.cs +++ b/src/QueueMessage.cs @@ -1,27 +1,27 @@ -using System; +using System; using PepperDash.Essentials.Core.Queues; -namespace PanasonicProjectorEpi -{ - public class QueueMessage:IQueueMessage - { - private readonly Action _dispatchAction; - - public QueueMessage(Action dispatchAction) - { - _dispatchAction = dispatchAction; - } - - public void Dispatch() - { - var handler = _dispatchAction; - - if (handler == null) - { - return; - } - - handler(); - } - } +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + public class QueueMessage:IQueueMessage + { + private readonly Action _dispatchAction; + + public QueueMessage(Action dispatchAction) + { + _dispatchAction = dispatchAction; + } + + public void Dispatch() + { + var handler = _dispatchAction; + + if (handler == null) + { + return; + } + + handler(); + } + } } \ No newline at end of file diff --git a/src/SerialCommandBuilder.cs b/src/SerialCommandBuilder.cs index 3506842..7c308a7 100644 --- a/src/SerialCommandBuilder.cs +++ b/src/SerialCommandBuilder.cs @@ -1,34 +1,34 @@ using System; -namespace PanasonicProjectorEpi -{ - public class SerialCommandBuilder:ICommandBuilder - { - public string Delimiter - { - get { return "\x03"; } - } - - private readonly string _id; - - private const string CommandWithParameterFormat = "AD{0};{1}:{2}"; - private const string CommandWithoutParameterFormat = "AD{0};{1}"; - - public SerialCommandBuilder(string id) - { - _id = id; - } - - public string GetCommand(string cmd, string parameter) - { - var cmdToSend = String.Format("\x02{0}\x03", CommandWithParameterFormat); - return String.Format(cmdToSend, _id, cmd, parameter); - } - - public string GetCommand(string cmd) - { - var cmdToSend = String.Format("\x02{0}\x03", CommandWithoutParameterFormat); - return String.Format(cmdToSend, _id, cmd); - } - } +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector +{ + public class SerialCommandBuilder:ICommandBuilder + { + public string Delimiter + { + get { return "\x03"; } + } + + private readonly string _id; + + private const string CommandWithParameterFormat = "AD{0};{1}:{2}"; + private const string CommandWithoutParameterFormat = "AD{0};{1}"; + + public SerialCommandBuilder(string id) + { + _id = id; + } + + public string GetCommand(string cmd, string parameter) + { + var cmdToSend = String.Format("\x02{0}\x03", CommandWithParameterFormat); + return String.Format(cmdToSend, _id, cmd, parameter); + } + + public string GetCommand(string cmd) + { + var cmdToSend = String.Format("\x02{0}\x03", CommandWithoutParameterFormat); + return String.Format(cmdToSend, _id, cmd); + } + } } \ No newline at end of file diff --git a/src/eInputTypes.cs b/src/eInputTypes.cs index b05068d..64d1159 100644 --- a/src/eInputTypes.cs +++ b/src/eInputTypes.cs @@ -1,4 +1,4 @@ -namespace PanasonicProjectorEpi +namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { public enum eInputTypes {