public string Excute() { if (!CanUse) { return(""); } IPortDevice device = DeviceManager.Instance.GetPortDevice(portid, baudrate, portDeviceType); if (device != null) { string cardid = device.Excute(this.controlid); if (!string.IsNullOrEmpty(cardid)) { lastReadTime = DateTime.Now; if (lastCardId != cardid) { lastCardId = cardid; return(cardid); } } } if (DateTime.Now - lastReadTime > TimeSpan.FromSeconds(2)) { lastCardId = ""; } return(""); }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> /// <param name="mask">Port mask</param> /// <param name="port">Port number after masking</param> /// <param name="canRead">Read supported?</param> /// <param name="canWrite">Write supported?</param> protected PortHandlerBase(IPortDevice parent, ushort mask, ushort port, bool canRead = true, bool canWrite = true) { ParentDevice = parent; PortMask = mask; Port = port; CanRead = canRead; CanWrite = canWrite; }
public bool KZ() { IPortDevice device = DeviceManager.Instance.GetPortDevice(portid, baudrate, portDeviceType); if (device != null) { return(device.Kz(this.controlid, addr)); } return(false); }
public bool Available() { IPortDevice device = DeviceManager.Instance.GetPortDevice(portid, baudrate, portDeviceType); if (device != null) { return(device.Available()); } return(false); }
public void AttachPortDevice(IPortDevice device) { foreach (var port in device.Ports) { if (_portDevices[port] != null) { throw new InvalidOperationException($"Conflicting port: 0x{port.ToString("X")}"); } _portDevices[port] = device; } }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public Spectrum48PortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public NextRegisterSelectPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public SpectrumP3FloppyStatusPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, true, false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public DivIdeControlPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, canRead: false) { }
public KempstonJoystickPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, true, false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public Spectrum128MemoryPagePortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, canRead: false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> public SoundRegisterValuePortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public NextMemoryBankSelectPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public SpectrumP3FloatingPointBusPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, true, false) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public SpectrumP3FloppyCommandPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> /// <param name="parent">Parent device</param> public NextRegisterAccessPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT) { }
/// <summary> /// Initializes a new port handler with the specified attributes. /// </summary> public SoundRegisterIndexPortHandler(IPortDevice parent) : base(parent, PORTMASK, PORT, canRead: false) { }