X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=bindings%2Fcxx%2Fclasses.cpp;h=324da04270cdc586278fb6650065e0535add21db;hb=6ec6c43b4738dbc7091f4a49a4ec80ea6102cb52;hp=78f484fa9dafffb8a188fd235c7cbf19d7f7e104;hpb=24287ea9e3dd0c6f7fc2299eaf725346b8c1fea2;p=libsigrok.git
diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp
index 78f484fa..324da042 100644
--- a/bindings/cxx/classes.cpp
+++ b/bindings/cxx/classes.cpp
@@ -17,7 +17,8 @@
* along with this program. If not, see .
*/
-#include "libsigrok/libsigrok.hpp"
+#include
+#include
#include
#include
@@ -77,7 +78,7 @@ Context::Context() :
{
check(sr_init(&_structure));
- struct sr_dev_driver **driver_list = sr_driver_list();
+ struct sr_dev_driver **driver_list = sr_driver_list(_structure);
if (driver_list)
for (int i = 0; driver_list[i]; i++)
_drivers[driver_list[i]->name] =
@@ -161,16 +162,6 @@ void Context::set_log_level(const LogLevel *level)
check(sr_log_loglevel_set(level->id()));
}
-string Context::log_domain()
-{
- return valid_string(sr_log_logdomain_get());
-}
-
-void Context::set_log_domain(string value)
-{
- check(sr_log_logdomain_set(value.c_str()));
-}
-
static int call_log_callback(void *cb_data, int loglevel, const char *format, va_list args)
{
va_list args_copy;
@@ -652,8 +643,7 @@ string Channel::name()
void Channel::set_name(string name)
{
- check(sr_dev_channel_name_set(_parent->_structure,
- _structure->index, name.c_str()));
+ check(sr_dev_channel_name_set(_structure, name.c_str()));
}
const ChannelType *Channel::type()
@@ -668,7 +658,7 @@ bool Channel::enabled()
void Channel::set_enabled(bool value)
{
- check(sr_dev_channel_enable(_parent->_structure, _structure->index, value));
+ check(sr_dev_channel_enable(_structure, value));
}
unsigned int Channel::index()
@@ -889,7 +879,7 @@ Session::Session(shared_ptr context) :
_context(context),
_saving(false)
{
- check(sr_session_new(&_structure));
+ check(sr_session_new(context->_structure, &_structure));
_context->_session = this;
}
@@ -899,7 +889,7 @@ Session::Session(shared_ptr context, string filename) :
_filename(filename),
_saving(false)
{
- check(sr_session_load(filename.c_str(), &_structure));
+ check(sr_session_load(context->_structure, filename.c_str(), &_structure));
GSList *dev_list;
check(sr_session_dev_list(_structure, &dev_list));
for (GSList *dev = dev_list; dev; dev = dev->next)
@@ -1385,15 +1375,27 @@ string InputFormat::description()
return valid_string(sr_input_description_get(_structure));
}
+vector InputFormat::extensions()
+{
+ vector exts;
+ for (const char *const *e = sr_input_extensions_get(_structure);
+ e && *e; e++)
+ exts.push_back(*e);
+ return exts;
+}
+
map> InputFormat::options()
{
const struct sr_option **options = sr_input_options_get(_structure);
- auto option_array = shared_ptr(
- options, sr_input_options_free);
map> result;
- for (int i = 0; options[i]; i++)
- result[options[i]->id] = shared_ptr