Class XLinkConnection
Defined in File XLinkConnection.hpp
Class Documentation
-
class XLinkConnection
Represents connection between host and device over XLink protocol
Public Functions
-
XLinkConnection(const DeviceInfo &deviceDesc, std::vector<std::uint8_t> mvcmdBinary, XLinkDeviceState_t expectedState = X_LINK_BOOTED)
-
XLinkConnection(const DeviceInfo &deviceDesc, std::filesystem::path pathToMvcmd, XLinkDeviceState_t expectedState = X_LINK_BOOTED)
-
explicit XLinkConnection(const DeviceInfo &deviceDesc, XLinkDeviceState_t expectedState = X_LINK_BOOTED)
-
~XLinkConnection()
-
void setRebootOnDestruction(bool reboot)
-
bool getRebootOnDestruction() const
-
int getLinkId() const
-
void close()
Explicitly closes xlink connection.
Note
This function does not need to be explicitly called as destructor closes the connection automatically
-
bool isClosed() const
Is the connection already closed (or disconnected)
Warning
This function is thread-unsafe and may return outdated incorrect values. It is only meant for use in simple single-threaded code. Well written code should handle exceptions when calling any DepthAI apis to handle hardware events and multithreaded use.
-
ProfilingData getProfilingData()
Get current accumulated profiling data
- Returns:
ProfilingData from the specific connection
Public Static Functions
-
static std::vector<DeviceInfo> getAllConnectedDevices(XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevices = true, int timeoutMs = XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS)
Returns information of all connected devices with given state
- Parameters:
state – State which the devices should be in
skipInvalidDevices – whether or not to skip over devices that cannot be successfully communicated with
- Returns:
Vector of connected device information
-
static std::tuple<bool, DeviceInfo> getFirstDevice(XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevices = true)
Returns information of first device with given state
- Parameters:
state – State which the device should be in
- Returns:
Device information
-
static std::tuple<bool, DeviceInfo> getDeviceById(std::string deviceId, XLinkDeviceState_t state = X_LINK_ANY_STATE, bool skipInvalidDevice = true)
Finds a device by Device ID. Example: 14442C10D13EABCE00
- Parameters:
deviceId – Device ID which uniquely specifies a device
state – Which state should the device be in
skipInvalidDevices – Whether or not to skip devices that cannot be fully detected
- Returns:
Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device
-
static DeviceInfo bootBootloader(const DeviceInfo &devInfo)
Tries booting the given device into bootloader state
- Parameters:
devInfo – Information of device which it should boot into bootloader state
- Returns:
New device information if successful
-
static ProfilingData getGlobalProfilingData()
Get current accumulated profiling data
- Returns:
ProfilingData from the specific connection
-
XLinkConnection(const DeviceInfo &deviceDesc, std::vector<std::uint8_t> mvcmdBinary, XLinkDeviceState_t expectedState = X_LINK_BOOTED)