This chapter contains the descriptions of all supported features from the File Access Control category.
Name
|
FileAccessControl
|
Category
|
Root
|
Interface
|
Category
|
Access
|
Read
|
Unit
|
-
|
Visibility
|
Guru
|
Values
|
-
|
Standard
|
SFNC
|
Availability uEye+
|

|
Availability uEye
|

|
These features provide the necessary settings for file access in the camera.
Selecting a file
With FileSelector, you can select the file that you want to work with:
•"UserData1" and "UserData2" are custom files that can be written and read.
•"CriticalEventLog" is a read only file that the camera automatically generates when a critical error occurs.
FileSize returns the size of the selected file as bytes in the camera's memory.
Performing operations
You can perform different operations on the files, selected by FileOperationSelector:
•Open: Opens a file for reading (FileOpenMode = 'Read') or writing (FileOpenMode = 'Write').
•Close: Closes the file.
•Read: Reads the file to the FileAccessBuffer
•Write: Writes the FileAccessBuffer to the file.
•Delete: Deletes the file.
The operations are executed by FileOperationExecute.
# Select the file that you want to write to
FileSelector = UserData1;
# Open the file for writing
FileOperationSelector = Open;
FileOpenMode = Write;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
open_status = FileOpenStatus.CurrentEntry; # Should return 'WriteRead'
# Define the buffer length for writing the data
max_access_length = FileAccessLength.Maximum;
access_length = min(max_access_length, data_length);
FileAccessLength = access_length;
# Set FileAccessOffset to 0 to start at beginning of the file and write the data into FileAccessBuffer
FileAccessOffset = 0;
FileAccessBuffer.Write(data);
# Perform the write operation
FileOperationSelector = Write;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
bytes_read = FileOperationResult.Value; # Should return the number of successfully written bytes
# If the data in your file is longer than the access buffer, you have to perform the write operation multiple times.
# Close the file
FileOperationSelector = Close;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
open_status = FileOpenStatus.CurrentEntry; # Should return 'Close'
|
# Select the file that you want to read
FileSelector = UserData1;
# Open the file for reading
FileOperationSelector = Open;
FileOpenMode = Read;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
open_status = FileOpenStatus.CurrentEntry; # Should return 'OpenRead'
# Define the buffer length for reading the data
max_access_length = FileAccessLength.Maximum;
file_size = FileSize.Value;
access_length = min(max_access_length, file_size);
FileAccessLength = access_length;
# Perform the read operation
FileOperationSelector = Read;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
bytes_read = FileOperationResult.Value; # Should return the number of successfully read bytes
# The read data can be accessed now
data = FileAccessBuffer.Read(access_length);
# If the data in your file is longer than the access buffer, you have to perform the read operation multiple times.
# Close the file
FileOperationSelector = Close;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
open_status = FileOpenStatus.CurrentEntry; # Should return 'Close'
|
# Select the file that you want to delete (must be closed)
FileSelector = UserData1;
# Delete the file
FileOperationSelector = Delete;
FileOperationExecute();
# Check the success of the operation
operation_status = FileOperationStatus.CurrentEntry; # Should return 'Success'
|