=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -8,6 +8,7 @@ namespace adas_core.module.LightBeacons.Devices;
/// The specific implementation of these methods will depend on the type of light beacon being used and the requirements of the application.
/// </summary>
/// <param name="options">A dictionary containing configuration options for the light beacon. This can include settings such as the beacon's IP address, port number, color configurations, and other relevant parameters.</param>
/// <!-- aidoc:v1 sig=f70cccd -->
public abstract class LightBeacon(EquatableDictionary<string, object> options)
{
/// <summary>
@@ -19,24 +20,28 @@ public abstract class LightBeacon(EquatableDictionary<string, object> options)
/// Turns the light beacon blue. This method should be implemented to control the beacon's hardware or software interface to change its color to blue.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=2fdc9f9 -->
public abstract Task BlueCode();
/// <summary>
/// Turns the light beacon red. This method should be implemented to control the beacon's hardware or software interface to change its color to red.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=8664798 -->
public abstract Task RedCode();
/// <summary>
/// Turns the light beacon yellow. This method should be implemented to control the beacon's hardware or software interface to change its color to yellow.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=7741a6b -->
public abstract Task YellowCode();
/// <summary>
/// Turns off the light beacon. This method should be implemented to control the beacon's hardware or software interface to turn off the light, regardless of its current color.
/// </summary>
/// <returns></returns>
/// <!-- aidoc:v1 sig=a171807 -->
public abstract Task PowerOffLed();
/// <summary>
@@ -45,11 +50,13 @@ public abstract class LightBeacon(EquatableDictionary<string, object> options)
/// </summary>
/// <param name="obs">The patient observation used to determine the appropriate color alert.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=a91a8f7 -->
public abstract Task GenerateColorAlert(PatientObservation obs);
/// <summary>
/// Retrieves the current color of the light beacon. This method should be implemented to query the beacon's hardware or software interface to determine its current color state and return it as a value from the LightBeaconColor enumeration.
/// </summary>
/// <returns>A task representing the asynchronous operation, with a result of the current color of the light beacon.</returns>
/// <!-- aidoc:v1 sig=e132b45 -->
public abstract Task<Domain.Enums.LightBeaconColor> GetBeaconColor();
}
@@ -7,6 +7,7 @@ namespace adas_core.module.LightBeacons.Devices;
/// </summary>
/// <param name="host">The host address of the LightBeacon device. This is typically the IP address or hostname used to connect to the device for controlling its LED states.</param>
/// <param name="password">The password used for authenticating with the LightBeacon device. This is required to establish a connection and control the device's LED states securely.</param>
/// <!-- aidoc:v1 sig=d775c30 -->
public abstract class LightBeaconAbstract(string host, string password)
{
/// <summary>
@@ -23,24 +24,28 @@ public abstract class LightBeaconAbstract(string host, string password)
/// Abstract method to set the LightBeacon device to Code Blue state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly.
/// </summary>
/// <param name="entry">An object parameter that can be used to pass additional information or context needed for setting the LED state.</param>
/// <!-- aidoc:v1 sig=0d7f136 -->
public abstract void CodeBlue(object entry);
/// <summary>
/// Abstract method to set the LightBeacon device to Code Red state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly.
/// </summary>
/// <param name="entry">An object parameter that can be used to pass additional information or context needed for setting the LED state.</param>
/// <!-- aidoc:v1 sig=f600697 -->
public abstract void CodeRed(object entry);
/// <summary>
/// Abstract method to set the LightBeacon device to Code Yellow state. This method should be implemented by each specific LightBeacon model to control the LED state accordingly.
/// </summary>
/// <param name="entry">An object parameter that can be used to pass additional information or context needed for setting the LED state.</param>
/// <!-- aidoc:v1 sig=2ed3bae -->
public abstract void CodeYellow(object entry);
/// <summary>
/// Abstract method to power off the LED of the LightBeacon device. This method should be implemented by each specific LightBeacon model to control the LED state accordingly.
/// </summary>
/// <param name="entry">An object parameter that can be used to pass additional information or context needed for setting the LED state.</param>
/// <!-- aidoc:v1 sig=70c2fef -->
public abstract void PowerOffLed(object entry);
/// <summary>
@@ -51,6 +56,7 @@ public abstract class LightBeaconAbstract(string host, string password)
/// <param name="host">The host address of the LightBeacon device.</param>
/// <param name="password">The password for authenticating with the LightBeacon device.</param>
/// <returns>An instance of the specific LightBeacon device, or null if the driver class is not found or cannot be instantiated.</returns>
/// <!-- aidoc:v1 sig=93cfab7 body=2607338 -->
public static LightBeaconAbstract? GetBeaconDevice(string driver, string host, string password)
{
var modelType = Type.GetType($"adas_core.Drivers.LightBeacon.{driver}");
@@ -10,6 +10,7 @@ namespace adas_core.module.LightBeacons.Devices;
/// This class represents a light beacon device that can be controlled via HTTP requests. It retrieves the current color of the beacon by parsing HTML pages and sends commands to change the beacon's color.
/// The class includes error handling and retry logic for network operations, and it can be configured to emulate the beacon for testing purposes.
/// </summary>
/// <!-- aidoc:v1 sig=483377a -->
public class Turktbens2LightBeacon : LightBeacon
{
/// <summary>
@@ -81,6 +82,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// </summary>
/// <param name="options">A dictionary containing the configuration options for the beacon.</param>
/// <exception cref="ArgumentException">Thrown when required options are missing or invalid.</exception>
/// <!-- aidoc:v1 sig=e320a8e body=1b6dc81 -->
public Turktbens2LightBeacon(EquatableDictionary<string, object> options) : base(options)
{
_logger = Log.ForContext<Turktbens2LightBeacon>();
@@ -108,6 +110,10 @@ public class Turktbens2LightBeacon : LightBeacon
/// returns OFF when some error appears or try to parse the bits to BalizaColors enum
/// </summary>
/// <returns>The current color of the beacon as a LightBeaconColor enum value.</returns>
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
/// "Summary contains leftover template placeholder 'GetByCodeSysAndCode' at the start, which is not meaningful in this context." -->
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
/// "Summary references 'BalizaColors' enum, but the code uses 'LightBeaconColor' (also confirmed by the <returns> tag)." -->
public override async Task<LightBeaconColor> GetBeaconColor()
{
if (_emulate)
@@ -194,6 +200,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// If an error occurs, it logs the error message and rethrows the exception to be handled by the caller.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=18624ee body=9cbaa1f -->
public override async Task BlueCode()
{
try
@@ -211,6 +218,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// The RedCode method sends a command to the beacon's web interface to change the beacon's color to red.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=a28d324 body=00b8012 -->
public override async Task RedCode()
{
try
@@ -228,6 +236,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// The YellowCode method sends a command to the beacon's web interface to change the beacon's color to yellow.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=5e4bc69 body=34c7285 -->
public override async Task YellowCode()
{
try
@@ -245,6 +254,10 @@ public class Turktbens2LightBeacon : LightBeacon
/// The GreenCode method sends a command to the beacon's web interface to change the beacon's color to green.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
/// "Documentation describes a 'GreenCode' method that changes the beacon's color to green, but the actual method is PowerOffLed that sends an off code." -->
/// <!-- aidoc-review:v1 severity=high kind=mentions_removed_behavior
/// "Documentation references a GreenCode behavior (changing color to green) that the code does not implement." -->
public override async Task PowerOffLed()
{
try
@@ -264,6 +277,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// <param name="obs">The patient observation based on which the color alert should be generated.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <exception cref="NotImplementedException"></exception>
/// <!-- aidoc:v1 sig=7b58387 body=bfa6f2f -->
public override Task GenerateColorAlert(PatientObservation obs)
{
throw new NotImplementedException();
@@ -274,6 +288,7 @@ public class Turktbens2LightBeacon : LightBeacon
/// </summary>
/// <param name="colorCodes">The color code to be sent to the beacon.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=9c8fbe5 body=e3eb8e4 -->
private async Task Send(ColorsCodes colorCodes)
{
var clr = ((int)colorCodes).ToString().PadLeft(3, '0');
@@ -306,6 +321,8 @@ public class Turktbens2LightBeacon : LightBeacon
/// <param name="body">The body parameters to be sent in the HTTP POST request.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <exception cref="InvalidOperationException"></exception>
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
/// "The summary describes the method as 'private' but it is declared as 'protected'." -->
protected async Task SendMessage(Dictionary<string, string> body)
{
if (string.IsNullOrEmpty(_url)) throw new InvalidOperationException("URL is not set.");