Skip to content

Commit 00cd44e

Browse files
committed
Exposed all connected devices over Device and fixed docs for some of the functions
1 parent afefd52 commit 00cd44e

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

include/depthai/device/DeviceBase.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,19 @@ class DeviceBase {
107107
static std::tuple<bool, DeviceInfo> getDeviceByMxId(std::string mxId);
108108

109109
/**
110-
* Returns all connected devices
111-
* @returns Vector of connected devices
110+
* Returns all available devices
111+
* @returns Vector of available devices
112112
*/
113113
static std::vector<DeviceInfo> getAllAvailableDevices();
114114

115+
/**
116+
* Returns information of all connected devices.
117+
* The devices could be both connectable as well as already connected to devices.
118+
*
119+
* @returns Vector of connected device information
120+
*/
121+
static std::vector<DeviceInfo> getAllConnectedDevices();
122+
115123
/**
116124
* Gets device firmware binary for a specific OpenVINO version
117125
* @param usb2Mode USB2 mode firmware

include/depthai/xlink/XLinkConnection.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,36 @@ struct DeviceInfo {
5050
class XLinkConnection {
5151
public:
5252
// static API
53+
54+
/**
55+
* Returns information of all connected devices with given state
56+
*
57+
* @param state State which the devices should be in
58+
* @param skipInvalidDevices whether or not to skip over devices that cannot be successfully communicated with
59+
* @returns Vector of connected device information
60+
*/
5361
static std::vector<DeviceInfo> getAllConnectedDevices(XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevices = true);
62+
63+
/**
64+
* Returns information of first device with given state
65+
* @param state State which the device should be in
66+
* @returns Device information
67+
*/
5468
static std::tuple<bool, DeviceInfo> getFirstDevice(XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevices = true);
69+
70+
/**
71+
* Finds a device by MX ID. Example: 14442C10D13EABCE00
72+
* @param mxId MyraidX ID which uniquely specifies a device
73+
* @returns Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device
74+
*/
5575
static std::tuple<bool, DeviceInfo> getDeviceByMxId(std::string, XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevice = true);
76+
77+
/**
78+
* Tries booting the given device into bootloader state
79+
*
80+
* @param devInfo Information of device which it should boot into bootloader state
81+
* @returns New device information if successful
82+
*/
5683
static DeviceInfo bootBootloader(const DeviceInfo& devInfo);
5784

5885
XLinkConnection(const DeviceInfo& deviceDesc, std::vector<std::uint8_t> mvcmdBinary, XLinkDeviceState_t expectedState = X_LINK_BOOTED);

src/device/DeviceBase.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ std::vector<DeviceInfo> DeviceBase::getAllAvailableDevices() {
221221
return availableDevices;
222222
}
223223

224+
// Returns all devices, also the ones that are already booted
225+
std::vector<DeviceInfo> DeviceBase::getAllConnectedDevices() {
226+
return XLinkConnection::getAllConnectedDevices();
227+
}
228+
224229
// First tries to find UNBOOTED device with mxId, then BOOTLOADER device with mxId
225230
std::tuple<bool, DeviceInfo> DeviceBase::getDeviceByMxId(std::string mxId) {
226231
std::vector<DeviceInfo> availableDevices;

0 commit comments

Comments
 (0)