RdcyAcyclicDirMirrorAsync (FUN)¶
FUNCTION RdcyAcyclicDirMirrorAsync : RTS_IEC_RESULT
Mirror a directory specified by name asynchronously (non-blocking) in acyclic context. Replaces all different items on the other PLC, deletes any orphans on the target side, and copies any source side orphans to the target side. Orphan file: File, that does not exist on other side. Makes the target side exactly the same as the source side. It will overwrite different files regardless of whether they are newer, older, or have the same timestamps. Orphans on the source side are copied and orphans on the target side are deleted.
After a successful synchronization the receive event created when the corresponding UUID was registered, will be posted. The EVTPARAM_CmpRdcyAcyclicRecv of this event includes the directory name that was mirrored in the pBuffer element and the strlen of the directory name in the length member of the struct.
This function has non-blocking (asynchronous) behavior. A synchronization job will be queued and processed asynchronously. The acyclic directory synchronization module will call the cbfSyncAsyncDone callback function when the synchronization job has been processed. The result of the internal directory synchronization call will be passed to the jobResult parameter of that callback function.
Precondition: The acyclic data transfer module has to be in the RA_STATE_PROTOCOL_VER_SUCCEEDED RdcyAcyclicState. Hint: The current state of the acyclic data transfer module can be queried with the RdcyAcyclicGetCurState function.
Note: We do not need a user-data pointer. Any user-data can be passed as data members of the function block passed in the iMirrorAsyncDoneCallback parameter.
- InOut:
Scope
Name
Type
Comment
Return
RdcyAcyclicDirMirrorAsyncRTS_IEC_RESULTError code (see CmpErrors.library). ERR_PENDING if the asynchronous send job has been successfully added to the job queue, ERR_PARAMETER if pcszAcyclicDataUUID or pcszSrcDirName is NULL, ERR_NO_OBJECT if there is no usage with this data UUID registered, ERR_FAILED if adding a send job to the send queue of the AsyncMgr failed (see log for more information), ERR_NOTINITIALIZED if the acyclic data transfer module has not been correctly initialized during initialization of the CmpRedundancy component, ERR_NOBUFFER if the maximum number of concurrent send jobs is exhausted at the moment, or ERR_NO_ACCESS_RIGHTS if any of the two directories is not allowed to be accessed from IEC applications.
Input
pcszAcyclicDataUUIDREFERENCE TO STRING
IN: The same Data UUID, which was used for registration with the RdcyAcyclicRegisterUsage FUNCTION
pcszSrcDirNameREFERENCE TO STRING
IN: UTF-8 encoded source directory name including relative path, relative to the working directory of the PLC, with forward slashes (/) as path separators, with strlen() <= maxPayloadSize. This can be a full directory path or a path containing placeholders as defined in the ‘SysDir’ section.
pcszDestDirNameREFERENCE TO STRING
IN: UTF-8 encoded destination directory name on the other PLC including relative path, relative to the working directory of the other PLC, with forward slashes (/) as path separators, with strlen() <= maxPayloadSize. This can be a full directory path or a path containing placeholders as defined in the ‘SysDir’ section.
iMirrorAsyncDoneCallbackIRdcyAcyclicAsyncJobDoneCallbackINOUT: FB whichs AsyncJobDone method will be called when the asynchronous directory mirror job of this function has been processed