OrbbecSDK 2.10.6
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
ob::DeviceList Class Reference

Class representing a list of devices. More...

#include <Device.hpp>

Public Member Functions

 DeviceList (ob_device_list_t *impl)
 ~DeviceList () noexcept
uint32_t getCount () const
 Get the number of devices in the list.
int getPid (uint32_t index) const
 Get the PID of the device at the specified index.
int getVid (uint32_t index) const
 Get the VID of the device at the specified index.
const char * getUid (uint32_t index) const
 Get the UID of the device at the specified index.
const char * getSerialNumber (uint32_t index) const
 Get the serial number of the device at the specified index.
const char * getName (uint32_t index) const
 Get the name of the device at the specified index in the device list.
const char * getConnectionType (uint32_t index) const
 Get device connection type.
const char * getIpAddress (uint32_t index) const
 get the ip address of the device at the specified index
const char * getSubnetMask (uint32_t index) const
 get the subnet mask of the device at the specified index
const char * getGateway (uint32_t index) const
 get the gateway of the device at the specified index
const char * getLocalMacAddress (uint32_t index) const
 Get the MAC address of the host network interface corresponding to the device at the specified index.
const char * getLocalIP (uint32_t index) const
 Get the IP address of the host network interface corresponding to the device at the specified index.
uint8_t getLocalSubnetLength (uint32_t index) const
 Get the subnet length of the host network interface corresponding to the device at the specified index.
const char * getLocalGateway (uint32_t index) const
 Get the gateway of the host network interface corresponding to the device at the specified index.
const char * getLocalNetInterfaceName (uint32_t index) const
 Get the name of the host network interface corresponding to the device at the specified index.
OBIpSourceType getIpSourceType (uint32_t index) const
 Get the current IP configuration mode of the device at the specified index.
const char * getUserName (uint32_t index) const
 Get the user-defined name of the device at the specified index.
OBDeviceAccessState queryDeviceAccessState (uint32_t index) const
 Query the current device access state without opening the device.
OBDeviceAccessState queryDeviceAccessStateBySN (const char *serialNumber) const
 Query the current device access state by serial number without opening the device.
std::shared_ptr< Device > getDevice (uint32_t index, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
 Get the device object at the specified index.
std::shared_ptr< Device > getDeviceBySN (const char *serialNumber, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
 Get the device object with the specified serial number.
std::shared_ptr< Device > getDeviceByUid (const char *uid, OBDeviceAccessMode accessMode=OB_DEVICE_DEFAULT_ACCESS) const
 Get the specified device object from the device list by uid.
uint32_t deviceCount () const
int pid (uint32_t index) const
int vid (uint32_t index) const
const char * uid (uint32_t index) const
const char * serialNumber (uint32_t index) const
const char * name (uint32_t index) const
const char * connectionType (uint32_t index) const
const char * ipAddress (uint32_t index) const

Detailed Description

Class representing a list of devices.

Definition at line 1355 of file Device.hpp.

Constructor & Destructor Documentation

◆ DeviceList()

ob::DeviceList::DeviceList ( ob_device_list_t * impl)
inlineexplicit

Definition at line 1360 of file Device.hpp.

◆ ~DeviceList()

ob::DeviceList::~DeviceList ( )
inlinenoexcept

Definition at line 1361 of file Device.hpp.

Member Function Documentation

◆ getCount()

uint32_t ob::DeviceList::getCount ( ) const
inline

Get the number of devices in the list.

Returns
uint32_t the number of devices in the list

Definition at line 1372 of file Device.hpp.

Referenced by deviceCount().

◆ getPid()

int ob::DeviceList::getPid ( uint32_t index) const
inline

Get the PID of the device at the specified index.

Parameters
[in]indexthe index of the device
Returns
int the PID of the device

Definition at line 1386 of file Device.hpp.

Referenced by pid().

◆ getVid()

int ob::DeviceList::getVid ( uint32_t index) const
inline

Get the VID of the device at the specified index.

Parameters
[in]indexthe index of the device
Returns
int the VID of the device

Definition at line 1400 of file Device.hpp.

Referenced by vid().

◆ getUid()

const char * ob::DeviceList::getUid ( uint32_t index) const
inline

Get the UID of the device at the specified index.

Parameters
[in]indexthe index of the device
Returns
const char* the UID of the device

Definition at line 1414 of file Device.hpp.

Referenced by uid().

◆ getSerialNumber()

const char * ob::DeviceList::getSerialNumber ( uint32_t index) const
inline

Get the serial number of the device at the specified index.

Parameters
[in]indexthe index of the device
Returns
const char* the serial number of the device

Definition at line 1428 of file Device.hpp.

Referenced by serialNumber().

◆ getName()

const char * ob::DeviceList::getName ( uint32_t index) const
inline

Get the name of the device at the specified index in the device list.

This function retrieves the name of the device at the given index in the device list. If an error occurs during the operation, it will be handled by the Error::handle function.

Parameters
[in]indexThe index of the device in the device list.
Returns
const char* The name of the device at the specified index.

Definition at line 1445 of file Device.hpp.

Referenced by name().

◆ getConnectionType()

const char * ob::DeviceList::getConnectionType ( uint32_t index) const
inline

Get device connection type.

Parameters
[in]indexdevice index
Returns
const char* returns connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet", "GMSL2"

Definition at line 1460 of file Device.hpp.

Referenced by connectionType().

◆ getIpAddress()

const char * ob::DeviceList::getIpAddress ( uint32_t index) const
inline

get the ip address of the device at the specified index

Attention
Only valid for network devices, otherwise it will return "0.0.0.0".
Parameters
[in]indexthe index of the device
Returns
const char* the ip address of the device

Definition at line 1476 of file Device.hpp.

Referenced by ipAddress().

◆ getSubnetMask()

const char * ob::DeviceList::getSubnetMask ( uint32_t index) const
inline

get the subnet mask of the device at the specified index

Attention
Only valid for network devices, otherwise it will return "0.0.0.0".
Parameters
[in]indexthe index of the device
Returns
const char* the subnet mask of the device

Definition at line 1492 of file Device.hpp.

◆ getGateway()

const char * ob::DeviceList::getGateway ( uint32_t index) const
inline

get the gateway of the device at the specified index

Attention
Only valid for network devices, otherwise it will return "0.0.0.0".
Parameters
[in]indexthe index of the device
Returns
const char* the gateway of the device

Definition at line 1508 of file Device.hpp.

◆ getLocalMacAddress()

const char * ob::DeviceList::getLocalMacAddress ( uint32_t index) const
inline

Get the MAC address of the host network interface corresponding to the device at the specified index.

Attention
Only valid for network devices, otherwise it will return "0:0:0:0:0:0".
Parameters
[in]indexthe index of the device
Returns
const char* The MAC address of the host network interface associated with the device.

Definition at line 1524 of file Device.hpp.

◆ getLocalIP()

const char * ob::DeviceList::getLocalIP ( uint32_t index) const
inline

Get the IP address of the host network interface corresponding to the device at the specified index.

Attention
Only valid for network devices, otherwise it will return "0.0.0.0".
Parameters
[in]indexThe index of the device
Returns
const char* The IP address of the host network interface associated with the device.

Definition at line 1540 of file Device.hpp.

◆ getLocalSubnetLength()

uint8_t ob::DeviceList::getLocalSubnetLength ( uint32_t index) const
inline

Get the subnet length of the host network interface corresponding to the device at the specified index.

Attention
Only valid for network devices, otherwise it will return 0.
Parameters
[in]indexThe index of the device
Returns
uint8_t The subnet length (0~32) of the host network interface associated with the device.

Definition at line 1556 of file Device.hpp.

◆ getLocalGateway()

const char * ob::DeviceList::getLocalGateway ( uint32_t index) const
inline

Get the gateway of the host network interface corresponding to the device at the specified index.

Attention
Only valid for network devices, otherwise it will return "0.0.0.0".
Parameters
[in]indexThe index of the device
Returns
const char* The gateway of the host network interface associated with the device.

Definition at line 1572 of file Device.hpp.

◆ getLocalNetInterfaceName()

const char * ob::DeviceList::getLocalNetInterfaceName ( uint32_t index) const
inline

Get the name of the host network interface corresponding to the device at the specified index.

Attention
Returns "unknown" for USB devices or non-network devices.
Parameters
[in]indexThe index of the device.
Returns
const char* The host network interface name (e.g., "eth0", "en0").

Definition at line 1588 of file Device.hpp.

◆ getIpSourceType()

OBIpSourceType ob::DeviceList::getIpSourceType ( uint32_t index) const
inline

Get the current IP configuration mode of the device at the specified index.

Attention
Only valid for Ethernet devices, otherwise it will return OB_IP_SOURCE_NONE.
Parameters
[in]indexThe index of the device.
Returns
OBCurIpConfig The active IP configuration mode (e.g. DHCP, LLA, or Persistent IP).

Definition at line 1604 of file Device.hpp.

◆ getUserName()

const char * ob::DeviceList::getUserName ( uint32_t index) const
inline

Get the user-defined name of the device at the specified index.

Attention
Only valid for Ethernet devices, otherwise returns "unknown".
Parameters
[in]indexThe index of the device.
Returns
const char* The user-defined name string.

Definition at line 1620 of file Device.hpp.

◆ queryDeviceAccessState()

OBDeviceAccessState ob::DeviceList::queryDeviceAccessState ( uint32_t index) const
inline

Query the current device access state without opening the device.

Attention
This is a non-invasive GVCP CCP query for supported Ethernet devices. It reports device-side CCP state, not the owner process or host. CONTROLLED means monitor access may still be available, while default/control access may still fail. This call is synchronous and blocks while waiting for the device's GVCP response over the network; querying an unreachable device blocks until the underlying retry logic gives up, so prefer calling it off the UI thread when querying multiple devices. The returned state reflects the device access state only at the moment of the query and does not guarantee that a subsequent access (such as creating or opening the device) will succeed, as another client may change the state in between.
Parameters
[in]indexThe index of the device.
Returns
OBDeviceAccessState The current access state of the device.

Definition at line 1641 of file Device.hpp.

◆ queryDeviceAccessStateBySN()

OBDeviceAccessState ob::DeviceList::queryDeviceAccessStateBySN ( const char * serialNumber) const
inline

Query the current device access state by serial number without opening the device.

Attention
This is a non-invasive GVCP CCP query for supported Ethernet devices. It reports device-side CCP state, not the owner process or host. CONTROLLED means monitor access may still be available, while default/control access may still fail. This call is synchronous and blocks while waiting for the device's GVCP response over the network; querying an unreachable device blocks until the underlying retry logic gives up, so prefer calling it off the UI thread when querying multiple devices. The returned state reflects the device access state only at the moment of the query and does not guarantee that a subsequent access (such as creating or opening the device) will succeed, as another client may change the state in between. If no device in the list matches the given serial number, this throws an ob::Error.
Parameters
[in]serialNumberThe serial number of the device.
Returns
OBDeviceAccessState The current access state of the device.

Definition at line 1663 of file Device.hpp.

◆ getDevice()

std::shared_ptr< Device > ob::DeviceList::getDevice ( uint32_t index,
OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS ) const
inline

Get the device object at the specified index.

Attention
If the device has already been acquired and created elsewhere, repeated acquisition will throw an exception
Parameters
[in]indexthe index of the device to create
[in]accessModeDevice access mode. ob_device_access_mode. If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used. Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
Returns
std::shared_ptr<Device> the device object

Definition at line 1682 of file Device.hpp.

◆ getDeviceBySN()

std::shared_ptr< Device > ob::DeviceList::getDeviceBySN ( const char * serialNumber,
OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS ) const
inline

Get the device object with the specified serial number.

Attention
If the device has already been acquired and created elsewhere, repeated acquisition will throw an exception
Parameters
[in]serialNumberthe serial number of the device to create
[in]accessModeDevice access mode. ob_device_access_mode. If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used. Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
Returns
std::shared_ptr<Device> the device object

Definition at line 1701 of file Device.hpp.

◆ getDeviceByUid()

std::shared_ptr< Device > ob::DeviceList::getDeviceByUid ( const char * uid,
OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS ) const
inline

Get the specified device object from the device list by uid.

On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number and only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port. Similarly, users can also directly pass in bus-port as uid to create device.

For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.

Attention
If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
Parameters
[in]uidThe uid of the device to be created
[in]accessModeDevice access mode. ob_device_access_mode. If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used. Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
Returns
std::shared_ptr<Device> returns the device object

Definition at line 1724 of file Device.hpp.

◆ deviceCount()

uint32_t ob::DeviceList::deviceCount ( ) const
inline

Definition at line 1733 of file Device.hpp.

◆ pid()

int ob::DeviceList::pid ( uint32_t index) const
inline

Definition at line 1737 of file Device.hpp.

Referenced by getPid().

◆ vid()

int ob::DeviceList::vid ( uint32_t index) const
inline

Definition at line 1741 of file Device.hpp.

Referenced by getVid().

◆ uid()

const char * ob::DeviceList::uid ( uint32_t index) const
inline

Definition at line 1745 of file Device.hpp.

Referenced by getDeviceByUid(), and getUid().

◆ serialNumber()

const char * ob::DeviceList::serialNumber ( uint32_t index) const
inline

Definition at line 1749 of file Device.hpp.

Referenced by getDeviceBySN(), and queryDeviceAccessStateBySN().

◆ name()

const char * ob::DeviceList::name ( uint32_t index) const
inline

Definition at line 1753 of file Device.hpp.

Referenced by getName().

◆ connectionType()

const char * ob::DeviceList::connectionType ( uint32_t index) const
inline

Definition at line 1757 of file Device.hpp.

◆ ipAddress()

const char * ob::DeviceList::ipAddress ( uint32_t index) const
inline

Definition at line 1761 of file Device.hpp.


The documentation for this class was generated from the following file: