namespace HardwareControl.Core.FocusSystem
{
///
/// 定焦系统上传的系统信息(0xF5)解析结果。
///
/// 对焦校准位置。
/// 设备端错误码:0=无错误,11=测距超时,12=超负极限,13=超正极限。
/// 错误码的中文描述。
/// 滑台位置。
/// 激光器是否在线。
/// 电源电压(V)。
/// 扩展板电压(V)。
/// 硬件版本号。
/// 软件版本号。
/// 开机时间(分钟)。
/// 同步延时。
/// 是否处于 Debug 模式(sys_sta 非 0)。
/// 本机解析到该帧的时间。
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})",
};
}
}