[Pcsclite-muscle] Multiple command processing and card recognition
ludovic.rousseau at gmail.com
Sat Feb 9 03:00:07 PST 2019
Le ven. 8 févr. 2019 à 21:51, Ertan Küçükoğlu
<ertan at cronosmedikal.com> a écrit :
> I am new to forum and pcsclite both. Thanks to everyone who has helped and
> still helping.
> I read sample C code from
> https://ludovicrousseau.blogspot.com/2010/04/pcsc-sample-in-c.html I believe
> I understand main process flow. What I need to do with DESFire/DESFire EV1
> cards is:
> 1- Read ID of card.
> 2- Send command
> 3- Send command
> 4- Send command
> 5- ... (send other commands)
> 6- Send last command
> Total number of commands will change. On average it will be about 20-30
> commands but may go high to 40 commands or more in total and they will not
> be firing one after other. There will be changing intervals between them.
> Above sequence is for a single card. Once another card gets to be processed,
> everything from number 1 repeats.
> I am planning to use Lazarus (FreePascal aka fpc) object-oriented language
> and planning to build myself a class so that I will not be needing to call
> "SCardEstablishContext" and "SCardListReaders" frequently. I have following
> A- How long can I keep Context and Reader without a need to call
> B- I need to auto identify when card is in range. What function(s) I should
> be using for that?
Have a look at the pcsc_scan program for example.
> C- Is it safe to call these functions constantly in a thread? More or less
> 24/7 non-stop? Do I need to wait between calls? For how long?
It should work.
Note that SCardGetStatusChange() is a blocking function. If no change
happens then no need to repeat the function.
Active polling is bad.
Dr. Ludovic Rousseau
More information about the pcsclite-muscle