The GestureManager class is a pure abstract class that provides an interface to create any gesture and manages its state. More...
#include <gesturemanager.h>
Public Member Functions | |
GestureManager () | |
~GestureManager () | |
virtual void | updateStatus (FrameData ¶ms) |
updateStatus processes the data of the given frame More... | |
virtual bool | isGestureDetected (FrameData ¶ms)=0 |
isGestureDetected determines if the gesture is detected with the given data More... | |
virtual void | generateGestureData (FrameData ¶ms)=0 |
generateGestureData This function generates the data needed for the gesture manager More... | |
virtual void | onStatusInit (FrameData ¶ms)=0 |
onStatusInit This function is called the first time the init counter reaches 0 More... | |
virtual void | onStatusActive (FrameData ¶ms)=0 |
onStatusActive This function is called while the status is active, until the end counter reaches 0 More... | |
virtual void | onStatusFinish (FrameData ¶ms)=0 |
onStatusFinish This function is called when the end counter reaches 0 More... | |
virtual void | onStatusInactive (FrameData ¶ms)=0 |
onStatusInactive This function is called when the status is set to inactive More... | |
virtual void | setIOManager (IOEventManager *eventManager) |
setIOManager This function changes the event manager associated with this class More... | |
virtual IOEventManager * | getIOManager () |
virtual bool | isActive () const |
int | getCounterInitMax () const |
void | setCounterInitMax (int value) |
int | getCounterEndMax () const |
void | setCounterEndMax (int value) |
Protected Member Functions | |
virtual void | resetInitCounter () |
virtual void | resetEndCounter () |
Protected Attributes | |
int | counterInit |
int | counterEnd |
int | counterInitMax |
int | counterEndMax |
IOEventManager * | iomanager |
bool | gestureDetected |
boost::mutex | iomanagerMutex |
Static Protected Attributes | |
static const int | STATUS_ACTIVE =0 |
static const int | STATUS_INACTIVE =-2 |
static const int | STATUS_INIT =-1 |
static const int | STATUS_FINISH =1 |
The GestureManager class is a pure abstract class that provides an interface to create any gesture and manages its state.
The key idea is that for each frame the controller is going to call updateStatus(). The object will decide then its state and execute the apropiate function. For managing the status the class uses counters. If the init counter is set to N the class will switch the state to active when N observations of the gesture have been detected. An equivalent process is applied for a counter to end the gesture.
For making a gesture work it is enough to override the pure virtual functions. Note that each gesture is independent and will not exclude other gestures from being performed.
The GestureManager is associated with an IOEventManager that should be called in the overriden functions accordingly to perform the event.
GestureManager::GestureManager | ( | ) |
|
inline |
|
pure virtual |
generateGestureData This function generates the data needed for the gesture manager
params | data of the frame needed for the gesture |
This function is called every time that GestureManager::updateStatus is called and GestureManager::isGestureDetected returns True
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
int GestureManager::getCounterEndMax | ( | ) | const |
int GestureManager::getCounterInitMax | ( | ) | const |
|
virtual |
|
virtual |
|
pure virtual |
isGestureDetected determines if the gesture is detected with the given data
params | data of the frame needed for the gesture |
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
|
pure virtual |
onStatusActive This function is called while the status is active, until the end counter reaches 0
params | data of the frame needed for the gesture |
Note that the status can be active serveral frames so this function is going to be called several times in a row.
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
|
pure virtual |
onStatusFinish This function is called when the end counter reaches 0
params | data of the frame needed for the gesture |
After this function is called the state of the gesutre is going to be set as inactive. The function should not be called again until the status of the gesture has gone to active again.
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
|
pure virtual |
onStatusInactive This function is called when the status is set to inactive
params | data of the frame needed for the gestures |
In case a gesture needs passive information this is the function where it should be recorded.
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
|
pure virtual |
onStatusInit This function is called the first time the init counter reaches 0
params | data of the frame needed for the gesture |
After this function is called the state of the gesture is going to be set as active. The function should not be called again until the status of the gesture has gone to inactive again.
In this function all the atributes that are going to be needed during the gesture should be initialized.
Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.
|
protectedvirtual |
|
protectedvirtual |
void GestureManager::setCounterEndMax | ( | int | value | ) |
void GestureManager::setCounterInitMax | ( | int | value | ) |
|
virtual |
setIOManager This function changes the event manager associated with this class
eventManager | pointer to the new event manager |
This function has lateral effects. No copy of the reference is done.
|
virtual |
updateStatus processes the data of the given frame
params | data of the frame needed for the gesture |
This function will call GestureManager::generateGestureData, GestureManager::onStatusInit, GestureManager::onStatusActive, GestureManager::onStatusFinish or GestureManager::onStatusInactive depending on the output of the function GestureManager::isGestureDetected and the values of the counters.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |