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... | |
Provides static functionality for scanning for Xsens devices.
|
virtual |
Destructor.
Definition at line 122 of file scanner.cpp.
XsResultValue Scanner::fetchBasicInfo | ( | XsPortInfo & | portInfo, |
uint32_t | singleScanTimeout, | ||
bool | detectRs485 | ||
) |
Fetch basic device information.
[in,out] | portInfo | The name of the port to fetch from |
[in] | singleScanTimeout | The timeout of a scan of a single port at a single baud rate in ms. |
[in] | detectRs485 | Enable more extended scan to detect rs485 devices |
Definition at line 144 of file scanner.cpp.
|
static |
[in] | vid | The vendor ID |
[in] | pid | the product ID |
Definition at line 383 of file scanner.cpp.
|
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.
cb | The callback function to use. When set to NULL, no callbacks will be generated. |
Definition at line 131 of file scanner.cpp.
|
virtual |
Enumerates a bluetooth device.
ports | The port info array |
Definition at line 599 of file scanner.cpp.
|
virtual |
Enumerates a network device.
ports | The port info array |
Definition at line 589 of file scanner.cpp.
bool Scanner::xsEnumerateSerialPorts | ( | XsPortInfoArray & | ports, |
bool | ignoreNonXsensDevices | ||
) |
Enumerate the serial ports.
[in,out] | ports | The list of ports to append to |
[in] | ignoreNonXsensDevices | If set to true (default), ignore serial ports that aren't Xsens USB devices |
Definition at line 406 of file scanner.cpp.
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.
[in,out] | ports | The list of ports to filter |
[in] | baudrate | The baud rate used for scanning. If baudrate equals XBR_Invalid, all rates are scanned. |
[in] | singleScanTimeout | The maximum time allowed for response |
[in] | detectRs485 | Enable more extended scan to detect rs485 devices |
Definition at line 339 of file scanner.cpp.
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.
[in,out] | portInfo | The name of the port to scan should be in this parameter, the other contents will be filled by the function |
[in] | baud | The baudrate to scan at. When set to XBR_Invalid, all known baudrates are scanned |
[in] | singleScanTimeout | The timeout of a scan of a single port at a single baud rate in ms |
[in] | detectRs485 | Enable more extended scan to detect rs485 devices |
Definition at line 224 of file scanner.cpp.
|
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.
[out] | ports | The list of detected ports. |
[in] | baudrate | The baudrate to scan at. When set to XBR_Invalid, all known baudrates are scanned. |
[in] | singleScanTimeout | The timeout of a scan of a single port at a single baud rate in ms. |
[in] | ignoreNonXsensDevices | When non-zero (the default), only Xsens devices are returned. Otherwise other devices that comply with the Xsens message protocol will also be returned. |
[in] | detectRs485 | Enable more extended scan to detect rs485 devices |
Definition at line 315 of file scanner.cpp.
XsUsbHubInfo Scanner::xsScanUsbHub | ( | const XsPortInfo & | portInfo | ) |
Get information about the hub configuration.
portInfo | Descriptor of the USB port to scan |
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
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:
Definition at line 879 of file scanner.cpp.