ASYNCJOB_PARAM (UNION) ¶ TYPE ASYNCJOB_PARAM : union Union type, including all async job call definitions. InOut: Name Type TaskParam AsyncJob_TaskParam EventParam AsyncJob_EventParam HookParam AsyncJob_HookParam
ASYNCJOB_TASKPARAM (STRUCT) ¶ TYPE ASYNCJOB_TASKPARAM : STRUCT Specifiy task that executes the job, in case ulType is set to ASYNCJOB_TASK InOut: Name Type Comment pszTaskname POINTER TO STRING Task name of queue. Same task can be re-used for different jobs, or use separate tasks for different jobs. If name is not specified, a default name is generated based on the priority. ulTaskPriority UDINT Priority of task. ulTaskSleepTime UDINT Not used, set to 0. phTaskHandle POINTER TO RTS_IEC_HANDLE Handle of the task used for the job. Filled by AsyncAdd. Set to RTS_INVALID_HANDLE in the call. ulEndTaskAfterJob UDINT If set, task will be terminated after the job is finished.
AsyncAdd (FUN) ¶ FUNCTION AsyncAdd : RTS_IEC_HANDLE Function to start a new asynchronous job. Note On shutdown or reset, or before download, call AsyncRemoveAll() to remove all registered asynchronous jobs. During exit of an application (Application reset or delete), an asynchronous job is executed synchronously! InOut: Scope Name Type Comment Return AsyncAdd RTS_IEC_HANDLE Handle to the job object Input pfJobFunc POINTER TO BYTE Function pointer to be called asyncrononous. Use ADR to retrieve the function pointer. pParam POINTER TO BYTE Parameter to be passed to pfJobFunc pInstance POINTER TO BYTE In case of ulIecFunc is ASYNC_IS_IEC, and if pfJobFunc is a method of a FB, pass here the instance pointer of the FB In other cases, set to 0 pulState POINTER TO UDINT Pointer to job state, filled by CmpAsyncMgr. Check this state cyclically. ulIecFunc UDINT Indicates if pfJobFunc is written in IEC or C: ASYNC_IS_IEC or ASYNC_ISNOT_IEC ulType UDINT Type of an async job: ASYNCJOB_TASK, ASYNCJOB_EVENT or ASYNCJOB_HOOK ulTimeout UDINT Timout for the operation in milliseconds. Can be 0, then infinite. pAsyncJobParam POINTER TO ASYNCJOB_PARAM Pointer to structure ASYNCJOB_PARAM. Specify task by name with member TaskParam.pszTaskname. A new task will be created on first call. For other jobs, this same task can be re-used by setting the same name. Specify task priority with member TaskParam.ulTaskPriority. pResult POINTER TO RTS_IEC_RESULT Pointer to the runtime system error code (see CmpErrors2 Interface Library): ERR_PARAMETER: invalid parameter Result of CmpMemPool ERR_NOTIMPLEMENTED: ulType ASYNCJOB_EVENT and SysEvent handling fails ERR_NOT_SUPPORTED: ulType ASYNCJOB_TASK and SysTask handling fails
AsyncBaseClass (FB) ¶ FUNCTION_BLOCK AsyncBaseClass Function block to handle the asynchronous job. Methods: AsyncRemoveJob AsyncSetJobParams Structure: AsyncRemoveJob (Method) AsyncSetJobParams (Method)
AsyncBaseClass.AsyncRemoveJob (METH) ¶ METHOD AsyncRemoveJob : RTS_IEC_RESULT Method to remove a job. InOut: Scope Name Type Comment Return AsyncRemoveJob RTS_IEC_RESULT Returns the runtime system error code (see CmpErrors.library): ERR_OK: Job has been successfully removed ERR_FAILED: Job cannot be removed because it has been started ERR_PARAMETER: hJob is invalid ERR_PENDING: Job cannot be removed because it is active Input hJob RTS_IEC_HANDLE Handle to the job object.
AsyncBaseClass.AsyncSetJobParams (METH) ¶ METHOD AsyncSetJobParams : RTS_IEC_RESULT Method to set the job parameters. See AsyncAdd for documentation of the parameters. InOut: Scope Name Type Return AsyncSetJobParams RTS_IEC_RESULT Input ulAsyncJobType UDINT ulTimeout UDINT pAsyncJobParams POINTER TO ASYNCJOB_PARAM
AsyncGetJobReturnValue (FUN) ¶ FUNCTION AsyncGetJobReturnValue : RTS_IEC_RESULT Do not use. Parameter pulState will be updated by CmpAsyncMgr automatically. InOut: Scope Name Type Return AsyncGetJobReturnValue RTS_IEC_RESULT Input hJob RTS_IEC_HANDLE pulReturnVal POINTER TO UDINT
AsyncKill (FUN) ¶ FUNCTION AsyncKill : RTS_IEC_RESULT Kill active job. InOut: Scope Name Type Comment Return AsyncKill RTS_IEC_RESULT Input hJob RTS_IEC_HANDLE Handle of job, returned by AsyncAdd
AsyncRemove (FUN) ¶ FUNCTION AsyncRemove : RTS_IEC_RESULT Remove a job. InOut: Scope Name Type Comment Return AsyncRemove RTS_IEC_RESULT Returns the runtime system error code (see CmpErrors.library): ERR_OK: Job has been successfully removed ERR_FAILED: Job cannot be removed because it has been started ERR_PARAMETER: hJob is invalid ERR_PENDING: Job cannot be removed because it is active Input hJob RTS_IEC_HANDLE Handle of job, returned by AsyncAdd
AsyncRemoveAll (FUN) ¶ FUNCTION AsyncRemoveAll : RTS_IEC_RESULT On shutdown or reset, or before download, call AsyncRemoveAll() to removed all registered asynchronous jobs. InOut: Scope Name Type Comment Return AsyncRemoveAll RTS_IEC_RESULT Always returns ERR_OK