Brief introduction
We have three ways to get file list from the camera. All APIs related to obtaining the file list are defined in the ICatchCameraPlayback class.
1. Get file list Method 1
Get a list of all files on the camera at once.
List<ICatchFile> listFiles(int fileType)throws IchSocketException, IchCameraModeException, IchNoSuchPathException, IchInvalidSessionException;List<ICatchFile> listFiles(int fileType, int timeoutInSecs)throws IchSocketException, IchCameraModeException, IchNoSuchPathException, IchInvalidSessionException;
It is not recommended to use this method to obtain files. On the one hand, it will takes a long time to obtain files. On the other hand, this method can return information of 800 to 900 files at most. When there are too many files, you may not get all of them.
2. Get file list Method 2
Get files in pages, get a certain number of files at a time.
int getFileCount()throws IchSocketException, IchCameraModeException, IchNoSuchPathException, IchInvalidSessionException;List<ICatchFile> listFiles(int fileType, int headIndex, int tailIndex, int timeoutInSecs)throws IchSocketException, IchCameraModeException, IchInvalidArgumentException, IchNoSuchPathException, IchInvalidSessionException;
As shown in the avove APIs, in general, you need to get the total number of files before using the Paging API, and then set the start index and the size of the list obtained by paging according to the total number of files, the number of items a page and which page to be displayed.
3. Get file list Method 3
App uses API to set the type and sorting of files to be retrieved from the camera before getting files by page.
boolean setFileListAttribute(int type, int order)throws IchSocketException, IchCameraModeException, IchInvalidSessionException;boolean setFileListAttribute(int type, int order, int takenBy)throws IchSocketException, IchCameraModeException, IchInvalidSessionException;int getFileCount()throws IchSocketException, IchCameraModeException, IchNoSuchPathException, IchInvalidSessionException;List<ICatchFile> listFiles(int fileType, int headIndex, int tailIndex, int timeoutInSecs)throws IchSocketException, IchCameraModeException, IchInvalidArgumentException, IchNoSuchPathException, IchInvalidSessionException;
By comparing with the second way, the third way only adds a API called setFileListAttribute, which will limit the file type and order type of the file lists obtained from the camera.
Recommended programming flow
Step 1: Get the camera’s support for paging.
—> Class:ICatchCameraProperty
Method: checkCameraCapabilities
boolean checkCameraCapabilities(int featureID)throws IchSocketException, IchCameraModeException, IchInvalidSessionException, IchDevicePropException;
Call this API with parameter ICH_CAM_NEW_PAGINATION_GET_FILE(featureID, defined in class ICatchCamFeatureID), If this call returns true, it supports below API:
boolean setFileListAttribute(int type, int order)throws IchSocketException, IchCameraModeException, IchInvalidSessionException;boolean setFileListAttribute(int type, int order, int takenBy)throws IchSocketException, IchCameraModeException, IchInvalidSessionException;
—> Class:ICatchCameraProperty
Method: getSupportedProperties
List<Integer> getSupportedProperties()throws IchSocketException, IchCameraModeException, IchInvalidSessionException, IchDevicePropException;
Call this api, you will a get a list of supported property codes(device property called DPC), If the return value list includes code 0xD83F, it supports below API:
int getFileCount()throws IchSocketException, IchCameraModeException, IchNoSuchPathException, IchInvalidSessionException;List<ICatchFile> listFiles(int fileType, int headIndex, int tailIndex, int timeoutInSecs)throws IchSocketException, IchCameraModeException, IchInvalidArgumentException, IchNoSuchPathException, IchInvalidSessionException;
Step2: According to the return value of the above APIs choose which way to get the file list
- If the camera supports both DPC 0xD83F and feature ICH_CAM_NEW_PAGINATION_GET_FILE, Use the Method 3**.**
- If the camera only supports DPC 0xD83F , Use the Method 2**.**
- If niether is supported, use the Method 1**.**
