Пример #1
0
        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("");
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
        public bool KZ()
        {
            IPortDevice device = DeviceManager.Instance.GetPortDevice(portid, baudrate, portDeviceType);

            if (device != null)
            {
                return(device.Kz(this.controlid, addr));
            }
            return(false);
        }
Пример #4
0
        public bool Available()
        {
            IPortDevice device = DeviceManager.Instance.GetPortDevice(portid, baudrate, portDeviceType);

            if (device != null)
            {
                return(device.Available());
            }
            return(false);
        }
Пример #5
0
 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;
     }
 }
Пример #6
0
 /// <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)
 {
 }
Пример #8
0
 /// <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)
 {
 }
Пример #9
0
 /// <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)
 {
 }
Пример #14
0
 /// <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)
 {
 }
Пример #15
0
 /// <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)
 {
 }