X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bindings%2Fcxx%2Finclude%2Flibsigrok%2Flibsigrok.hpp;h=3e49bd5986defbc4cbabc789c0adf0be2c08a9f6;hb=1411f7d8e9fa5d90d8140fc51eb44562dd626b7c;hp=9c211837b12b01cc915ce064e1da9dae440bac52;hpb=9c51e8ec56715074ca756fd54e63b360096113e2;p=libsigrok.git diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index 9c211837..3e49bd59 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -77,6 +77,7 @@ raised, which provides access to the error code and description. #include #include #include +#include namespace sigrok { @@ -148,6 +149,12 @@ protected: weak_ptr _weak_this; public: + /* Get parent object that owns this object. */ + shared_ptr parent() + { + return _parent; + } + /* Note, this implementation will create a new smart_ptr if none exists. */ shared_ptr shared_from_this() { @@ -281,6 +288,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 +309,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 config_keys(const ConfigKey *key); + map > 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: @@ -340,13 +353,17 @@ class SR_API Device : public Configurable { public: /** Description identifying this device. */ - string description(); + virtual string description(); /** Vendor name for this device. */ string vendor(); /** Model name for this device. */ 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. */ @@ -598,6 +615,8 @@ class SR_API SessionDevice : public ParentOwned, public Device { + /** Description identifying this device. */ + string description(); protected: SessionDevice(struct sr_dev_inst *sdi); ~SessionDevice(); @@ -653,14 +672,19 @@ public: /** Set trigger setting. * @param trigger Trigger object to use. */ void set_trigger(shared_ptr trigger); + /** Get filename this session was loaded from. */ + string filename(); protected: Session(shared_ptr context); Session(shared_ptr context, string filename); ~Session(); + shared_ptr get_device(const struct sr_dev_inst *sdi); const shared_ptr _context; - map > _devices; + map _owned_devices; + map > _other_devices; vector _datafeed_callbacks; map, SourceCallbackData *> _source_callbacks; + string _filename; bool _saving; bool _save_initialized; string _save_filename; @@ -669,6 +693,7 @@ protected: friend class Deleter; friend class Context; friend class DatafeedCallbackData; + friend class SessionDevice; }; /** A packet on the session datafeed */ @@ -838,6 +863,9 @@ class SR_API InputDevice : public ParentOwned, public Device { +public: + /** Description identifying this device. */ + string description(); protected: InputDevice(shared_ptr input, struct sr_dev_inst *sdi); ~InputDevice();