version 1.16.0_alpha

PISerial::availableDevicesInfo (Linux and Windows)
This commit is contained in:
2020-05-26 16:08:38 +03:00
parent 6413e7747e
commit b6ab5aa202
5 changed files with 308 additions and 68 deletions

View File

@@ -71,6 +71,29 @@ public:
S4000000 /*! 4000000 baud */ = 4000000
};
//! \brief Information about serial device
struct DeviceInfo {
DeviceInfo();
//! \brief String representation of USB ID in format \"xxxx:xxxx\"
PIString id() const;
//! \brief USB Vendor ID
uint vID;
//! \brief USB Product ID
uint pID;
//! \brief Path to device, e.g. "COM2" or "/dev/ttyUSB0"
PIString path;
//! \brief Device description
PIString description;
//! \brief Device manufacturer
PIString manufacturer;
};
//! Contructs %PISerial with device name "device", speed "speed" and parameters "params"
explicit PISerial(const PIString & device, PISerial::Speed speed = S115200, PIFlags<PISerial::Parameters> params = 0);
@@ -173,9 +196,12 @@ public:
//! \brief Returns all available speeds for serial devices
static PIVector<int> availableSpeeds();
//! \brief Returns all available system devices. If "test" each device will be tried to open
//! \brief Returns all available system devices path. If "test" each device will be tried to open
static PIStringList availableDevices(bool test = false);
//! \brief Returns all available system devices. If "test" each device will be tried to open
static PIVector<DeviceInfo> availableDevicesInfo(bool test = false);
//! \ioparams
//! \{
#ifdef DOXYGEN
@@ -232,4 +258,11 @@ protected:
};
inline PICout operator <<(PICout s, const PISerial::DeviceInfo & v) {
s << v.path << " (" << v.id() << ", \"" << v.manufacturer << "\", \"" << v.description << "\")";
return s;
}
#endif // PISERIAL_H