direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
demoThread.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) Markus Knapp *
3  * www.direcs.de *
4  * *
5  * This file is part of direcs. *
6  * *
7  * direcs is free software: you can redistribute it and/or modify it *
8  * under the terms of the GNU General Public License as published *
9  * by the Free Software Foundation, version 3 of the License. *
10  * *
11  * direcs is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with direcs. If not, see <http://www.gnu.org/licenses/>. *
18  * *
19  *************************************************************************/
20 
21 #ifndef DEMOTHREAD_H
22 #define DEMOTHREAD_H
23 
24 #include <QThread>
25 #include <QTime>
26 
27 #ifdef Q_OS_LINUX
28 #include <time.h> // for rand
29 #include <stdlib.h> // for rand
30 #endif
31 
32 
39 class DemoThread : public QThread
40 {
41  Q_OBJECT
42 
43  public:
44  DemoThread();
45  ~DemoThread();
46 
50  void stop();
51 
55  virtual void run();
56 
61  bool init();
62 
63 
64  signals:
73  void message(QString text, bool CR=true, bool sayIt=false, bool addTimestamp=true);
74 
78  bool setRGBLEDBrightness(unsigned char rgbLed, unsigned char brightness);
79 
80 
81  private:
82  volatile bool stopped;
83  bool demoMode;
84 
85  static const int timeToNetworkCheck = 3; // time in seconds
86 
87  // Time in milliseconds every ms the run method is called
88  static const unsigned long THREADSLEEPTIME = 200; // 250 ms
89 
91  static const unsigned char RGBLED1 = 0;
92  static const unsigned char RGBLED2 = 1;
93  static const unsigned char RGBLED3 = 2;
94  static const unsigned char RGBLED4 = 3;
95  static const unsigned char RGBLED5 = 4;
96  static const unsigned char RGBLED6 = 5;
97 };
98 
99 #endif