libsigrok  0.4.0
sigrok hardware access and backend library
Functions
Output modules

Output module handling. More...

Functions

const struct sr_output_module ** sr_output_list (void)
 Returns a NULL-terminated list of all available output modules. More...
 
const char * sr_output_id_get (const struct sr_output_module *omod)
 Returns the specified output module's ID. More...
 
const char * sr_output_name_get (const struct sr_output_module *omod)
 Returns the specified output module's name. More...
 
const char * sr_output_description_get (const struct sr_output_module *omod)
 Returns the specified output module's description. More...
 
const char *const * sr_output_extensions_get (const struct sr_output_module *omod)
 Returns the specified output module's file extensions typical for the file format, as a NULL terminated array, or returns a NULL pointer if there is no preferred extension. More...
 
gboolean sr_output_test_flag (const struct sr_output_module *omod, uint64_t flag)
 
const struct sr_output_module * sr_output_find (char *id)
 Return the output module with the specified ID, or NULL if no module with that id is found. More...
 
const struct sr_option ** sr_output_options_get (const struct sr_output_module *omod)
 Returns a NULL-terminated array of struct sr_option, or NULL if the module takes no options. More...
 
void sr_output_options_free (const struct sr_option **options)
 After a call to sr_output_options_get(), this function cleans up all resources returned by that call. More...
 
const struct sr_output * sr_output_new (const struct sr_output_module *omod, GHashTable *options, const struct sr_dev_inst *sdi, const char *filename)
 Create a new output instance using the specified output module. More...
 
int sr_output_send (const struct sr_output *o, const struct sr_datafeed_packet *packet, GString **out)
 Send a packet to the specified output instance. More...
 
int sr_output_free (const struct sr_output *o)
 Free the specified output instance and all associated resources. More...
 

Detailed Description

Output module handling.

libsigrok supports several output modules for file formats such as binary, VCD, gnuplot, and so on. It provides an output API that frontends can use. New output modules can be added/implemented in libsigrok without having to change the frontends at all.

All output modules are fed data in a stream. Devices that can stream data into libsigrok, instead of storing and then transferring the whole buffer, can thus generate output live.

Output modules generate a newly allocated GString. The caller is then expected to free this with g_string_free() when finished with it.

Function Documentation

const char* sr_output_description_get ( const struct sr_output_module *  omod)

Returns the specified output module's description.

Since
0.4.0

Definition at line 131 of file output.c.

const char* const* sr_output_extensions_get ( const struct sr_output_module *  omod)

Returns the specified output module's file extensions typical for the file format, as a NULL terminated array, or returns a NULL pointer if there is no preferred extension.

Note
these are a suggestions only.
Since
0.4.0

Definition at line 149 of file output.c.

const struct sr_output_module* sr_output_find ( char *  id)

Return the output module with the specified ID, or NULL if no module with that id is found.

Since
0.4.0

Definition at line 178 of file output.c.

int sr_output_free ( const struct sr_output *  o)

Free the specified output instance and all associated resources.

Since
0.4.0

Definition at line 345 of file output.c.

References SR_ERR_ARG, and SR_OK.

const char* sr_output_id_get ( const struct sr_output_module *  omod)

Returns the specified output module's ID.

Since
0.4.0

Definition at line 101 of file output.c.

const struct sr_output_module** sr_output_list ( void  )

Returns a NULL-terminated list of all available output modules.

Since
0.4.0

Definition at line 91 of file output.c.

const char* sr_output_name_get ( const struct sr_output_module *  omod)

Returns the specified output module's name.

Since
0.4.0

Definition at line 116 of file output.c.

const struct sr_output* sr_output_new ( const struct sr_output_module *  omod,
GHashTable *  options,
const struct sr_dev_inst *  sdi,
const char *  filename 
)

Create a new output instance using the specified output module.

options is a *HashTable with the keys corresponding with the module options' id field. The values should be GVariant pointers with sunk * references, of the same GVariantType as the option's default value.

The sr_dev_inst passed in can be used by the instance to determine channel names, samplerate, and so on.

Since
0.4.0

Definition at line 260 of file output.c.

References sr_option::def, sr_option::id, and SR_OK.

void sr_output_options_free ( const struct sr_option **  options)

After a call to sr_output_options_get(), this function cleans up all resources returned by that call.

Since
0.4.0

Definition at line 226 of file output.c.

References sr_option::def, and sr_option::values.

const struct sr_option** sr_output_options_get ( const struct sr_output_module *  omod)

Returns a NULL-terminated array of struct sr_option, or NULL if the module takes no options.

Each call to this function must be followed by a call to sr_output_options_free().

Since
0.4.0

Definition at line 199 of file output.c.

References sr_option::id.

int sr_output_send ( const struct sr_output *  o,
const struct sr_datafeed_packet packet,
GString **  out 
)

Send a packet to the specified output instance.

The instance's output is returned as a newly allocated GString, which must be freed by the caller.

Since
0.4.0

Definition at line 334 of file output.c.

gboolean sr_output_test_flag ( const struct sr_output_module *  omod,
uint64_t  flag 
)

Definition at line 166 of file output.c.