OSC API 规范中的 API 级别 1 侧重于图像类型,API 级别 2 中增加了视频支持。我们鼓励相机制造商定义自定义命令,并且/或者在必要时扩展标准命令的参数集。 这些被称为供应商命令和供应商参数。
供应商特定的命令和参数的名称必须是字母数字,并且以下划线 ( _ ) 作为前缀。
供应商特定的功能可能出现在以下四个地点:
- 输出 /osc/info API
- 输出 of /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" } |