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

qlabcashboxinterfacedefinition.h

00001 /*
00002 * Linux Advanced Business Enterprise Management System
00003 *
00004 *
00005 * File name....... : qlabcashboxinterfacedefinition.h
00006 * File version.... : 1.0.1
00007 * Revision Date... : Mon Feb 02 2004
00008 *
00009 * File Description : Abstract Cashbox Hardware Definition
00010 *
00011 * Author.......... : DJ Anubis
00012 * Copyright....... : (C) 2001-2003 by DJ Anubis
00013 * Email .......... : labproject@free.fr
00014 *
00015 * License :
00016 *   Please read the license file in doc directory.
00017 *   1. Lab Public License.
00018 *      You should have received a copy of the Lab Public License with this package.
00019 *      If this is not the case, you can read it or download it at:
00020 *      http://labproject.free.fr
00021 *   2. Q Public License.
00022 *      Conformant to Trolltech QPL license.
00023 *   3. GNU General Public License.
00024 *      Reserved for free projects.
00025 *   4. Commercial license.
00026 *      Recommanded if your code is not distributed under one of the 3 models above.
00027 *
00028 *   Read the license FAQ in doc directory.
00029 *
00030 */
00031 
00032 #ifndef QLABCASHBOXINTERFACEDEFINITION_H
00033 #define QLABCASHBOXINTERFACEDEFINITION_H
00034 
00035 #include <qobject.h>
00036 #include <qvariant.h>
00037 #include <qmap.h>
00038 #include <qtextstream.h>
00039 #include <qfile.h>
00040 #include <qvaluestack.h>
00041 #include <qstring.h>
00042 
00043 // Some defines to have a simpler way of life ;-)
00044 #define DISPLAY         0
00045 #define MSR                     1
00046 #define SCANNER         2
00047 #define SCL                     3
00048 #define KEYBOARD        4
00049 #define TIL                     5
00050 #define PRINTER         6
00051 #define RAM                     7
00052 #define CUST            8
00053 #define SLEEP_MILLISECONDS      100L
00054 #define MSR_BUFFER_SIZE         300
00055 #define SCANNER_BUFFER_SIZE     300
00056 #define MSR_HEADER_SIZE         sizeof(PosMsrDataHdr)
00057 #define SCANNER_HEADER_SIZE     sizeof(PosScannerDataHdr)
00058 #define PRINTER_MAXPRINT_WIDTH  38
00059 
00065 typedef struct {
00066         QString name ;          
00067         QString clsname ;       
00068         int  descriptor ;       
00069         int  type ;                     
00070         int  subtype ;          
00071         int  number ;           
00072 } cashboxdevice ;
00073 
00074 class Q_EXPORT QlabCashboxInterfaceDefinition : public QObject
00075 {
00076         Q_OBJECT ;
00077 
00078         Q_ENUMS( PosActiveStatus ) ;
00079         Q_ENUMS( PosErrorSeverity ) ;
00080         Q_ENUMS( ActivePrintDevice ) ;
00081         Q_ENUMS( BarcodeTypes ) ;
00082         Q_ENUMS( ICharsets ) ;
00083 
00084         Q_PROPERTY( bool supervise READ supervise WRITE setSupervise ) ;
00085         Q_PROPERTY( PosActiveStatus currentStatus READ currentStatus WRITE setCurrentStatus ) ;
00086         Q_PROPERTY( ActivePrintDevice activePrinter READ activePrinter WRITE setActivePrinter ) ;
00087         Q_PROPERTY( PrintModeData currentPrintInfo READ currentPrintInfo WRITE setCurrentPrintInfo ) ;
00088 
00089 public :
00090         QlabCashboxInterfaceDefinition( QObject * parent = 0, char * name = 0 ) ;
00091         ~QlabCashboxInterfaceDefinition() ;
00092 
00100         enum PosActiveStatus { PosStatusUnknown,                
00101                                                    PosStatusSignedOff,          
00102                                                    PosStatusPaused,                     
00103                                                    PosStatusReadCheck,          
00104                                                    PosStatusRemoveCheck,        
00105                                                    PosStatusPrintError          
00106                                              } ;
00107 
00115         enum PosErrorSeverity { SeverityInfo,           
00116                                                         SeverityWarning,        
00117                                                         SeverityError,          
00118                                                         SeverityMemory,         
00119                                                         SeverityFatal           
00120                                                   } ;
00121 
00127         enum ActivePrintDevice { PrinterNone,                           
00128                                                          PrinterCustomerReceipt,        
00129                                                          PrinterDocumentInsert,         
00130                                                          PrinterFiscalPrinter,          
00131                                                          PrinterCheckWriter                     
00132                                                    } ;
00154         enum PrintModeData { None,                                      
00155                                                  SelectFontA,                   
00156                                                  SelectFontB,                   
00157                                                  SelectEmphasis,                
00158                                                  DeselectEmphasis,              
00159                                                  SelectDoubleHeight,    
00160                                                  UnselectDoubleHeight,  
00161                                                  SelectDoubleWidth,             
00162                                                  UnselectDoubleWidth,   
00163                                                  SelectDoubleSize,              
00164                                                  UnselectDoubleSize,    
00165                                                  SelectUnderline,               
00166                                                  UnselectUnderline,             
00167                                                  SelectBlackRibbon,             
00168                                                  SelectRedRibbon                
00169                                            } ;
00170 
00181         enum BarcodeTypes { UpcA,               
00182                                                 UpcE,           
00183                                                 Ean13,          
00184                                                 Ean8,           
00185                                                 Code39,         
00186                                                 Itf,            
00187                                                 Codabar,        
00188                                                 Code93,         
00189                                                 Code128         
00190                                           } ;
00191 
00199         enum ICharsets { Usa,                   
00200                                          France,                
00201                                          Germany,               
00202                                          Uk,                    
00203                                          Denmark1,              
00204                                          Sweeden,               
00205                                          Italy,                 
00206                                          Spain1,                
00207                                          Japan,                 
00208                                          Norway,                
00209                                          Denmark2,              
00210                                          Spain2,                
00211                                          LatinAmerica,  
00212                                          Korea                  
00213                                    } ;
00214 
00224         enum ICodePages { Pc437,                
00225                                           Pc850,                
00226                                           Pc860,                
00227                                           Pc868                 
00228                                         } ;
00229         virtual void setup() ;
00230         virtual void exec() ;
00231         virtual QStringList features() ;
00232 
00233 
00234 public slots :
00235         // Properties
00236         virtual bool supervise() const ;
00237         virtual void setSupervise( bool super ) ;
00238         virtual PosActiveStatus currentStatus() const ;
00239         virtual void setCurrentStatus( PosActiveStatus newStatus ) ;
00240         virtual ActivePrintDevice activePrinter() const ;
00241         virtual void setActivePrinter( ActivePrintDevice prn ) ;
00242         virtual PrintModeData currentPrintInfo() const ;
00243         virtual void setCurrentPrintInfo( PrintModeData md ) ;
00244 
00245         // Standard slots
00246         virtual void exitLoop() ;
00247         virtual void pushStatus() ;
00248         virtual void popStatus() ;
00249         virtual void closeAll() ;
00250         virtual void closeDevice( int dev ) ;
00251         virtual void releaseAll() ;
00252         virtual void lockDevice( int dev ) ;
00253         virtual void unlockDevice( int dev ) ;
00254         virtual long keyboardSupervisorStatus() ;
00255         virtual void clearKeyboard() ;
00256         virtual QString getKeyboardBuffer() ;
00257         virtual void installKeymap( const QString & mapname ) ;
00258 
00259         // display specific Methods
00260         virtual void clearScreen( int dev ) ;
00261         virtual void displayFullScreen( int dev, const QString & msg, int cursor = 0 ) ;
00262         virtual void displayString( int dev, const QString & msg, int cursor = 0 ) ;
00263         virtual void displayItemRight( int dev, const QString & msg, int lineno = 1 ) ;
00264 
00265         // printer specific Methods
00266         virtual bool selectRollPaper() ;
00267         virtual bool selectFullPage() ;
00268         virtual void printLine( const QString & li ) ;
00269         virtual void printText( const QString & txt ) ;
00270         virtual long printerStatus() ;
00271         virtual void writeToCRstation( const QString & line ) ;
00272         virtual void writeToCRandSJstations( const QString & buffer ) ;
00273         virtual void writeToDIstation( const QString & buffer ) ;
00274         virtual QString evalPrintLine( const QString & line, bool withdash = FALSE ) ;
00275         virtual void setHTabs( const QString & tlist ) ;
00276         virtual QString hTabs() const ;
00277 
00278         virtual void setBarCodeType( BarcodeTypes bct ) ;
00279         virtual void setBarcodeHeight( int height ) ;
00280         virtual int barcodeHeight() const ;
00281         virtual bool printBarcode( BarcodeTypes bc, const QString & value ) ;
00282 
00283         // drawer specific Methods
00284         virtual void openCashDrawer() ;
00285         virtual long drawerStatus() ;
00286         virtual void waitForDrawerClosed() ;
00287 
00288         // Sound Methods
00289         virtual void soundTone( int frequency = 440, int duration = 10, int volume = 25 ) ;
00290         virtual void soundError() ;
00291         virtual void soundWarning() ;
00292         virtual void soundReject() ;
00293 
00294         // Internationalization stuff
00295         virtual void selectCodePage( ICodePages cp ) ;
00296         virtual void selectCharSet( ICharsets cs ) ;
00297 
00298 signals :
00305         void deviceOnlineStatusChanged( const QString & desc ) ;
00312         void deviceStatusChanged( const QString & desc ) ;
00319         void deviceError( int errNo, int sev, const QString & desc ) ;
00323         void activeStatusChanged( int newStatus ) ;
00327         void superviseStatusChanged( bool newStatus ) ;
00331         void printerChanged( int prn ) ;
00335         void checkIdentAvailable( const QString & checkNumber ) ;
00339         void scannerDataAvailable( const QString & scanData ) ;
00343         void msrDataAvailable( const QString & msrd ) ;
00347         void drawerOpen() ;
00351         void drawerClosed() ;
00355         void chaseComplete() ;
00359         void keyboardBufferChanged( const QString & msg ) ;
00363         void keyboardDataAvailable( const QString & msg ) ;
00367         void eventKey( unsigned char keyCode ) ;
00368 
00369 protected slots :
00370         // Read scanner data
00371         virtual QString readScannerData() ;
00372 
00373 
00374 protected :
00375         virtual void initDevices() ;
00376         virtual void deviceStatus() ;
00377         virtual void processPrinterStatus() ;
00378         virtual void processPrinterData() ;
00379         virtual void processPrinterError() ;
00380         virtual void processScannerData() ;
00381         virtual QString processMsrData() ;
00382         virtual void processTillOpened( long *till_open_tm ) ;
00383         virtual void processTillClosed( long *till_open_tm ) ;
00384         virtual void processChaseComplete() ;
00385         virtual void processCharacterMessage() ;
00386 
00387         virtual QString readMicr( long size ) ;
00388 
00389         PrintModeData activeModeData ;                  
00390         QMap<QString, QString> printcodes ;             
00391         int columnsCR ;                                                 
00392         int columnsFP ;                                                 
00393         QFile  * printCtrl ;                                    
00394         QTextStream  printStream ;                              
00395         QString labSignature ;                                  
00396         QString chasePrint ;                                    
00397         bool inSupervise ;                                              
00398         PosActiveStatus activeStatus ;                  
00399         QValueStack<PosActiveStatus>  statusStack ;     
00403         QString tabslist ;
00407         QMap<uint, cashboxdevice> deviceList ;
00411         QString printLineBuffer ;
00415         ActivePrintDevice currentPrinter ;
00416 
00420         bool MicrInstalled ;
00424         bool MicrInfoRequested ;
00425 
00429         QString kbdBuffer ;
00433         QString micrBuffer ;
00437         QString scannerBuffer ;
00441         QString msrBuffer ;
00445         bool exitRequired ;
00449         bool welcomeDisplayed ;
00453         bool waitForErrorRecover ;
00457         int barcodesize ;
00458 
00462         PrintModeData prnInfo ;
00466         QStringList featureList ;
00471         QMap< QChar, QChar > ICharMap ;
00472 } ;
00473 
00474 #endif // QLABCASHBOXINTERFACEDEFINITION_H
00475 

 

L.A.B. Project © 2001-2004 LAB Project & DJ Anubis