Task class is an implementation of mail driven thread, for it makes to use Thread and Mail classes in mbed-rtos library easier.

Dependents:   mail_driven_task_example

Embed: (wiki syntax)

« Back to documentation index

Task Class Reference

Task class : A Thread which driven by mail event, and it have own logger. More...

#include <Task.h>

Data Structures

class  Logger
 Logger class. More...

Public Member Functions

MailPacketwaitMail ()
 Wait for mail addressed to itself.
void deleteMail (MailPacket *mail)
 Delete a mail queue block.
void log (LogLevel lv, const char *format,...)
 Output log to task's own stream pointer.

Static Public Member Functions

static void init (TaskConfig *config, uint32_t num_of_task)
 Initialize task config table.
static void sendMail (TaskID task_id, MessageID message_id, void *packet)
 Send mail to task specified by task_id with Any data.

Detailed Description

Task class : A Thread which driven by mail event, and it have own logger.

Definition at line 60 of file Task.h.


Member Function Documentation

void deleteMail ( MailPacket mail )

Delete a mail queue block.

it's responsible for received task.

Parameters:
mailreceived MailPacket
Returns:
void

Definition at line 42 of file Task.cpp.

void init ( TaskConfig config,
uint32_t  num_of_task 
) [static]

Initialize task config table.

Parameters:
cfgarray of TaskConfig
num_of_tasklength of cfg
Returns:
void

set the lowest priority to main thread.

start logger tick

Definition at line 18 of file Task.cpp.

void log ( LogLevel  lv,
const char *  format,
  ... 
)

Output log to task's own stream pointer.

Parameters:
lvloglevel
formatlog format
...log arguments
Returns:
void

Definition at line 61 of file Task.cpp.

void sendMail ( TaskID  task_id,
MessageID  message_id,
void *  packet 
) [static]

Send mail to task specified by task_id with Any data.

Parameters:
task_iddestination task's id
message_idmail id
packetany data pointer
Returns:
void

Definition at line 34 of file Task.cpp.

MailPacket * waitMail (  )

Wait for mail addressed to itself.

Returns:
received MailPacket

Definition at line 47 of file Task.cpp.