import { IOcaProgramRunMode } from '../../types/OcaProgramRunMode.js'; import { OcaTaskOperationalState } from '../../types/OcaTaskOperationalState.js'; import { Event } from '../event.js'; import { PropertyEvent } from '../property_event.js'; import { RemoteDevice } from '../remote_device.js'; import { OcaAgent } from './OcaAgent.js'; /** * Task scheduler. Holds a queue of task-program pairs to be executed under * specific future conditions. * @extends OcaAgent * @class OcaTaskAgent */ export declare class OcaTaskAgent extends OcaAgent { /** * Event raised when execution terminates for any reason. * @member OcaTaskAgent#OnExecutionTerminated {Event} */ OnExecutionTerminated: Event; /** * This event is emitted whenever ExecutableONo changes. */ OnExecutableONoChanged: PropertyEvent; /** * This event is emitted whenever GroupID changes. */ OnGroupIDChanged: PropertyEvent; /** * This event is emitted whenever ExecutionParameters changes. */ OnExecutionParametersChanged: PropertyEvent; /** * This event is emitted whenever RunMode changes. */ OnRunModeChanged: PropertyEvent; /** * This event is emitted whenever Blocked changes. */ OnBlockedChanged: PropertyEvent; /** * This event is emitted whenever OperationalState changes. */ OnOperationalStateChanged: PropertyEvent; constructor(objectNumber: number, device: RemoteDevice); /** * Prepares task for program execution, but does not start execution. Sets * **ExecutableONo** and **ExecutionParameters**. Changes state from * **NotPrepared** to **Ready**. If property **.Blocked** is TRUE, does * nothing and returns status of **ProcessingFailed**. * * @method OcaTaskAgent#ActionPrepare * @param {number} Program * @param {Uint8Array} ExecutionParameters * @param {IOcaProgramRunMode} RunMode * * @returns {Promise} */ ActionPrepare( Program: number, ExecutionParameters: Uint8Array, RunMode: IOcaProgramRunMode ): Promise; /** * Execute the given program immediately. Sets **ExecutableONo** and * **ExecutionParameters**. Changes state from **NotPrepared** to **Running**. * If property **.Blocked** is TRUE, does nothing and returns status of * **ProcessingFailed**. * * @method OcaTaskAgent#ActionRun * @param {number} Program * @param {Uint8Array} ExecutionParameters * @param {IOcaProgramRunMode} RunMode * * @returns {Promise} */ ActionRun( Program: number, ExecutionParameters: Uint8Array, RunMode: IOcaProgramRunMode ): Promise; /** * Executes the prepared program. Changes state from **Ready** to **Running**. * If property **.Blocked** is TRUE, does nothing and returns status of * **ProcessingFailed**. * * @method OcaTaskAgent#ActionStart * @returns {Promise} */ ActionStart(): Promise; /** * Requests orderly termination of running program. Changes state from * **Running** to **Stopping**. When termination is complete, state changes * from **Stopping** to **Ended.** * * @method OcaTaskAgent#ActionStop * @returns {Promise} */ ActionStop(): Promise; /** * Resets all internal states to their values at start of execution. Forces * immediate termination of running or stopping program. Changes state from * **Running, Stopping,** or **Ended** to **Ready.** * * @method OcaTaskAgent#ActionReset * @returns {Promise} */ ActionReset(): Promise; /** * Clears all memory of program and program execution from the task agent. * Forces immediate termination of running or stopping program. Changes state * from **Running, Stopping,** or **Ended** to **NotPrepared. ** Sets property * **ExecutableONo** to zero, property **ExecutionParameters** to a null blob, * and property **RunMode** to **None**. * * @method OcaTaskAgent#ActionClear * @returns {Promise} */ ActionClear(): Promise; /** * Gets property **Blocked**. * * @method OcaTaskAgent#GetBlocked * @returns {Promise} * A promise which resolves to a single value of type ``boolean``. */ GetBlocked(): Promise; /** * Sets the **Blocked** property. * * @method OcaTaskAgent#SetBlocked * @param {boolean} Blocked * * @returns {Promise} */ SetBlocked(Blocked: boolean): Promise; /** * Gets value of the **OperationalState** property. * * @method OcaTaskAgent#GetOperationalState * @returns {Promise} * A promise which resolves to a single value of type :class:`OcaTaskOperationalState`. */ GetOperationalState(): Promise; /** * Gets value of **ExecutableONo** property, as set by the * **ActionPrepare(...)** and **ActionRun(...)** methods. Returns zero if no * execution is pending or in progress. * * @method OcaTaskAgent#GetExecutableONo * @returns {Promise} * A promise which resolves to a single value of type ``number``. */ GetExecutableONo(): Promise; /** * Gets value of **ExecutionParameters** property, as set by the * **ActionPrepare(...)** and **ActionRun(...)** methods. Returns an empty * blob if no execution is pending or in progress. * * @method OcaTaskAgent#GetExecutionParameters * @returns {Promise} * A promise which resolves to a single value of type ``Uint8Array``. */ GetExecutionParameters(): Promise; /** * Gets the value of the **RunMode** property, as set by the * **ActionPrepare(...)** and **ActionRun(...)** methods. Returns the value * **None** if no execution is pending or in progress. * * @method OcaTaskAgent#GetRunMode * @returns {Promise} * A promise which resolves to a single value of type ``IOcaProgramRunMode``. */ GetRunMode(): Promise; }