Guiliani  Version 2.5 revision 7293 (documentation build 13)
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 };
124
125public:
129 static void CreateInstance(const eC_UInt uiStartDelay = 5000);
130
133 static void DeleteInstance();
134
143 virtual CGUIEvent* GetEvent(eC_UInt uiIdleTime);
144
145 virtual void StopIdle()
146 {
147 if (ms_pkConnectedInputMedia)
148 ms_pkConnectedInputMedia->StopIdle();
149 }
150
155 static eC_Bool SimulateLeftButtonClick(CGUIObject* pkObject);
156
161 static eC_Bool SimulateKeyPress(const GUIKeyIdentifier_t &eKeyIdentifier);
162
170 static void AddMouseEvent(
171 const EventType_t eEventType,
172 const eC_Int iMouseXPos,
173 const eC_Int iMouseYPos,
174 const eC_UInt uiTime = 0,
175 const eC_Bool bImmediate = false);
176
188 static void AddMouseMovement(
189 const eC_Int iMouseStartXPos,
190 const eC_Int iMouseStartYPos,
191 const eC_Int iMouseEndXPos,
192 const eC_Int iMouseEndYPos,
193 const eC_UInt uiDuration,
194 const eC_Bool bDrag,
195 const eC_UInt uiTime = 0,
196 const eC_Bool bImmediate = false);
197
205 static void AddKeyboardEvent(
206 const EventType_t eEventType,
207 const eC_UInt uiKey,
208 const GUIKeyIdentifier_t eGUIKey,
209 const eC_UInt uiTime = 0,
210 const eC_Bool bImmediate = false);
211
216 static void EnableVirtualMouseCursor(const eC_Bool bShowMouseCursor);
217
222 static void EnableStressTest(const eC_Bool bStressTestActive);
223
228 static void EnableRunOnceMode(const eC_Bool bRunOnceMode);
229
231 static void ClearEventQueue();
232
233#ifdef GUILIANI_STREAM_GUI
237 static void ReadFromFile(const eC_String &kPath);
238#endif //#ifdef GUILIANI_STREAM_GUI
239
243 static eC_Bool IsEventQueueEmpty()
244 {
245 return ms_kEventsList.IsEmpty();
246 }
247
248protected:
252 CGUIScriptedInput(const eC_UInt uiStartTime);
254
260
261private:
263 static void AddMouseEventToQueue(
264 const EventType_t eEventType,
265 const eC_Int iMouseXPos,
266 const eC_Int iMouseYPos,
267 const eC_Bool bLeftButton,
268 const eC_Bool bRightButton,
269 const eC_UInt uiTime = 0,
270 const eC_Bool bImmediate = false);
271
274 CGUIScriptedInput(const CGUIScriptedInput& kSource);
275
278 CGUIScriptedInput& operator=(const CGUIScriptedInput& kSource);
279
280private:
282 eC_UInt m_uiTimeToNextEvent;
283
285 eC_UInt m_uiTimeAtLastEvent;
286
288 static eC_TListDoubleLinked<ScriptedInputEvent_t> ms_kEventsList;
289
292
294 static eC_Bool ms_bStressTestActive;
295
297 static eC_Bool ms_bRunOnceActive;
298
300 static CGUIInputMedia* ms_pkConnectedInputMedia;
301
303 static CGUIObject* ms_pMouseCursor;
304 CGUIPoint m_kPosition;
305 CGUIPoint m_kDirection;
306 eC_Bool m_bButtonPressed;
307};
308#endif
EventType_t
List of event type ids.
Definition: GUIEventTypeResource.h:63
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:205
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Definition: GUIInputMedia.h:29
virtual void StopIdle()
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
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:243
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 EnableVirtualMouseCursor(const eC_Bool bShowMouseCursor)
virtual void StopIdle()
Definition: GUIScriptedInput.h:145
static void EnableRunOnceMode(const eC_Bool bRunOnceMode)
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()
virtual CGUIEvent * GetEvent(eC_UInt uiIdleTime)
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_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_Bool m_bMouseEvent
True for mouse event.
Definition: GUIScriptedInput.h:121
eC_Int m_iMouseYPos
y position of event
Definition: GUIScriptedInput.h:117