API ระดับ 1 ของข้อกำหนดของ OSC API จะมุ่งเน้นที่ประเภทรูปภาพ และมีการเพิ่มการรองรับวิดีโอลงใน API ระดับ 2 เราขอแนะนำให้ผู้ผลิตกล้องระบุคำสั่งที่กำหนดเองและ/หรือขยายชุดพารามิเตอร์ของคำสั่งมาตรฐาน หากจำเป็น ซึ่งเรียกว่าคำสั่งผู้ให้บริการและพารามิเตอร์ผู้ให้บริการ
ชื่อของคำสั่งและพารามิเตอร์เฉพาะผู้ให้บริการต้องเป็นตัวอักษรและตัวเลขคละกันและนำหน้าด้วยเครื่องหมายขีดล่าง ( _ )
ฟังก์ชันการทำงานเฉพาะผู้ให้บริการอาจเกิดขึ้นได้จาก 4 ที่ดังต่อไปนี้
- เอาต์พุตของ /osc/info API
- เอาต์พุตของ /osc/state API
- ข้อกำหนดของ OSC API, คำสั่งสำหรับ /osc/commands/execute
- ข้อกำหนดของ OSC API พารามิเตอร์คำสั่ง เช่น พารามิเตอร์สำหรับคำสั่ง
setOptions
และgetOptions
ตัวอย่าง | |
---|---|
คำขอ (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", "iso": 200, "exposureCompensation": -2, "captureMode": "_video" } } |
คำตอบ | 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" } |
คำขอ | 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._startRecording", "parameters": { "sessionId": "12ABC3", ... } } |
คำตอบ | HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { "name": "camera._startRecording", "state": "done" } |