Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIInputDeviceUnix.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef _GUIINPUTDEVICEUNIX_H_
11#define _GUIINPUTDEVICEUNIX_H_
12
13#include "eC_Types.h"
14#include "eC_TList_doubleLinked.h"
15#include "eC_Semaphore.h"
16
17#include "GUIInputMedia.h"
18#include "GUIThread.h"
19
20#ifdef GUILIANI_UNIX_INPUT_RESISTIVE_TOUCH
21 #include "tslib.h"
22#endif
23
24/**************** Remote: Key codes *******************/
25#define REM_KEY_PREV_CH 34
26
27#define REM_KEY_LEFT 17
28#define REM_KEY_RIGHT 16
29#define REM_KEY_UP 32
30#define REM_KEY_DOWN 33
31#define REM_KEY_OK 13
32
33/***************** Keypad: Key codes *****************/
34#define KEY_LEFT 105
35#define KEY_RIGHT 106
36#define KEY_UP 103
37#define KEY_DOWN 108
38#define KEY_ENTER 28
39
40class CGUIEvent;
42
43#ifdef GUILIANI_UNIX_INPUT_USE_KEYBOARD
45class CGUIInputThreadDeviceUnix_Keyboard : public CGUIThread
46{
47public:
52 CGUIInputThreadDeviceUnix_Keyboard(CGUIInputDeviceUnix* pkInputDevice, const char* pkKeyboardDevice);
53 ~CGUIInputThreadDeviceUnix_Keyboard();
54
55 void Execute(void *pArg);
56
57private:
58 CGUIInputDeviceUnix* m_pkInputDevice;
59 eC_Int m_iKeyboardDevice;
60};
61#endif
62
65{
66public:
73 CGUIInputDeviceUnix* pkInputDevice,
74 const char* pkTouchscreenDevice,
75 const eC_Int& iTSFilterDelta);
77
78 void Execute(void *pArg);
79
84 void SetSize(const eC_Int& iSizeX, const eC_Int& iSizeY);
85
90 void SetOffset(const eC_Int& iOffsetX, const eC_Int& iOffsetY);
91
92private:
93 void DumpRawEvent(char* pcData);
94
95 CGUIEvent* CreateTSEvent();
96
97 eC_Int CalcXPosition(const int& x);
98 eC_Int CalcYPosition(const int& y);
99
100private:
101 enum TouchScreenPressState_t
102 {
103 TS_RELEASED,
104 TS_PRESSED,
105 TS_MOVED
106 };
107
108private:
109 CGUIInputDeviceUnix* m_pkInputDevice;
110 eC_Int m_iTouchScreenDevice;
111
112 eC_Int m_iTSFilterDelta;
113
114#ifdef GUILIANI_UNIX_INPUT_RESISTIVE_TOUCH
115 struct tsdev * ts;
116#endif
117 TouchScreenPressState_t m_eTSState;
118 TouchScreenPressState_t m_eLastTSState;
119
120 eC_Int m_iTouchscreenWidth;
121 eC_Int m_iTouchscreenHeight;
122 eC_Int m_iTouchscreenOffsetX;
123 eC_Int m_iTouchscreenOffsetY;
124
125 eC_Int m_iTSX;
126 eC_Int m_iTSY;
127
128 eC_Int m_iTSLastButtonX;
129 eC_Int m_iTSLastButtonY;
130
131 eC_Int m_iLastDraggedX;
132 eC_Int m_iLastDraggedY;
133};
134
135#ifdef GUILIANI_UNIX_INPUT_USE_REMOTE
137class CGUIInputThreadDeviceUnix_Remote : public CGUIThread
138{
139public:
144 CGUIInputThreadDeviceUnix_Remote(CGUIInputDeviceUnix* pkInputDevice, char* pkRemoteDevice);
145 ~CGUIInputThreadDeviceUnix_Remote();
146
147 void Execute(void *pArg);
148
149private:
150 CGUIInputDeviceUnix* m_pkInputDevice;
151 eC_Int m_iRemoteDevice;
152};
153#endif
154
162{
163public:
174 static void CreateInstance(
175 const char* pcKeyboardDevice,
176 const char* pcTouchscreenDevice,
177 const char* pcRemoteDevice,
178 const eC_Int& iTouchScreenX = 0,
179 const eC_Int& iTouchScreenY = 0,
180 const eC_Int& iTouchscreenWidth = 0,
181 const eC_Int& iTouchscreenHeight = 0,
182 const eC_Int& iTSFilterDelta = 10);
183
184 virtual void PollEvent();
185
186 virtual void StopIdle();
187
192
196
200
204 pthread_cond_t* GetInputEventCond();
205
206 virtual void SetSize(const eC_Int& iSizeX, const eC_Int& iSizeY);
207 virtual void SetOffset(const eC_Int& iOffsetX, const eC_Int& iOffsetY);
208
209protected:
217 const char* pcKeyboardDevice,
218 const char* pcTouchscreenDevice,
219 const char* pcRemoteDevice,
220 const eC_Int& iTouchscreenFilterDelta);
221
223
224private:
228
231 CGUIInputDeviceUnix& operator=(const CGUIInputDeviceUnix& kSource);
232
233private:
234 const char* m_pcKeyboardDevice;
235 const char* m_pcTouchscreenDevice;
236 const char* m_pcRemoteDevice;
237
238#ifdef GUILIANI_UNIX_INPUT_USE_KEYBOARD
242 CGUIInputThreadDeviceUnix_Keyboard* m_pkKeyboardThread;
243#endif
244
248 CGUIInputThreadDeviceUnix_TouchScreen* m_pkTouchScreenThread;
249
250#ifdef GUILIANI_UNIX_INPUT_USE_REMOTE
254 CGUIInputThreadDeviceUnix_Remote* m_pkRemoteThread;
255#endif
256
257 eC_Int m_iTouchscreenFilterDelta;
258
260 eC_Semaphore m_kEventQueueSemaphore;
261
262 pthread_cond_t m_kInputEventCond;
263 pthread_mutex_t m_kInputEventMutex;
264};
265
266#endif
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Reads input of the touchscreen, keyboard and remote.
Definition: GUIInputDeviceUnix.h:162
virtual void PollEvent()
virtual void SetSize(const eC_Int &iSizeX, const eC_Int &iSizeY)
static void CreateInstance(const char *pcKeyboardDevice, const char *pcTouchscreenDevice, const char *pcRemoteDevice, const eC_Int &iTouchScreenX=0, const eC_Int &iTouchScreenY=0, const eC_Int &iTouchscreenWidth=0, const eC_Int &iTouchscreenHeight=0, const eC_Int &iTSFilterDelta=10)
eC_TListDoubleLinked< CGUIEvent * > & GetEventQueue()
virtual void SetOffset(const eC_Int &iOffsetX, const eC_Int &iOffsetY)
CGUIInputDeviceUnix(const char *pcKeyboardDevice, const char *pcTouchscreenDevice, const char *pcRemoteDevice, const eC_Int &iTouchscreenFilterDelta)
virtual void StopIdle()
pthread_cond_t * GetInputEventCond()
Definition: GUIInputMedia.h:30
Thread for touch screen event handling in Unix.
Definition: GUIInputDeviceUnix.h:65
void SetOffset(const eC_Int &iOffsetX, const eC_Int &iOffsetY)
void SetSize(const eC_Int &iSizeX, const eC_Int &iSizeY)
CGUIInputThreadDeviceUnix_TouchScreen(CGUIInputDeviceUnix *pkInputDevice, const char *pkTouchscreenDevice, const eC_Int &iTSFilterDelta)
This is the base class for Guiliani threads.
Definition: GUIThread.h:85
virtual void Execute(void *pArg)=0