void AutoPollTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            RG_ENDPOINT portEndpoin = AutoPullDevice.Endpoint;
            byte        address     = AutoPullDevice.DeviceInfoShort.DeviceAddress;

            RG_PIN_SATETS_16      pinStates  = new RG_PIN_SATETS_16();
            RG_DEVICE_STATUS_TYPE statusType = RG_DEVICE_STATUS_TYPE.DS_UNKNONWN;
            RG_CARD_INFO          cardInfo   = new RG_CARD_INFO()
            {
                CardType = RG_CARD_TYPE_CODE.CT_UNKNOWN
            };
            RG_CARD_MEMORY cardMemory = new RG_CARD_MEMORY()
            {
                ProfileBlock = 0,
                MemBlock     = new byte[16]
            };

            uint errorCode = RG_GetStatus(ref portEndpoin, address,
                                          ref statusType, ref pinStates, ref cardInfo, ref cardMemory);

            if (errorCode != 0 && statusType == RG_DEVICE_STATUS_TYPE.DS_UNKNONWN)
            {
                throw new ApplicationException($"Ошибка {errorCode} при запросе статуса устройства");
            }

            var result = new CardStateEventArgs(pinStates, statusType, cardInfo, cardMemory);

            if (statusType != RG_DEVICE_STATUS_TYPE.DS_NOCARD)
            {
                logger.Debug($"Прочитана карта: {result.CardUid}");
            }
            СardStatusRead?.Invoke(this, result);
        }
        void AutoPollTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            RG_ENDPOINT portEndpoin = AutoPullDevice.Endpoint;
            byte        address     = AutoPullDevice.DeviceInfoShort.DeviceAddress;

            RG_PIN_SATETS_16      pinStates  = new RG_PIN_SATETS_16();
            RG_DEVICE_STATUS_TYPE statusType = RG_DEVICE_STATUS_TYPE.DS_UNKNONWN;
            RG_CARD_INFO          cardInfo   = new RG_CARD_INFO()
            {
                CardType = RG_CARD_TYPE_CODE.CT_UNKNOWN
            };
            RG_CARD_MEMORY cardMemory = new RG_CARD_MEMORY()
            {
                ProfileBlock = 0,
                MemBlock     = new byte[16]
            };

            if (ticksLeft <= 0)
            {
                if (stateNoCard)
                {
                    stateNoCard = false;
                    if (AutoPullDevice.DeviceInfoShort.DeviceAddress == 0)
                    {
                        random.NextBytes(lastUid);
                    }
                    else if (AutoPullDevice.DeviceInfoShort.DeviceAddress == 1)
                    {
                        NextStepReader1();
                    }
                    ticksLeft = 10;
                }
                else
                {
                    stateNoCard = true;
                    ticksLeft   = 25;
                }
            }
            else
            {
                ticksLeft--;
            }

            if (stateNoCard)
            {
                statusType = RG_DEVICE_STATUS_TYPE.DS_NOCARD;
            }
            else
            {
                statusType       = RG_DEVICE_STATUS_TYPE.DS_CARD;
                cardInfo.CardUid = lastUid;
            }

            var result = new CardStateEventArgs(pinStates, statusType, cardInfo, cardMemory);

            СardStatusRead?.Invoke(this, result);
        }