Devices
Devices

Contains helper functions for accessing attached devices

Types
DeviceType
TYPE_ALL

0 - All Devices

TYPE_BASESTATION

1 - Device of a BaseStation type

TYPE_INERTIALDEVICE

2 - Device of an InertialDevice type

DeviceList

Typedef for a map of string COM ports to DeviceInfo objects detailing the information about each device

Functions
listBaseStations
static DeviceList listBaseStations()

Gets a list of all the attached (USB) BaseStations.  Note that this is solely going by listed devices that use our driver, so this may pick up similar devices that are not BaseStations.

Returns

A DeviceList representing the COM ports that were found that match MicroStrain BaseStations.  If none were found, the list will be empty.

listInertialDevices
static DeviceList listInertialDevices()

Gets a list of all the attached (USB) InertialDevices.

Returns

A DeviceList representing the COM ports that were found that match MicroStrain InertialDevices.  If none were found, the list will be empty.

listPorts
static DeviceList listPorts()

Gets a simple list of all serial ports and their availability. This function does not tell you which device is on which port, but can be useful for listing actual serial ports.

Returns

A DeviceList representing the ports that were found and their availability.  If none were found, the list will be empty.

listDevices
static DeviceList listDevices(
DeviceType devType
)

Gets a list of attached devices that match the given DeviceType

Parameters
devType

The type of device to list

matchesDevice
static bool matchesDevice(
std::string pnpID,
std::string description,
DeviceType devType
)

Checks whether a given string found from WMI matches the given device

Parameters
pnpID
std::string

The WMI PNPDeviceID to match

description
std::string

The WMI Description to match

devType

The DeviceType to check for

Returns

true if the string matches the given DeviceType, false otherwise

matchesDevice
static bool matchesDevice(
std::string manufacturer,
std::string vendorId,
DeviceType devType
)

Checks whether the given information, found from searching files in linux, matches the given device

Parameters
manufacturer
std::string

The manufacturer of the device

vendorId
std::string

The vendor id of the device

devType

The DeviceType to check for

Returns

true if the string matches the given DeviceType, false otherwise

getDeviceInfo
static bool getDeviceInfo(
std::string devicePath,
std::string &serial,
std::string &manufacturer,
std::string &vendorId
)

Gets information about the attached device

Parameters
devicePath
std::string

The device path in the directory/form of "/sys/bus/___/devices/___"

serial
std::string&

An output parameter that holds the resulting serial of the device

manufacturer
std::string&

An output parameter that holds the resulting manufacturer of the device

vendorId
std::string&

An output parameter that holds the resulting vendor ID of the device

Returns

true if successfully find the device info, false otherwise