//g++ -I ../svn -I /usr/include/PCSC test.cpp -lpcsclite -ggdb3
#include <pcsc.hxx>
#include <iostream>

int main(int, char const*const*const argv) try {
  pcsc::Connection::Strings reader(pcsc::Connection::scan());
  std::cout<<"Library-Version: "<<pcsc::version()<<std::endl;
  std::cout<<"Suche PCSC-Reader ..."<<std::endl;
  if (!reader.size()) std::cout<<"Keine gefunden."<<std::endl;
  for (pcsc::Connection::Strings::const_iterator it(reader.begin());
       it!=reader.end(); ++it) {
    std::cout<<"Reader: "<<*it<<std::endl;
    pcsc::Connection::Reader::Status s(pcsc::Connection::reader(*it)->status());
    std::cout<<"Status = "<<s.state<<std::endl;
    std::cout<<"ATR = "<<crypto::hex(s.atr)<<std::endl;
  }
  return 0;
 } catch (std::exception& x) {
  std::cerr<<"**** FEHLER in "<<*argv<<": "<<x.what()<<std::endl;
 }