libsigrokdecode
0.3.0
sigrok protocol decoding library
|
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, int unit_size) |
Set all channels in a decoder instance. More... | |
struct srd_decoder_inst * | srd_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_inst * | srd_inst_find_by_id (struct srd_session *sess, const char *inst_id) |
Find a decoder instance by its instance ID. More... | |
Decoder instance handling.
int srd_inst_channel_set_all | ( | struct srd_decoder_inst * | di, |
GHashTable * | new_channels, | ||
int | unit_size | ||
) |
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).
di | Decoder instance. |
new_channels | A 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. |
unit_size | Number of bytes per sample in the data stream to be passed to the decoder. The highest channel index specified in the channel map must lie within a sample unit. |
Definition at line 197 of file instance.c.
References srd_decoder::channels, srd_decoder_inst::data_unitsize, 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, SRD_ERR_MALLOC, 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.
Only the bottom level of instances are searched – instances already stacked on top of another one will not be found.
sess | The session holding the protocol decoder instance. |
inst_id | The instance ID to be found. |
Definition at line 442 of file instance.c.
References srd_decoder_inst::inst_id, and SRD_OK.
struct srd_decoder_inst* srd_inst_new | ( | struct srd_session * | sess, |
const char * | decoder_id, | ||
GHashTable * | options | ||
) |
Create a new protocol decoder instance.
sess | The session holding the protocol decoder instance. |
decoder_id | Decoder 'id' field. |
options | GHashtable of options which override the defaults set in the decoder class. May be NULL. |
Definition at line 306 of file instance.c.
References srd_decoder_inst::channel_samples, srd_decoder::channels, srd_decoder_inst::data_unitsize, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_decoder_inst::inst_id, srd_decoder::opt_channels, srd_decoder::py_dec, srd_decoder_inst::py_inst, srd_decoder_inst::sess, srd_decoder_get_by_id(), srd_inst_option_set(), and SRD_OK.
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.
di | Decoder instance. |
options | A GHashTable of options to set. |
Definition at line 64 of file instance.c.
References srd_decoder_inst::decoder, srd_decoder_option::def, 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().
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.
sess | The session holding the protocol decoder instances. |
di_bottom | The instance on top of which di_top will be stacked. |
di_top | The instance to go on top. |
Definition at line 401 of file instance.c.
References srd_decoder_inst::inst_id, srd_decoder_inst::next_di, SRD_ERR_ARG, and SRD_OK.