libsigrokdecode  unreleased development snapshot
sigrok protocol decoding library
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_channel_set_all (struct srd_decoder_inst *di, GHashTable *new_channels)
 Set all channels in a decoder instance. More...
 
struct srd_decoder_instsrd_inst_new (struct srd_session *sess, const char *decoder_id, GHashTable *options)
 Create a new protocol decoder instance. More...
 
int srd_inst_stack (struct srd_session *sess, struct srd_decoder_inst *di_bottom, struct srd_decoder_inst *di_top)
 Stack a decoder instance on top of another. More...
 
struct srd_decoder_instsrd_inst_find_by_id (struct srd_session *sess, const char *inst_id)
 Find a decoder instance by its instance ID. More...
 
int srd_inst_initial_pins_set_all (struct srd_decoder_inst *di, GArray *initial_pins)
 Set the list of initial (assumed) pin values. More...
 

Detailed Description

Decoder instance handling.

Function Documentation

int srd_inst_channel_set_all ( struct srd_decoder_inst di,
GHashTable *  new_channels 
)

Set all channels in a decoder instance.

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

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

Definition at line 231 of file instance.c.

References srd_decoder::channels, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_channel::id, srd_decoder_inst::inst_id, srd_decoder::name, srd_decoder::opt_channels, srd_channel::order, SRD_ERR, SRD_ERR_ARG, and SRD_OK.

struct srd_decoder_inst* srd_inst_find_by_id ( struct srd_session *  sess,
const char *  inst_id 
)

Find a decoder instance by its instance ID.

This will recurse to find the instance anywhere in the stack tree of the given session.

Parameters
sessThe session holding the protocol decoder instance. Must not be NULL.
inst_idThe instance ID to be found.
Returns
Pointer to struct srd_decoder_inst, or NULL if not found.
Since
0.3.0

Definition at line 613 of file instance.c.

Referenced by srd_inst_new().

+ Here is the caller graph for this function:

int srd_inst_initial_pins_set_all ( struct srd_decoder_inst di,
GArray *  initial_pins 
)
struct srd_decoder_inst* srd_inst_new ( struct srd_session *  sess,
const char *  decoder_id,
GHashTable *  options 
)
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 92 of file instance.c.

References srd_decoder_inst::decoder, srd_decoder_option::def, srd_channel::id, srd_decoder_option::id, srd_decoder_inst::inst_id, srd_decoder::options, 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_stack ( struct srd_session *  sess,
struct srd_decoder_inst di_bottom,
struct srd_decoder_inst di_top 
)

Stack a decoder instance on top of another.

Parameters
sessThe session holding the protocol decoder instances. Must not be NULL.
di_bottomThe instance on top of which di_top will be stacked.
di_topThe instance to go on top.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.3.0

Definition at line 521 of file instance.c.

References srd_decoder_inst::decoder, FALSE, srd_decoder::inputs, srd_decoder_inst::inst_id, srd_decoder_inst::next_di, srd_decoder::outputs, SRD_ERR_ARG, SRD_OK, and TRUE.