| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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";
- /// <summary>
- /// SIG350 IP 地址
- /// </summary>
- public string IP
- {
- get { return _IP; }
- set { SetProperty(ref _IP, value); }
- }
- private int _CycleTime = 10;
- /// <summary>
- /// I/O 循环 RPI(毫秒)
- /// </summary>
- public int CycleTime
- {
- get { return _CycleTime; }
- set { SetProperty(ref _CycleTime, value); }
- }
- private int _RfidPortCount = 1;
- /// <summary>
- /// 启用的 RFID 端口数量(1–8,对应端口 1..N)
- /// </summary>
- 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); }
- }
- /// <summary>返回端口 1 至 <see cref="RfidPortCount"/> 的列表。</summary>
- public IReadOnlyList<int> GetEnabledPortNumbers()
- {
- int count = Math.Max(1, Math.Min(8, RfidPortCount));
- return Enumerable.Range(1, count).ToList();
- }
- /// <summary>固定读取 UID。</summary>
- public Rfh5xxReadOptions ToRfh5xxReadOptions()
- {
- return new Rfh5xxReadOptions { Kind = RfidPayloadKind.Uid };
- }
- }
- }
|