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 #ifndef TEGLOBAL_H
00027 #define TEGLOBAL_H
00028 #include <qglobal.h>
00029 #include <qgplugin.h>
00030 #include <qstringlist.h>
00031
00032 #define DEBUG
00033
00034
00035 #ifdef Q_OS_WIN32
00036 # include <windows.h>
00037 # include <math.h>
00038 # define _TTY_WIN_
00039 # define round(x) floor(x+0.55555555)
00040 #endif
00041 #ifdef Q_OS_UNIX
00042 # include <unistd.h>
00043 # define Sleep(a) usleep((a)*1000)
00044 # ifndef _TTY_POSIX_
00045 # define _TTY_POSIX_
00046 # endif
00047 #endif
00048
00049 #if defined(Q_OS_WIN32) && !defined(LIB_NO_DLL)
00050 # define LIB_DLLIMPORT __declspec(dllimport)
00051 # define LIB_DLLEXPORT __declspec(dllexport)
00052 #else
00053 # define LIB_DLLIMPORT
00054 # define LIB_DLLEXPORT
00055 #endif
00056
00057 #if defined (Q_CC_MSVC)
00058 #define TEMPLATE_EXTERN extern
00059 #else
00060 #define TEMPLATE_EXTERN
00061 #endif
00062
00063 #ifdef TRADEEQUIP_EXPORT
00064 # define LIB_EXPORT LIB_DLLEXPORT
00065 #else
00066 # define LIB_EXPORT LIB_DLLIMPORT
00067 #endif
00068
00069 #ifdef TRADEEQUIP_EXPORT
00070 # define LIB_TEMPLATE_EXTERN
00071 #else
00072 # define LIB_TEMPLATE_EXTERN TEMPLATE_EXTERN
00073 #endif
00074
00075 #if defined(Q_CC_MSVC)
00076 # define vsnprintf _vsnprintf
00077 #endif
00078
00079 #undef min
00080 #undef max
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 template <class U, class V>
00095 U min(const U & a, const V & b)
00096 {
00097 if (a<=(const U&)b) return a; else return (const U&)b;
00098 }
00099
00100 template <class U, class V>
00101 U max(const U & a, const V & b)
00102 {
00103 if (a>=(const U&)b) return a; else return (const U&)b;
00104 }
00105
00106
00107
00119 class TE
00120 {
00121 public:
00125 enum EquipmentConnectionType {
00126 ECT_NOCONNECTION =0x0,
00127 ECT_SERIAL =0x1,
00128 ECT_KEYBOARD =0x2
00129 };
00133 enum CashRegisterOperations {
00134 CRO_SELL = 0x0,
00135 CRO_BUY = 0x1,
00136 CRO_SELLRET = 0x2,
00137 CRO_BUYRET = 0x3,
00138 CRO_SELLSTORNO = 0x4,
00139 CRO_BUYSTORNO = 0x5,
00140 CRO_CASHIN = 0x6,
00141 CRO_CASHOUT = 0x7,
00142 CRO_DISCOUNT = 0x8,
00143 CRO_DISCOUNTPERCENT = 0x9,
00144 CRO_OPMASK = 0xF
00145
00146
00147
00148
00149 };
00150
00151
00152 };
00153
00154 class TEBase;
00155
00156 Q_EXTERN_C LIB_EXPORT QStringList te_drivers( const QString &baseClass = QString::null );
00157 Q_EXTERN_C LIB_EXPORT bool te_driverExists( const QString &className, const QString &baseClass = QString::null );
00158 Q_EXTERN_C LIB_EXPORT TEBase *te_createDriverObject( const QString &className );
00159
00160 LIB_EXPORT QString te_MD5( const QByteArray &data );
00161 LIB_EXPORT QString te_MD5( const QString &data );
00162 LIB_EXPORT int te_MD5_selftest();
00163
00164
00165 extern void cr_message(QString logFile, int msgtype, const char *msgfmt,...);
00166
00167 extern void cfg_message(int msgtype, const char *msgfmt,...);
00168
00169 #endif