added method control; refs #18

master
Marc Wäckerlin 13 years ago
parent 72b76eb711
commit 31dc334b51
  1. 18
      src/pcsc.hxx

@ -325,6 +325,24 @@ namespace pcsc {
return std::string((char*)buff, len);
}
//! Transmit control command and data to the reader.
/*!
* @note Take care: Strings may contain embedded @c 0.
*/
std::string control(unsigned long controlCode,
std::string in) {
DWORD len(256); // arbitrary
UCHAR dataBuffer[256];
PCSC_LOG("SCardControl: "<<"Command: "<<controlCode);
PCSC_LOG(" -> "<<crypto::hex(in));
check(SCardControl(_id, controlCode,
(unsigned char*)in.c_str(), in.size(),
dataBuffer, sizeof(dataBuffer), &len),
"smartcard control message sent");
PCSC_LOG(" -> "<<crypto::hex(std::string((char*)dataBuffer, len)));
return std::string((char*)dataBuffer, len);
}
//! @c false if last operation was not successful
operator bool() const {
// Values are 32 bit values layed out as follows:

Loading…
Cancel
Save