From: Martin Ling Date: Tue, 30 Sep 2014 10:50:07 +0000 (+0100) Subject: C++: Expose device serial number and connection ID. X-Git-Tag: libsigrok-0.4.0~913 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d1075e5acf811d6e6a0d5a87df1ff8f5ce6bf901;p=libsigrok.git C++: Expose device serial number and connection ID. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 549e07b0..8735302c 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -448,6 +448,11 @@ string Device::description() if (part.length() > 0) s << part; + if (serial_number().length() > 0) + s << serial_number(); + else + s << connection_id(); + return s.str(); } @@ -466,6 +471,16 @@ string Device::version() return valid_string(_structure->version); } +string Device::serial_number() +{ + return valid_string(_structure->serial_num); +} + +string Device::connection_id() +{ + return valid_string(_structure->connection_id); +} + vector> Device::channels() { vector> result; diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index 2deb6175..e30fd4d3 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -354,6 +354,10 @@ public: string model(); /** Version string for this device. */ string version(); + /** Serial number for this device. */ + string serial_number(); + /** Connection ID for this device. */ + string connection_id(); /** List of the channels available on this device. */ vector > channels(); /** Channel groups available on this device, indexed by name. */