mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-07 16:55:04 +00:00
wip: update XML comments
This commit is contained in:
@@ -22,7 +22,14 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public CommunicationStreamDebugging StreamDebugging { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when bytes are received
|
||||
/// </summary>
|
||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when text is received
|
||||
/// </summary>
|
||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
/// <summary>
|
||||
@@ -32,6 +39,12 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
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,
|
||||
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)
|
||||
: base(key)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,14 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
if (objectType == typeof(ComPort.ComPortSpec?))
|
||||
@@ -42,6 +50,9 @@ namespace PepperDash.Essentials.Core
|
||||
return objectType == typeof(ComPort.ComPortSpec?);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CanRead
|
||||
/// </summary>
|
||||
public override bool CanRead { get { return true; } }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,6 +15,11 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
try
|
||||
@@ -223,11 +228,16 @@ namespace PepperDash.Essentials.Core
|
||||
public class EssentialsControlPropertiesConfig :
|
||||
ControlPropertiesConfig
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ComParams
|
||||
/// </summary>
|
||||
[JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(ComSpecJsonConverter))]
|
||||
public ComPort.ComPortSpec? ComParams { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CresnetId
|
||||
/// </summary>
|
||||
[JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CresnetId { get; set; }
|
||||
|
||||
@@ -250,10 +260,10 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||
/// <summary>
|
||||
/// Gets or sets the InfinetId
|
||||
/// </summary>
|
||||
[JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string InfinetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public interface IComPortsDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Device
|
||||
/// </summary>
|
||||
IComPorts Device { get; }
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
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)
|
||||
:base(key, name)
|
||||
{
|
||||
@@ -72,20 +79,24 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ConsoleCommMockDevicePropertiesConfig
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Represents a ConsoleCommMockDevicePropertiesConfig
|
||||
/// </summary>
|
||||
public class ConsoleCommMockDevicePropertiesConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the LineEnding
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Gets or sets the LineEnding
|
||||
/// </summary>
|
||||
public string LineEnding { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the CommunicationMonitorProperties
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CommunicationMonitorProperties
|
||||
/// </summary>
|
||||
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ConsoleCommMockDevicePropertiesConfig class.
|
||||
/// </summary>
|
||||
public ConsoleCommMockDevicePropertiesConfig()
|
||||
{
|
||||
LineEnding = "\x0a";
|
||||
@@ -97,6 +108,9 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public class ConsoleCommMockDeviceFactory : EssentialsDeviceFactory<ConsoleCommMockDevice>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ConsoleCommMockDeviceFactory class.
|
||||
/// </summary>
|
||||
public ConsoleCommMockDeviceFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "commmock" };
|
||||
|
||||
@@ -23,8 +23,15 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
EssentialsControlPropertiesConfig PropertiesConfig;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CommPort
|
||||
/// </summary>
|
||||
public IBasicCommunication CommPort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="config">the config of the device</param>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CustomSetConfig method
|
||||
/// </summary>
|
||||
/// <param name="config">the new device configuration</param>
|
||||
protected override void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
|
||||
@@ -144,6 +155,9 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public class GenericCommFactory : EssentialsDeviceFactory<GenericComm>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the GenericCommFactory class.
|
||||
/// </summary>
|
||||
public GenericCommFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericComm" };
|
||||
|
||||
@@ -4,15 +4,26 @@ using System;
|
||||
|
||||
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")]
|
||||
/// <summary>
|
||||
/// Represents a GenericHttpClient
|
||||
/// </summary>
|
||||
public class GenericHttpClient : Device, IBasicCommunication
|
||||
{
|
||||
private readonly HttpClient Client;
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when response is received
|
||||
/// </summary>
|
||||
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)
|
||||
: base(key, name)
|
||||
{
|
||||
@@ -25,12 +36,9 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// SendText method
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <summary>
|
||||
/// SendText method
|
||||
/// </summary>
|
||||
/// <param name="path">the path to send the request to</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
HttpClientRequest request = new HttpClientRequest();
|
||||
@@ -46,9 +60,11 @@ namespace PepperDash.Essentials.Core
|
||||
HttpClient.DISPATCHASYNC_ERROR error = Client.DispatchAsyncEx(request, Response, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SendTextNoResponse method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// SendTextNoResponse method
|
||||
/// </summary>
|
||||
/// <param name="format">format for the items</param>
|
||||
/// <param name="items">items to format</param>
|
||||
public void SendTextNoResponse(string format, params object[] items)
|
||||
{
|
||||
HttpClientRequest request = new HttpClientRequest();
|
||||
@@ -57,6 +73,12 @@ namespace PepperDash.Essentials.Core
|
||||
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)
|
||||
{
|
||||
if (error == HTTP_CALLBACK_ERROR.COMPLETED)
|
||||
@@ -74,9 +96,10 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
#region IBasicCommunication Members
|
||||
|
||||
/// <summary>
|
||||
/// SendBytes method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// SendBytes method
|
||||
/// </summary>
|
||||
/// <param name="bytes">bytes to send</param>
|
||||
public void SendBytes(byte[] bytes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -88,50 +111,69 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
#region ICommunicationReceiver Members
|
||||
|
||||
/// <summary>
|
||||
/// BytesReceived event
|
||||
/// </summary>
|
||||
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Connect method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Connect method
|
||||
/// </summary>
|
||||
public void Connect()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnect method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Disconnect method
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IsConnected property
|
||||
/// </summary>
|
||||
public bool IsConnected
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TextReceived event
|
||||
/// </summary>
|
||||
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Represents a GenericHttpClientEventArgs
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Represents a GenericHttpClientEventArgs
|
||||
/// </summary>
|
||||
public class GenericHttpClientEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ResponseText
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Gets or sets the ResponseText
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// Gets or sets the Error
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Error
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
ResponseText = response;
|
||||
|
||||
@@ -15,10 +15,13 @@ using Serilog.Events;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Helper class for IR port operations
|
||||
/// </summary>
|
||||
public static class IRPortHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the IrDriverPathPrefix
|
||||
/// </summary>
|
||||
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
|
||||
/// </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
|
||||
/// if valid values don't exist on config</returns>
|
||||
public static IrOutPortConfig GetIrPort(JToken propsToken)
|
||||
@@ -83,9 +86,11 @@ namespace PepperDash.Essentials.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetIrOutputPort method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// GetIrOutputPort method
|
||||
/// </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)
|
||||
{
|
||||
var irControllerKey = dc.Key + "-ir";
|
||||
@@ -145,9 +150,11 @@ namespace PepperDash.Essentials.Core
|
||||
return port;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetIrOutputPortController method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// GetIrOutputPortController method
|
||||
/// </summary>
|
||||
/// <param name="config">DeviceConfig to create the IrOutputPortController for</param>
|
||||
/// <returns>IrOutputPortController object</returns>
|
||||
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
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a IrOutPortConfig
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Represents a IrOutPortConfig
|
||||
/// </summary>
|
||||
public class IrOutPortConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Port
|
||||
/// </summary>
|
||||
[JsonProperty("port")]
|
||||
/// <summary>
|
||||
/// Gets or sets the Port
|
||||
/// </summary>
|
||||
public IROutputPort Port { get; set; }
|
||||
|
||||
public IROutputPort Port { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the FileName
|
||||
/// </summary>
|
||||
[JsonProperty("fileName")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to use bridge join map
|
||||
/// </summary>
|
||||
[JsonProperty("useBridgeJoinMap")]
|
||||
public bool UseBridgeJoinMap { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public IrOutPortConfig()
|
||||
{
|
||||
FileName = "";
|
||||
|
||||
Reference in New Issue
Block a user