wip: update XML comments

This commit is contained in:
Erik Meyer
2026-01-28 09:52:06 -05:00
parent d41f6a4a54
commit 34f236868b
8 changed files with 188 additions and 60 deletions

View File

@@ -22,7 +22,14 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public CommunicationStreamDebugging StreamDebugging { get; private set; } public CommunicationStreamDebugging StreamDebugging { get; private set; }
/// <summary>
/// Event raised when bytes are received
/// </summary>
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived; public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
/// <summary>
/// Event raised when text is received
/// </summary>
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived; public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
/// <summary> /// <summary>
@@ -32,6 +39,12 @@ namespace PepperDash.Essentials.Core
ICec Port; ICec Port;
/// <summary>
/// Constructor
/// </summary>
/// <param name="key">key of the device</param>
/// <param name="postActivationFunc">post activation function for the device</param>
/// <param name="config">configuration for the device</param>
public CecPortController(string key, Func<EssentialsControlPropertiesConfig, ICec> postActivationFunc, public CecPortController(string key, Func<EssentialsControlPropertiesConfig, ICec> postActivationFunc,
EssentialsControlPropertiesConfig config) : base(key) EssentialsControlPropertiesConfig config) : base(key)
{ {
@@ -45,6 +58,11 @@ namespace PepperDash.Essentials.Core
}); });
} }
/// <summary>
/// Constructor
/// </summary>
/// <param name="key">key of the device</param>
/// <param name="port">CEC port</param>
public CecPortController(string key, ICec port) public CecPortController(string key, ICec port)
: base(key) : base(key)
{ {

View File

@@ -21,6 +21,14 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public class ComSpecJsonConverter : JsonConverter public class ComSpecJsonConverter : JsonConverter
{ {
/// <summary>
/// ReadJson method
/// </summary>
/// <param name="reader">reader to use</param>
/// <param name="objectType">type of the object being read</param>
/// <param name="existingValue">existing value of the object being read</param>
/// <param name="serializer">serializer to use</param>
/// <returns>deserialized object</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{ {
if (objectType == typeof(ComPort.ComPortSpec?)) if (objectType == typeof(ComPort.ComPortSpec?))
@@ -42,6 +50,9 @@ namespace PepperDash.Essentials.Core
return objectType == typeof(ComPort.ComPortSpec?); return objectType == typeof(ComPort.ComPortSpec?);
} }
/// <summary>
/// Gets or sets the CanRead
/// </summary>
public override bool CanRead { get { return true; } } public override bool CanRead { get { return true; } }
/// <summary> /// <summary>

View File

@@ -15,6 +15,11 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public class CommFactory public class CommFactory
{ {
/// <summary>
/// GetControlPropertiesConfig method
/// </summary>
/// <param name="deviceConfig">The Device config object</param>
/// <returns>EssentialsControlPropertiesConfig object</returns>
public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig) public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
{ {
try try
@@ -223,11 +228,16 @@ namespace PepperDash.Essentials.Core
public class EssentialsControlPropertiesConfig : public class EssentialsControlPropertiesConfig :
ControlPropertiesConfig ControlPropertiesConfig
{ {
/// <summary>
/// Gets or sets the ComParams
/// </summary>
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)] [JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(ComSpecJsonConverter))] [JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec? ComParams { get; set; } public ComPort.ComPortSpec? ComParams { get; set; }
/// <summary>
/// Gets or sets the CresnetId
/// </summary>
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)] [JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
public string CresnetId { get; set; } public string CresnetId { get; set; }
@@ -250,10 +260,10 @@ namespace PepperDash.Essentials.Core
} }
} }
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
/// <summary> /// <summary>
/// Gets or sets the InfinetId /// Gets or sets the InfinetId
/// </summary> /// </summary>
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
public string InfinetId { get; set; } public string InfinetId { get; set; }
/// <summary> /// <summary>

View File

@@ -20,6 +20,9 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public interface IComPortsDevice public interface IComPortsDevice
{ {
/// <summary>
/// Gets the Device
/// </summary>
IComPorts Device { get; } IComPorts Device { get; }
} }
} }

View File

@@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public bool ShowHexResponse { get; set; } public bool ShowHexResponse { get; set; }
/// <summary>
/// Initializes a new instance of the ConsoleCommMockDevice class.
/// </summary>
/// <param name="key">The key of the device.</param>
/// <param name="name">The name of the device.</param>
/// <param name="props">The properties configuration for the device.</param>
/// <param name="comm">The communication method for the device.</param>
public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm) public ConsoleCommMockDevice(string key, string name, ConsoleCommMockDevicePropertiesConfig props, IBasicCommunication comm)
:base(key, name) :base(key, name)
{ {
@@ -72,20 +79,24 @@ namespace PepperDash.Essentials.Core
} }
} }
/// <summary> /// <summary>
/// Represents a ConsoleCommMockDevicePropertiesConfig /// Represents a ConsoleCommMockDevicePropertiesConfig
/// </summary> /// </summary>
public class ConsoleCommMockDevicePropertiesConfig public class ConsoleCommMockDevicePropertiesConfig
{ {
/// <summary> /// <summary>
/// Gets or sets the LineEnding /// Gets or sets the LineEnding
/// </summary> /// </summary>
public string LineEnding { get; set; } public string LineEnding { get; set; }
/// <summary>
/// Gets or sets the CommunicationMonitorProperties /// <summary>
/// </summary> /// Gets or sets the CommunicationMonitorProperties
/// </summary>
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
/// <summary>
/// Initializes a new instance of the ConsoleCommMockDevicePropertiesConfig class.
/// </summary>
public ConsoleCommMockDevicePropertiesConfig() public ConsoleCommMockDevicePropertiesConfig()
{ {
LineEnding = "\x0a"; LineEnding = "\x0a";
@@ -97,6 +108,9 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice> public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
{ {
/// <summary>
/// Initializes a new instance of the ConsoleCommMockDeviceFactory class.
/// </summary>
public ConsoleCommMockDeviceFactory() public ConsoleCommMockDeviceFactory()
{ {
TypeNames = new List<string>() { "commmock" }; TypeNames = new List<string>() { "commmock" };

View File

@@ -23,8 +23,15 @@ namespace PepperDash.Essentials.Core
{ {
EssentialsControlPropertiesConfig PropertiesConfig; EssentialsControlPropertiesConfig PropertiesConfig;
/// <summary>
/// Gets the CommPort
/// </summary>
public IBasicCommunication CommPort { get; private set; } public IBasicCommunication CommPort { get; private set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="config">the config of the device</param>
public GenericComm(DeviceConfig config) public GenericComm(DeviceConfig config)
: base(config) : base(config)
{ {
@@ -33,7 +40,7 @@ namespace PepperDash.Essentials.Core
var commPort = CommFactory.CreateCommForDevice(config); 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) if (commPort == null)
{ {
config.Key = config.Key + "-comPorts"; config.Key = config.Key + "-comPorts";
@@ -70,6 +77,10 @@ namespace PepperDash.Essentials.Core
} }
} }
/// <summary>
/// CustomSetConfig method
/// </summary>
/// <param name="config">the new device configuration</param>
protected override void CustomSetConfig(DeviceConfig config) protected override void CustomSetConfig(DeviceConfig config)
{ {
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config); PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
@@ -144,6 +155,9 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm> public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
{ {
/// <summary>
/// Initializes a new instance of the GenericCommFactory class.
/// </summary>
public GenericCommFactory() public GenericCommFactory()
{ {
TypeNames = new List<string>() { "genericComm" }; TypeNames = new List<string>() { "genericComm" };

View File

@@ -4,15 +4,26 @@ using System;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary>
/// Represents a GenericHttpClient
/// </summary>
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")] [Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
/// <summary>
/// Represents a GenericHttpClient
/// </summary>
public class GenericHttpClient : Device, IBasicCommunication public class GenericHttpClient : Device, IBasicCommunication
{ {
private readonly HttpClient Client; private readonly HttpClient Client;
/// <summary>
/// Event raised when response is received
/// </summary>
public event EventHandler<GenericHttpClientEventArgs> ResponseRecived; public event EventHandler<GenericHttpClientEventArgs> ResponseRecived;
/// <summary>
/// Constructor
/// </summary>
/// <param name="key">key of the device</param>
/// <param name="name">name of the device</param>
/// <param name="hostname">hostname for the HTTP client</param>
public GenericHttpClient(string key, string name, string hostname) public GenericHttpClient(string key, string name, string hostname)
: base(key, name) : base(key, name)
{ {
@@ -25,12 +36,9 @@ namespace PepperDash.Essentials.Core
} }
/// <summary> /// <summary>
/// /// SendText method
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path">the path to send the request to</param>
/// <summary>
/// SendText method
/// </summary>
public void SendText(string path) public void SendText(string path)
{ {
HttpClientRequest request = new HttpClientRequest(); HttpClientRequest request = new HttpClientRequest();
@@ -38,6 +46,12 @@ namespace PepperDash.Essentials.Core
request.Url = new UrlParser(url); request.Url = new UrlParser(url);
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
} }
/// <summary>
/// SendText method
/// </summary>
/// <param name="format">format for the items</param>
/// <param name="items">items to format</param>
public void SendText(string format, params object[] items) public void SendText(string format, params object[] items)
{ {
HttpClientRequest request = new HttpClientRequest(); HttpClientRequest request = new HttpClientRequest();
@@ -46,9 +60,11 @@ namespace PepperDash.Essentials.Core
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request); HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
} }
/// <summary> /// <summary>
/// SendTextNoResponse method /// SendTextNoResponse method
/// </summary> /// </summary>
/// <param name="format">format for the items</param>
/// <param name="items">items to format</param>
public void SendTextNoResponse(string format, params object[] items) public void SendTextNoResponse(string format, params object[] items)
{ {
HttpClientRequest request = new HttpClientRequest(); HttpClientRequest request = new HttpClientRequest();
@@ -57,6 +73,12 @@ namespace PepperDash.Essentials.Core
Client.Dispatch(request); Client.Dispatch(request);
} }
/// <summary>
/// Response method
/// </summary>
/// <param name="response">response received from the HTTP client</param>
/// <param name="error">error status of the HTTP callback</param>
/// <param name="request">original HTTP client request</param>
private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request) private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request)
{ {
if (error == HTTP_CALLBACK_ERROR.COMPLETED) if (error == HTTP_CALLBACK_ERROR.COMPLETED)
@@ -74,9 +96,10 @@ namespace PepperDash.Essentials.Core
#region IBasicCommunication Members #region IBasicCommunication Members
/// <summary> /// <summary>
/// SendBytes method /// SendBytes method
/// </summary> /// </summary>
/// <param name="bytes">bytes to send</param>
public void SendBytes(byte[] bytes) public void SendBytes(byte[] bytes)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@@ -88,50 +111,69 @@ namespace PepperDash.Essentials.Core
#region ICommunicationReceiver Members #region ICommunicationReceiver Members
/// <summary>
/// BytesReceived event
/// </summary>
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived; public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
/// <summary> /// <summary>
/// Connect method /// Connect method
/// </summary> /// </summary>
public void Connect() public void Connect()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary> /// <summary>
/// Disconnect method /// Disconnect method
/// </summary> /// </summary>
public void Disconnect() public void Disconnect()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// IsConnected property
/// </summary>
public bool IsConnected public bool IsConnected
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// TextReceived event
/// </summary>
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived; public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
#endregion #endregion
} }
/// <summary>
/// Represents a GenericHttpClientEventArgs /// <summary>
/// </summary> /// Represents a GenericHttpClientEventArgs
/// </summary>
public class GenericHttpClientEventArgs : EventArgs public class GenericHttpClientEventArgs : EventArgs
{ {
/// <summary> /// <summary>
/// Gets or sets the ResponseText /// Gets or sets the ResponseText
/// </summary> /// </summary>
public string ResponseText { get; private set; } public string ResponseText { get; private set; }
/// <summary>
/// Gets or sets the RequestPath /// <summary>
/// </summary> /// Gets or sets the RequestPath
/// </summary>
public string RequestPath { get; private set; } public string RequestPath { get; private set; }
/// <summary>
/// Gets or sets the Error /// <summary>
/// </summary> /// Gets or sets the Error
/// </summary>
public HTTP_CALLBACK_ERROR Error { get; set; } public HTTP_CALLBACK_ERROR Error { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="response">response text</param>
/// <param name="request">request path</param>
/// <param name="error">error status</param>
public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error) public GenericHttpClientEventArgs(string response, string request, HTTP_CALLBACK_ERROR error)
{ {
ResponseText = response; ResponseText = response;

View File

@@ -15,10 +15,13 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// /// Helper class for IR port operations
/// </summary> /// </summary>
public static class IRPortHelper public static class IRPortHelper
{ {
/// <summary>
/// Gets the IrDriverPathPrefix
/// </summary>
public static string IrDriverPathPrefix public static string IrDriverPathPrefix
{ {
get get
@@ -31,7 +34,7 @@ namespace PepperDash.Essentials.Core
/// Finds either the ControlSystem or a device controller that contains IR ports and /// Finds either the ControlSystem or a device controller that contains IR ports and
/// returns a port from the hardware device /// returns a port from the hardware device
/// </summary> /// </summary>
/// <param name="propsToken"></param> /// <param name="propsToken">JSON token containing properties</param>
/// <returns>IrPortConfig object. The port and or filename will be empty/null /// <returns>IrPortConfig object. The port and or filename will be empty/null
/// if valid values don't exist on config</returns> /// if valid values don't exist on config</returns>
public static IrOutPortConfig GetIrPort(JToken propsToken) public static IrOutPortConfig GetIrPort(JToken propsToken)
@@ -83,9 +86,11 @@ namespace PepperDash.Essentials.Core
} }
} }
/// <summary> /// <summary>
/// GetIrOutputPort method /// GetIrOutputPort method
/// </summary> /// </summary>
/// <param name="dc">DeviceConfig to get the IR port for</param>
/// <returns>IROutputPort or null if not found</returns>
public static IROutputPort GetIrOutputPort(DeviceConfig dc) public static IROutputPort GetIrOutputPort(DeviceConfig dc)
{ {
var irControllerKey = dc.Key + "-ir"; var irControllerKey = dc.Key + "-ir";
@@ -145,9 +150,11 @@ namespace PepperDash.Essentials.Core
return port; return port;
} }
/// <summary> /// <summary>
/// GetIrOutputPortController method /// GetIrOutputPortController method
/// </summary> /// </summary>
/// <param name="config">DeviceConfig to create the IrOutputPortController for</param>
/// <returns>IrOutputPortController object</returns>
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config) public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
{ {
Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller"); Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller");
@@ -228,23 +235,32 @@ namespace PepperDash.Essentials.Core
}*/ }*/
} }
/// <summary> /// <summary>
/// Represents a IrOutPortConfig /// Represents a IrOutPortConfig
/// </summary> /// </summary>
public class IrOutPortConfig public class IrOutPortConfig
{ {
/// <summary>
/// Gets or sets the Port
/// </summary>
[JsonProperty("port")] [JsonProperty("port")]
/// <summary> public IROutputPort Port { get; set; }
/// Gets or sets the Port
/// </summary>
public IROutputPort Port { get; set; }
/// <summary>
/// Gets or sets the FileName
/// </summary>
[JsonProperty("fileName")] [JsonProperty("fileName")]
public string FileName { get; set; } public string FileName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to use bridge join map
/// </summary>
[JsonProperty("useBridgeJoinMap")] [JsonProperty("useBridgeJoinMap")]
public bool UseBridgeJoinMap { get; set; } public bool UseBridgeJoinMap { get; set; }
/// <summary>
/// Constructor
/// </summary>
public IrOutPortConfig() public IrOutPortConfig()
{ {
FileName = ""; FileName = "";