Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

ctcard.h

Go to the documentation of this file.
00001 /***************************************************************************
00002   $RCSfile: ctcard.h,v $
00003                              -------------------
00004     cvs         : $Id: ctcard.h,v 1.18 2003/06/16 20:31:03 aquamaniac Exp $
00005     begin       : Tue Aug 28 2001
00006     copyright   : (C) 2001 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009 
00010  ***************************************************************************
00011  *                                                                         *
00012  *   This library is free software; you can redistribute it and/or         *
00013  *   modify it under the terms of the GNU Lesser General Public            *
00014  *   License as published by the Free Software Foundation; either          *
00015  *   version 2.1 of the License, or (at your option) any later version.    *
00016  *                                                                         *
00017  *   This library is distributed in the hope that it will be useful,       *
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00020  *   Lesser General Public License for more details.                       *
00021  *                                                                         *
00022  *   You should have received a copy of the GNU Lesser General Public      *
00023  *   License along with this library; if not, write to the Free Software   *
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00025  *   MA  02111-1307  USA                                                   *
00026  *                                                                         *
00027  ***************************************************************************/
00028 
00162 #ifndef CTCARD_H
00163 #define CTCARD_H
00164 
00165 class CTCard;
00166 
00167 
00168 #include <string>
00169 #include <list>
00170 
00171 #include <chipcard/libchipcard.h>
00172 #include <chipcard/cterror.h>
00173 #include <chipcard/ctpointer.h>
00174 #include <chipcard/ctcommand.h>
00175 #include <chipcard/ctreadercontext.h>
00176 #include <chipcard/ctreadertrader.h>
00177 #include <chipcard/ctcardbase.h>
00178 
00179 
00193 class CHIPCARD_API CTCard: public CTCardBase {
00194   friend class CTCardTrader;
00195 private:
00196   unsigned int _memsize;
00197   unsigned int _timeout;
00198 
00199   string _cardTypes;
00200 
00201   string _cmdSelectFile;
00202   string _cmdSelectFileId;
00203   string _cmdReadBinary;
00204   string _cmdUpdateBinary;
00205 
00206   int _calculateMemorySize(const string &atr);
00207 
00208   CTError _locateCommandReader(const string &command,
00209                                const string &reader,
00210                                string &result);
00211   CTError _locateCommand(const string &command,
00212                          string &result);
00213 
00214 private:
00215   CTCard(const CTReaderContext &rc);
00216 
00217 protected:
00218   virtual CallBackResult callback(bool first);
00219 
00220 public:
00225 
00236   CTCard(const CTCard &c);
00237 
00238   virtual ~CTCard();
00240 
00258   virtual CTError openCard();
00259 
00267   virtual CTError closeCard(bool force=false);
00268 
00281   virtual CTError reopenCard();
00283 
00294   virtual string cardType();
00295 
00304   virtual string cardTypes();
00305 
00311   bool isProcessorCard() const ;
00312 
00322   unsigned int memorySize() const { return _memsize;};
00323 
00325 
00326 
00333   CTError makeAPDU(const string &command,
00334                    string &cmdCache,
00335                    string &apdu,
00336                    const string &param1,
00337                    const string &param2,
00338                    const string &param3,
00339                    const string &param4,
00340                    const string &param5);
00341 
00353   CTError execCommand(CTCommand &cmd);
00354 
00374   CTError execCommand(const string &command,
00375                       string &cmdCache,
00376                       string &response,
00377                       const string &param1="",
00378                       const string &param2="",
00379                       const string &param3="",
00380                       const string &param4="",
00381                       const string &param5="");
00382 
00392   CTError selectFile(string &fcp, unsigned short fid);
00393 
00403   CTError selectFile(string &fcp, const string &fid);
00404 
00414   CTError readBinary(string &data,
00415                      unsigned int offset,
00416                      unsigned int size);
00417 
00418   CTError readBinaryRaw(string &data,
00419                         unsigned short offset,
00420                         unsigned char size);
00421 
00432   CTError updateBinary(const string &data,
00433                        unsigned int offset);
00434 
00435 
00436   CTError updateBinaryRaw(const string &data,
00437                           unsigned short offset);
00439 };
00440 
00441 
00442 
00443 
00444 
00445 
00446 #endif
00447 
00448 
00449 
00450 
00451 
00452 

Generated on Fri Dec 3 23:10:24 2004 for libchipcard by  doxygen 1.3.9.1