تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تعرض واجهة برمجة التطبيقات /osc/state سمات state للكاميرا. الفرق
بين هذه الواجهة وواجهة برمجة التطبيقات info، وهي أنّ state يحتوي على قيم قابلة للتغيير.
تمثّل حالة الكاميرا (batteryLevel، على سبيل المثال)، في حين أنّ السمة info
يحتوي فقط على سمات ثابتة للكاميرا (على سبيل المثال، manufacturer أو
السمات التي لا تتغير كثيرًا مثل firmwareVersion).
الإدخال
لا يتطلب هذا الأمر إدخالاً.
الناتج
الاسم
النوع
الوصف
fingerprint
سلسلة
بصمة الإصبع (المعرّف الفريد) لحالة الكاميرا الحالية
state
الكائن
كائن JSON يحتوي على حالة حالات الكاميرا المختلفة اطّلِع على الجدول التالي.
عنصر واحد (state)
يعرض كائن JSON هذا حالة الحالات المختلفة للكاميرا. يمكن للشركات المصنّعة
توفير حالات مخصصة جديدة يجب أن تسبقها شرطة سفلية ( _ )
لمنع تضاربات مساحة الاسم.
الاسم
النوع
الوصف
sessionId
سلسلة
رقم تعريف الجلسة الحالية تم إيقاف هذا الحقل في المستوى 2 من واجهة برمجة التطبيقات.
batteryLevel
العدد
ويتم التعبير عنها كقيمة النقطة العائمة للبطارية المتبقية، مثال: 0.5
storageChanged
منطقي
True في حالة إدخال/إزالة نوع جديد من التخزين (مثل بطاقة SD أو محرك أقراص USB).
تم إيقاف هذا الحقل في المستوى 2 من واجهة برمجة التطبيقات.
storageUri
سلسلة
معرّف فريد للتمييز بين مساحات التخزين المختلفة ويتم استخدامه لمعرفة ما إذا كانت مساحة التخزين قد تغيّرت أم لا.
تمت إضافة هذا الحقل في المستوى 2 من واجهة برمجة التطبيقات.
_vendorSpecific
[النوع](اختياري)
الحالة الإضافية التي يحدّدها المورّد بشأن الكاميرا البادئة مع شرطة سفلية ( _ ) لمنع تعارضات مساحة الاسم.
خطأ
لا يؤدي هذا الأمر إلى عرض أي أخطاء.
مثال
طلب
POST /osc/state HTTP/1.1
Host: [camera ip address]:[httpPort]
Accept: application/json
X-XSRF-Protected: 1
تاريخ التعديل الأخير: 2024-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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 } } ``` |"]]