1.3.11 OcaTaskManager

Class Hierarchy:

OcaRootOcaManagerOcaTaskManager

class OcaTaskManager : OcaManager

Optional manager that collects OcaTask and OcaProgram objects.

  • May be instantiated once in any device.

  • If instantiated, object number must be 11.

Tasks shall be device execution threads that start, execute, and (normally) stop. The action of an OcaTask is defined by an OcaProgram . The idea is that OcaTasks shall execute OcaPrograms . OcaTaskManager offers global control over tasks in the device.

  • Device task processing state is Enabled by default. In Enabled state, tasks may be running.

  • Device task processing state may be Disabled by the OcaTaskManager Disable command.

  • The Disable command will succeed only if no tasks are running.

Tasks may be stopped by: passing the OcaTaskManager a Stop or Abort command, which will stop designated tasks in the device;.

Properties:

static const OcaClassID ClassID = "1.3.11"

Number that uniquely identifies the class. Note that this differs from the object number, which identifies the instantiated object. This property is an override of the OcaRoot property.

This property has id 3.1.

static const OcaClassVersionNumber ClassVersion = 1

Identifies the interface version of the class. Any change to the class definition leads to a higher class version. This property is an override of the OcaRoot property.

This property has id 3.2.

OcaTaskManagerState State

Current state of task processing. State is Disabled after a Disable command has been received, Enabled otherwise.

This property has id 3.1.

OcaMap<OcaTaskID, OcaTask> Tasks

Task collection

This property has id 3.2.

Properties inherited from OcaRoot:

Methods:

OcaStatus Enable(OcaBoolean Enable)

Enables (parameter =TRUE) or disables (parameter = FALSE) the running of tasks. Changes value of property State from Disabled to Enabled and vice versa. All tasks running when Enable is called with parameter = FALSE are immediately aborted.

This method has id 3.1.

Parameters

OcaBoolean Enable – Input parameter.

OcaStatus ControlAllTasks(OcaTaskCommand Command, OcaBlob ApplicationTaskParameter)

Controls all tasks in device. Return value indicates whether tasks were successfully controlled.

This method has id 3.2.

Parameters
  • OcaTaskCommand Command – Input parameter.

  • OcaBlob ApplicationTaskParameter – Input parameter.

OcaStatus ControlTaskGroup(OcaTaskGroupID GroupID, OcaTaskCommand Command, OcaBlob ApplicationTaskParameter)

Controls all tasks in the given group. Return value indicates whether tasks were successfully controlled.

This method has id 3.3.

Parameters
  • OcaTaskGroupID GroupID – Input parameter.

  • OcaTaskCommand Command – Input parameter.

  • OcaBlob ApplicationTaskParameter – Input parameter.

OcaStatus ControlTask(OcaTaskID TaskID, OcaTaskCommand Command, OcaBlob ApplicationTaskParameter)

Controls a specified task. Return value indicates whether tasks were successfully controlled.

This method has id 3.4.

Parameters
  • OcaTaskID TaskID – Input parameter.

  • OcaTaskCommand Command – Input parameter.

  • OcaBlob ApplicationTaskParameter – Input parameter.

OcaStatus GetState(OcaTaskManagerState &State)

Gets value of property State . Return value indicates whether value was successfully retrieved.

This method has id 3.5.

Parameters

OcaTaskManagerState State – Output parameter.

OcaStatus GetTaskStatuses(OcaTaskStatus &Statuses)

This method has id 3.6.

Parameters

OcaTaskStatus Statuses – Output parameter.

OcaStatus GetTaskStatus(OcaTaskID TaskID, OcaTaskStatus &Status)

This method has id 3.7.

Parameters
  • OcaTaskID TaskID – Input parameter.

  • OcaTaskStatus Status – Output parameter.

OcaStatus AddTask(OcaTask Task, OcaTask &Task_)

Creates a Task. Parameters of the new Task are given in the Task parameter; device returns the same parameter with the new Task ID filled in. Initial task state is set to Disabled. Return value indicates whether Task was successfully created.

This method has id 3.8.

Parameters
  • OcaTask Task – Input parameter.

  • OcaTask Task – Output parameter.

OcaStatus GetTasks(OcaMap<OcaTaskID, OcaTask> &Tasks)

Gets map of Tasks in the device. Return value indicates whether map was successfully retrieved.

This method has id 3.9.

Parameters

OcaMap<OcaTaskID, OcaTask> Tasks – Output parameter.

OcaStatus GetTask(OcaTaskID ID, OcaTask &Task)

Retrieves a Task. Return value indicates whether Task was successfully retrieved.

This method has id 3.10.

Parameters
  • OcaTaskID ID – Input parameter.

  • OcaTask Task – Output parameter.

OcaStatus SetTask(OcaTaskID ID, OcaTask Task)

Updates a Task. Return value indicates whether Task was successfully updated.

This method has id 3.11.

Parameters
  • OcaTaskID ID – Input parameter.

  • OcaTask Task – Input parameter.

OcaStatus DeleteTask(OcaTaskID ID)

Deletes a task. Return value indicates whether task was successfully deleted. Method fails with status=ProcessingFailed if task is running.

This method has id 3.12.

Parameters

OcaTaskID ID – Input parameter.

Methods inherited from OcaRoot:

Events:

void TaskStateChanged(OcaTaskStateChangedEventData eventData)