diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs b/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs index 2dd4f2ba..298bbc9b 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CecPortController.cs @@ -22,7 +22,14 @@ namespace PepperDash.Essentials.Core /// public CommunicationStreamDebugging StreamDebugging { get; private set; } + /// + /// Event raised when bytes are received + /// public event EventHandler BytesReceived; + + /// + /// Event raised when text is received + /// public event EventHandler TextReceived; /// @@ -32,6 +39,12 @@ namespace PepperDash.Essentials.Core ICec Port; + /// + /// Constructor + /// + /// key of the device + /// post activation function for the device + /// configuration for the device public CecPortController(string key, Func postActivationFunc, EssentialsControlPropertiesConfig config) : base(key) { @@ -45,6 +58,11 @@ namespace PepperDash.Essentials.Core }); } + /// + /// Constructor + /// + /// key of the device + /// CEC port public CecPortController(string key, ICec port) : base(key) { diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs index e2d13f5f..11e2bc74 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs @@ -21,6 +21,14 @@ namespace PepperDash.Essentials.Core /// public class ComSpecJsonConverter : JsonConverter { + /// + /// ReadJson method + /// + /// reader to use + /// type of the object being read + /// existing value of the object being read + /// serializer to use + /// deserialized object public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (objectType == typeof(ComPort.ComPortSpec?)) @@ -42,6 +50,9 @@ namespace PepperDash.Essentials.Core return objectType == typeof(ComPort.ComPortSpec?); } + /// + /// Gets or sets the CanRead + /// public override bool CanRead { get { return true; } } /// diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs index fbc46579..9318e04b 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs @@ -15,6 +15,11 @@ namespace PepperDash.Essentials.Core /// public class CommFactory { + /// + /// GetControlPropertiesConfig method + /// + /// The Device config object + /// EssentialsControlPropertiesConfig object public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig) { try @@ -223,11 +228,16 @@ namespace PepperDash.Essentials.Core public class EssentialsControlPropertiesConfig : ControlPropertiesConfig { - + /// + /// Gets or sets the ComParams + /// [JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)] [JsonConverter(typeof(ComSpecJsonConverter))] public ComPort.ComPortSpec? ComParams { get; set; } + /// + /// Gets or sets the CresnetId + /// [JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)] public string CresnetId { get; set; } @@ -250,10 +260,10 @@ namespace PepperDash.Essentials.Core } } - [JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)] /// /// Gets or sets the InfinetId /// + [JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)] public string InfinetId { get; set; } /// diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs index 995004b9..d9bd0974 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs @@ -20,6 +20,9 @@ namespace PepperDash.Essentials.Core /// public interface IComPortsDevice { + /// + /// Gets the Device + /// IComPorts Device { get; } } } \ 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 5bc4c8fb..7c2af905 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ConsoleCommMockDevice.cs @@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Core /// public bool ShowHexResponse { get; set; } + /// + /// Initializes a new instance of the ConsoleCommMockDevice class. + /// + /// The key of the device. + /// The name of the device. + /// The properties configuration for the device. + /// The communication method for the device. public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm) :base(key, name) { @@ -72,20 +79,24 @@ namespace PepperDash.Essentials.Core } } - /// - /// Represents a ConsoleCommMockDevicePropertiesConfig - /// + /// + /// Represents a ConsoleCommMockDevicePropertiesConfig + /// public class ConsoleCommMockDevicePropertiesConfig { - /// - /// Gets or sets the LineEnding - /// + /// + /// Gets or sets the LineEnding + /// public string LineEnding { get; set; } - /// - /// Gets or sets the CommunicationMonitorProperties - /// + + /// + /// Gets or sets the CommunicationMonitorProperties + /// public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } + /// + /// Initializes a new instance of the ConsoleCommMockDevicePropertiesConfig class. + /// public ConsoleCommMockDevicePropertiesConfig() { LineEnding = "\x0a"; @@ -97,6 +108,9 @@ namespace PepperDash.Essentials.Core /// public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory { + /// + /// Initializes a new instance of the ConsoleCommMockDeviceFactory class. + /// public ConsoleCommMockDeviceFactory() { TypeNames = new List() { "commmock" }; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs index a9c4df08..069244c3 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs @@ -23,8 +23,15 @@ namespace PepperDash.Essentials.Core { EssentialsControlPropertiesConfig PropertiesConfig; + /// + /// Gets the CommPort + /// public IBasicCommunication CommPort { get; private set; } + /// + /// Constructor + /// + /// the config of the device public GenericComm(DeviceConfig config) : base(config) { @@ -33,7 +40,7 @@ namespace PepperDash.Essentials.Core var commPort = CommFactory.CreateCommForDevice(config); - //Fixing decision to require '-comPorts' in delcaration for DGE in order to get a device with comports included + //Fixing decision to require '-comPorts' in declaration for DGE in order to get a device with comports included if (commPort == null) { config.Key = config.Key + "-comPorts"; @@ -70,6 +77,10 @@ namespace PepperDash.Essentials.Core } } + /// + /// CustomSetConfig method + /// + /// the new device configuration protected override void CustomSetConfig(DeviceConfig config) { PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); @@ -144,6 +155,9 @@ namespace PepperDash.Essentials.Core /// public class GenericCommFactory : EssentialsDeviceFactory { + /// + /// Initializes a new instance of the GenericCommFactory class. + /// public GenericCommFactory() { TypeNames = new List() { "genericComm" }; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs index 3a1ba4d4..e02027b3 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs @@ -4,15 +4,26 @@ using System; namespace PepperDash.Essentials.Core { + + /// + /// Represents a GenericHttpClient + /// [Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")] - /// - /// Represents a GenericHttpClient - /// public class GenericHttpClient : Device, IBasicCommunication { private readonly HttpClient Client; + + /// + /// Event raised when response is received + /// public event EventHandler ResponseRecived; + /// + /// Constructor + /// + /// key of the device + /// name of the device + /// hostname for the HTTP client public GenericHttpClient(string key, string name, string hostname) : base(key, name) { @@ -25,12 +36,9 @@ namespace PepperDash.Essentials.Core } /// - /// + /// SendText method /// - /// - /// - /// SendText method - /// + /// the path to send the request to public void SendText(string path) { HttpClientRequest request = new HttpClientRequest(); @@ -38,6 +46,12 @@ namespace PepperDash.Essentials.Core request.Url = new UrlParser(url); HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); } + + /// + /// SendText method + /// + /// format for the items + /// items to format public void SendText(string format, params object[] items) { HttpClientRequest request = new HttpClientRequest(); @@ -46,9 +60,11 @@ namespace PepperDash.Essentials.Core HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); } - /// - /// SendTextNoResponse method - /// + /// + /// SendTextNoResponse method + /// + /// format for the items + /// items to format public void SendTextNoResponse(string format, params object[] items) { HttpClientRequest request = new HttpClientRequest(); @@ -57,6 +73,12 @@ namespace PepperDash.Essentials.Core Client.Dispatch(request); } + /// + /// Response method + /// + /// response received from the HTTP client + /// error status of the HTTP callback + /// original HTTP client request private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request) { if (error == HTTP_CALLBACK_ERROR.COMPLETED) @@ -74,9 +96,10 @@ namespace PepperDash.Essentials.Core #region IBasicCommunication Members - /// - /// SendBytes method - /// + /// + /// SendBytes method + /// + /// bytes to send public void SendBytes(byte[] bytes) { throw new NotImplementedException(); @@ -88,50 +111,69 @@ namespace PepperDash.Essentials.Core #region ICommunicationReceiver Members + /// + /// BytesReceived event + /// public event EventHandler BytesReceived; - /// - /// Connect method - /// + /// + /// Connect method + /// public void Connect() { throw new NotImplementedException(); } - /// - /// Disconnect method - /// + /// + /// Disconnect method + /// public void Disconnect() { throw new NotImplementedException(); } + /// + /// IsConnected property + /// public bool IsConnected { get { return true; } } + /// + /// TextReceived event + /// public event EventHandler TextReceived; #endregion } - /// - /// Represents a GenericHttpClientEventArgs - /// + + /// + /// Represents a GenericHttpClientEventArgs + /// public class GenericHttpClientEventArgs : EventArgs { - /// - /// Gets or sets the ResponseText - /// + /// + /// Gets or sets the ResponseText + /// public string ResponseText { get; private set; } - /// - /// Gets or sets the RequestPath - /// + + /// + /// Gets or sets the RequestPath + /// public string RequestPath { get; private set; } - /// - /// Gets or sets the Error - /// + + /// + /// Gets or sets the Error + /// public HTTP_CALLBACK_ERROR Error { get; set; } + + /// + /// Constructor + /// + /// response text + /// request path + /// error status public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error) { ResponseText = response; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs index 0655e83b..6ca4b533 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs @@ -15,10 +15,13 @@ using Serilog.Events; namespace PepperDash.Essentials.Core { /// - /// + /// Helper class for IR port operations /// public static class IRPortHelper { + /// + /// Gets the IrDriverPathPrefix + /// public static string IrDriverPathPrefix { get @@ -31,7 +34,7 @@ namespace PepperDash.Essentials.Core /// Finds either the ControlSystem or a device controller that contains IR ports and /// returns a port from the hardware device /// - /// + /// JSON token containing properties /// IrPortConfig object. The port and or filename will be empty/null /// if valid values don't exist on config public static IrOutPortConfig GetIrPort(JToken propsToken) @@ -83,9 +86,11 @@ namespace PepperDash.Essentials.Core } } - /// - /// GetIrOutputPort method - /// + /// + /// GetIrOutputPort method + /// + /// DeviceConfig to get the IR port for + /// IROutputPort or null if not found public static IROutputPort GetIrOutputPort(DeviceConfig dc) { var irControllerKey = dc.Key + "-ir"; @@ -145,9 +150,11 @@ namespace PepperDash.Essentials.Core return port; } - /// - /// GetIrOutputPortController method - /// + /// + /// GetIrOutputPortController method + /// + /// DeviceConfig to create the IrOutputPortController for + /// IrOutputPortController object public static IrOutputPortController GetIrOutputPortController(DeviceConfig config) { Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller"); @@ -228,23 +235,32 @@ namespace PepperDash.Essentials.Core }*/ } - /// - /// Represents a IrOutPortConfig - /// + /// + /// Represents a IrOutPortConfig + /// public class IrOutPortConfig { + /// + /// Gets or sets the Port + /// [JsonProperty("port")] - /// - /// Gets or sets the Port - /// - public IROutputPort Port { get; set; } - + public IROutputPort Port { get; set; } + + /// + /// Gets or sets the FileName + /// [JsonProperty("fileName")] public string FileName { get; set; } + /// + /// Gets or sets a value indicating whether to use bridge join map + /// [JsonProperty("useBridgeJoinMap")] public bool UseBridgeJoinMap { get; set; } + /// + /// Constructor + /// public IrOutPortConfig() { FileName = "";