Guiliani  Version 2.5 revision 7293 (documentation build 13)
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
97private:
98 enum TouchScreenPressState_t
99 {
100 TS_RELEASED,
101 TS_PRESSED,
102 TS_MOVED
103 };
104
105private:
106 CGUIInputDeviceUnix* m_pkInputDevice;
107 eC_Int m_iTouchScreenDevice;
108
109 eC_Int m_iTSFilterDelta;
110
111#ifdef GUILIANI_UNIX_INPUT_RESISTIVE_TOUCH
112 struct tsdev * ts;
113#endif
114 TouchScreenPressState_t m_eTSState;
115 TouchScreenPressState_t m_eLastTSState;
116
117 eC_Int m_iTouchscreenWidth;
118 eC_Int m_iTouchscreenHeight;
119 eC_Int m_iTouchscreenOffsetX;
120 eC_Int m_iTouchscreenOffsetY;
121
122 eC_Int m_iTSX;
123 eC_Int m_iTSY;
124
125 eC_Int m_iTSLastButtonX;
126 eC_Int m_iTSLastButtonY;
127
128 eC_Int m_iLastDraggedX;
129 eC_Int m_iLastDraggedY;
130};
131
132#ifdef GUILIANI_UNIX_INPUT_USE_REMOTE
134class CGUIInputThreadDeviceUnix_Remote : public CGUIThread
135{
136public:
141 CGUIInputThreadDeviceUnix_Remote(CGUIInputDeviceUnix* pkInputDevice, char* pkRemoteDevice);
142 ~CGUIInputThreadDeviceUnix_Remote();
143
144 void Execute(void *pArg);
145
146private:
147 CGUIInputDeviceUnix* m_pkInputDevice;
148 eC_Int m_iRemoteDevice;
149};
150#endif
151
159{
160public:
171 static void CreateInstance(
172 const char* pcKeyboardDevice,
173 const char* pcTouchscreenDevice,
174 const char* pcRemoteDevice,
175 const eC_Int& iTouchScreenX = 0,
176 const eC_Int& iTouchScreenY = 0,
177 const eC_Int& iTouchscreenWidth = 0,
178 const eC_Int& iTouchscreenHeight = 0,
179 const eC_Int& iTSFilterDelta = 10);
180
181 CGUIEvent* GetEvent(eC_UInt uiIdleTime);
182
183 void StopIdle();
184
189
193
197
201 pthread_cond_t* GetInputEventCond();
202
203 virtual void SetSize(const eC_Int& iSizeX, const eC_Int& iSizeY);
204 virtual void SetOffset(const eC_Int& iOffsetX, const eC_Int& iOffsetY);
205
206protected:
214 const char* pcKeyboardDevice,
215 const char* pcTouchscreenDevice,
216 const char* pcRemoteDevice,
217 const eC_Int& iTouchscreenFilterDelta);
218
220
221private:
225
228 CGUIInputDeviceUnix& operator=(const CGUIInputDeviceUnix& kSource);
229
230private:
231 const char* m_pcKeyboardDevice;
232 const char* m_pcTouchscreenDevice;
233 const char* m_pcRemoteDevice;
234
235#ifdef GUILIANI_UNIX_INPUT_USE_KEYBOARD
239 CGUIInputThreadDeviceUnix_Keyboard* m_pkKeyboardThread;
240#endif
241
245 CGUIInputThreadDeviceUnix_TouchScreen* m_pkTouchScreenThread;
246
247#ifdef GUILIANI_UNIX_INPUT_USE_REMOTE
251 CGUIInputThreadDeviceUnix_Remote* m_pkRemoteThread;
252#endif
253
254 eC_Int m_iTouchscreenFilterDelta;
255
258 eC_Bool m_bStopIdle;
259
261 eC_Semaphore m_kEventQueueSemaphore;
262
263 pthread_cond_t m_kInputEventCond;
264 pthread_mutex_t m_kInputEventMutex;
265};
266
267#endif
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Reads input of the touchscreen, keyboard and remote.
Definition: GUIInputDeviceUnix.h:159
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)
CGUIEvent * GetEvent(eC_UInt uiIdleTime)
CGUIInputDeviceUnix(const char *pcKeyboardDevice, const char *pcTouchscreenDevice, const char *pcRemoteDevice, const eC_Int &iTouchscreenFilterDelta)
pthread_cond_t * GetInputEventCond()
Definition: GUIInputMedia.h:29
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