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

cterror.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 $RCSfile: cterror.h,v $ 00003 ------------------- 00004 cvs : $Id: cterror.h,v 1.4 2003/01/10 20:02:15 aquamaniac Exp $ 00005 begin : Tue Aug 28 2001 00006 copyright : (C) 2001 by Martin Preuss 00007 email : martin@libchipcard.de 00008 */ 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 /* 00029 Changes 00030 00031 */ 00032 00033 #ifndef CTERROR_H 00034 #define CTERROR_H 00035 00036 class CTError; 00037 00038 00039 #include <string> 00040 00041 00042 /* these errors are directly returned by CTAPI drivers 00043 * all other drivers will map their error codes to these codes */ 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

Generated on Wed Jul 28 14:56:49 2004 for libchipcard by doxygen 1.3.7