using Prism.Mvvm; using System; using System.Collections.Generic; using System.Linq; using TeamAAS_VP.Core.RFID; namespace TeamAAS_VP.Models { public class BgEthernetIP : BindableBase { private string _IP = "127.0.0.1"; /// /// SIG350 IP 地址 /// public string IP { get { return _IP; } set { SetProperty(ref _IP, value); } } private int _CycleTime = 10; /// /// I/O 循环 RPI(毫秒) /// public int CycleTime { get { return _CycleTime; } set { SetProperty(ref _CycleTime, value); } } private int _RfidPortCount = 1; /// /// 启用的 RFID 端口数量(1–8,对应端口 1..N) /// public int RfidPortCount { get { return _RfidPortCount; } set { SetProperty(ref _RfidPortCount, Math.Max(1, Math.Min(8, value))); } } private bool _IsEnabled = false; public bool IsEnabled { get { return _IsEnabled; } set { SetProperty(ref _IsEnabled, value); } } /// 返回端口 1 至 的列表。 public IReadOnlyList GetEnabledPortNumbers() { int count = Math.Max(1, Math.Min(8, RfidPortCount)); return Enumerable.Range(1, count).ToList(); } /// 固定读取 UID。 public Rfh5xxReadOptions ToRfh5xxReadOptions() { return new Rfh5xxReadOptions { Kind = RfidPayloadKind.Uid }; } } }