AI-generated Key Takeaways
-
The
/osc/state
API provides mutable camera status values like battery level, unlike the/osc/info
API which returns static camera attributes. -
Camera state is represented by a
fingerprint
that uniquely identifies it and changes whenever a tracked state is modified. -
The
state
object contains various camera status details, includingbatteryLevel
, storage information, and vendor-specific data. -
Manufacturers can introduce custom states within the
state
object using an underscore (_) prefix to avoid conflicts.
The /osc/state
API returns state
attributes of the camera. The difference
between this and the info
API is that state
contains mutable values
representing camera status (batteryLevel
, for example), while the info
contains only static attributes of the camera (for example, manufacturer
or
attributes that don’t change often like firmwareVersion)
.
Input
- This command takes no input.
Output
Name | Type | Description |
---|---|---|
fingerprint |
String | Fingerprint (unique identifier) of the current camera state. |
state |
Object | A JSON object containing the status of various the camera states. See the next table. |
state
object
This JSON object provides the status of various camera states. Manufacturers can provide new, custom states, which should be prefixed with an underscore ( _ ) to prevent namespace collisions.
Name | Type | Description |
---|---|---|
sessionId |
String | ID of the current session. This field was deprecated in API level 2. |
batteryLevel |
Number | Expressed as a floating point value of the battery remaining, e.g. 0.5 |
storageChanged |
Boolean | True if a new type of storage (e.g. a SD card or a USB drive) is inserted/removed. This field was deprecated in API level 2. |
storageUri |
String | A unique identifier to distinguish different storages. It is used to tell if the storage has changed or not. This field was added in API level 2. |
_vendorSpecific |
[type](optional) | Vendor specific additional state about the camera. Prefix with an underscore ( _ ) to prevent namespace collisions. |
Error
- This command returns no errors.
Example |
|
---|---|
Request | POST /osc/state HTTP/1.1 Host: [camera ip address]:[httpPort] Accept: application/json X-XSRF-Protected: 1 |
Response | HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { "fingerprint": "12EGA33", "state": { "sessionId": "12ABC3", "batteryLevel": 0.5, "storageChanged": false } } |