ApparatusFramework::Kernel Class Reference
[Kernel Services]

#include <KernelServices/Win32/current/include/Kernel.h>

Inheritance diagram for ApparatusFramework::Kernel:

List of all members.

Public Member Functions

void startKernel ()
void registerTask (Task *pTask)
TaskcurrentTask ()
TaskgetTaskWithId (const TaskId taskId) const
const char * getTaskName (const TaskId taskId) const
Timeout time () const
void getTimestamp (char *buffer, uint16 bufferSize, const char *formatString) const
void delayFor (const Timeout timeoutInMilliseconds)
unsigned long int convertMillisecondsToClockTicks (const Timeout timeInMilliseconds)
void installErrHndl (ErrorHandler *pErrHndl)
bool handleError (ErrorStatus &errorStatus)

Static Public Member Functions

static KernelCreate (const Timeout tickDuration)
static KernelDefault ()
static bool IsCreated ()

Detailed Description

This class represents the abstract interface to the real time kernel. It is responsible for kernel startup and task administration. It further provides an interface for handling asynchronous errors.

The kernel is only concerned with the administration of tasks. Functions like message sending, semaphore waiting, etc. are implemented in the related classes.

Definition at line 59 of file Kernel.h.

Member Function Documentation

unsigned long int ApparatusFramework::Kernel::convertMillisecondsToClockTicks ( const Timeout  timeInMilliseconds  ) 

Converts the given time in milliseconds to clock ticks. Time precision depends on the OS. E.g. Win32 1ms, eCos 10ms

timeInMilliseconds Time in milliseconds to change in clock ticks
static Kernel* ApparatusFramework::Kernel::Create ( const Timeout  tickDuration  )  [static]

singleton methods Creates an instance of the singleton if none exists yet. The object is created in static memory.

tickDuration Time between two operating system ticks in miliseconds.
A pointer to the created singleton instance.
Task* ApparatusFramework::Kernel::currentTask (  ) 

queries Returns the currently executing task.

Pointer to the currently executing task.
static Kernel* ApparatusFramework::Kernel::Default (  )  [static]

References an instance that has been previously created.

A pointer to the singleton instance.
void ApparatusFramework::Kernel::delayFor ( const Timeout  timeoutInMilliseconds  ) 

Delays the current task until the given interval of time has elapsed. If there is no current task (this function is call from main) a generic delay from the operating system is used.

timeoutInMilliseconds to wait on the message before the caller is again ready for execution. The timeout unit is milliseconds. Time precision depends on the OS. E.g. Win32 1ms, eCos 10ms
const char* ApparatusFramework::Kernel::getTaskName ( const TaskId  taskId  )  const

Returns the name of the task with the given id.

taskId The id of the task we want to know the name.
The name of the task wit id "taskId".
Task* ApparatusFramework::Kernel::getTaskWithId ( const TaskId  taskId  )  const

Returns the pointer to the task with the requested ID. If none is found, we return NULL.

The task with the requested ID. If not found, null is returned.
void ApparatusFramework::Kernel::getTimestamp ( char *  buffer,
uint16  bufferSize,
const char *  formatString 
) const

Returns the time stamp as string, based on the format specification buffer to receive the time string. size of buffer. tells how to format the time stamp. See strftime for detailed info.

bool ApparatusFramework::Kernel::handleError ( ErrorStatus errorStatus  )  [virtual]

This function implements the default error handling. If an application error handler has been installed, the error is first forwarded to the applications error handler. In case the application error handler has handled the error (returns true), this function does no more action. The only exception are error with error type ERROR_HANDLER_ASSERT , these errors are always handled inhere and lead to a dump to the Logger if available. Otherwise this function tries to dump to the standard output using printf. Following error handling applies, depending on the error type:

  • ERROR_HANDLER_NO_ERROR : nothing is done
  • ERROR_HANDLER_WARNING : dump information
  • ERROR_HANDLER_ERROR : dump information
  • ERROR_HANDLER_ASSERT : dump information and block any further execution by crashing over watchdog. When handling this error type, the errorStatus.errorNr points to a string representing the validated statement. The errorStatus.param points to a string representing the file and errorStatus.senderId contains the line where the assertion occurred.
errorStatus Status of the error. It includes the error number, type, senderId and the param.
Always true -> error handled.

Implements ApparatusFramework::ErrorHandler.

void ApparatusFramework::Kernel::installErrHndl ( ErrorHandler pErrHndl  ) 

asynchronous error handling. Installs an error handler which is called whenever an error occurs. To uninstall an error handler and force the default handling, simply call this function with pErrHandl = NULL.

pErrHndl Pointer to the error handler.
static bool ApparatusFramework::Kernel::IsCreated (  )  [static]

States whether an instance of this singleton has been created.

True if an instance has been created, false otherwise.
void ApparatusFramework::Kernel::registerTask ( Task pTask  ) 

modifiers The given task is registered with the kernel.

pTask Pointer to the task to be registered.
void ApparatusFramework::Kernel::startKernel (  ) 

Starts the scheduling process and makes the kernel start with its work. This procedure should be called after the kernel has been instanced.

Timeout ApparatusFramework::Kernel::time (  )  const

Returns the amount of time passed since the kernel has been started. It tells you the time with the precision of the ticks provided by the kernel or real time OS.

The amount of time that has passed since the start of the kernel in ms.
© 2004-2010 bbv Software Services AG / Apparatus Services