giokoguashvili / MRTD.NET

.NET Library for reading data from contactless chip cards on PCSC compatible smart chip card readers and chip encoders built into plastic card printers
MIT License
21 stars 9 forks source link

Card reader and Card presence tests #5

Closed sirjo66 closed 5 months ago

sirjo66 commented 5 months ago

Like the example on main page, I tried to read an italian identity card with only one row of code:

Dim dg = Await New SmartCardContent(New MRZInfo("CA06903XA", New Date(1986, 2, 3), New Date(2028, 2, 3))).Content

and it works very fine !! But, first of this I'd like to test if there is a card reader connected and to test if there is a card into the reader because in these cases the command don't break and wait wait wait. How can I test the presence of the reader and the card ? Is there any documentation about this DLL ?? Many many thanks Sergio

giokoguashvili commented 5 months ago

I used PCSC Nuget Package for card communications. There is a github repo of this project PC/SC wrapper classes for .NET

Also, take a look at this part of the code, where you can see how to retrieve a specific reader and then use it to communicate with a particular card https://github.com/giokoguashvili/MRTD.NET/blob/c5f20a33df4494765a27c7afdfd2b3f3f5156fc4/SmartCardApi/SmartCardReader/ConnectedReader.cs#L27-L70

sirjo66 commented 5 months ago

Solved !!!