From ef9d7d91e9ed91bd49e01baddb96abaf8650d876 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 10 Feb 2020 21:38:10 -0700 Subject: [PATCH 1/2] Update Readme.md Corrects spelling mistake. Minor edits. --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 00f050a..bf8facf 100644 --- a/Readme.md +++ b/Readme.md @@ -8,12 +8,12 @@ PepperDash Core is an open source Crestron SIMPL# library that can be used in SI ## Constituent Elements -- JSON Configuration File reading writing +- JSON Configuration File reading/writing - PortalConfigReader - Generic config classes - Communications - TCP/IP client and server - - Secure TCP/IP clinet and server + - Secure TCP/IP client and server - UDP server - SSH client - HTTP SSE client @@ -22,7 +22,7 @@ PepperDash Core is an open source Crestron SIMPL# library that can be used in SI - Console debugging - Logging both to Crestron error log as well as a custom log file - System Info -- Reports system and Ethernet information to SIMPL via S+ +- Reports system and Ethernet information to SIMPL via SIMPL+ - Device Class, IKeyed and IKeyName Interfaces - Base level device class that most classes derive from - Password Manager From 814e0f247c0646d3c819e5cb37ef2f363a8a6500 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 11 Feb 2020 14:52:34 -0700 Subject: [PATCH 2/2] closes PDC-43 and adds correct condition before printing statment in Debug class. --- .../Pepperdash Core/Comm/GenericUdpServer.cs | 71 ++++++++++++++++++- .../Pepperdash Core/Logging/Debug.cs | 3 +- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs index 011c17c..d675646 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericUdpServer.cs @@ -15,7 +15,7 @@ using Newtonsoft.Json.Linq; namespace PepperDash.Core { - public class GenericUdpServer : Device, IBasicCommunication + public class GenericUdpServer : Device, IBasicCommunication, ISocketStatus { /// /// @@ -40,11 +40,16 @@ namespace PepperDash.Core /// /// /// - //public event GenericSocketStatusChangeEventDelegate SocketStatusChange; public event EventHandler ConnectionChange; + /// + /// + /// public event EventHandler UpdateConnectionStatus; + /// + /// + /// public SocketStatus ClientStatus { get @@ -53,6 +58,9 @@ namespace PepperDash.Core } } + /// + /// + /// public ushort UStatus { get { return (ushort)Server.ServerStatus; } @@ -120,6 +128,13 @@ namespace PepperDash.Core CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler); } + /// + /// + /// + /// + /// + /// + /// public GenericUdpServer(string key, string address, int port, int buffefSize) : base(key) { @@ -134,6 +149,12 @@ namespace PepperDash.Core CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler); } + /// + /// Call from S+ to initialize values + /// + /// + /// + /// public void Initialize(string key, string address, ushort port) { Key = key; @@ -141,6 +162,10 @@ namespace PepperDash.Core UPort = port; } + /// + /// + /// + /// void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs) { // Re-enable the server if the link comes back up and the status should be connected @@ -151,6 +176,10 @@ namespace PepperDash.Core } } + /// + /// + /// + /// void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType) { if (programEventType == eProgramStatusEventType.Stopping) @@ -299,6 +328,10 @@ namespace PepperDash.Core } } + /// + /// + /// + /// public void SendBytes(byte[] bytes) { //if (Debug.Level == 2) @@ -309,13 +342,35 @@ namespace PepperDash.Core } + /// + /// + /// public class GenericUdpReceiveTextExtraArgs : EventArgs { + /// + /// + /// public string Text { get; private set; } + /// + /// + /// public string IpAddress { get; private set; } + /// + /// + /// public int Port { get; private set; } + /// + /// + /// public byte[] Bytes { get; private set; } + /// + /// + /// + /// + /// + /// + /// public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes) { Text = text; @@ -330,11 +385,20 @@ namespace PepperDash.Core public GenericUdpReceiveTextExtraArgs() { } } + /// + /// + /// public class UdpServerPropertiesConfig { + /// + /// + /// [JsonProperty(Required = Required.Always)] public string Address { get; set; } + /// + /// + /// [JsonProperty(Required = Required.Always)] public int Port { get; set; } @@ -343,6 +407,9 @@ namespace PepperDash.Core /// public int BufferSize { get; set; } + /// + /// + /// public UdpServerPropertiesConfig() { BufferSize = 32768; diff --git a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs index cf4d8df..14c6b37 100644 --- a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs +++ b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs @@ -91,8 +91,7 @@ namespace PepperDash.Core Level = context.Level; DoNotLoadOnNextBoot = context.DoNotLoadOnNextBoot; - if(DoNotLoadOnNextBoot) - CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber)); + CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber)); try {