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
GVL_2 (GVL) ¶ Version define for CmpAsyncMgr InOut: Scope Name Type Initial Constant CMPASYNCMGR_VERSION_3_5_6_0 BOOL TRUE
GVL (GVL) ¶ Global defines for CmpAsyncMgr InOut: Scope Name Type Initial Comment Constant ASYNCJOB_TASK UDINT 0 Parameter ulType of AsyncAdd ASYNCJOB_EVENT UDINT 1 Parameter ulType of AsyncAdd ASYNCJOB_HOOK UDINT 2 Parameter ulType of AsyncAdd ASYNCSTATE_INVALID UDINT 16#FFFFFFFF State of an async job ASYNCSTATE_PENDING UDINT 0 State of an async job ASYNCSTATE_ACTIVE UDINT 1 State of an async job ASYNCSTATE_READY UDINT 2 State of an async job ASYNCSTATE_ERROR UDINT 3 State of an async job ASYNCSTATE_TIMEOUT UDINT 4 State of an async job ASYNC_TIMEOUT_INFINITE UDINT 0 Parameter ulTimeout of AsyncAdd ASYNC_IS_IEC UDINT 1 Parameter ulIecFunc of AsyncAdd ASYNC_ISNOT_IEC UDINT 0 Parameter ulIecFunc of AsyncAdd CH_COMM_CYCLE UDINT 20 Hooks