Appendix A: GenICam Commands
•
69
CLHS File Transfer Protocol
If you are not using CamExpert to perform file transfers, pseudo-code for the CLHS File Transfer
Protocol is as follows.
Download File from Camera
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
a.
Read FileOperationStatus to confirm that the file opened correctly.
b.
A return value of 0 is success. Error codes are listed in the XML.
5.
Read FileSize to get the maximum number of bytes allowed in the file
a.
Abort and jump to Close if this is less the file size on the host
6.
From FileAccessBuffer.Length you will know that maximum number of bytes that can be
written through FileAccessBuffer is 988.
7.
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
8.
Next Offset = number of bytes written
9.
Set the FileOperationSelector to Close
10.
Close the file by setting FileOperationExecute to 1 and poll until 0 and complete
11.
Read FileOperationStatus to confirm the close worked