Components/Libraries/XF/FreeRTOS/Event
Event
This class describe events that are used by state machines to execute their next state
Member Attributes
eEventType _type : the basical type of the event
ID_SIZE _id : the event's ID
timeSize _delay : the time in ms befor the event must be sent to the state machine
Thread* _pDstThread : the thread where is living the destinated state machine
IStateMachine* _pDstStateMachine : the destinated state machine
PRIORITY_SIZE _priority : the priority of the event
static ID_SIZE _nextFreeID : the next free ID
bool _isActive : indicate if the event is active
const bool _isStatic : indicate that the event has been created statically and must not be delete
Member Functions Documentation
Event* createEvent(eEventType oType, IStateMachine* opDstStateMachine, Thread* opDstThread, timeSize oDelay, PRIORITY_SIZE oPriority) [static]
Description
This function create an event and return a pointer to it. The ID of the Event is automatically set.
Parameters
eEventType oType : the basic type of the event normally define as Normal
StateMachine opDstStateMachine : the state machine whose send the event
Thread opDstThread : the thread where is living the destinated stateMachine only used by events that has a delay
timeSize oDelay : time in ms to wait before the event must be processed (basically set as 0)
PRIORITY_SIZE oPriority : the priority of the event (basically set as LOW_PRIORITY)
Event* createStaticEvent(ID_SIZE oID, eEventType oType, IStateMachine* opDstStateMachine, Thread* opDstThread, timeSize oDelay, PRIORITY_SIZE oPriority) [static]
Description
This function create a static event and return a pointer to it. You need to set manually the ID of a static event.
Parameters
ID_SIZE oID : the event ID
eEventType oType : the basic type of the event normally define as Normal
StateMachine opDstStateMachine : the state machine whose send the event
Thread opDstThread : the thread where is living the destinated stateMachine only used by events that has a delay
timeSize oDelay : time in ms to wait before the event must be processed (basically set as 0)
PRIORITY_SIZE oPriority : the priority of the event (basically set as LOW_PRIORITY)
void deleteEvent(Event* opEv) [static]
Description
This function delete the event
Parameters
Event opEv : a pointer to the event to delete
void setDelay(timeSize oDelay)
Description
Set the delay of the event
Parameters
Event opEv : the delay of the event in ms
void setEventType(eEventType oNewType)
Description
Set the basic type of the event
Parameters
eEventType oNewType : the new type of the event
void setPriority(PRIORITY_SIZE oNewPriority)
Description
Set the priority of the event
Parameters
PRIORITY_SIZE oNewPriority : the value of the priority
void setDstStateMachine(IStateMachine* opDstStateMachine)
Description
Set the destinated state machine
Parameters
IStateMachine opDstStateMachine : a pointer to the destinated state machine
void setDstThread(Thread* opDstThread)
Description
Set the thread where is living the destinated state machine (only used by events with delay
Parameters
Thread opDstThread : a pointer to the destinated thread
eEventType getEventType()
Description
Returns the basic type of the event. This method does not modify attributes
ID_SIZE getID()
Description
Returns the ID of the event
timeSize getDelay()
Description
Returns the time in ms before the event must be sent to the state machine
PRIORITY_SIZE getPriority()
Description
Get the priority of the event
IStateMachine* getDstStateMachine()
Description
Returns a pointer to the destinated state machine
Thread* getDstThread()
Description
Returns a pointer to the destinated thread
ID_SIZE getFreeID() [static]
Description
This function is used to set an auto free ID
bool isActive()
Description
Indicate if the event is active
bool isStatic()
Description
Indicate if the event is static
void cancel()
Description
Cancel the event (set it in the inactive state)
Event(eEventType oType, IStateMachine* opDstStateMachine, Thread* opDstThread, bool oIsStatic, timeSize oDelay, PRIORITY_SIZE oPriority)
Description
The constructor of the Event
Parameters
eEventType oType : the basic type of the event
IStateMachine opDstStateMachine : the state machine whose send the event
Thread opDstThread : the thread where is living the destinated stateMachine only used by events that has a delay
bool oIsStatic : indicate if the event is static (basically set as false)
timeSize oDelay : time in ms to wait before send event (basically set as 0)
PRIORITY_SIZE oPriority : the priority of the event (basically set as LOW_PRIORITY)
Event(ID_SIZE oID, eEventType oType, IStateMachine* opDstStateMachine, Thread* opDstThread, bool oIsStatic, timeSize oDelay, PRIORITY_SIZE oPriority)
Description
The constructor of the Event
Parameters
ID_SIZE oID : the ID of the event
eEventType oType : the basic type of the event
IStateMachine opDstStateMachine : the state machine whose send the event
Thread opDstThread : the thread where is living the destinated stateMachine only used by events that has a delay
bool oIsStatic : indicate if the event is static (basically set as false)
timeSize oDelay : time in ms to wait before send event (basically set as 0)
PRIORITY_SIZE oPriority : the priority of the event (basically set as LOW_PRIORITY)
~Event() [virtual]
Description
The destructor of the Event. It does anything because pointers must not be destroyed