libsigrokdecode  0.4.0
sigrok protocol decoding library
Functions
Initialization

Initializing and shutting down libsigrokdecode. More...

Functions

int srd_init (const char *path)
 Initialize libsigrokdecode. More...
 
int srd_exit (void)
 Shutdown libsigrokdecode. More...
 

Detailed Description

Initializing and shutting down libsigrokdecode.

Before using any of the libsigrokdecode functionality, srd_init() must be called to initialize the library.

When libsigrokdecode functionality is no longer needed, srd_exit() should be called.

Function Documentation

int srd_exit ( void  )

Shutdown libsigrokdecode.

This frees all the memory allocated for protocol decoders and shuts down the Python interpreter.

This function should only be called if there was a (successful!) invocation of srd_init() before. Calling this function multiple times in a row, without any successful srd_init() calls in between, is not allowed.

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

Definition at line 220 of file srd.c.

References srd_decoder_unload_all(), SRD_OK, and srd_session_destroy().

+ Here is the call graph for this function:

int srd_init ( const char *  path)

Initialize libsigrokdecode.

This initializes the Python interpreter, and creates and initializes a "sigrokdecode" Python module.

Then, it searches for sigrok protocol decoders in the "decoders" subdirectory of the the libsigrokdecode installation directory. All decoders that are found are loaded into memory and added to an internal list of decoders, which can be queried via srd_decoder_list().

The caller is responsible for calling the clean-up function srd_exit(), which will properly shut down libsigrokdecode and free its allocated memory.

Multiple calls to srd_init(), without calling srd_exit() in between, are not allowed.

Parameters
pathPath to an extra directory containing protocol decoders which will be added to the Python sys.path. May be NULL.
Returns
SRD_OK upon success, a (negative) error code otherwise. Upon Python errors, SRD_ERR_PYTHON is returned. If the decoders directory cannot be accessed, SRD_ERR_DECODERS_DIR is returned. If not enough memory could be allocated, SRD_ERR_MALLOC is returned.
Since
0.1.0

Definition at line 142 of file srd.c.

References SRD_ERR, and SRD_OK.