|
|
|
@ -381,7 +381,48 @@ namespace pcsc { |
|
|
|
|
std::string error() const { |
|
|
|
|
#ifdef WIN32 |
|
|
|
|
std::stringstream ss; |
|
|
|
|
ss<<"PCSC state: "<<_state; |
|
|
|
|
switch (_state) { |
|
|
|
|
case SCARD_S_SUCCESS: |
|
|
|
|
ss<<"Success"; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_UNRESPONSIVE_CARD: |
|
|
|
|
ss<<"The smart card is not responding to a reset."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_UNPOWERED_CARD: |
|
|
|
|
ss<<"Power has been removed from the smart card, so that further" |
|
|
|
|
" communication is not possible."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_RESET_CARD: |
|
|
|
|
ss<<"The smart card has been reset, so any shared state" |
|
|
|
|
" information is invalid."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_REMOVED_CARD: |
|
|
|
|
ss<<"The smart card has been removed, so that further" |
|
|
|
|
" communication is not possible."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_SECURITY_VIOLATION: |
|
|
|
|
ss<<"Access was denied because of a security violation."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_WRONG_CHV: |
|
|
|
|
ss<<"The card cannot be accessed because the wrong PIN was" |
|
|
|
|
" presented."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_CHV_BLOCKED: |
|
|
|
|
ss<<"The card cannot be accessed because the maximum number" |
|
|
|
|
" of PIN entry attempts has been reached."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_EOF: |
|
|
|
|
ss<<"The end of the smart card file has been reached."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_CANCELLED_BY_USER: |
|
|
|
|
ss<<"The action was cancelled by the user."; |
|
|
|
|
break; |
|
|
|
|
case SCARD_W_CARD_NOT_AUTHENTICATED: |
|
|
|
|
ss<<"No PIN was presented to the smart card."; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
ss<<"Unknown PCSC state: "<<_state; |
|
|
|
|
} |
|
|
|
|
return ss.str(); |
|
|
|
|
#else |
|
|
|
|
return pcsc_stringify_error(_state); |
|
|
|
|