rama creada apartir de master en j
This commit is contained in:
@@ -5,6 +5,9 @@ using Serilog;
|
||||
|
||||
namespace adas_core.Domain.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// Provides helper methods for relaying operations, data, or commands between components.
|
||||
/// </summary>
|
||||
public class RelayHelper
|
||||
{
|
||||
public static bool GetRelayStatusFromApiRest(Relay relay)
|
||||
@@ -56,31 +59,40 @@ public class RelayHelper
|
||||
|
||||
|
||||
//TODO son provisionales mientras se añade como nuget Smacs.Divers
|
||||
/// <summary>
|
||||
/// Powers on the specified relay by constructing a request to the local relay control endpoint at https://localhost:7186, where the relay is identified by its <see cref="Relay.RelayNumber"/> in the path.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power on.</param>
|
||||
public static void PowerOnRelay(Relay relay)
|
||||
{
|
||||
UriBuilder builder = new()
|
||||
{
|
||||
Scheme = "https",
|
||||
Host = "localhost",
|
||||
Port = 7186,
|
||||
Path = $"{relay.RelayNumber}/powerOn"
|
||||
};
|
||||
|
||||
PowerRelay(relay, builder);
|
||||
}
|
||||
UriBuilder builder = new()
|
||||
{
|
||||
Scheme = "https",
|
||||
Host = "localhost",
|
||||
Port = 7186,
|
||||
Path = $"{relay.RelayNumber}/powerOn"
|
||||
};
|
||||
|
||||
PowerRelay(relay, builder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a power off command to the specified relay by building a request to the local relay control endpoint
|
||||
/// using the relay's number as the path identifier, then forwarding the call to the underlying relay handler.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power off, identified by its <see cref="Relay.RelayNumber"/> which is used to construct the request path.</param>
|
||||
public static void PowerOffRelay(Relay relay)
|
||||
{
|
||||
UriBuilder builder = new()
|
||||
{
|
||||
Scheme = "https",
|
||||
Host = "localhost",
|
||||
Port = 7186,
|
||||
Path = $"{relay.RelayNumber}/powerOff"
|
||||
};
|
||||
|
||||
PowerRelay(relay, builder);
|
||||
}
|
||||
UriBuilder builder = new()
|
||||
{
|
||||
Scheme = "https",
|
||||
Host = "localhost",
|
||||
Port = 7186,
|
||||
Path = $"{relay.RelayNumber}/powerOff"
|
||||
};
|
||||
|
||||
PowerRelay(relay, builder);
|
||||
}
|
||||
|
||||
private static void PowerRelay(Relay relay, UriBuilder builder)
|
||||
{
|
||||
@@ -111,8 +123,13 @@ public class RelayHelper
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the current status of the specified relay. Currently always returns <c>false</c>, indicating the relay status is not available or is treated as inactive.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay whose status is being queried.</param>
|
||||
/// <returns><c>true</c> if the relay is active; otherwise, <c>false</c>.</returns>
|
||||
public static bool GetRelayStatus(Relay relay)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user