libsigrokcxx  unreleased development snapshot
C++ bindings for libsigrok
Public Member Functions | Static Public Member Functions | List of all members
sigrok::Context Class Reference

The global libsigrok context. More...

#include <libsigrokcxx/libsigrokcxx.hpp>

Inherits sigrok::UserOwned< Class >.

Public Member Functions

map< string, shared_ptr< Driver > > drivers ()
 Available hardware drivers, indexed by name. More...
 
map< string, shared_ptr< InputFormat > > input_formats ()
 Available input formats, indexed by name. More...
 
map< string, shared_ptr< OutputFormat > > output_formats ()
 Available output formats, indexed by name. More...
 
const LogLevellog_level () const
 Current log level. More...
 
void set_log_level (const LogLevel *level)
 Set the log level. More...
 
void set_log_callback (LogCallbackFunction callback)
 Set the log callback. More...
 
void set_log_callback_default ()
 Set the log callback to the default handler. More...
 
void set_resource_reader (ResourceReader *reader)
 Install a delegate for reading resource files. More...
 
shared_ptr< Sessioncreate_session ()
 Create a new session. More...
 
shared_ptr< UserDevicecreate_user_device (string vendor, string model, string version)
 Create a new user device. More...
 
shared_ptr< Packetcreate_header_packet (Glib::TimeVal start_time)
 Create a header packet. More...
 
shared_ptr< Packetcreate_meta_packet (map< const ConfigKey *, Glib::VariantBase > config)
 Create a meta packet. More...
 
shared_ptr< Packetcreate_logic_packet (void *data_pointer, size_t data_length, unsigned int unit_size)
 Create a logic packet. More...
 
shared_ptr< Packetcreate_analog_packet (vector< shared_ptr< Channel > > channels, float *data_pointer, unsigned int num_samples, const Quantity *mq, const Unit *unit, vector< const QuantityFlag *> mqflags)
 Create an analog packet. More...
 
shared_ptr< Sessionload_session (string filename)
 Load a saved session. More...
 
shared_ptr< Triggercreate_trigger (string name)
 Create a new trigger. More...
 
shared_ptr< Inputopen_file (string filename)
 Open an input file. More...
 
shared_ptr< Inputopen_stream (string header)
 Open an input stream based on header data. More...
 
map< string, string > serials (shared_ptr< Driver > driver) const
 

Static Public Member Functions

static shared_ptr< Contextcreate ()
 Create new context.
 
static string package_version ()
 libsigrok package version. More...
 
static string lib_version ()
 libsigrok library version. More...
 

Detailed Description

The global libsigrok context.

Definition at line 241 of file libsigrokcxx.hpp.

Member Function Documentation

◆ package_version()

static string sigrok::Context::package_version ( )
static

libsigrok package version.

◆ lib_version()

static string sigrok::Context::lib_version ( )
static

libsigrok library version.

◆ drivers()

map<string, shared_ptr<Driver> > sigrok::Context::drivers ( )

Available hardware drivers, indexed by name.

◆ input_formats()

map<string, shared_ptr<InputFormat> > sigrok::Context::input_formats ( )

Available input formats, indexed by name.

◆ output_formats()

map<string, shared_ptr<OutputFormat> > sigrok::Context::output_formats ( )

Available output formats, indexed by name.

◆ log_level()

const LogLevel* sigrok::Context::log_level ( ) const

Current log level.

◆ set_log_level()

void sigrok::Context::set_log_level ( const LogLevel level)

Set the log level.

Parameters
levelLogLevel to use.

◆ set_log_callback()

void sigrok::Context::set_log_callback ( LogCallbackFunction  callback)

Set the log callback.

Parameters
callbackCallback of the form callback(LogLevel, string).

◆ set_log_callback_default()

void sigrok::Context::set_log_callback_default ( )

Set the log callback to the default handler.

◆ set_resource_reader()

void sigrok::Context::set_resource_reader ( ResourceReader reader)

Install a delegate for reading resource files.

Parameters
readerThe resource reader delegate, or nullptr to unset.

◆ create_session()

shared_ptr<Session> sigrok::Context::create_session ( )

Create a new session.

◆ create_user_device()

shared_ptr<UserDevice> sigrok::Context::create_user_device ( string  vendor,
string  model,
string  version 
)

Create a new user device.

◆ create_header_packet()

shared_ptr<Packet> sigrok::Context::create_header_packet ( Glib::TimeVal  start_time)

Create a header packet.

◆ create_meta_packet()

shared_ptr<Packet> sigrok::Context::create_meta_packet ( map< const ConfigKey *, Glib::VariantBase >  config)

Create a meta packet.

◆ create_logic_packet()

shared_ptr<Packet> sigrok::Context::create_logic_packet ( void *  data_pointer,
size_t  data_length,
unsigned int  unit_size 
)

Create a logic packet.

◆ create_analog_packet()

shared_ptr<Packet> sigrok::Context::create_analog_packet ( vector< shared_ptr< Channel > >  channels,
float *  data_pointer,
unsigned int  num_samples,
const Quantity mq,
const Unit unit,
vector< const QuantityFlag *>  mqflags 
)

Create an analog packet.

◆ load_session()

shared_ptr<Session> sigrok::Context::load_session ( string  filename)

Load a saved session.

Parameters
filenameFile name string.

◆ create_trigger()

shared_ptr<Trigger> sigrok::Context::create_trigger ( string  name)

Create a new trigger.

Parameters
nameName string for new trigger.

◆ open_file()

shared_ptr<Input> sigrok::Context::open_file ( string  filename)

Open an input file.

Parameters
filenameFile name string.

◆ open_stream()

shared_ptr<Input> sigrok::Context::open_stream ( string  header)

Open an input stream based on header data.

Parameters
headerInitial data from stream.

The documentation for this class was generated from the following file: