Class Device

Inheritance Relationships

Base Type

Class Documentation

class Device : public dai::DeviceBase

Represents the DepthAI device with the methods to interact with it. Implements the host-side queues to connect with XLinkIn and XLinkOut nodes

Public Functions

explicit Device(const Pipeline &pipeline)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:

pipelinePipeline to be executed on the device

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
Device(const Pipeline &pipeline, T usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • usb2Mode – (bool) Boot device using USB2 mode firmware

Device(const Pipeline &pipeline, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • maxUsbSpeed – Maximum allowed USB speed

Device(const Pipeline &pipeline, const dai::Path &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • pathToCmdPath to custom device firmware

Device(const Pipeline &pipeline, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
Device(const Pipeline &pipeline, const DeviceInfo &devInfo, T usb2Mode)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • usb2Mode – (bool) Boot device using USB2 mode firmware

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • maxUsbSpeed – Maximum allowed USB speed

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, const dai::Path &pathToCmd)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • pathToCmdPath to custom device firmware

Device()

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

~Device() override

dtor to close the device

std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string &name)

Gets an output queue corresponding to stream name. If it doesn’t exist it throws

Parameters:

name – Queue/stream name, created by XLinkOut node

Returns:

Smart pointer to DataOutputQueue

std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string &name, unsigned int maxSize, bool blocking = true)

Gets a queue corresponding to stream name, if it exists, otherwise it throws. Also sets queue options

Parameters:
  • name – Queue/stream name, set in XLinkOut node

  • maxSize – Maximum number of messages in queue

  • blocking – Queue behavior once full. True specifies blocking and false overwriting of oldest messages. Default: true

Returns:

Smart pointer to DataOutputQueue

std::vector<std::string> getOutputQueueNames() const

Get all available output queue names

Returns:

Vector of output queue names

std::shared_ptr<DataInputQueue> getInputQueue(const std::string &name)

Gets an input queue corresponding to stream name. If it doesn’t exist it throws

Parameters:

name – Queue/stream name, set in XLinkIn node

Returns:

Smart pointer to DataInputQueue

std::shared_ptr<DataInputQueue> getInputQueue(const std::string &name, unsigned int maxSize, bool blocking = true)

Gets an input queue corresponding to stream name. If it doesn’t exist it throws. Also sets queue options

Parameters:
  • name – Queue/stream name, set in XLinkIn node

  • maxSize – Maximum number of messages in queue

  • blocking – Queue behavior once full. True: blocking, false: overwriting of oldest messages. Default: true

Returns:

Smart pointer to DataInputQueue

std::vector<std::string> getInputQueueNames() const

Get all available input queue names

Returns:

Vector of input queue names

std::vector<std::string> getQueueEvents(const std::vector<std::string> &queueNames, std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any of specified queues has received a message

Parameters:
  • queueNames – Names of queues for which to block

  • maxNumEvents – Maximum number of events to remove from queue - Default is unlimited

  • timeout – Timeout after which return regardless. If negative then wait is indefinite - Default is -1

Returns:

Names of queues which received messages first

std::vector<std::string> getQueueEvents(const std::initializer_list<std::string> &queueNames, std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))
std::vector<std::string> getQueueEvents(std::string queueName, std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until specified queue has received a message

Parameters:
  • queueName – Name of queues for which to wait for

  • maxNumEvents – Maximum number of events to remove from queue. Default is unlimited

  • timeout – Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Returns:

Names of queues which received messages first

std::vector<std::string> getQueueEvents(std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any queue has received a message

Parameters:
  • maxNumEvents – Maximum number of events to remove from queue. Default is unlimited

  • timeout – Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Returns:

Names of queues which received messages first

std::string getQueueEvent(const std::vector<std::string> &queueNames, std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any of specified queues has received a message

Parameters:
  • queueNames – Names of queues for which to wait for

  • timeout – Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Returns:

Queue name which received a message first

std::string getQueueEvent(const std::initializer_list<std::string> &queueNames, std::chrono::microseconds timeout = std::chrono::microseconds(-1))
std::string getQueueEvent(std::string queueName, std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until specified queue has received a message

Parameters:
  • queueNames – Name of queues for which to wait for

  • timeout – Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Returns:

Queue name which received a message

std::string getQueueEvent(std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any queue has received a message

Parameters:

timeout – Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Returns:

Queue name which received a message

explicit DeviceBase(const Pipeline &pipeline)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:

pipelinePipeline to be executed on the device

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(const Pipeline &pipeline, T usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(const Pipeline &pipeline, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(const Pipeline &pipeline, const dai::Path &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • pipelinePipeline to be executed on the device

  • pathToCmdPath to custom device firmware

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, T usb2Mode)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, const dai::Path &pathToCmd)

Connects to device specified by devInfo.

Parameters:
  • pipelinePipeline to be executed on the device

  • devInfoDeviceInfo which specifies which device to connect to

  • pathToCmdPath to custom device firmware

DeviceBase()

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

explicit DeviceBase(OpenVINO::Version version)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:

versionOpenVINO version which the device will be booted with.

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(OpenVINO::Version version, T usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(OpenVINO::Version version, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(OpenVINO::Version version, const dai::Path &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • pathToCmdPath to custom device firmware

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, T usb2Mode)

Connects to device specified by devInfo.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, const dai::Path &pathToCmd)

Connects to device specified by devInfo.

Parameters:
  • versionOpenVINO version which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • pathToCmdPath to custom device firmware

explicit DeviceBase(Config config)

Connects to any available device with custom config.

Parameters:

configDevice custom configuration to boot with

DeviceBase(Config config, const DeviceInfo &devInfo)

Connects to device ‘devInfo’ with custom config.

Parameters:
  • configDevice custom configuration to boot with

  • devInfoDeviceInfo which specifies which device to connect to

explicit DeviceBase(const DeviceInfo &devInfo)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

Parameters:

devInfoDeviceInfo which specifies which device to connect to

DeviceBase(const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

Parameters:
  • devInfoDeviceInfo which specifies which device to connect to

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(std::string nameOrDeviceId)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

Parameters:

nameOrDeviceId – Creates DeviceInfo with nameOrDeviceId to connect to

DeviceBase(std::string nameOrDeviceId, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version OpenVINO::VERSION_UNIVERSAL

Parameters:
  • nameOrDeviceId – Creates DeviceInfo with nameOrDeviceId to connect to

  • maxUsbSpeed – Maximum allowed USB speed

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(Config config, T usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • config – Config with which the device will be booted with

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(Config config, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • config – Config with which the device will be booted with

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(Config config, const dai::Path &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters:
  • config – Config with which the device will be booted with

  • pathToCmdPath to custom device firmware

template<typename T, std::enable_if_t<std::is_same<T, bool>::value, bool> = true>
inline DeviceBase(Config config, const DeviceInfo &devInfo, T usb2Mode)

Connects to device specified by devInfo.

Parameters:
  • config – Config with which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • usb2Mode – Boot device using USB2 mode firmware

DeviceBase(Config config, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters:
  • config – Config with which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • maxUsbSpeed – Maximum allowed USB speed

DeviceBase(Config config, const DeviceInfo &devInfo, const dai::Path &pathToCmd, bool dumpOnly = false)

Connects to device specified by devInfo.

Parameters:
  • config – Config with which the device will be booted with

  • devInfoDeviceInfo which specifies which device to connect to

  • pathToCmdPath to custom device firmware

  • dumpOnly – If true only the minimal connection is established to retrieve the crash dump

Public Static Attributes

static constexpr std::size_t EVENT_QUEUE_MAXIMUM_SIZE = {2048}

Maximum number of elements in event queue.