Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Interfejs /osc/state API zwraca atrybuty kamery o nazwie state. Różnica
między tym a interfejsem API info jest to, że state zawiera zmienne wartości
reprezentujące stan kamery (np. batteryLevel), a info
zawiera tylko statyczne atrybuty kamery (na przykład manufacturer lub
atrybutów, które rzadko się zmieniają, np. firmwareVersion).
Dane wejściowe
To polecenie nie wymaga wprowadzania danych.
Wyniki
Nazwa
Typ
Opis
fingerprint
Ciąg znaków
Odcisk cyfrowy (unikalny identyfikator) bieżącego stanu aparatu.
state
Obiekt
Obiekt JSON zawierający stan różnych stanów kamery. Zobacz następną tabelę.
state obiekt
Ten obiekt JSON udostępnia stan różnych stanów kamery. Producenci mogą
podaj nowe, niestandardowe stany, które powinny być poprzedzone znakiem podkreślenia ( _ )
, aby zapobiec konfliktom przestrzeni nazw.
Nazwa
Typ
Opis
sessionId
Ciąg znaków
Identyfikator bieżącej sesji. To pole zostało wycofane na poziomie interfejsu API 2.
batteryLevel
Liczba
Wyrażona jako zmiennoprzecinkowa pozostałego czasu pracy baterii, np. 0,5
storageChanged
Wartość logiczna
Prawda, jeśli został włożony lub wyjęty nowy typ pamięci (np. karta SD lub dysk USB).
To pole zostało wycofane na poziomie interfejsu API 2.
storageUri
Ciąg znaków
Unikalny identyfikator umożliwiający rozróżnienie różnych pamięci. Wskazuje, czy ilość miejsca na dane się zmieniła.
To pole zostało dodane na poziomie interfejsu API 2.
_vendorSpecific
[typ](opcjonalnie)
Dodatkowy stan kamery specyficzny dla dostawcy. Aby zapobiegać kolizji z przestrzeniami nazw, poprzedź prefiksem podkreślenia ( _ ).
Błąd
To polecenie nie zwraca żadnych błędów.
Przykład
Wyślij prośbę
POST /osc/state HTTP/1.1
Host: [camera ip address]:[httpPort]
Accept: application/json
X-XSRF-Protected: 1
[null,null,["Ostatnia aktualizacja: 2024-08-21 UTC."],[[["\u003cp\u003eThe \u003ccode\u003e/osc/state\u003c/code\u003e API provides mutable camera status values like battery level, unlike the \u003ccode\u003e/osc/info\u003c/code\u003e API which returns static camera attributes.\u003c/p\u003e\n"],["\u003cp\u003eCamera state is represented by a \u003ccode\u003efingerprint\u003c/code\u003e that uniquely identifies it and changes whenever a tracked state is modified.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003estate\u003c/code\u003e object contains various camera status details, including \u003ccode\u003ebatteryLevel\u003c/code\u003e, storage information, and vendor-specific data.\u003c/p\u003e\n"],["\u003cp\u003eManufacturers can introduce custom states within the \u003ccode\u003estate\u003c/code\u003e object using an underscore (_) prefix to avoid conflicts.\u003c/p\u003e\n"]]],["The `/osc/state` API retrieves mutable camera status attributes. It outputs a `fingerprint`, a unique identifier for the current camera state, and a `state` object. The `state` object includes `batteryLevel`, `storageUri` and optional vendor-specific states prefixed with an underscore. It also contained `sessionId` and `storageChanged` which have been deprecated. The API uses POST and the response has a `200 OK` HTTP status with a content-type of `application/json`. The fingerprint changes with any tracked state change.\n"],null,["# State\n\nThe `/osc/state` API returns `state` attributes of the camera. The difference\nbetween this and the `info` API is that `state` contains mutable values\nrepresenting camera status (`batteryLevel`, for example), while the `info`\ncontains only static attributes of the camera (for example, `manufacturer` or\nattributes that don't change often like `firmwareVersion)`.\n\nInput\n-----\n\n- This command takes no input.\n\nOutput\n------\n\n| **Name** | **Type** | **Description** |\n|---------------|----------|---------------------------------------------------------------------------------------|\n| `fingerprint` | String | Fingerprint (unique identifier) of the current camera state. |\n| `state` | Object | A JSON object containing the status of various the camera states. See the next table. |\n\n| **Note:** Manufacturers define the fingerprinting algorithm, which must change the fingerprint value when a tracked camera state changes. Possible implementations include:\n|\n| - Hash of the current state.\n| - Monotonically incremented number on every state change.\n| - Timestamp / timecounter of the last state change.\n\n### `state` object\n\nThis JSON object provides the status of various camera states. Manufacturers can\nprovide new, custom states, which should be prefixed with an underscore ( _ )\nto prevent namespace collisions.\n\n| **Name** | **Type** | **Description** |\n|-------------------|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sessionId` | String | ID of the current session. **This field was deprecated in API level 2.** |\n| `batteryLevel` | Number | Expressed as a floating point value of the battery remaining, e.g. 0.5 |\n| `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.** |\n| `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.** |\n| `_vendorSpecific` | \\[type\\](optional) | Vendor specific additional state about the camera. Prefix with an underscore ( _ ) to prevent namespace collisions. |\n\nError\n-----\n\n- This command returns no errors.\n\n| Example ------- ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Request** | ```http POST /osc/state HTTP/1.1 Host: [camera ip address]:[httpPort] Accept: application/json X-XSRF-Protected: 1 ``` |\n| **Response** | ```http 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 } } ``` |"]]