ApparatusFramework::SupervisedTask Class Reference
[Pattern Services]

#include <PatternServices/current/include/SprvTask.h>

Inheritance diagram for ApparatusFramework::SupervisedTask:
ApparatusFramework::Task ApparatusFramework::Protocol ApparatusFramework::CANOpenProtocol

List of all members.

Classes

struct  SupervisionInfo

Public Types

enum  TaskTypeEnum { ASYNC_SLEEPING, ASYNC_BLOCKING, SYNC }
enum  SupervisionStateEnum {
  CREATED, INITIALIZING, UNKNOWN, ALIVE,
  SLEEPING, BLOCKING, WAKING_UP, RESET
}

Public Member Functions

 SupervisedTask (const SupervisedTask &right)
 SupervisedTask (TaskId taskId, TaskPriority priority, StackSize stackSize, uint16 msgQueueLgth, const char taskName[], TaskTypeEnum type, uint8 credit)
 ~SupervisedTask ()
SupervisedTaskoperator= (const SupervisedTask &right)
int operator== (const SupervisedTask &right) const
int operator!= (const SupervisedTask &right) const
void setSupervisionState (SupervisedTask::SupervisionStateEnum state=UNKNOWN)
void startTask ()
MsgwaitMsg ()
void delayFor (const Timeout timeout)
const char * stateToString (SupervisedTask::SupervisionStateEnum state)
void dumpSprvTaskInfo ()

Protected Member Functions

SupervisedTask::SupervisionInfogetSupervisionInfo ()

Protected Attributes

SupervisionInfo m_supervisionInfo

Friends

class WatchdogTaskSupervisor

Detailed Description

SupervisedTask is the base class for all tasks which want to be supervised by the WatchdogTaskSupervisor. Just inherit from it and use it like a common KernelServices task.

The supervised task can be one out of three types: ASYNC_SLEEPING, ASYNC_BLOCKING, or SYNC. See the types documentation for further information.

The supervision state of the task is set by the supervised task itself and by the supervisor task. The supervisor changes the state to check if the supervised task is alive.

Definition at line 70 of file SprvTask.h.


Member Enumeration Documentation

The supervision states of the supervised task. This state is changed by the supervised task itself or by the supervisor task.

  • CREATED The supervised task has been created but not started.
  • INITIALIZING The supervised task has been started with startTask() and executes to waitMsg.
  • ALIVE The supervised task is processing a received message from the message queue.
  • SLEEPING The supervised task is waiting for the next message from the tasks message queue or waits for the end of method waitFor().
  • BLOCKING The state of supervised tasks of type ASYNC_BLOCKED after initialization. The watchdog supervisor stops supervising these tasks after initialization.
  • WAKING_UP The supervised task was sent a wake-up message.
  • RESET The supervised task causes a reset. The reset will actually executed by the hardware watchdog, not software.
  • UNKNOWN The supervisor changes the state to UNKNOWN to check if the supervised task is alive. The supervised task (e.g. such of type SYNCH) set the state back to ALIVE, what is checked by the supervisor.
Enumerator:
CREATED 
INITIALIZING 
UNKNOWN 
ALIVE 
SLEEPING 
BLOCKING 
WAKING_UP 
RESET 

Definition at line 111 of file SprvTask.h.

nested types The three different types of supervised tasks the supervisor knows.

  • Supervised tasks of type ASYNC_SLEEPING are waiting for messages. The supervisor sends them wake-up messages and checks if the message is processed.
  • Supervised tasks of type ASYNC_BLOCKING are set to the supervision state BLOCKING after initialization and not further checked.
  • Supervised tasks of type SYNC set the supervision state to ALIVE on a regular basis. The supervisor clears the state to UNKNOWN to check if the supervised task is alive.
Enumerator:
ASYNC_SLEEPING 
ASYNC_BLOCKING 
SYNC 

Definition at line 84 of file SprvTask.h.


Constructor & Destructor Documentation

ApparatusFramework::SupervisedTask::SupervisedTask ( const SupervisedTask right  ) 

constructors, destructors Copy constructor.

ApparatusFramework::SupervisedTask::SupervisedTask ( TaskId  taskId,
TaskPriority  priority,
StackSize  stackSize,
uint16  msgQueueLgth,
const char  taskName[],
TaskTypeEnum  type,
uint8  credit 
)

Constructs a supervised task. The parameters are more or less the same as for a common KernelServices task. Two new parameters are needed.

Parameters:
taskId Unique task id.
priority The smaller the number, the more important the task.
stackSize The stack size for this task in bytes.
msgQueueLgth Number of messages that fit into the message queue of the task
taskName String name identifing the task
type NEW: Is it a synchronous or asynchronous task?
credit NEW: If the credits have run out, and the task did not pop alive an action is taken.
ApparatusFramework::SupervisedTask::~SupervisedTask (  ) 

Default destructor of the Supervised Task.


Member Function Documentation

void ApparatusFramework::SupervisedTask::delayFor ( const Timeout  timeout  )  [virtual]

Overwrites the tasks delayFor and sets the task alive or sleeping.

Parameters:
timeout sleeping time in ms.

Reimplemented from ApparatusFramework::Task.

void ApparatusFramework::SupervisedTask::dumpSprvTaskInfo (  ) 

Dumbs all important information about the tasks state and its super vision info.

SupervisedTask::SupervisionInfo* ApparatusFramework::SupervisedTask::getSupervisionInfo (  )  [protected]

Protected fields modifiers Retrieves the struct which contains all the information the WatchdogTaskSupervisor needs for its job.

Returns:
SupervisionInfo* pointer to the info struct of this task.
int ApparatusFramework::SupervisedTask::operator!= ( const SupervisedTask right  )  const

Unequality operator

SupervisedTask& ApparatusFramework::SupervisedTask::operator= ( const SupervisedTask right  ) 

operators Assignment operator

int ApparatusFramework::SupervisedTask::operator== ( const SupervisedTask right  )  const

Equality operator

void ApparatusFramework::SupervisedTask::setSupervisionState ( SupervisedTask::SupervisionStateEnum  state = UNKNOWN  ) 

queries Sets the state of the task. Is used by the watchdog task supervisor and should not be used by the client except that the task is synchronised using semaphores or mutexes.

Parameters:
state The new state of the task
void ApparatusFramework::SupervisedTask::startTask (  ) 

inherited task methods Overwrites the startTask method. Needed to detect whether the task shall run or not (if it was not started there is not need to supervise it).

Reimplemented from ApparatusFramework::Task.

const char* ApparatusFramework::SupervisedTask::stateToString ( SupervisedTask::SupervisionStateEnum  state  ) 

diagnostic methods Just needed to retrieve the current state of the task in alphanumeric form.

Parameters:
state the state enumberator which you want to convert into a text.
Returns:
char* the converted string text.
Msg* ApparatusFramework::SupervisedTask::waitMsg (  )  [virtual]

Overwrites the tasks waitMsg and sets the task state ALIVE or SLEEPING. If the received message is an alive check message from the supervisor the task deletes the message and waits for the next message to receive. Any other message is returned to the caller and normal processing continues.

Returns:
Msg* The next message out of the receiving task message queue.

Reimplemented from ApparatusFramework::Task.


Friends And Related Function Documentation

friend class WatchdogTaskSupervisor [friend]

Definition at line 72 of file SprvTask.h.


Member Data Documentation

This struct packs all the important information about this task.

Definition at line 240 of file SprvTask.h.

© 2004-2010 bbv Software Services AG / Apparatus Services