From 9195d6811a79ba274e699aaed77e35272e3eec88 Mon Sep 17 00:00:00 2001 From: jdevito Date: Tue, 1 Oct 2024 11:58:00 -0500 Subject: [PATCH] refactor: format documents and organize --- src/PanasonicProjectorController.cs | 638 ++++++++---------- src/PanasonicProjectorControllerConfig.cs | 28 - src/PanasonicProjectorControllerFactory.cs | 55 -- src/QueueMessage.cs | 2 +- src/SerialCommandBuilder.cs | 2 +- ...display-panasonic-projector.4Series.csproj | 8 + src/epi-display-panasonic-projector.csproj | 4 +- 7 files changed, 304 insertions(+), 433 deletions(-) delete mode 100644 src/PanasonicProjectorControllerConfig.cs delete mode 100644 src/PanasonicProjectorControllerFactory.cs diff --git a/src/PanasonicProjectorController.cs b/src/PanasonicProjectorController.cs index f909498..461f2e2 100644 --- a/src/PanasonicProjectorController.cs +++ b/src/PanasonicProjectorController.cs @@ -18,39 +18,52 @@ namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector /// public class PanasonicProjectorController : TwoWayDisplayBase, IBridgeAdvanced, ICommunicationMonitor #if SERIES4 - ,IHasInputs + , IHasInputs #endif { private const long DefaultWarmUpTimeMs = 1000; private const long DefaultCooldownTimeMs = 2000; - - private bool _isWarming; - private bool _isCooling; - private bool _powerOnIgnoreFb; - - private readonly PanasonicProjectorControllerConfig _config; - + + private readonly PanasonicProjectorConfig _config; + private readonly ICommandBuilder _commandBuilder; + private readonly IBasicCommunication _comms; + private readonly CommunicationGather _commsGather; + private readonly StatusMonitorBase _commsMonitor; private readonly MD5CryptoServiceProvider _md5Provider; - private readonly GenericQueue _rxQueue; - private readonly CrestronQueue _txQueue; - private eInputTypes _currentInput; + private bool _powerIsOn; + private bool _powerOnIgnoreFb; + private bool _isWarming; + private bool _isCooling; + private string _currentCommand; + private eInputTypes _currentInput; private string _hash; + + public StatusMonitorBase CommunicationMonitor + { + get { return _commsMonitor; } + } - #region IBasicCommunication Properties and Constructor. Remove if not needed. - - private readonly ICommandBuilder _commandBuilder; - - private readonly IBasicCommunication _comms; + /// + /// Reports online feedback through the bridge + /// + public BoolFeedback OnlineFeedback + { + get { return _commsMonitor.IsOnlineFeedback; } + } - private readonly CommunicationGather _commsGather; - private readonly StatusMonitorBase _commsMonitor; + /// + /// Reports socket status feedback through the bridge + /// + public IntFeedback StatusFeedback { get; private set; } - private string _currentCommand; + /// + /// Reports connect feedback through the bridge + /// + public BoolFeedback ConnectFeedback { get; private set; } - private bool _powerIsOn; /// /// Plugin device constructor for devices that need IBasicCommunication @@ -59,39 +72,21 @@ public class PanasonicProjectorController : TwoWayDisplayBase, IBridgeAdvanced, /// /// /// - public PanasonicProjectorController(string key, string name, PanasonicProjectorControllerConfig config, + public PanasonicProjectorController(string key, string name, PanasonicProjectorConfig config, IBasicCommunication comms) : base(key, name) { Debug.Console(0, this, "Constructing new {0} instance", name); _rxQueue = new GenericQueue(String.Format("{0}-rxQueue", Key)); - _txQueue = new CrestronQueue(50); - _config = config; - - if (_config.WarmupTimeInSeconds == 0) - { - WarmupTime = (uint) DefaultWarmUpTimeMs; - } - else - { - WarmupTime = (uint) (_config.WarmupTimeInSeconds*1000); - } - - if (_config.CooldownTimeInSeconds == 0) - { - CooldownTime = (uint)DefaultCooldownTimeMs; - } - else - { - CooldownTime = (uint)(_config.CooldownTimeInSeconds * 1000); - } + WarmupTime = _config.WarmupTimeInSeconds == 0 ? (uint)DefaultWarmUpTimeMs : (uint)_config.WarmupTimeInSeconds * 1000; + CooldownTime = _config.CooldownTimeInSeconds == 0 ? (uint)DefaultCooldownTimeMs : (uint)_config.CooldownTimeInSeconds * 1000; ConnectFeedback = new BoolFeedback(() => Connect); - StatusFeedback = new IntFeedback(() => (int) _commsMonitor.Status); + StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status); _comms = comms; _commandBuilder = GetCommandBuilder(_config); @@ -103,8 +98,6 @@ public PanasonicProjectorController(string key, string name, PanasonicProjectorC return; } - var commsDelimiter = _commandBuilder.Delimiter; - _commsMonitor = new PanasonicStatusMonitor(this, _comms, 60000, 120000); var socket = _comms as ISocketStatus; @@ -117,81 +110,18 @@ public PanasonicProjectorController(string key, string name, PanasonicProjectorC _md5Provider.Initialize(); } - // Only one of the below handlers should be necessary. - + var commsDelimiter = _commandBuilder.Delimiter; // _comms gather for any API that has a defined delimiter _commsGather = new CommunicationGather(_comms, commsDelimiter); _commsGather.LineReceived += Handle_LineRecieved; - SetUpInputPorts(); - -#if SERIES4 - SetupInputs4Series(); -#endif + SetupInputPorts(); } - public bool PowerIsOn - { - get { return _powerIsOn; } - set - { - Debug.Console(1, this, "Setting powerIsOn to {0} from {1}", value, _powerIsOn); - - if (value == _powerIsOn) - { - return; - } - - _powerIsOn = value; - - PowerIsOnFeedback.FireUpdate(); - } - } - - - /// - /// Connects/disconnects the comms of the plugin device - /// - /// - /// triggers the _comms.Connect/Disconnect as well as thee comms monitor start/stop - /// - public bool Connect - { - get { return _comms.IsConnected; } - set - { - if (value) - { - _comms.Connect(); - _commsMonitor.Start(); - } - else - { - _comms.Disconnect(); - _commsMonitor.Stop(); - } - } - } - - /// - /// Reports connect feedback through the bridge - /// - public BoolFeedback ConnectFeedback { get; private set; } - /// - /// Reports online feedback through the bridge + /// Initializes device /// - public BoolFeedback OnlineFeedback - { - get { return _commsMonitor.IsOnlineFeedback; } - } - - /// - /// Reports socket status feedback through the bridge - /// - public IntFeedback StatusFeedback { get; private set; } - - public override bool CustomActivate() + public override void Initialize() { _commsMonitor.Start(); @@ -210,100 +140,25 @@ public override bool CustomActivate() CrestronEnvironment.ProgramStatusEventHandler += type => { - if (type != eProgramStatusEventType.Stopping) + if (type != eProgramStatusEventType.Stopping) return; pollTimer.Stop(); pollTimer.Dispose(); _commsMonitor.Stop(); }; + } - return base.CustomActivate(); - } - -#if SERIES4 - private void SetupInputs4Series() - { - Inputs = new PanasonicInputs() - { - Items = new Dictionary - { - { - 1, new PanasonicInput("1", "Computer 1", this, () => SetInput(eInputTypes.Rg1)) - }, - { - 2, new PanasonicInput("2", "Computer 2", this, () => SetInput(eInputTypes.Rg2)) - }, - { - 3, new PanasonicInput("3", "Video", this, () => SetInput(eInputTypes.Vid)) - }, - { - 4, new PanasonicInput("4", "S-Video", this, () => SetInput(eInputTypes.Svd)) - }, - { - 5, new PanasonicInput("5", "DVI", this, () => SetInput(eInputTypes.Dvi)) - }, - { - 6, new PanasonicInput("6", "HDMI 1", this, () => SetInput(eInputTypes.Hd1)) - }, - { - 7, new PanasonicInput("7", "HDMI 2", this, () => SetInput(eInputTypes.Hd2)) - }, - { - 8, new PanasonicInput("8", "SDI", this, () => SetInput(eInputTypes.Sd1)) - }, - { - 9, new PanasonicInput("9", "Digital Link", this, () => SetInput(eInputTypes.Dl1)) - } - } - }; - - - } -#endif + #region Implementation of IBridgeAdvanced - private void SetUpInputPorts() + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - var computer1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.Vga, new Action(() => SetInput(eInputTypes.Rg1)), this); - - var computer2 = new RoutingInputPort(RoutingPortNames.VgaIn1, eRoutingSignalType.Video, - eRoutingPortConnectionType.Vga, new Action(() => SetInput(eInputTypes.Rg2)), this); - - var video = new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.Composite, new Action(() => SetInput(eInputTypes.Vid)), this); - - var sVideo = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.Component, new Action(() => SetInput(eInputTypes.Svd)), this); - - var dvi = new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.Dvi, new Action(() => SetInput(eInputTypes.Dvi)), this); - - var hdmi1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(() => SetInput(eInputTypes.Hd1)), this); - - var hdmi2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(() => SetInput(eInputTypes.Hd2)), this); - - var sdi = new RoutingInputPort("Sdi", eRoutingSignalType.Video, - eRoutingPortConnectionType.Sdi, new Action(() => SetInput(eInputTypes.Sd1)), this); - - var digitalLink = new RoutingInputPort(RoutingPortNames.DmIn, eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, new Action(() => SetInput(eInputTypes.Dl1)), this); - - - InputPorts.Add(hdmi1); - InputPorts.Add(dvi); - InputPorts.Add(computer1); - InputPorts.Add(computer2); - InputPorts.Add(video); - InputPorts.Add(sVideo); - InputPorts.Add(hdmi2); - InputPorts.Add(sdi); - InputPorts.Add(digitalLink); + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); } - private ICommandBuilder GetCommandBuilder(PanasonicProjectorControllerConfig config) + #endregion + + private ICommandBuilder GetCommandBuilder(PanasonicProjectorConfig config) { if (config.Control.Method == eControlMethod.Com) { @@ -332,54 +187,55 @@ private void socket_ConnectionChange(object sender, GenericSocketStatusChageEven { StatusFeedback.FireUpdate(); } + if (!args.Client.IsConnected && !_txQueue.IsEmpty) { CrestronInvoke.BeginInvoke(_ => _comms.Connect()); } } - private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args) + private string GetHash(string randomNumber) { - _rxQueue.Enqueue(new QueueMessage(() => ParseResponse(args.Text))); - } + //response is of the form ntcontrol 1 {random} + var randomString = randomNumber.Split(' ')[2]; + var stringToHash = String.Format("{0}:{1}:{2}", _config.Control.TcpSshProperties.Username, + _config.Control.TcpSshProperties.Password, randomString); - /// - /// Sends text to the device plugin comms - /// - /// - /// Can be used to test commands with the device plugin using the DEVPROPS and DEVJSON console commands - /// - /// Command to be sent - public void SendText(string text) - { - if (_config.Control.Method == eControlMethod.Com) - { - _currentCommand = text; + var bytes = Encoding.UTF8.GetBytes(stringToHash); - _comms.SendText(text); + var hash = _md5Provider.ComputeHash(bytes); - return; - } + return Encoding.UTF8.GetString(hash, 0, hash.Length); + } - if (_comms.IsConnected) + private object DequeueAndSend(object notUsed) + { + + if (_txQueue.IsEmpty) { - _currentCommand = text; - _comms.SendText(String.IsNullOrEmpty(_hash) ? text : String.Format("{0}{1}", _hash, text)); + Debug.Console(1, this, "Queue is empty we're out!"); + return null; } - else + + var cmdToSend = _txQueue.Dequeue(10); + + if (String.IsNullOrEmpty(cmdToSend)) { + Debug.Console(1, this, "Unable to get command to send"); - _txQueue.Enqueue(text); - Debug.Console(1, this, "Queue isn't empty and client isn't connected, connecting..."); - CrestronInvoke.BeginInvoke(_ => _comms.Connect()); } - } - public void Poll() + _currentCommand = cmdToSend; + _comms.SendText(String.IsNullOrEmpty(_hash) ? cmdToSend : String.Format("{0}{1}", _hash, cmdToSend)); + + + return null; + } + + private void Handle_LineRecieved(object sender, GenericCommMethodReceiveTextArgs args) { - Debug.Console(1, this, "Sending poll..."); - SendText(_commandBuilder.GetCommand("QPW")); + _rxQueue.Enqueue(new QueueMessage(() => ParseResponse(args.Text))); } private void ParseResponse(string response) @@ -404,7 +260,7 @@ private void ParseResponse(string response) } //power query - if (_currentCommand.ToLower().Contains("qpw")) + if (_currentCommand.ToLower().Contains("qpw")) { if (_powerOnIgnoreFb && (response.Contains("001") || response.ToLower().Contains("pon"))) { @@ -426,81 +282,74 @@ private void ParseResponse(string response) { CurrentInput = response.Replace("iis:", "").Trim(); } - - } - - - private object DequeueAndSend(object notUsed) - { - - if (_txQueue.IsEmpty) - { - Debug.Console(1, this, "Queue is empty we're out!"); - return null; - } - - var cmdToSend = _txQueue.Dequeue(10); - - if (String.IsNullOrEmpty(cmdToSend)) - { - Debug.Console(1, this, "Unable to get command to send"); - - } - - _currentCommand = cmdToSend; - _comms.SendText(String.IsNullOrEmpty(_hash) ? cmdToSend : String.Format("{0}{1}", _hash, cmdToSend)); - - - return null; } - private string GetHash(string randomNumber) - { - //response is of the form ntcontrol 1 {random} - var randomString = randomNumber.Split(' ')[2]; - var stringToHash = String.Format("{0}:{1}:{2}", _config.Control.TcpSshProperties.Username, - _config.Control.TcpSshProperties.Password, randomString); - - var bytes = Encoding.UTF8.GetBytes(stringToHash); - - var hash = _md5Provider.ComputeHash(bytes); - - return Encoding.UTF8.GetString(hash, 0, hash.Length); - } - - public void SetInput(eInputTypes input) + /// + /// Sends text to the device plugin comms + /// + /// + /// Can be used to test commands with the device plugin using the DEVPROPS and DEVJSON console commands + /// + /// Command to be sent + public void SendText(string text) { - SendText(_commandBuilder.GetCommand("IIS", input.ToString().ToUpper())); + if (_config.Control.Method == eControlMethod.Com) + { + _currentCommand = text; - CurrentInput = input.ToString(); - } + _comms.SendText(text); - #endregion + return; + } + + if (_comms.IsConnected) + { + _currentCommand = text; + _comms.SendText(String.IsNullOrEmpty(_hash) ? text : String.Format("{0}{1}", _hash, text)); + } + else + { - #region Overrides of DisplayBase + _txQueue.Enqueue(text); + Debug.Console(1, this, "Queue isn't empty and client isn't connected, connecting..."); + CrestronInvoke.BeginInvoke(_ => _comms.Connect()); + } + } - protected override Func PowerIsOnFeedbackFunc + /// + /// Connects/disconnects the comms of the plugin device + /// + /// + /// triggers the _comms.Connect/Disconnect as well as thee comms monitor start/stop + /// + public bool Connect { - get + get { return _comms.IsConnected; } + set { - return () => + if (value) { - Debug.Console(1, this, "Updating PowerIsOnFeedback to {0}", PowerIsOn); - return PowerIsOn; - }; + _comms.Connect(); + _commsMonitor.Start(); + } + else + { + _comms.Disconnect(); + _commsMonitor.Stop(); + } } } - protected override Func IsCoolingDownFeedbackFunc + public void Poll() { - get { return () => _isCooling; } - } + Debug.Console(1, this, "Sending poll..."); + SendText(_commandBuilder.GetCommand("QPW")); + } + - protected override Func IsWarmingUpFeedbackFunc - { - get { return () => _isWarming; } - } + + #region Power public override void PowerOn() { @@ -549,85 +398,51 @@ public override void PowerToggle() SendText(_commandBuilder.GetCommand(PowerIsOn ? "POF" : "PON")); } - public override void ExecuteSwitch(object selector) + public bool PowerIsOn { - /* - * if (_PowerIsOn) - (selector as Action)(); - else // if power is off, wait until we get on FB to send it. - { - // One-time event handler to wait for power on before executing switch - EventHandler handler = null; // necessary to allow reference inside lambda to handler - handler = (o, a) => - { - if (!_IsWarmingUp) // Done warming - { - IsWarmingUpFeedback.OutputChange -= handler; - (selector as Action)(); - } - }; - IsWarmingUpFeedback.OutputChange += handler; // attach and wait for on FB - PowerOn(); - } - */ - if (PowerIsOn) + get { return _powerIsOn; } + set { - var handler = selector as Action; + Debug.Console(1, this, "Setting powerIsOn to {0} from {1}", value, _powerIsOn); - if (handler == null) + if (value == _powerIsOn) { - Debug.Console(1, this, "Unable to switch using selector {0}", selector); return; } - handler(); + _powerIsOn = value; + + PowerIsOnFeedback.FireUpdate(); } - else + } + + protected override Func PowerIsOnFeedbackFunc + { + get { - EventHandler handler = null; - var inputSelector = selector as Action; - handler = (o, a) => + return () => { - if (!_isWarming) - { - return; - } - - IsWarmingUpFeedback.OutputChange -= handler; - - if (inputSelector == null) - { - return; - } - - inputSelector(); + Debug.Console(1, this, "Updating PowerIsOnFeedback to {0}", PowerIsOn); + return PowerIsOn; }; - - IsWarmingUpFeedback.OutputChange += handler; - PowerOn(); } } - #endregion - - #region Overrides of TwoWayDisplayBase + protected override Func IsCoolingDownFeedbackFunc + { + get { return () => _isCooling; } + } - protected override Func CurrentInputFeedbackFunc + protected override Func IsWarmingUpFeedbackFunc { - get { return () => _currentInput.ToString(); } + get { return () => _isWarming; } } #endregion - #region Implementation of IBridgeAdvanced - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); - } + #region Input - #endregion - #if SERIES4 public ISelectableItems Inputs { get; private set; } @@ -645,6 +460,91 @@ Build a class that satisfies Iselectable Items and an IselectableItems Class The select method should just have an Action, and I can pass in the input method to be called */ #endif + private void SetupInputPorts() + { +#if SERIES4 + // 4-series logic + Inputs = new PanasonicInputs() + { + Items = new Dictionary + { + { + 1, new PanasonicInput("1", "Computer 1", this, () => SetInput(eInputTypes.Rg1)) + }, + { + 2, new PanasonicInput("2", "Computer 2", this, () => SetInput(eInputTypes.Rg2)) + }, + { + 3, new PanasonicInput("3", "Video", this, () => SetInput(eInputTypes.Vid)) + }, + { + 4, new PanasonicInput("4", "S-Video", this, () => SetInput(eInputTypes.Svd)) + }, + { + 5, new PanasonicInput("5", "DVI", this, () => SetInput(eInputTypes.Dvi)) + }, + { + 6, new PanasonicInput("6", "HDMI 1", this, () => SetInput(eInputTypes.Hd1)) + }, + { + 7, new PanasonicInput("7", "HDMI 2", this, () => SetInput(eInputTypes.Hd2)) + }, + { + 8, new PanasonicInput("8", "SDI", this, () => SetInput(eInputTypes.Sd1)) + }, + { + 9, new PanasonicInput("9", "Digital Link", this, () => SetInput(eInputTypes.Dl1)) + } + } + }; +#else + // 3-series logic + var computer1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Vga, new Action(() => SetInput(eInputTypes.Rg1)), this); + + var computer2 = new RoutingInputPort(RoutingPortNames.VgaIn1, eRoutingSignalType.Video, + eRoutingPortConnectionType.Vga, new Action(() => SetInput(eInputTypes.Rg2)), this); + + var video = new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Composite, new Action(() => SetInput(eInputTypes.Vid)), this); + + var sVideo = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Component, new Action(() => SetInput(eInputTypes.Svd)), this); + + var dvi = new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.Dvi, new Action(() => SetInput(eInputTypes.Dvi)), this); + + var hdmi1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(() => SetInput(eInputTypes.Hd1)), this); + + var hdmi2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(() => SetInput(eInputTypes.Hd2)), this); + + var sdi = new RoutingInputPort("Sdi", eRoutingSignalType.Video, + eRoutingPortConnectionType.Sdi, new Action(() => SetInput(eInputTypes.Sd1)), this); + + var digitalLink = new RoutingInputPort(RoutingPortNames.DmIn, eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, new Action(() => SetInput(eInputTypes.Dl1)), this); + + + InputPorts.Add(hdmi1); + InputPorts.Add(dvi); + InputPorts.Add(computer1); + InputPorts.Add(computer2); + InputPorts.Add(video); + InputPorts.Add(sVideo); + InputPorts.Add(hdmi2); + InputPorts.Add(sdi); + InputPorts.Add(digitalLink); +#endif + } + + public void SetInput(eInputTypes input) + { + SendText(_commandBuilder.GetCommand("IIS", input.ToString().ToUpper())); + + CurrentInput = input.ToString(); + } public string CurrentInput { @@ -658,7 +558,7 @@ public string CurrentInput try { - _currentInput = (eInputTypes) Enum.Parse(typeof (eInputTypes), value, true); + _currentInput = (eInputTypes)Enum.Parse(typeof(eInputTypes), value, true); } catch { @@ -666,9 +566,9 @@ public string CurrentInput } CurrentInputFeedback.FireUpdate(); - + #if SERIES4 - byte b = (byte) _currentInput; + byte b = (byte)_currentInput; if (Inputs.Items.ContainsKey(b)) { Inputs.CurrentItem = b; @@ -677,15 +577,61 @@ public string CurrentInput { item.Value.IsSelected = item.Key.Equals(b); } - + Inputs.CurrentItem = b; #endif } } - public StatusMonitorBase CommunicationMonitor + protected override Func CurrentInputFeedbackFunc { - get { return _commsMonitor; } + get { return () => _currentInput.ToString(); } + } + + /// + /// Executes device switch + /// + /// + public override void ExecuteSwitch(object selector) + { + if (PowerIsOn) + { + var handler = selector as Action; + + if (handler == null) + { + Debug.Console(1, this, "Unable to switch using selector {0}", selector); + return; + } + + handler(); + } + else + { + EventHandler handler = null; + var inputSelector = selector as Action; + handler = (o, a) => + { + if (!_isWarming) + { + return; + } + + IsWarmingUpFeedback.OutputChange -= handler; + + if (inputSelector == null) + { + return; + } + + inputSelector(); + }; + + IsWarmingUpFeedback.OutputChange += handler; + PowerOn(); + } } + + #endregion } } \ No newline at end of file diff --git a/src/PanasonicProjectorControllerConfig.cs b/src/PanasonicProjectorControllerConfig.cs deleted file mode 100644 index 8175888..0000000 --- a/src/PanasonicProjectorControllerConfig.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json; -using PepperDash.Essentials.Core; - -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 deleted file mode 100644 index 86f206e..0000000 --- a/src/PanasonicProjectorControllerFactory.cs +++ /dev/null @@ -1,55 +0,0 @@ -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; - } - } -} - - \ No newline at end of file diff --git a/src/QueueMessage.cs b/src/QueueMessage.cs index edafbee..3f37ba5 100644 --- a/src/QueueMessage.cs +++ b/src/QueueMessage.cs @@ -3,7 +3,7 @@ namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { - public class QueueMessage:IQueueMessage + public class QueueMessage : IQueueMessage { private readonly Action _dispatchAction; diff --git a/src/SerialCommandBuilder.cs b/src/SerialCommandBuilder.cs index 7c308a7..404ee25 100644 --- a/src/SerialCommandBuilder.cs +++ b/src/SerialCommandBuilder.cs @@ -2,7 +2,7 @@ namespace PepperDash.Essentials.Plugins.Display.Panasonic.Projector { - public class SerialCommandBuilder:ICommandBuilder + public class SerialCommandBuilder : ICommandBuilder { public string Delimiter { diff --git a/src/epi-display-panasonic-projector.4Series.csproj b/src/epi-display-panasonic-projector.4Series.csproj index 14dfe5e..be7b774 100644 --- a/src/epi-display-panasonic-projector.4Series.csproj +++ b/src/epi-display-panasonic-projector.4Series.csproj @@ -40,4 +40,12 @@ + + + + + + + + diff --git a/src/epi-display-panasonic-projector.csproj b/src/epi-display-panasonic-projector.csproj index da451fd..79eb5e8 100644 --- a/src/epi-display-panasonic-projector.csproj +++ b/src/epi-display-panasonic-projector.csproj @@ -107,8 +107,8 @@ - - + +