提交代码

This commit is contained in:
ldh
2026-11-19 16:42:26 +08:00
parent dd6edce089
commit 4929d5dcd5
209 changed files with 158631 additions and 1311 deletions
@@ -0,0 +1,30 @@
using HardwareWeb.Models;
using HardwareWeb.Services;
using Microsoft.AspNetCore.Mvc;
namespace HardwareWeb.Controllers
{
/// <summary>硬件设备连接状态与重试。</summary>
[ApiController]
[Route("api/devices")]
public class DeviceController : ControllerBase
{
private readonly DeviceConnectionService _devices;
public DeviceController(DeviceConnectionService devices)
{
_devices = devices;
}
/// <summary>读取位移台/对焦系统/光谱仪/相机的连接状态。</summary>
[HttpGet("status")]
[ProducesResponseType(typeof(DeviceStatusPayload), StatusCodes.Status200OK)]
public IActionResult Status() => Ok(_devices.GetSnapshot());
/// <summary>重试连接所有未连接的设备。</summary>
[HttpPost("retry")]
[ProducesResponseType(typeof(DeviceStatusPayload), StatusCodes.Status200OK)]
public async Task<IActionResult> Retry(CancellationToken ct) =>
Ok(await _devices.RetryFailedAsync(ct));
}
}