Files
SpectraElement/HardwareControl.Core/FocusSystem/FocusSystemStatus.cs
T

44 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace HardwareControl.Core.FocusSystem
{
/// <summary>
/// 定焦系统上传的系统信息(0xF5)解析结果。
/// </summary>
/// <param name="FocusPosition">对焦校准位置。</param>
/// <param name="Error">设备端错误码:0=无错误,11=测距超时,12=超负极限,13=超正极限。</param>
/// <param name="ErrorDescription">错误码的中文描述。</param>
/// <param name="Location">滑台位置。</param>
/// <param name="LaserOnline">激光器是否在线。</param>
/// <param name="VoltageVolts">电源电压(V)。</param>
/// <param name="ExtendedVoltageVolts">扩展板电压(V)。</param>
/// <param name="HardwareVersion">硬件版本号。</param>
/// <param name="SoftwareVersion">软件版本号。</param>
/// <param name="StartTimeMinutes">开机时间(分钟)。</param>
/// <param name="SyncTime">同步延时。</param>
/// <param name="IsDebugMode">是否处于 Debug 模式(sys_sta 非 0)。</param>
/// <param name="ReceivedAt">本机解析到该帧的时间。</param>
public sealed record FocusSystemStatus(
int FocusPosition,
int Error,
string ErrorDescription,
int Location,
bool LaserOnline,
double VoltageVolts,
double ExtendedVoltageVolts,
int HardwareVersion,
int SoftwareVersion,
int StartTimeMinutes,
int SyncTime,
bool IsDebugMode,
DateTimeOffset ReceivedAt)
{
public static string DescribeError(int error) => error switch
{
0 => "无错误",
11 => "测距超时",
12 => "超负极限",
13 => "超正极限",
_ => $"未知错误({error})",
};
}
}