Skip to content

Device API ​

Device APIs require a session and matching capability on the current connection. device.list and device.get are filtered by auth_context.device_scope.

DeviceDescriptor ​

FieldTypeNotes
device_idstringDevice ID.
modelstringDevice model.
display_namestringDisplay name.
vidnumberUSB vendor ID.
pidnumberUSB product ID.
statusstringDevice status.
authorizedbooleanWhether the device is in current auth scope.
supports_videobooleanWhether video preview is supported.
features.image_transfer_protocolbooleanWhether image transfer protocol is supported.
resolutions[]arrayResolution list.
device_snstringOptional response field added in 0.0.9. Returned only when device.open reads a valid unique device SN; not returned by device.list or device.get.

Resolution ​

FieldTypeNotes
widthnumberPreview width.
heightnumberPreview height.
real_widthnumberActual device output width.
real_heightnumberActual device output height.
fpsnumberFrame rate.
pixel_formatstringVideo frame format. Supports mjpeg, jpeg, and bgr24; jpeg is handled as mjpeg.
is_defaultbooleanWhether this is the default resolution.

CaptureOutputCapabilities ​

device.open responses may additionally include capture_output, which describes the capture output size buckets supported by the opened device. Clients should use device.open.data.capture_output.target_sizes as the source of valid profile.output.target_size values.

FieldTypeNotes
target_size_supportedbooleanWhether the current device supports target output size buckets.
target_sizes[]arrayAvailable target output size buckets.

OutputTargetSizeOption ​

FieldTypeNotes
target_sizenumberTarget size bucket value to pass as profile.output.target_size.
widthnumberTarget width for this bucket.
heightnumberTarget height for this bucket.
is_device_defaultbooleanOptional. Whether this is the device default bucket.

Methods ​

MethodParametersResponse dataNotes
device.listnonedevices: DeviceDescriptor[], count: numberLists devices visible to current session.
device.getdevice_id: string requiredDeviceDescriptor + provider: stringGets one device.
device.opendevice_id: string required, width?: number, height?: number, fps?: number, pixel_format?: string=mjpeg; supports mjpeg, jpeg, and bgr24DeviceDescriptor + opened: boolean, provider, optional device_sn: string and capture_outputOpens a device.
device.closedevice_id: string requireddevice_id, closed, was_opened, stopped_stream, stream_id, providerCloses a device and stops the active stream for that device on the current connection.

device.list and device.get do not guarantee capture_output. If you need to set the capture output size, call device.open first and choose a supported target_size from the opened-device response.

Unique device SN in device.open (0.0.9+) ​

  • Request parameters are unchanged; clients do not pass an SN. After a successful open, a valid unique SN read through a device command is returned as data.device_sn, not nested under data.device.
  • device_sn is neither the UVC enumeration/connection serial nor device_id. The runtime does not use these identifiers or cached values as a fallback. Continue to use device_id for subsequent device operations.
  • If reading is unsupported, fails, or returns invalid data, device_sn is omitted, not returned as an empty string or null. This does not change the original open result. Clients must allow the field to be absent.
  • This field extends the open response; it is not a common field present in every DeviceDescriptor. device.list and device.get do not return it.

Device Events ​

When a device is removed, Command WS pushes device.removed to related connections. The event is sent to connections that opened the device or still own a video stream for it; the runtime also clears the related device and video state.

EventPayloadNotes
device.removeddevice_id, reason, was_opened, was_streaming, ts_msThe device was removed.

After receiving this event, clients should stop the preview UI, clear the current device selection, and call device.list again to refresh available devices.

json
{
  "event": "device.removed",
  "code": 0,
  "message": "ok",
  "payload": {
    "device_id": "mock-device-01",
    "reason": "hotplug_removed",
    "was_opened": true,
    "was_streaming": true,
    "ts_ms": 1710000000000
  },
  "ts": 1710000000
}

Example ​

json
{
  "request_id": "req-device-open-001",
  "method": "device.open",
  "params": {
    "device_id": "mock-device-01",
    "width": 1280,
    "height": 720,
    "fps": 15,
    "pixel_format": "mjpeg"
  }
}

Successful response when a valid SN is read (illustrative SN only):

json
{
  "request_id": "req-device-open-001",
  "code": 0,
  "message": "ok",
  "data": {
    "device_id": "mock-device-01",
    "model": "CZUR Mock",
    "display_name": "CZUR Mock Device",
    "vid": 7759,
    "pid": 10243,
    "status": "online",
    "authorized": true,
    "supports_video": true,
    "features": {
      "image_transfer_protocol": false
    },
    "resolutions": [],
    "opened": true,
    "device_sn": "AM3300123456789A",
    "provider": "czur-device-provider",
    "capture_output": {
      "target_size_supported": true,
      "target_sizes": [
        {
          "target_size": 500,
          "width": 2592,
          "height": 1944
        },
        {
          "target_size": 1600,
          "width": 4608,
          "height": 3456,
          "is_device_default": true
        }
      ]
    }
  },
  "ts": 1710000000
}

CZUR Open Platform Documentation