onTrigger method

void onTrigger()

Callback when the triggerExecutor triggers.

Implementation

void onTrigger() {
  // add the trigger task measurement to the measurements stream
  _controller.add(Measurement.fromData(TriggeredTask(
      triggerId: taskControl.triggerId,
      taskName: taskControl.taskName,
      destinationDeviceRoleName: taskControl.destinationDeviceRoleName!,
      control: taskControl.control)));

  if (taskControl.control == Control.Start) {
    taskExecutor?.start();
  } else if (taskControl.control == Control.Stop) {
    taskExecutor?.stop();
  }
}