Classes | Public Member Functions | Static Public Member Functions | List of all members
Scanner Class Reference

Provides static functionality for scanning for Xsens devices. More...

#include <scanner.h>

Classes

class  Accessor
 An accessor class for scanner. More...
 

Public Member Functions

XsResultValue fetchBasicInfo (XsPortInfo &portInfo, uint32_t singleScanTimeout, bool detectRs485)
 Fetch basic device information. More...
 
virtual bool xsEnumerateBluetoothDevices (XsPortInfoArray &ports)
 Enumerates a bluetooth device. More...
 
virtual bool xsEnumerateNetworkDevices (XsPortInfoArray &ports)
 Enumerates a network device. More...
 
bool xsEnumerateSerialPorts (XsPortInfoArray &ports, bool ignoreNonXsensDevices)
 Enumerate the serial ports. More...
 
bool xsFilterResponsiveDevices (XsPortInfoArray &ports, XsBaudRate baudrate, uint32_t singleScanTimeout, bool detectRs485)
 Filter responsive devices. More...
 
bool xsScanPort (XsPortInfo &portInfo, XsBaudRate baud, uint32_t singleScanTimeout, bool detectRs485)
 Scan a single COM port for connected Xsens devices. More...
 
virtual bool xsScanPorts (XsPortInfoArray &ports, XsBaudRate baudrate, uint32_t singleScanTimeout, bool ignoreNonXsensDevices, bool detectRs485)
 Scan serial ports for connected Xsens devices. More...
 
XsUsbHubInfo xsScanUsbHub (const XsPortInfo &portInfo)
 Get information about the hub configuration. More...
 
virtual ~Scanner ()
 Destructor. More...
 

Static Public Member Functions

static bool isXsensUsbDevice (uint16_t vid, uint16_t pid)
 
static void setScanLogCallback (XsScanLogCallbackFunc cb)
 Set a callback function for scan log progress and problem reporting. More...
 

Detailed Description

Provides static functionality for scanning for Xsens devices.

Definition at line 83 of file scanner.h.

Constructor & Destructor Documentation

◆ ~Scanner()

Scanner::~Scanner ( )
virtual

Destructor.

Definition at line 122 of file scanner.cpp.

Member Function Documentation

◆ fetchBasicInfo()

XsResultValue Scanner::fetchBasicInfo ( XsPortInfo portInfo,
uint32_t  singleScanTimeout,
bool  detectRs485 
)

Fetch basic device information.

Parameters
[in,out]portInfoThe name of the port to fetch from
[in]singleScanTimeoutThe timeout of a scan of a single port at a single baud rate in ms.
[in]detectRs485Enable more extended scan to detect rs485 devices
Returns
XRV_OK if successful

Definition at line 144 of file scanner.cpp.

◆ isXsensUsbDevice()

bool Scanner::isXsensUsbDevice ( uint16_t  vid,
uint16_t  pid 
)
static
Returns
true if the vendor/product combination may point to an xsens device
Parameters
[in]vidThe vendor ID
[in]pidthe product ID

Definition at line 383 of file scanner.cpp.

◆ setScanLogCallback()

void Scanner::setScanLogCallback ( XsScanLogCallbackFunc  cb)
static

Set a callback function for scan log progress and problem reporting.

When set, any scan will use the provided callback function to report progress and failures. Normal operation is not affected, so all return values for the scan functions remain valid.

Parameters
cbThe callback function to use. When set to NULL, no callbacks will be generated.

Definition at line 131 of file scanner.cpp.

◆ xsEnumerateBluetoothDevices()

bool Scanner::xsEnumerateBluetoothDevices ( XsPortInfoArray ports)
virtual

Enumerates a bluetooth device.

Parameters
portsThe port info array
Returns
false

Definition at line 599 of file scanner.cpp.

◆ xsEnumerateNetworkDevices()

bool Scanner::xsEnumerateNetworkDevices ( XsPortInfoArray ports)
virtual

Enumerates a network device.

Parameters
portsThe port info array
Returns
false

Definition at line 589 of file scanner.cpp.

◆ xsEnumerateSerialPorts()

bool Scanner::xsEnumerateSerialPorts ( XsPortInfoArray ports,
bool  ignoreNonXsensDevices 
)

Enumerate the serial ports.

Parameters
[in,out]portsThe list of ports to append to
[in]ignoreNonXsensDevicesIf set to true (default), ignore serial ports that aren't Xsens USB devices
Returns
True if successful

Definition at line 406 of file scanner.cpp.

◆ xsFilterResponsiveDevices()

bool Scanner::xsFilterResponsiveDevices ( XsPortInfoArray ports,
XsBaudRate  baudrate,
uint32_t  singleScanTimeout,
bool  detectRs485 
)

Filter responsive devices.

Serial ports that do not have a responsive Xsens device connected are removed from ports.

Parameters
[in,out]portsThe list of ports to filter
[in]baudrateThe baud rate used for scanning. If baudrate equals XBR_Invalid, all rates are scanned.
[in]singleScanTimeoutThe maximum time allowed for response
[in]detectRs485Enable more extended scan to detect rs485 devices
Returns
true if successful

Definition at line 339 of file scanner.cpp.

◆ xsScanPort()

bool Scanner::xsScanPort ( XsPortInfo portInfo,
XsBaudRate  baud,
uint32_t  singleScanTimeout,
bool  detectRs485 
)

Scan a single COM port for connected Xsens devices.

The xsScanPort function will scan a single port for connected Xsens devices. If the baudrate parameter is 0 (default), it will try to connect at all supported baud rates, starting with the most common 115k2, 460k8 and 58k6. If the baudrate parameter is non-zero, only the specified baud rate is tried. Any detected devices are returned in the portInfo parameter.

Parameters
[in,out]portInfoThe name of the port to scan should be in this parameter, the other contents will be filled by the function
[in]baudThe baudrate to scan at. When set to XBR_Invalid, all known baudrates are scanned
[in]singleScanTimeoutThe timeout of a scan of a single port at a single baud rate in ms
[in]detectRs485Enable more extended scan to detect rs485 devices
Returns
true if a device was found, false otherwise

Definition at line 224 of file scanner.cpp.

◆ xsScanPorts()

bool Scanner::xsScanPorts ( XsPortInfoArray ports,
XsBaudRate  baudrate,
uint32_t  singleScanTimeout,
bool  ignoreNonXsensDevices,
bool  detectRs485 
)
virtual

Scan serial ports for connected Xsens devices.

The xsScanPorts function will scan registered Xsens USB converters and serial COM ports for connected Xsens devices. If the baudrate parameter is 0 (default), it will try to connect at all supported baud rates, starting with the most common 115k2, 460k8 and 58k6. If the baudrate parameter is non-zero, only the specified baudrate is tried. Any detected devices are returned in the ports list, which is sorted by port nr.

Parameters
[out]portsThe list of detected ports.
[in]baudrateThe baudrate to scan at. When set to XBR_Invalid, all known baudrates are scanned.
[in]singleScanTimeoutThe timeout of a scan of a single port at a single baud rate in ms.
[in]ignoreNonXsensDevicesWhen non-zero (the default), only Xsens devices are returned. Otherwise other devices that comply with the Xsens message protocol will also be returned.
[in]detectRs485Enable more extended scan to detect rs485 devices
Returns
true if at least one device was found, false otherwise

Definition at line 315 of file scanner.cpp.

◆ xsScanUsbHub()

XsUsbHubInfo Scanner::xsScanUsbHub ( const XsPortInfo portInfo)

Get information about the hub configuration.

Parameters
portInfoDescriptor of the USB port to scan
Returns
An XsUsbHubInfo object that provides platform independent comparison

This function behaves slightly different on different platforms. On Windows only hubs that are Xsens devices are taken into account. On platforms supporting udev the information is always filled in if port exists. This means that

if (xsScanUsbHub(port).isValid())
{
// device is docked
}

is not enough to accurately determine whether a device was docked in a cross-platform and future proof application. Instead use the recommended approach to check whether two devices share the same hub:

XsUsbHubInfo hubInfo1 = xsScanUsbHub(port1);
XsUsbHubInfo hubInfo2 = xsScanUsbHub(port2);
hubInfo1.parentPathMatches(hubInfo2);

Definition at line 879 of file scanner.cpp.


The documentation for this class was generated from the following files:
Scanner::xsScanUsbHub
XsUsbHubInfo xsScanUsbHub(const XsPortInfo &portInfo)
Get information about the hub configuration.
Definition: scanner.cpp:879
XsUsbHubInfo
A structure that wraps USB hub information.
Definition: xsusbhubinfo.h:99


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22