70
Camera Performance and Features
3.
Set the FileOperationSelector to Open
4.
Open the file by setting FileOperationExecute to 1. This is a read-write feature - poll it every
100 ms until it returns 0 to indicate it has completed
5.
Read FileOperationStatus to confirm that the file opened correctly
A return value of 0 is success. Error codes are listed in the XML.
6.
Read FileSize to get the number of bytes in the file
7.
From FileAccessBuffer.Length you will know that maximum number of bytes that can be
read through FileAccessBuffer is 988.
8.
For Offset = 0 While ((Offset < FileSize) and (Status = 0)) Do
a.
Set FileAccessOffset to Offset
b.
Set FileAccessLength to min(FileSize - Offset, FileAccessBuffer.Length), the number
of bytes to read
c.
Set the FileOperationSelector to Read
d.
Read the file by setting FileOperationExecute to 1 and poll until 0 and complete
e.
Read FileOperationStatus to confirm the read worked
f.
Read FileOperationResult to confirm the number of bytes read
g.
Read the bytes from FileAccessBuffer
h.
Write bytes read to host file.
9.
Next Offset = number of bytes read
10.
Set the FileOperationSelector to Close
11.
Close the file by setting FileOperationExecute to 1 and poll until 0 and complete
12.
Read FileOperationStatus to confirm the close worked
Download File
1.
Select the file by setting the FileSelector feature
2.
Set the FileOpenMode to Write
3.
Set the FileOperationSelector to Open
4.
Open the file by setting FileOperationExecute to 1. This is a read-write feature - poll it every
100 ms until it returns 0 to indicate it has completed
5.
Read FileOperationStatus to confirm that the file opened correctly. A return value of 0 is
success. Error codes are listed in the XML.
6.
Read FileSize to get the maximum number of bytes allowed in the file
7.
Abort and jump to Close if this is less the file size on the host
8.
From FileAccessBuffer.Length you will know that maximum number of bytes that can be
written through FileAccessBuffer is 988.
9.
For Offset = 0 While ((Offset < Host File Size) and (Status = 0)) Do
a.
Set FileAccessOffset to Offset
b.
Set FileAccessLength to min(Host File Size - Offset, FileAccessBuffer.Length), the
number of bytes to write
c.
Read next FileAccessLength bytes from host file.
d.
Write the bytes to FileAccessBuffer
e.
Set the FileOperationSelector to Write
f.
Write to the file by setting FileOperationExecute to 1 and poll until 0 and complete
g.
Read FileOperationStatus to confirm the write worked
h.
Read FileOperationResult to confirm the number of bytes written
10.
Next Offset = number of bytes written
11.
Set the FileOperationSelector to Close
12.
Close the file by setting FileOperationExecute to 1 and poll until 0 and complete
13.
Read FileOperationStatus to confirm the close worked