]> sigrok.org Git - libsigrok.git/commitdiff
C++: Expose device serial number and connection ID.
authorMartin Ling <redacted>
Tue, 30 Sep 2014 10:50:07 +0000 (11:50 +0100)
committerMartin Ling <redacted>
Tue, 30 Sep 2014 10:50:07 +0000 (11:50 +0100)
bindings/cxx/classes.cpp
bindings/cxx/include/libsigrok/libsigrok.hpp

index 549e07b0843d92be6a4cc4de2ae156b370821182..8735302c570fe6bdb10c375a9b4ce0662909496b 100644 (file)
@@ -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<shared_ptr<Channel>> Device::channels()
 {
        vector<shared_ptr<Channel>> result;
index 2deb6175b7ae526868ca7765868e128cd6e6fb2d..e30fd4d396a360dbca2df87de75eda0ff17c8b57 100644 (file)
@@ -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<shared_ptr<Channel> > channels();
        /** Channel groups available on this device, indexed by name. */