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
00029
00030
00031
00032
00033
#ifndef CTERROR_H
00034
#define CTERROR_H
00035
00036
class CTError;
00037
00038
00039
#include <string>
00040
00041
00042
00043
00044 #define k_CTERROR_OK 0
00045 #define k_CTERROR_INVALID_D -1
00046 #define k_CTERROR_CT -8
00047 #define k_CTERROR_TRANS -10
00048 #define k_CTERROR_MEMORY -11
00049 #define k_CTERROR_HTSI -128
00050
00051 #define k_CTERROR_PARAM 10
00052 #define k_CTERROR_INVALID 11
00053 #define k_CTERROR_NULL 12
00054 #define k_CTERROR_NETWORK 14
00055 #define k_CTERROR_LOCK 15
00056 #define k_CTERROR_DRIVER 16
00057 #define k_CTERROR_LIBLOADER 17
00058 #define k_CTERROR_POINTER 18
00059 #define k_CTERROR_DEBUG 19
00060 #define k_CTERROR_FILE 20
00061 #define k_CTERROR_IMPL 21
00062 #define k_CTERROR_AUTH 22
00063 #define k_CTERROR_SERVICE 23
00064 #define k_CTERROR_API 24
00065
00066
#include <string>
00067
using namespace std;
00068
00069
00086 class CHIPCARD_API CTError {
00087
private:
00088 string _where;
00089
unsigned char _code;
00090
unsigned char _subcode1;
00091
unsigned char _subcode2;
00092 string _info;
00093 string _explanation;
00094 string _reportedFrom;
00095 string _textFromCode(
unsigned char code,
00096
unsigned char sw1,
00097
unsigned char sw2);
00098 string _num2string(
int n,
const string &format=
"%d");
00099
int _string2num(
const string &n,
const string &format=
"%d");
00100
00101
public:
00123 CTError(
const string &where,
00124
unsigned char code,
00125
unsigned char subcode1,
00126
unsigned char subcode2,
00127
const string &info=
"",
00128
const string &explanation=
"");
00129
00130 CTError(
const string &where,
00131
const CTError &err);
00132
00139 CTError();
00140
00141 ~CTError();
00142
00158
bool isOk(
unsigned char ad1=0,
unsigned char ad2=0);
00159
00164 const string &where()
const {
return _where; };
00165
00170 int code()
const {
return _code; };
00171
00176 int subcode1()
const {
return _subcode1; };
00177
00182 int subcode2()
const {
return _subcode2; };
00183
00188 const string &info()
const {
return _info; };
00189
00194 const string &explanation()
const {
return _explanation;};
00195
00200 string errorString();
00201
00205 const string &reportedFrom()
const {
return _reportedFrom;};
00206 };
00207
00208
00209
00210
00211
00212
#endif
00213
00214
00215
00216