ERROR (ENUM) ¶ TYPE ERROR : This data type defines error values, which might occur when handling functions of the CAA_File.library . Attributes: qualified_only InOut: Name Initial Comment NO_ERROR 0 0 No error FIRST_ERROR 5100 5100 First library specific error TIME_OUT 5101 Time limit exceeded ABORT 5102 Order has been aborted by activating input xAbort HANDLE_INVALID 5103 Invalid handle NOT_EXIST 5104 File or directory does not exist EXIST 5105 File or directory already exist NO_MORE_ENTRIES 5106 No further entries are available NOT_EMPTY 5107 File or directory is not empty READ_ONLY_CAA 5108 File or directory is write protected WRONG_PARAMETER 5109 Wrong parameter ERROR_UNKNOWN 5110 Unknown error WRITE_INCOMPLETE 5111 Not all data have been written FILE_NOT_IMPLEMENTED 5112 Function is not implemented ASM_CREATEJOB_FAILED 5113 Job creation of AsyncManager failed FILE_OPERATION_DENIED 5114 No access due to ForceFilePath/ForceIecFilePath FIRST_MF 5150 5150 First manufacturer-specific error LAST_ERROR 5199 insert manuf. specific errors here 5199 Last library specific error
MODE (ENUM) ¶ TYPE MODE : This data type defines mode values for file access to use with the FILE.Open function block. Attributes: qualified_only InOut: Name Initial Comment MWRITE 0 Write access, file will be overwritten or created MREAD Read access, file will only be opened for reading MRDWR Read- and Write access, the file will be overwritten or created MAPPD File will be opened in WRITE mode, but the written data will be appended at the end of the file MREADPLUS Open an existing file with Read/Write access. If file does not exist, Open fails
Function Blocks ¶ Directory DirClose (FunctionBlock) DirCopy (FunctionBlock) DirCreate (FunctionBlock) DirList (FunctionBlock) DirOpen (FunctionBlock) DirRemove (FunctionBlock) DirRename (FunctionBlock) File Close (FunctionBlock) Copy (FunctionBlock) Delete (FunctionBlock) EOF (FunctionBlock) Flush (FunctionBlock) GetAttribute (FunctionBlock) GetPos (FunctionBlock) GetSize (FunctionBlock) GetTime (FunctionBlock) Open (FunctionBlock) Read (FunctionBlock) Rename (FunctionBlock) SetPos (FunctionBlock) Write (FunctionBlock)
Directory ¶ DirClose (FunctionBlock) DirCopy (FunctionBlock) DirCreate (FunctionBlock) DirList (FunctionBlock) DirOpen (FunctionBlock) DirRemove (FunctionBlock) DirRename (FunctionBlock)
DirClose (FB; Prefix fildcl) ¶ FUNCTION_BLOCK DirClose EXTENDS CBM.ETrig This function block closes the access on the specified directory. InOut: Scope Name Type Comment Input hDir CAA.HANDLE Directory handle Output eError ERROR Local library error ID (0: no error; 5101: time out)
DirCopy (FB; Prefix fildcp) ¶ FUNCTION_BLOCK DirCopy EXTENDS CBM.ETrig This function block copies the contents of the source directory to the destination directory Nonexisting destination path will be created. Depending of the parameters, all subdirectories and its content will be copied too, and existing files will be overwritten. NOTE: Empty direcories will be copied if xRecursive is TRUE. InOut: Scope Name Type Comment Input sDirNameDest CAA.FILENAME destination directory name sDirNameSource CAA.FILENAME source directory name xRecursive BOOL TRUE: all subdirectories and their contents are copied, FALSE: subdirectories are omitted xOverWrite BOOL TRUE: existing files are overwritten, FALSE: existing files are left untouched Output eError ERROR Local library error ID (0: no error; 5101: time out)
DirCreate (FB; Prefix fildcr) ¶ FUNCTION_BLOCK DirCreate EXTENDS CBM.ETrig This function block creates a sub-directory in the standard directory. If the sub-directory already exists, an error message is generated. There may be restrictions concerning the specification of the directory name, e.g. only capital letters allowed, for different targets. The function ”FILE. GetProperty ” shows these restrictions. InOut: Scope Name Type Comment Input sDirName CAA.FILENAME Name of the new directory, absolute or relative path specification xParent BOOL Create missing subdirectories; TRUE: missing sub-directories will be created automatically, FALSE: missing sub- directories will cause an error message Output eError ERROR Local library error ID (5104 - FILE_NOT_EXIST: Directory does not exist; 5105 - FILE_EXIST: Directory already exists )
DirList (FB; Prefix fildls) ¶ FUNCTION_BLOCK DirList EXTENDS CBM.ETrig This function reads directory entries. The function block needs a valid handle which identifies the directory as a transfer parameter. The information is written to structure ” deDirEntry ” of type ” FILE_DIR_ENTRY ”. If the function block cannot find any further entries the error message ” ERROR.NO_MORE_ENTRIES ” is generated and the entries in the structure ” deDirEntry ” are deleted. InOut: Scope Name Type Comment Input hDir CAA.HANDLE Directory handle Output eError ERROR Local library error ID (5106 - FILE_NO_MORE_ENTRIES: no further entries available) deDirEntry FILE_DIR_ENTRY Directory entry
DirOpen (FB; Prefix fildop) ¶ FUNCTION_BLOCK DirOpen EXTENDS CBM.ETrig This function block opens a directory. The entries (files and sub-directories) of which should be read with the help of the function block ”FILE. DirList ”. The return value is a handle. There may be restrictions concerning the specification of the directory name, e.g. only capital letters allowed, for different targets. The function ”FILE. GetProperty ” shows these restrictions. InOut: Scope Name Type Comment Input sDirName CAA.FILENAME Directory name, absolute or relative path specification Output eError ERROR Local library error ID (0: no error; 5101: time out) hDir CAA.HANDLE Directory handle
DirRemove (FB; Prefix fildrm) ¶ FUNCTION_BLOCK DirRemove EXTENDS CBM.ETrigToA This function block deletes a directory. Contrary to the original CAA specification the directory may be removed even if it is opened via ”FILE. DirOpen ”. This behavior is dependent of the underlying operating system and file system. InOut: Scope Name Type Comment Input sDirName CAA.FILENAME Directory name xRecursive BOOL TRUE: Remove all files and sub-directories, FALSE: Directory is only deleted, if empty, i.e. if no files and sub-directories are left; otherwise an error will be dumped Output eError ERROR Local library error ID (5107 - FILE_NOT_EMPTY: Directory not empty; will be generated only if xRecursive = FALSE)