libsigrokdecode
 All Data Structures Files Functions Variables Typedefs Enumerator Macros
Functions | Variables
decoder.c File Reference
#include "config.h"
#include "sigrokdecode.h"
#include "sigrokdecode-internal.h"
#include <glib.h>
Include dependency graph for decoder.c:

Go to the source code of this file.

Functions

SRD_API GSList * srd_decoder_list (void)
 Returns the list of supported/loaded protocol decoders. More...
 
SRD_API struct srd_decodersrd_decoder_get_by_id (const char *id)
 Get the decoder with the specified ID. More...
 
SRD_API int srd_decoder_load (const char *module_name)
 Load a protocol decoder module into the embedded Python interpreter. More...
 
SRD_API char * srd_decoder_doc_get (const struct srd_decoder *dec)
 Return a protocol decoder's docstring. More...
 
SRD_API int srd_decoder_unload (struct srd_decoder *dec)
 Unload decoder module. More...
 
SRD_API int srd_decoder_load_all (void)
 Load all installed protocol decoders. More...
 
SRD_API int srd_decoder_unload_all (void)
 Unload all loaded protocol decoders. More...
 

Variables

SRD_PRIV GSList * pd_list = NULL
 
SRD_PRIV PyObject * mod_sigrokdecode
 

Function Documentation

SRD_API char* srd_decoder_doc_get ( const struct srd_decoder dec)

Return a protocol decoder's docstring.

Parameters
decThe loaded protocol decoder.
Returns
A newly allocated buffer containing the protocol decoder's documentation. The caller is responsible for free'ing the buffer.

Definition at line 292 of file decoder.c.

References srd_decoder::py_mod, py_str_as_str(), and srd_exception_catch().

Here is the call graph for this function:

SRD_API struct srd_decoder* srd_decoder_get_by_id ( const char *  id)
read

Get the decoder with the specified ID.

Parameters
idThe ID string of the decoder to return.
Returns
The decoder with the specified ID, or NULL if not found.

Definition at line 51 of file decoder.c.

References srd_decoder::id, and srd_decoder_list().

Referenced by srd_inst_new().

Here is the call graph for this function:

SRD_API GSList* srd_decoder_list ( void  )

Returns the list of supported/loaded protocol decoders.

This is a GSList containing the names of the decoders as strings.

Returns
List of decoders, NULL if none are supported or loaded.

Definition at line 39 of file decoder.c.

References pd_list.

Referenced by srd_decoder_get_by_id(), and srd_decoder_unload_all().

SRD_API int srd_decoder_load ( const char *  module_name)

Load a protocol decoder module into the embedded Python interpreter.

Parameters
nameThe module name to be loaded.
Returns
SRD_OK upon success, a (negative) error code otherwise.

Definition at line 131 of file decoder.c.

References srd_decoder::annotations, srd_decoder::desc, srd_decoder::id, srd_decoder::license, srd_decoder::longname, mod_sigrokdecode, srd_decoder::name, srd_decoder::opt_probes, pd_list, srd_decoder::probes, py_attr_as_str(), srd_decoder::py_dec, srd_decoder::py_mod, py_strlist_to_char(), srd_dbg(), srd_err(), SRD_ERR_MALLOC, SRD_ERR_PYTHON, srd_exception_catch(), and SRD_OK.

Referenced by srd_decoder_load_all().

Here is the call graph for this function:

SRD_API int srd_decoder_load_all ( void  )

Load all installed protocol decoders.

Returns
SRD_OK upon success, a (negative) error code otherwise.

Definition at line 373 of file decoder.c.

References srd_decoder_load(), srd_err(), SRD_ERR_DECODERS_DIR, and SRD_OK.

Here is the call graph for this function:

SRD_API int srd_decoder_unload ( struct srd_decoder dec)

Unload decoder module.

Parameters
decThe struct srd_decoder to be unloaded.
Returns
SRD_OK upon success, a (negative) error code otherwise.

Definition at line 338 of file decoder.c.

References srd_decoder::desc, srd_decoder::id, srd_decoder::license, srd_decoder::longname, srd_decoder::name, srd_decoder::opt_probes, srd_decoder::probes, srd_decoder::py_dec, srd_decoder::py_mod, srd_dbg(), srd_inst_free_all(), and SRD_OK.

Referenced by srd_decoder_unload_all().

Here is the call graph for this function:

SRD_API int srd_decoder_unload_all ( void  )

Unload all loaded protocol decoders.

Returns
SRD_OK upon success, a (negative) error code otherwise.

Definition at line 398 of file decoder.c.

References srd_decoder_list(), srd_decoder_unload(), and SRD_OK.

Referenced by srd_exit().

Here is the call graph for this function:

Variable Documentation

SRD_PRIV PyObject* mod_sigrokdecode

Definition at line 34 of file module_sigrokdecode.c.

Referenced by PyInit_sigrokdecode(), and srd_decoder_load().

SRD_PRIV GSList* pd_list = NULL

Definition at line 27 of file decoder.c.

Referenced by srd_decoder_list(), srd_decoder_load(), and srd_exit().