Общая библиотека для работы с торговым оборудованием.  1.0.0
tescalesbase.h
1 /****************************************************************************
2 ** $Id: tescalesbase.h,v 1.6 2006/07/18 03:28:33 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 /*
27  Abstract Scales interface object
28  (c) V.Grazdankin, 1999-2005
29 */
30 #ifndef TESCALES_H
31 #define TESCALES_H
32 #include <tebase.h>
33 
34 #define EVENT_SCALES_WEIGHT_READ 1
35 #define EVENT_SCALES_COMM_ERROR 100
36 #define EVENT_SCALES_QUERY_INFO 2
37 
38 struct PLUInfo {
39  unsigned int PLU,
40  ICode;
41  char Name[56];
42  int Price,
43  SLife,
44  Tare,
45  GCode,
46  MsgNo;
47 };
48 
49 //---------------------------------------------------------------------------
50 class LIB_EXPORT TEScalesBase : public TEBase
51 {
52  Q_OBJECT
53 
54 public:
55  TEScalesBase( int pn );
56  ~TEScalesBase();
57 
58  enum PLUCapsEnum
59  {
60  PCAP_BCFORMAT=1,
61  PCAP_BCDATE=2,
62  PCAP_USEBYDATE=4,
63  PCAP_USEBYTIME=8,
64  PCAP_SELLBYDATE=16,
65  PCAP_SELLBYTIME=32,
66  PCAP_PACKDATE=64,
67  PCAP_PACKTIME=128,
68  PCAP_TARE=256,
69  PCAP_PICTURENUM=512,
70  PCAP_MAX=0xffffffff
71  };
72 
73  enum GenCapsEnum
74  {
75  GCAP_GETWEIGHT=1, // Can read current value of weight.
76  GCAP_GETPRICE=2, // Can read current product's price.
77  GCAP_GETPLU=4,
78  GCAP_CANQUERYPLU=8, // Scales can query PLU data. Driver will emit deviceEvent(EVENT_SCALES_QUERY_INFO) in responce.
79  GCAP_MAX=0xffffffff
80  };
81 
82 public slots:
83  virtual uint PLUCaps() const {return 0;} // Returns supported PLU fields (PLUCapsEnum members or'ed together)
84  virtual uint GenCaps() const {return 0;} // Returns driver/scale capabilities.
85 
86  virtual int writePLU(){return 0;} // Writes PLU and all its attributes set by setXXX functions.
87  virtual int detelePLU(){return 0;} // deletes PLU set by setPLU function from scales memory
88  virtual int deletePLU(uint uiPLU){return 0;} // deletes uiPLU from scales memory
89 
90  QString productCode() const; // Can be used after EVENT_SCALES_QUERY_INFO.
91  //Returns product code for which information was requested.
92 
93 
94  double price() const {return m_dPrice;}
95  virtual void setPrice( double Price );
96 
97  double tareWeight() const {return m_dTareWeight;}
98  virtual void setTareWeight( double dTareWeight ) {m_dTareWeight=dTareWeight;}
99 
100  unsigned int PLU() const {return m_uiPLU;}
101  virtual void setPLU(unsigned int uiPLU) {m_uiPLU=uiPLU;}
102 
103  QString prodCode() const {return m_sProdCode;}
104  virtual void setProdCode(const QString & sProdCode) {m_sProdCode=sProdCode;}
105 
106  QString groupCode() const {return m_sGroupCode;}
107  virtual void setGroupCode(const QString & sGroupCode) {m_sGroupCode=sGroupCode;}
108 
109  QString prodName() const {return m_sProdName;}
110  virtual void setProdName(const QString & sProdName) {m_sProdName=sProdName;}
111 
112  QDateTime useByDate() const {return m_dUseByDate;}
113  virtual void setUseByDate(const QDateTime & dUseByDate) {m_dUseByDate=dUseByDate;}
114 
115  double weight() const {return 0;}
116  double summa() const {return 0;}
117 
118 public slots:
119  virtual int readDisplay();
120 
121 protected:
122  void setSumma(double dSum){ Q_UNUSED( dSum );};
123  void setWeight(double dWeight){ Q_UNUSED( dWeight ); };
124 
125 // virtual void processEvent( int Code );
126 // int poll();
127 private:
128  unsigned int m_uiPLU;
129  QString m_sProdCode;
130  QString m_sGroupCode;
131  double m_dPrice;
132  double m_dTareWeight;
133  QString m_sProdName;
134  QDateTime m_dUseByDate;
135 };
136 //---------------------------------------------------------------------------
137 
138 #endif
139 
140 
The TEScalesBase is base class for all scales classes.
Definition: tescalesbase.h:50
Definition: tescalesbase.h:38
The TEBase is base class for all trade equipment classes.
Definition: tebase.h:148