camera.listFiles
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
列出相机中的所有图片/所有视频/所有图片和视频。这可能需要
多个请求来列出所有文件。此命令是在 API 级别 2 中添加的。
如果摄像头不支持所请求的参数,则必须返回
硬件可用的最大功能。例如,在极少数情况下
请求:{entryCount: 500, maxSize: 2000}
。系统不会抛出错误
应基于相机支持的最大功能,
例如 {entryCount: 100, maxSize: 200}
。请为所有其他
案件;例如,当请求为 {entryCount: 500, maxSize: -500}
时,
应抛出错误 invalidParameterValue
,因为 maxSize
为负数。
参数
- fileType:要列出的文件的类型,应为以下任何一项
三个字段:“图片”“视频”“全部”
- startPosition::(可选)要添加到的第一个文件的位置
返回的值。如果省略,则起始位置为 0,
第一个文件。如果它大于最后一个文件的位置,则返回
结果中包含空白条目的正常响应,而不是错误响应。
- entryCount::要返回的条目数。如果
超过剩余文件数,则仅返回包含
实际剩余的文件,而不是错误响应。
- maxThumbSize::缩略图的大小上限;
max(thumbnail_width, thumbnail_height)。如果客户端
null
希望从结果中省略缩略图。
结果
- entries:图片属性的列表。每个条目应包含以下字段
但纬度和经度是可选项:
<ph type="x-smartling-placeholder">
</ph>
- name:文件的名称。
- fileUrl::文件的绝对网址,可用于直接从相机下载。
- size:文件的大小(以字节为单位)。
- dateTimeZone:文件的日期、时间和时区,格式为:
YYYY:MM:DD HH:MM:SS+(-)HH:MM
。时间采用 24 小时制。日期和
由一个空白字符分隔。时区与世界协调时间 (UTC) 相差。请注意
表示视频捕获的结束。
- lat:(可选)文件捕获时位置的纬度。
- lng:(可选)拍摄文件时位置的经度。
- width:图片或每个视频帧的宽度。
- height:图片或每个视频帧的高度。
- thumbnail:文件缩略图的 Base64 编码字符串(如果为
maxThumbSize != null
)。
- isProcessed:一个布尔值,指示文件是否
处理(例如拼接)或只是预览。通过
默认,除非
delayProcessing
设置为 true。如果存在经过处理的图片
不应列出相应的预览图片(即使存在),
否则,请列出预览图片。
- previewUrl::如果
delayProcessing
,则默认为空字符串
不受支持,或者当 isProcessed
等于 false 或预览图片时
从未作为中间结果生成,否则,该网址
与最终图片对应的预览图片。这用于构建
预览图片与最终图片之间的对应关系。
- totalEntries:中“
fileType
”的条目总数
存储空间,如如果 fileType 是“image”,那么它是
storage。
错误
- missing 参数:未指定任何必需参数;
例如,未指定
entryCount
。
- invalidParameterName:输入参数名称为
无法识别。
- invalidParameterValue::识别输入参数名称,
但其值无效;例如,
entryCount
为负数
或其数据类型不正确。
命令 I/O |
命令输入 |
{
"parameters": {
"entryCount": 50,
"maxThumbSize": 100
}
} |
命令输出 |
{
"results": {
"entries": [
{
"name": "abc",
"fileUrl": "file URL",
"size": file size, # of bytes,
"dateTimeZone": "2014:12:27 08:00:00+08:00",
"lat": 50.5324,
"lng": -120.2332,
"width": 2000,
"height": 1000,
"thumbnail": "ENCODEDSTRING",
"isProcessed": true,
"previewUrl": ""
}
...
{
...
}
],
"totalEntries": 250
}
} |
命令输出(错误) |
{
"error": {
"code": "invalidParameterValue",
"message": "Parameter entryCount is negative."
}
} |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["\u003cp\u003eLists all images, videos, or both from the camera's storage, sorted by capture time in descending order.\u003c/p\u003e\n"],["\u003cp\u003eAllows retrieval of a specific number of files, starting from a designated position, with optional thumbnail generation.\u003c/p\u003e\n"],["\u003cp\u003eReturns file details like name, URL, size, capture timestamp, dimensions, and processing status.\u003c/p\u003e\n"],["\u003cp\u003eIncludes error handling for missing or invalid parameters, prioritizing maximum camera capabilities over throwing errors when possible.\u003c/p\u003e\n"],["\u003cp\u003eRequires API level 2 or higher for compatibility.\u003c/p\u003e\n"]]],["This command retrieves a list of files (images, videos, or both) from a camera's storage, sorted by capture time (newest first). Key actions involve specifying `fileType`, optional `startPosition`, desired `entryCount`, and `maxThumbSize`. The camera returns a list of `entries`, each with file details like name, URL, size, and capture time. Errors occur for invalid parameters, with the camera returning maximum supported capabilities for specific cases. Total entries are also provided.\n"],null,["# camera.listFiles\n\nLists all images/all videos/all images and videos in the camera. It might take\nseveral requests to list all files. **This command was added in API level 2.**\n| **Note:** File list *MUST* be sorted by capture time, newest first.\n\n\u003cbr /\u003e\n\nIf a camera doesn't support the requested parameters, the camera must return the\nmaximum capability available for the hardware. For example, a rare case might be\nthe request: `{entryCount: 500, maxSize: 2000}`. Instead of throwing an error,\nthe response should be based on the maximum capability supported by the camera,\nsuch as: `{entryCount: 100, maxSize: 200}`. Please throw errors for all other\ncases; for example, when the request is, `{entryCount: 500, maxSize: -500}`, it\nshould throw the error `invalidParameterValue` since `maxSize` is negative.\n\nParameters\n----------\n\n- **fileType:** Type of the files to be listed, should be any of the three: \"image\", \"video\", \"all\".\n- **startPosition:** (Optional) The position of the first file to be returned in the list. If omitted, start position is 0, which represents the first file. If it is larger than the position of the last file, return a normal response with empty entries in results instead of an error response.\n- **entryCount:** Desired number of entries to return. If it is more than the number of remaining files, just return a normal response with the actual files remaining instead of an error response.\n- **maxThumbSize:** Maximum size of thumbnail images; max(thumbnail_width, thumbnail_height). It is set to `null` when the client wants to omit thumbnail images from the result.\n\nResults\n-------\n\n- **entries:** A list of image properties. Each entry should contain the following fields except for latitude and longitude, which are optional:\n - **name:** Name of the file.\n - **fileUrl:** Absolute URL of the file, which can be used to download from the camera directly.\n - **size:** Size in bytes of the file.\n - **dateTimeZone:** Date, time, and time zone for the file, in the format: `YYYY:MM:DD HH:MM:SS+(-)HH:MM`. Use 24-hour format for the time. Date and time are separated by one blank character. Time zone is offset from UTC time. **Please note this\n represents the ending of the capture for videos.**\n - **lat:** (Optional) Latitude of the location at the time of file capture.\n - **lng:** (Optional) Longitude of the location at the time of file capture.\n - **width:** Width of the image or each video frame.\n - **height:** Height of the image or each video frame.\n - **thumbnail:** Base64 encoded string for thumbnail image of the file (when `maxThumbSize != null`).\n - **isProcessed:** A boolean value indicating if the file is processed (e.g. stitched) or it is only a preview. This should be true by default unless `delayProcessing` is set to true. If a processed image exists, the corresponding preview image shouldn't be listed even if it exists, otherwise, list the preview image.\n - **previewUrl:** Default to empty string if `delayProcessing` is not supported or when `isProcessed` equals false or when preview image was never generated as an intermediate result, otherwise, it is the URL of the preview image corresponding to the final image. This is used to build the correspondence between the preview image and the final image.\n- **totalEntries:** Total number of entries of `fileType` in storage, e.g. if fileType is \"image\", it is the total number of images in storage.\n\nErrors\n------\n\n- **missingParameter:** Any required parameter is not specified; for example, `entryCount` is not specified.\n- **invalidParameterName:** The input parameter name is unrecognized.\n- **invalidParameterValue:** The input parameter name is recognized, but its value is invalid; for example, the `entryCount` is negative or its data type is incorrect.\n\n| Command I/O ----------- ||\n|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Command Input** | ```text { \"parameters\": { \"entryCount\": 50, \"maxThumbSize\": 100 } } ``` |\n| **Command Output** | ```text { \"results\": { \"entries\": [ { \"name\": \"abc\", \"fileUrl\": \"file URL\", \"size\": file size, # of bytes, \"dateTimeZone\": \"2014:12:27 08:00:00+08:00\", \"lat\": 50.5324, \"lng\": -120.2332, \"width\": 2000, \"height\": 1000, \"thumbnail\": \"ENCODEDSTRING\", \"isProcessed\": true, \"previewUrl\": \"\" } ... { ... } ], \"totalEntries\": 250 } } ``` |\n| **Command Output (Error)** | ```text { \"error\": { \"code\": \"invalidParameterValue\", \"message\": \"Parameter entryCount is negative.\" } } ``` |"]]