00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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 ¶m1,
00337
const string ¶m2,
00338
const string ¶m3,
00339
const string ¶m4,
00340
const string ¶m5);
00341
00353
CTError execCommand(
CTCommand &cmd);
00354
00374
CTError execCommand(
const string &command,
00375 string &cmdCache,
00376 string &response,
00377
const string ¶m1=
"",
00378
const string ¶m2=
"",
00379
const string ¶m3=
"",
00380
const string ¶m4=
"",
00381
const string ¶m5=
"");
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