Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIScriptedInput.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 _GUISCRIPTEDINPUT_H_
11#define _GUISCRIPTEDINPUT_H_
12
13#include "eC_Types.h"
14#include "GUIInputMedia.h"
15#include "GUIEvent.h"
17#include "eC_TList_doubleLinked.h"
18#include "eC_String.h"
19#include "GUIPoint.h"
20
21class CGUIEvent;
22
24// @guiliani_doxygen toplevel_module Scripted Input
35// @endguiliani_doxygen
108{
109public:
112 {
115 eC_UInt m_uiKey;
120 eC_UInt m_uiTime;
123 eC_Value m_vDistance;
125 };
126
127public:
131 static void CreateInstance(const eC_UInt uiStartDelay = 5000);
132
135 static void DeleteInstance();
136
137 virtual void PollEvent();
138
139 virtual void StopIdle()
140 {
142
143 if (ms_pkConnectedInputMedia)
144 ms_pkConnectedInputMedia->StopIdle();
145 }
146
151 static eC_Bool SimulateLeftButtonClick(CGUIObject* pkObject);
152
157 static eC_Bool SimulateKeyPress(const GUIKeyIdentifier_t &eKeyIdentifier);
158
166 static void AddMouseEvent(
167 const EventType_t eEventType,
168 const eC_Int iMouseXPos,
169 const eC_Int iMouseYPos,
170 const eC_UInt uiTime = 0,
171 const eC_Bool bImmediate = false);
172
184 static void AddMouseMovement(
185 const eC_Int iMouseStartXPos,
186 const eC_Int iMouseStartYPos,
187 const eC_Int iMouseEndXPos,
188 const eC_Int iMouseEndYPos,
189 const eC_UInt uiDuration,
190 const eC_Bool bDrag,
191 const eC_UInt uiTime = 0,
192 const eC_Bool bImmediate = false);
193
202 static void AddMouseWheel(
203 const eC_Int& iMouseXPos,
204 const eC_Int& iMouseYPos,
205 const eC_Value& vDistance,
206 const eC_UInt& uiModifiers,
207 const eC_UInt& uiTime = 0,
208 const eC_Bool& bImmediate = false);
209
217 static void AddKeyboardEvent(
218 const EventType_t& eEventType,
219 const eC_UInt& uiKey,
220 const GUIKeyIdentifier_t& eGUIKey,
221 const eC_UInt& uiTime = 0,
222 const eC_Bool& bImmediate = false);
223
231 static void AddGestureEvent(
232 const eC_Int& iMouseXPos,
233 const eC_Int& iMouseYPos,
234 const eC_Value& vSpan,
235 const eC_UInt& uiTime = 0,
236 const eC_Bool& bImmediate = false);
237
242 static void EnableVirtualMouseCursor(const eC_Bool bShowMouseCursor);
243
248 static void EnableStressTest(const eC_Bool bStressTestActive);
249
254 static void EnableRunOnceMode(const eC_Bool bRunOnceMode);
255
257 static void ClearEventQueue();
258
259#ifdef GUILIANI_STREAM_GUI
263 static void ReadFromFile(const eC_String &kPath);
264#endif //#ifdef GUILIANI_STREAM_GUI
265
269 static eC_Bool IsEventQueueEmpty()
270 {
271 return ms_kEventsList.IsEmpty();
272 }
273
274protected:
278 CGUIScriptedInput(const eC_UInt uiStartTime);
280
286
287private:
289 static void AddMouseEventToQueue(
290 const EventType_t& eEventType,
291 const eC_Int& iMouseXPos,
292 const eC_Int& iMouseYPos,
293 const eC_Bool& bLeftButton,
294 const eC_Bool& bRightButton,
295 const eC_UInt& uiTime = 0,
296 const eC_Bool& bImmediate = false);
297
300 CGUIScriptedInput(const CGUIScriptedInput& kSource);
301
304 CGUIScriptedInput& operator=(const CGUIScriptedInput& kSource);
305
306private:
308 eC_UInt m_uiTimeToNextEvent;
309
311 eC_UInt m_uiTimeAtLastEvent;
312
314 static eC_TListDoubleLinked<ScriptedInputEvent_t> ms_kEventsList;
315
318
320 static eC_Bool ms_bStressTestActive;
321
323 static eC_Bool ms_bRunOnceActive;
324
326 static CGUIInputMedia* ms_pkConnectedInputMedia;
327
329 static CGUIObject* ms_pMouseCursor;
330 CGUIPoint m_kPosition;
331 CGUIPoint m_kDirection;
332 eC_Bool m_bButtonPressed;
333};
334#endif
EventType_t
List of event type ids.
Definition: GUIEventTypeResource.h:65
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:207
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Definition: GUIInputMedia.h:30
virtual void StopIdle()
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:81
CGUIPoint class to hold two values (x, y) like a vector.
Definition: GUIPoint.h:18
CGUIScriptedInput is used to simulate user-input via scripted or randomized events.
Definition: GUIScriptedInput.h:108
static void CreateInstance(const eC_UInt uiStartDelay=5000)
static void EnableStressTest(const eC_Bool bStressTestActive)
static void ClearEventQueue()
Clears the internal event queue, removing all scripted events.
static void AddKeyboardEvent(const EventType_t &eEventType, const eC_UInt &uiKey, const GUIKeyIdentifier_t &eGUIKey, const eC_UInt &uiTime=0, const eC_Bool &bImmediate=false)
CGUIScriptedInput(const eC_UInt uiStartTime)
static void ReadFromFile(const eC_String &kPath)
static eC_Bool IsEventQueueEmpty()
Definition: GUIScriptedInput.h:269
static eC_Bool SimulateLeftButtonClick(CGUIObject *pkObject)
static eC_Bool SimulateKeyPress(const GUIKeyIdentifier_t &eKeyIdentifier)
static void AddMouseMovement(const eC_Int iMouseStartXPos, const eC_Int iMouseStartYPos, const eC_Int iMouseEndXPos, const eC_Int iMouseEndYPos, const eC_UInt uiDuration, const eC_Bool bDrag, const eC_UInt uiTime=0, const eC_Bool bImmediate=false)
CGUIEvent * CreateRandomEvent()
static void AddMouseWheel(const eC_Int &iMouseXPos, const eC_Int &iMouseYPos, const eC_Value &vDistance, const eC_UInt &uiModifiers, const eC_UInt &uiTime=0, const eC_Bool &bImmediate=false)
virtual void PollEvent()
static void EnableVirtualMouseCursor(const eC_Bool bShowMouseCursor)
virtual void StopIdle()
Definition: GUIScriptedInput.h:139
static void EnableRunOnceMode(const eC_Bool bRunOnceMode)
static void AddGestureEvent(const eC_Int &iMouseXPos, const eC_Int &iMouseYPos, const eC_Value &vSpan, const eC_UInt &uiTime=0, const eC_Bool &bImmediate=false)
static void AddMouseEvent(const EventType_t eEventType, const eC_Int iMouseXPos, const eC_Int iMouseYPos, const eC_UInt uiTime=0, const eC_Bool bImmediate=false)
static void DeleteInstance()
Represents a double linked list template with header and tail node.
Definition: eC_TList_doubleLinked.h:67
An iterator that stays valid even if elements are deleted from the list.
Definition: eC_TList_Iterators.h:313
Struct which holds the information for each event in the list.
Definition: GUIScriptedInput.h:112
eC_Int m_iMouseXPos
x position of event
Definition: GUIScriptedInput.h:116
GUIKeyIdentifier_t m_eGUIKey
key identifier
Definition: GUIScriptedInput.h:114
eC_UInt m_uiTime
timestamp
Definition: GUIScriptedInput.h:120
eC_UInt m_uiModifiers
modifiers for event
Definition: GUIScriptedInput.h:124
eC_Bool m_bImmediateEvent
True for immediate event.
Definition: GUIScriptedInput.h:122
EventType_t m_eEventType
event type
Definition: GUIScriptedInput.h:113
eC_UInt m_uiKey
key value
Definition: GUIScriptedInput.h:115
eC_Bool m_bLeftButton
Left button pressed.
Definition: GUIScriptedInput.h:118
eC_Bool m_bRightButton
Right button pressed.
Definition: GUIScriptedInput.h:119
eC_Value m_vDistance
distance for scroll and gesture
Definition: GUIScriptedInput.h:123
eC_Bool m_bMouseEvent
True for mouse event.
Definition: GUIScriptedInput.h:121
eC_Int m_iMouseYPos
y position of event
Definition: GUIScriptedInput.h:117