MagicSmoke  $VERSION$
hidscanner.h
Go to the documentation of this file.
1 //
2 // C++ Interface: plugin for USB barcode scanners: Scanner Implementation
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2013-2014
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_BCSUSB_SCANNER_H
14 #define MAGICSMOKE_BCSUSB_SCANNER_H
15 
16 #include <barcode-plugin.h>
17 
18 #include <hidapi.h>
19 
20 #include "bcskeyboard.h"
21 
22 class QTimer;
24 {
25  Q_OBJECT
26  public:
27  explicit MHidBarcodeScanner(QString path,QString setGrp,QObject* parent = 0);
28  virtual ~MHidBarcodeScanner();
29 
30  QString readableName()const override;
31  bool isActive()const override{return mdev!=nullptr;}
32 
33  void activate() override;
34  void deactivate() override;
35 
36  bool matchPath(const QString &p){return mpath==p;}
37 
38  private slots:
39  void readData();
40  void processData();
41  private:
42  hid_device*mdev=nullptr;
43  QTimer*mrdtmr=nullptr;
44  QString mpath,mname;
45  MHidKeySequence mseq;
46  MHidKeyLayout mlayout;
47  int mtimeout=0;
48  MKey mterminator;
49 };
50 
51 #endif
void activate() override
attempts to activate the scanner
Definition: hidscanner.cpp:40
bool isActive() const override
returns whether the scanner is currently active
Definition: hidscanner.h:31
QString readableName() const override
returns a human readable name for the scanner
Definition: hidscanner.cpp:68
void deactivate() override
attempts to de-activate the scanner
Definition: hidscanner.cpp:58
Definition: bcskeyboard.h:131
base class of actual scanner implementations
Definition: barcode-plugin.h:42
virtual ~MHidBarcodeScanner()
Definition: hidscanner.cpp:34
Definition: bcskeyboard.h:22
MHidBarcodeScanner(QString path, QString setGrp, QObject *parent=0)
Definition: hidscanner.cpp:18
bool matchPath(const QString &p)
Definition: hidscanner.h:36
Definition: bcskeyboard.h:145
Definition: hidscanner.h:23