// // Created by robin on 6/28/15. // #ifndef LIBPCSC_CPPTOOLS_SCREADER_H # define LIBPCSC_CPPTOOLS_SCREADER_H # include # include # include # include "ScCommand.h" # include "ScResult.h" class ScReader { public: inline ScReader(LPCSTR name); virtual ~ScReader(); bool establishContext(); bool freeContext(); bool connect(DWORD shareMode = SCARD_SHARE_SHARED, DWORD protocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, DWORD disposition = SCARD_LEAVE_CARD); bool disconnect(DWORD disposition = SCARD_LEAVE_CARD); std::shared_ptr transmit(const ScCommand& command, DWORD size = 2048); private: LPCSTR _name; LPSCARDCONTEXT _context; LPSCARDHANDLE _card; LPDWORD _proto; LPSCARD_IO_REQUEST _sendPci; LONG _lastResult; }; # include "ScReader.hxx" #endif //LIBPCSC_CPPTOOLS_SCREADER_H