]> sigrok.org Git - libsigrok.git/blobdiff - bindings/cxx/include/libsigrok/libsigrok.hpp
C++: Fix management of SessionDevice objects.
[libsigrok.git] / bindings / cxx / include / libsigrok / libsigrok.hpp
index 972bde883d523fccec8f7324a9dc05dea06f6972..0bf19015b22bee0d0068983d7fcfacd0d9b86504 100644 (file)
@@ -77,6 +77,7 @@ raised, which provides access to the error code and description.
 #include <memory>
 #include <vector>
 #include <map>
+#include <set>
 
 namespace sigrok
 {
@@ -281,6 +282,12 @@ protected:
        friend class Driver;
 };
 
+enum Capability {
+       GET = SR_CONF_GET,
+       SET = SR_CONF_SET,
+       LIST = SR_CONF_LIST
+};
+
 /** An object that can be configured. */
 class SR_API Configurable
 {
@@ -296,7 +303,7 @@ public:
         * @param key ConfigKey to enumerate values for. */
        Glib::VariantContainerBase config_list(const ConfigKey *key);
        /** Enumerate available keys, according to a given index key. */
-       vector<const ConfigKey *> config_keys(const ConfigKey *key);
+       map<const ConfigKey *, set<Capability> > config_keys(const ConfigKey *key);
        /** Check for a key in the list from a given index key. */
        bool config_check(const ConfigKey *key, const ConfigKey *index_key);
 protected:
@@ -347,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. */
@@ -657,8 +668,10 @@ protected:
        Session(shared_ptr<Context> context);
        Session(shared_ptr<Context> context, string filename);
        ~Session();
+       shared_ptr<Device> get_device(const struct sr_dev_inst *sdi);
        const shared_ptr<Context> _context;
-       map<const struct sr_dev_inst *, shared_ptr<Device> > _devices;
+       map<const struct sr_dev_inst *, SessionDevice *> _owned_devices;
+       map<const struct sr_dev_inst *, shared_ptr<Device> > _other_devices;
        vector<DatafeedCallbackData *> _datafeed_callbacks;
        map<shared_ptr<EventSource>, SourceCallbackData *> _source_callbacks;
        bool _saving;
@@ -821,6 +834,8 @@ public:
        /** Send next stream data.
         * @param data Next stream data. */
        void send(string data);
+       /** Signal end of input data. */
+       void end();
 protected:
        Input(shared_ptr<Context> context, const struct sr_input *structure);
        ~Input();