Общая библиотека для работы с торговым оборудованием.  1.0.0
tedisplaybase.h
1 /****************************************************************************
2 ** $Id: tedisplaybase.h,v 1.3 2006/06/20 06:55:18 red75 Exp $
3 **
4 ** Trade equipment common portable library project
5 **
6 ** Copyright (C) 1999-2006 Leader InfoTech. All rights reserved.
7 **
8 ** This file is part of the Library of the Ananas
9 ** automation accounting system.
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.GPL included in the
14 ** packaging of this file.
15 **
16 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 **
19 ** See http://www.leaderit.ru/ or email sales@leaderit.ru
20 **
21 ** Contact org@leaderit.ru if any conditions of this licensing are
22 ** not clear to you.
23 **
24 **********************************************************************/
25 
26 #ifndef _TEDISPLAYBASE_H
27 #define _TEDISPLAYBASE_H
28 #include <tebase.h>
29 #include <qstringlist.h>
30 #include <qthread.h>
31 #include <qmutex.h>
32 #include <qwaitcondition.h>
33 
34 //---------------------------------------------------------------------------
35 class LIB_EXPORT TEDisplayBase : public TEBase
36 {
37  Q_OBJECT
38 
39 public:
40  TEDisplayBase( int pn );
41  ~TEDisplayBase();
42 
43  enum CommandSet
44  {
45  CS_DEFAULT=0,
46  CS_EPSON,
47  CS_DSP800,
48  CS_AEDEX,
49  CS_FIRICH
50  };
51  virtual QString commandSetName(int);
52  virtual bool isCommandSetSupported(int);
53 
54  virtual QString modelInfo();
55  virtual int scrollSpeed()=0;
56  virtual int portBaudRate();
57  int getCommandSet() const {return m_eCommandSet;}
58 public slots:
59  virtual void setPortBaudRate(int);
60  virtual void setScrollSpeed(int)=0;
61  virtual int setCommandSet(int);
62  virtual void initDisplay();
63  virtual void setPortNumberAndInit(int pn);
64  virtual void setDisplayMode(const QString & mode);
65  virtual void showText(const QString & text,
66  const QString & category="default",
67  const QString & mode="scroll/left");
68  virtual void processEvent( int Code );
69 // virtual QStringList execCommand(const QString & cmd);
70 
71 protected:
72  Q_ULONG m_baudRate;
73  int m_slowMode;
74  void setSlowPortMode(int delayus);
75  Q_ULONG writeBlockSlow( const char *data, Q_ULONG len );
76  void addToBuffer(const char * data, Q_ULONG len);
77 
78  QMutex * m_pBufferMutex;
79  QWaitCondition * m_pDataReady;
80  QThread * m_pWriter;
81  QByteArray * m_pBuffer;
82  int m_eCommandSet;
83 
84  virtual void initPort()=0;
85 };
86 //---------------------------------------------------------------------------
87 
88 #endif
89 
90 
The TEDisplayBase is base class for all customer display classes.
Definition: tedisplaybase.h:35
The TEBase is base class for all trade equipment classes.
Definition: tebase.h:148