ดำเนินการ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
/osc/commands/execute
API จะเรียกใช้คำสั่งที่ระบุในกล้อง เอาต์พุตเป็นออบเจ็กต์คำสั่ง
ชื่อ |
ประเภท |
คำอธิบาย |
name |
สตริง |
คำสั่งที่จะดำเนินการ |
parameters |
ออบเจ็กต์ |
พารามิเตอร์อินพุตของคำสั่งตามข้อกำหนดการกำหนดคำสั่ง โปรดดูข้อกำหนดของ OSC API เพื่อดูตัวอย่าง |
เอาต์พุต
ชื่อ |
ประเภท |
คำอธิบาย |
name |
สตริง |
คำสั่งที่จะดำเนินการ |
state |
สตริง |
สถานะของคำสั่ง ควรเป็นข้อใดข้อหนึ่งต่อไปนี้
done - เสร็จสมบูรณ์ ระบบแสดงผลลัพธ์ในคำตอบนี้
inProgress - กำลังดำเนินการ
error - ไม่สำเร็จ โปรดดูข้อผิดพลาดในการตอบกลับ
|
id |
สตริง (ไม่บังคับ) |
รหัสคำสั่ง ค่านี้จำเป็นสำหรับคำสั่งที่ส่งคืนสถานะ
inProgress ตัวอย่างเช่น คำสั่ง camera.takePicture จะใช้เวลา 2-3 วินาทีเนื่องจากจำเป็นต้องต่อภาพ ดูรายละเอียดเพิ่มเติมได้ที่ส่วน "สถานะ" |
results |
ออบเจ็กต์ (ไม่บังคับ) |
ผลลัพธ์ของคำสั่ง ค่านี้จำเป็นสำหรับคำสั่งที่แสดงสถานะ
done หากคาดว่าคำสั่งจะแสดงผลลัพธ์ ตัวอย่างเช่น
“results” : {
"AAA": "BBB"
...
}
โปรดดูข้อกำหนดของ OSC API เพื่อดูตัวอย่าง |
error |
ออบเจ็กต์ (ไม่บังคับ) |
คำอธิบายข้อผิดพลาดของคำสั่ง ต้องระบุค่านี้สำหรับคำสั่งที่แสดงสถานะ error; เช่น
วันที่“error”: {
“code”: “missingParameter”
} |
progress |
ออบเจ็กต์ (ไม่บังคับ) |
คำอธิบายความคืบหน้าของคำสั่ง ต้องใช้ค่านี้สำหรับคำสั่งที่แสดงสถานะ inProgress ตัวอย่างเช่น
วันที่“progress”: {
“completion”: 0.8
} |
ข้อผิดพลาด
รหัสข้อผิดพลาด |
คำอธิบาย |
unknownCommand |
ไม่ทราบคําสั่งที่ขอ เช่น หากไคลเอ็นต์ v2 (clientVersion เป็น 2 โปรดดูตัวเลือก) ขอคำสั่งที่เลิกใช้งานแล้วจาก API ระดับ 1 คำขอควรจะล้มเหลวโดยมีรหัสข้อผิดพลาดนี้ |
disabledCommand |
มีการปิดใช้คําสั่งที่ดําเนินการอยู่ เช่น คำสั่ง "takePicture" ถูกปิดใช้เมื่อ
กล้องอยู่ในโหมดวิดีโอ คำสั่ง processPicture จะถูกปิดใช้งานเมื่อกล้องไม่รองรับ DelayProcessing เพิ่มรหัสข้อผิดพลาดนี้ใน API ระดับ 2 |
cameraInExclusiveUse |
กล้องมีการใช้งานพิเศษอยู่แล้ว จึงไม่สามารถเริ่มเซสชันใหม่ได้ เราเลิกใช้งานรหัสข้อผิดพลาดนี้ใน API ระดับ 2 แล้ว |
missingParameter |
ไม่ได้ระบุพารามิเตอร์ที่จำเป็นอย่างน้อย 1 รายการ |
invalidParameterName |
ไม่รู้จักหรือไม่รองรับพารามิเตอร์อินพุตหรือชื่อตัวเลือกอย่างน้อย 1 รายการ |
invalidParameterValue |
ระบบรู้จักพารามิเตอร์หรือชื่อตัวเลือก แต่มีค่าอย่างน้อย 1 ค่าที่ไม่ถูกต้อง ตัวอย่างเช่น ค่าอยู่นอกช่วง |
ตัวอย่าง |
คำขอ (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
}
} |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-08-21 UTC
[null,null,["อัปเดตล่าสุด 2024-08-21 UTC"],[[["\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 } } ``` |"]]