using System;
namespace YuncangTrace.LocalService.Services.Scan;
///
/// 扫码设备类型判定。
///
/// AndroidStation 是我们自己的安卓扫码端(UDP 发现应答的型号固定为
/// )。桌面端识别到条码后,只有这类通道**需要**收到
/// 「扫码成功」通知(它会在现有 TCP 连接上解析控制帧并播报语音)。
/// 网口扫码枪/中控盒没有语音能力,收到通知也无事可做,而且下行字节会被透传到枪的串口,
/// 所以一律不发。
///
/// ⚠️ 这条判定**只影响通知**,不影响扫码记录:记录一律先写进待上报队列,
/// 与通道类型、设备是否在线都无关。
///
public static class ScanDeviceKind
{
/// 安卓扫码端的型号(见 AndroidStation 的 StationIdentity.MODEL)
public const string AndroidStation = "AndroidStation";
/// 是否安卓扫码通道(型号大小写不敏感)
public static bool IsAndroidStation(string? model)
=> !string.IsNullOrWhiteSpace(model)
&& model.Trim().Equals(AndroidStation, StringComparison.OrdinalIgnoreCase);
/// 界面上的类型标注
public static string Describe(string? model)
=> IsAndroidStation(model) ? "安卓扫描通道" : "扫码枪";
}