اجرا کردن
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
API /osc/commands/execute
دستورات مشخص شده را روی دوربین اجرا می کند. خروجی یک شی فرمان است.
نام | تایپ کنید | توضیحات |
---|
name | رشته | دستوری که باید اجرا شود. |
parameters | شیء | پارامترهای ورودی فرمان را با توجه به مشخصات تعاریف فرمان. لطفاً برای مثال به مشخصات OSC API مراجعه کنید. |
خروجی
نام | تایپ کنید | توضیحات |
---|
name | رشته | دستوری که باید اجرا شود. |
state | رشته | وضعیت فرماندهی باید یکی از موارد زیر باشد:-
done - کامل، نتایج در این پاسخ برگردانده شده است. -
inProgress - اجرا هنوز در حال انجام است. -
error - ناموفق، خطا را در پاسخ ببینید.
|
id | رشته (اختیاری) | شناسه فرمان این مقدار برای دستورهایی که وضعیت را برمی گرداند لازم است در حال پیشرفت . برای مثال دستور camera.takePicture به دلیل نیاز به دوخت چند ثانیه طول می کشد. برای جزئیات بیشتر به بخش "وضعیت" مراجعه کنید. |
results | شی (اختیاری) | نتایج فرمان این مقدار برای دستورهایی که حالت را برمیگردانند لازم است در صورتی انجام می شود که انتظار می رود فرمان نتایج را برگرداند. برای مثال، "نتایج" : { "AAA": "BBB"، ... } لطفاً برای مثال به مشخصات OSC API مراجعه کنید. |
error | شی (اختیاری) | شرح خطای فرمان این مقدار برای دستورهایی که error; برای مثال،“error”: {
“code”: “missingParameter”
} |
progress | شی (اختیاری) | شرح پیشرفت فرمان این مقدار برای دستورهایی که حالت inProgress را برمیگردانند لازم است. برای مثال،“progress”: {
“completion”: 0.8
} |
خطا
کد خطا | توضیحات |
---|
unknownCommand | دستور درخواست شده ناشناخته است، به عنوان مثال اگر یک کلاینت v2 (clientVersion روی 2 تنظیم شده است، به گزینه ها مراجعه کنید) یک دستور منسوخ شده از سطح 1 API را درخواست کند، درخواست باید با این کد خطا شکست بخورد. |
disabledCommand | فرمان اجرا شده در حال حاضر غیرفعال است، به عنوان مثال دستور "takePicture" زمانی که دوربین در حالت ویدئو است غیرفعال است، دستور processPicture زمانی که دوربین از delayProcessing پشتیبانی نمی کند غیرفعال می شود. این کد خطا در سطح 2 API اضافه شده است. |
cameraInExclusiveUse | دوربین از قبل در حال استفاده انحصاری است، جلسه جدید را نمی توان شروع کرد. این کد خطا در سطح 2 API منسوخ شده است. |
missingParameter | یک یا چند پارامتر مورد نیاز مشخص نشده است. |
invalidParameterName | یک یا چند پارامتر ورودی یا نام گزینه شناسایی نشد یا پشتیبانی نشد. |
invalidParameterValue | نام پارامتر یا گزینه شناسایی شد، اما یک یا چند مقدار نامعتبر است. به عنوان مثال، مقدار خارج از محدوده است. |
مثال |
---|
درخواست (API 1) | POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.setOptions",
"parameters": {
"sessionId": "12ABC3",
"options": {
"iso": 200,
"exposureCompensation": -2
}
}
} |
درخواست (API 2) | POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.setOptions",
"parameters": {
"options": {
"iso": 200,
"exposureCompensation": -2
}
}
} |
پاسخ | HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: {CONTENT_LENGTH}
X-Content-Type-Options: nosniff
{
"name": "camera.setOptions",
"state": "done"
} |
درخواست (API 1) | POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.takePicture",
"parameters": {
"sessionId": "12ABC3"
}
} |
درخواست (API 2) | POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.takePicture"
} |
پاسخ | HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: {CONTENT_LENGTH}
X-Content-Type-Options: nosniff
{
"name": "camera.takePicture",
"state": "inProgress",
"id": "90ABCD",
"progress": {
"completion": 0
}
} |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-11-13 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2024-11-13 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe \u003ccode\u003e/osc/commands/execute\u003c/code\u003e API allows you to execute commands on the camera, such as adjusting settings or taking pictures.\u003c/p\u003e\n"],["\u003cp\u003eInput requires the command \u003ccode\u003ename\u003c/code\u003e and any necessary \u003ccode\u003eparameters\u003c/code\u003e defined in the OSC API Specification.\u003c/p\u003e\n"],["\u003cp\u003eOutput provides the command \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003estate\u003c/code\u003e, and may include an \u003ccode\u003eid\u003c/code\u003e, \u003ccode\u003eresults\u003c/code\u003e, \u003ccode\u003eerror\u003c/code\u003e, or \u003ccode\u003eprogress\u003c/code\u003e depending on the command and its execution status.\u003c/p\u003e\n"],["\u003cp\u003ePossible command states include \u003ccode\u003edone\u003c/code\u003e, \u003ccode\u003einProgress\u003c/code\u003e, and \u003ccode\u003eerror\u003c/code\u003e, with further details provided in the output fields.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the OSC API Specification for specific command definitions, parameters, and result formats.\u003c/p\u003e\n"]]],["The `/osc/commands/execute` API triggers commands on a camera, defined by a command `name` and associated `parameters`. The output indicates the command's `state` (`done`, `inProgress`, or `error`), an optional `id` for `inProgress` commands, `results` for completed commands, or `error` details. Possible errors include `unknownCommand`, `disabledCommand`, `missingParameter`, and `invalidParameterValue`. Example requests demonstrate how to set options and take a picture, with the responses showing command completion or ongoing progress.\n"],null,["# Execute\n\nThe `/osc/commands/execute` API executes specified commands on the camera. The output is a command object.\n\nInput\n-----\n\n| Name | Type | Description |\n|--------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | String | The command to be executed. |\n| `parameters` | Object | Command input parameters according to the command definitions specification. Please refer to [OSC API Specification](/streetview/open-spherical-camera/reference/camera) for examples. |\n\nOutput\n------\n\n| Name | Type | Description |\n|------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | String | The command to be executed. |\n| `state` | String | State of the command. Should be one of the following: - `done` - Complete, results have been returned in this response. - `inProgress` - Execution is still in progress. - `error` - Failed, see error in the response. |\n| `id` | String (optional) | Command ID. This value is required for commands returning the status`inProgress`. For example, the `camera.takePicture` command takes a few seconds due to the need for stitching. See the \"Status\" section for more details. |\n| `results` | Object (optional) | Command results. This value is required for commands returning state`done` if the command is expected to return results; for example, \"results\" : { \"AAA\": \"BBB\", ... } Please refer to [OSC API Specification](/streetview/open-spherical-camera/reference/camera) for examples. |\n| `error` | Object (optional) | Command error description. This value is required for commands returning state `error;` for example, ```text “error”: { “code”: “missingParameter” } ``` |\n| `progress` | Object (optional) | Command progress description. This value is required for commands returning state `inProgress`; for example, ```text “progress”: { “completion”: 0.8 } ``` |\n\nError\n-----\n\n| Error code | Description |\n|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `unknownCommand` | Requested command is unknown, e.g. if a v2 client (clientVersion is set to 2, see [Options](/streetview/open-spherical-camera/reference/options)) requests a deprecated command from API level 1, the request should fail with this error code. |\n| `disabledCommand` | Command executed is currently disabled, e.g. \\`takePicture\\` command is disabled when camera is video mode, processPicture command is disabled when the camera doesn't support delayProcessing. **This error code was added in API level 2.** |\n| `cameraInExclusiveUse` | Camera is already in exclusive use, new session can't be started. **This error code was deprecated in API level 2.** |\n| `missingParameter` | One or more required parameters were not specified. |\n| `invalidParameterName` | One or more input parameter or option name was unrecognized or unsupported. |\n| `invalidParameterValue` | The parameter or option names were recognized, but one or more values is invalid; for example, the value is out of range. |\n\n| Example ------- ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Request (API 1)** | ```http POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { \"name\": \"camera.setOptions\", \"parameters\": { \"sessionId\": \"12ABC3\", \"options\": { \"iso\": 200, \"exposureCompensation\": -2 } } } ``` |\n| **Request (API 2)** | ```http POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { \"name\": \"camera.setOptions\", \"parameters\": { \"options\": { \"iso\": 200, \"exposureCompensation\": -2 } } } ``` |\n| **Response** | ```http HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { \"name\": \"camera.setOptions\", \"state\": \"done\" } ``` |\n| **Request (API 1)** | ```http POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { \"name\": \"camera.takePicture\", \"parameters\": { \"sessionId\": \"12ABC3\" } } ``` |\n| **Request (API 2)** | ```http POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { \"name\": \"camera.takePicture\" } ``` |\n| **Response** | ```http HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { \"name\": \"camera.takePicture\", \"state\": \"inProgress\", \"id\": \"90ABCD\", \"progress\": { \"completion\": 0 } } ``` |"]]