You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScReader.h 901B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // Created by robin on 6/28/15.
  3. //
  4. #ifndef LIBPCSC_CPPTOOLS_SCREADER_H
  5. # define LIBPCSC_CPPTOOLS_SCREADER_H
  6. # include <wintypes.h>
  7. # include <pcsclite.h>
  8. # include <memory>
  9. # include "ScCommand.h"
  10. # include "ScResult.h"
  11. class ScReader
  12. {
  13. public:
  14. inline ScReader(LPCSTR name);
  15. virtual ~ScReader();
  16. bool establishContext();
  17. bool freeContext();
  18. bool connect(DWORD shareMode = SCARD_SHARE_SHARED, DWORD protocols =
  19. SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, DWORD disposition = SCARD_LEAVE_CARD);
  20. bool disconnect(DWORD disposition = SCARD_LEAVE_CARD);
  21. std::shared_ptr<ScResult> transmit(const ScCommand& command, DWORD size = 2048);
  22. private:
  23. LPCSTR _name;
  24. LPSCARDCONTEXT _context;
  25. LPSCARDHANDLE _card;
  26. LPDWORD _proto;
  27. LPSCARD_IO_REQUEST _sendPci;
  28. LONG _lastResult;
  29. };
  30. # include "ScReader.hxx"
  31. #endif //LIBPCSC_CPPTOOLS_SCREADER_H