libsigrokdecode  0.2.0
sigrok protocol decoding library
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
Functions
Decoder instances

Decoder instance handling. More...

Functions

int srd_inst_option_set (struct srd_decoder_inst *di, GHashTable *options)
 Set one or more options in a decoder instance. More...
 
int srd_inst_probe_set_all (struct srd_decoder_inst *di, GHashTable *new_probes)
 Set all probes in a decoder instance. More...
 
struct srd_decoder_instsrd_inst_new (const char *decoder_id, GHashTable *options)
 Create a new protocol decoder instance. More...
 
int srd_inst_stack (struct srd_decoder_inst *di_from, struct srd_decoder_inst *di_to)
 Stack a decoder instance on top of another. More...
 
struct srd_decoder_instsrd_inst_find_by_id (const char *inst_id)
 Find a decoder instance by its instance ID. More...
 

Detailed Description

Decoder instance handling.

Function Documentation

struct srd_decoder_inst* srd_inst_find_by_id ( const char *  inst_id)
read

Find a decoder instance by its instance ID.

Only the bottom level of instances are searched – instances already stacked on top of another one will not be found.

Parameters
inst_idThe instance ID to be found.
Returns
Pointer to struct srd_decoder_inst, or NULL if not found.
Since
0.1.0

Definition at line 641 of file controller.c.

References srd_decoder_inst::inst_id.

struct srd_decoder_inst* srd_inst_new ( const char *  decoder_id,
GHashTable *  options 
)
read

Create a new protocol decoder instance.

Parameters
decoder_idDecoder 'id' field.
optionsGHashtable of options which override the defaults set in the decoder class. May be NULL.
Returns
Pointer to a newly allocated struct srd_decoder_inst, or NULL in case of failure.
Since
0.1.0

Definition at line 533 of file controller.c.

References srd_decoder_inst::dec_num_probes, srd_decoder_inst::dec_probemap, srd_decoder_inst::decoder, srd_decoder_inst::inst_id, srd_decoder::opt_probes, srd_decoder::probes, srd_decoder::py_dec, srd_decoder_inst::py_inst, srd_decoder_get_by_id(), srd_inst_option_set(), and SRD_OK.

+ Here is the call graph for this function:

int srd_inst_option_set ( struct srd_decoder_inst di,
GHashTable *  options 
)

Set one or more options in a decoder instance.

Handled options are removed from the hash.

Parameters
diDecoder instance.
optionsA GHashTable of options to set.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 296 of file controller.c.

References srd_decoder_inst::decoder, srd_decoder::py_dec, srd_decoder_inst::py_inst, SRD_ERR_ARG, SRD_ERR_PYTHON, and SRD_OK.

Referenced by srd_inst_new().

+ Here is the caller graph for this function:

int srd_inst_probe_set_all ( struct srd_decoder_inst di,
GHashTable *  new_probes 
)

Set all probes in a decoder instance.

This function sets all probes for the specified decoder instance, i.e., it overwrites any probes that were already defined (if any).

Parameters
diDecoder instance.
new_probesA GHashTable of probes to set. Key is probe name, value is the probe number. Samples passed to this instance will be arranged in this order.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 441 of file controller.c.

References srd_decoder_inst::dec_num_probes, srd_decoder_inst::dec_probemap, srd_decoder_inst::decoder, srd_probe::id, srd_decoder_inst::inst_id, srd_decoder::name, srd_decoder::opt_probes, srd_probe::order, srd_decoder::probes, SRD_ERR_ARG, SRD_ERR_MALLOC, and SRD_OK.

int srd_inst_stack ( struct srd_decoder_inst di_from,
struct srd_decoder_inst di_to 
)

Stack a decoder instance on top of another.

Parameters
di_fromThe instance to move.
di_toThe instance on top of which di_from will be stacked.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 610 of file controller.c.

References srd_decoder_inst::next_di, SRD_ERR_ARG, and SRD_OK.