ThingWorx C SDK
Classes | Typedefs | Functions
twTasker.h File Reference

Simple ThingWorx Tasker. More...

#include "twDefaultSettings.h"

Go to the source code of this file.

Classes

struct  twTask
 Task structure definition. More...
 

Typedefs

typedef void(* twTaskFunction) (uint64_t sys_msecs, void *params)
 Function signature of a task called in round robin fashion. More...
 
typedef struct twTask twTask
 Task structure definition.
 

Functions

void twTasker_Initialize ()
 Initializes the tasker. More...
 
int twTasker_CreateTask (uint32_t runTimeIntervalMsec, twTaskFunction func)
 Adds a new task to the tasker. More...
 
int twTasker_RemoveTask (int id)
 Removes a task from the tasker. More...
 

Detailed Description

Simple ThingWorx Tasker.

Typedef Documentation

typedef void(* twTaskFunction) (uint64_t sys_msecs, void *params)

Function signature of a task called in round robin fashion.

Parameters
[in]sys_msecsThe current non-rollover 64-bit msec counter value. On a platform with millisecond datetime capabilities, this will be the current date/time.
[in]paramsA pointer to the parameters of the function.
Returns
Nothing.
Note
Task functions must return in a cooperative fashion.

Function Documentation

int twTasker_CreateTask ( uint32_t  runTimeIntervalMsec,
twTaskFunction  func 
)

Adds a new task to the tasker.

Parameters
[in]runTimeIntervalMsecThe period (in msec) at which to call this task.
[in]funcA pointer to the function to call when executing the task.
Returns
The id of the resulting task.
void twTasker_Initialize ( )

Initializes the tasker.

Returns
Nothing.
Note
Task functions are called in round robin fashion at a rate defined when the tasks are added.
int twTasker_RemoveTask ( int  id)

Removes a task from the tasker.

Parameters
[in]idThe id of the task to be removed from the tasker.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.