X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Fclasses.cpp;h=9dc003acae70ac863776b3a8be5c9273b59513f9;hb=161dc24d845acfc00108dd33eac7c42430d21e17;hp=efb4995db6152f705053f041830daae6c04fbdd6;hpb=e835e8080b6278137ea90f3b10e5d8bc51136a91;p=libsigrok.git
diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp
index efb4995d..9dc003ac 100644
--- a/bindings/cxx/classes.cpp
+++ b/bindings/cxx/classes.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-#include "libsigrok/libsigrok.hpp"
+#include "libsigrokcxx/libsigrokcxx.hpp"
#include
#include
@@ -318,6 +318,20 @@ shared_ptr Context::open_stream(string header)
new Input(shared_from_this(), input), Input::Deleter());
}
+map Context::serials(shared_ptr driver)
+{
+ GSList *serial_list = sr_serial_list(driver ? driver->_structure : NULL);
+ map serials;
+
+ for (GSList *serial = serial_list; serial; serial = serial->next) {
+ struct sr_serial_port *port = (sr_serial_port *) serial->data;
+ serials[string(port->name)] = string(port->description);
+ }
+
+ g_slist_free_full(serial_list, (GDestroyNotify)sr_serial_free);
+ return serials;
+}
+
Driver::Driver(struct sr_dev_driver *structure) :
ParentOwned(structure),
Configurable(structure, NULL, NULL),