Example #1
0
        public CardBuffer Process(CardBuffer inBuffer)
        {
            CardBuffer outBuffer;

            if (UseApdus)
            {
                try
                {
                    /* Transform incoming frame into an APDU */
                    CAPDU capdu = new CAPDU(inBuffer.GetBytes());
                    /* Process the APDU */
                    outBuffer = OnApdu(new CAPDU(inBuffer.GetBytes()));
                } catch (Exception)
                {
                    /* Incoming frame is not a valid APDU, return 6700 */
                    outBuffer = new RAPDU(0x67, 0x00);
                }
            }
            else
            {
                /* Process the frame */
                outBuffer = OnFrame(inBuffer);
            }

            IsFirstCommand = false;

            return(outBuffer);
        }
Example #2
0
        public RAPDU Transmit(CAPDU capdu)
        {
            _capdu = capdu;

            if (!Transmit())
            {
                return(null);
            }

            return(_rapdu);
        }
Example #3
0
        public RAPDU Control(CAPDU cctrl)
        {
            _cctrl = cctrl;

            if (!Control())
            {
                return(null);
            }

            return(new RAPDU(_rctrl));
        }
Example #4
0
        public RAPDU Control(CAPDU cctrl)
        {
            CardBuffer _rctrl;

            if (!Control(cctrl, out _rctrl))
            {
                return(null);
            }

            return(new RAPDU(_rctrl));
        }
Example #5
0
        public bool Transmit(CAPDU capdu, out RAPDU rapdu)
        {
            rapdu  = null;
            _capdu = capdu;

            if (!Transmit())
            {
                return(false);
            }

            rapdu = _rapdu;
            return(true);
        }
Example #6
0
        public bool Control(CAPDU cctrl, out RAPDU rctrl)
        {
            rctrl  = null;
            _cctrl = cctrl;

            if (!Control())
            {
                return(false);
            }

            rctrl = new RAPDU(_rctrl);
            return(true);
        }
Example #7
0
        public bool Control(CAPDU cctrl, out RAPDU rctrl)
        {
            rctrl = null;
            CardBuffer _rctrl;

            if (!Control(cctrl, out _rctrl))
            {
                return(false);
            }

            rctrl = new RAPDU(_rctrl);
            return(true);
        }
Example #8
0
        public void Transmit(CAPDU capdu, TransmitDoneCallback callback)
        {
            if (_transmit_thread != null)
            {
                _transmit_thread = null;
            }

            _capdu = capdu;

            if (callback != null)
            {
                _transmit_done_callback = callback;
                _transmit_thread        = new Thread(TransmitFunction);
                _transmit_thread.Start();
            }
        }
 protected override RAPDU OnApdu(CAPDU capdu)
 {
     System.Threading.Thread.Sleep(750);
     return(new RAPDU(new byte[1], 0x90, 0x00));
 }
Example #10
0
 protected abstract RAPDU OnApdu(CAPDU capdu);