libsigrokdecode  0.4.0
sigrok protocol decoding library
Data Structures | Macros | Typedefs | Enumerations | Functions
libsigrokdecode.h File Reference

The public libsigrokdecode header file to be used by frontends. More...

#include <stdint.h>
#include <glib.h>
#include "version.h"
+ Include dependency graph for libsigrokdecode.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  srd_decoder
 
struct  srd_channel
 Structure which contains information about one protocol decoder channel. More...
 
struct  srd_decoder_option
 
struct  srd_decoder_annotation_row
 
struct  srd_decoder_inst
 
struct  srd_pd_output
 
struct  srd_proto_data
 
struct  srd_proto_data_annotation
 
struct  srd_proto_data_binary
 
struct  srd_pd_callback
 

Macros

#define SRD_API   __attribute__((visibility("default")))
 
#define SRD_PRIV   __attribute__((visibility("hidden")))
 

Typedefs

typedef void(* srd_pd_output_callback) (struct srd_proto_data *pdata, void *cb_data)
 
typedef int(* srd_log_callback) (void *cb_data, int loglevel, const char *format, va_list args)
 

Enumerations

enum  srd_error_code {
  SRD_OK = 0,
  SRD_ERR = -1,
  SRD_ERR_MALLOC = -2,
  SRD_ERR_ARG = -3,
  SRD_ERR_BUG = -4,
  SRD_ERR_PYTHON = -5,
  SRD_ERR_DECODERS_DIR = -6
}
 Status/error codes returned by libsigrokdecode functions. More...
 
enum  srd_loglevel {
  SRD_LOG_NONE = 0,
  SRD_LOG_ERR = 1,
  SRD_LOG_WARN = 2,
  SRD_LOG_INFO = 3,
  SRD_LOG_DBG = 4,
  SRD_LOG_SPEW = 5
}
 
enum  srd_output_type {
  SRD_OUTPUT_ANN,
  SRD_OUTPUT_PYTHON,
  SRD_OUTPUT_BINARY,
  SRD_OUTPUT_META
}
 
enum  srd_configkey { SRD_CONF_SAMPLERATE = 10000 }
 

Functions

int srd_init (const char *path)
 Initialize libsigrokdecode. More...
 
int srd_exit (void)
 Shutdown libsigrokdecode. More...
 
int srd_session_new (struct srd_session **sess)
 Create a decoding session. More...
 
int srd_session_start (struct srd_session *sess)
 Start a decoding session. More...
 
int srd_session_metadata_set (struct srd_session *sess, int key, GVariant *data)
 Set a metadata configuration key in a session. More...
 
int srd_session_send (struct srd_session *sess, uint64_t start_samplenum, uint64_t end_samplenum, const uint8_t *inbuf, uint64_t inbuflen, uint64_t unitsize)
 Send a chunk of logic sample data to a running decoder session. More...
 
int srd_session_destroy (struct srd_session *sess)
 Destroy a decoding session. More...
 
int srd_pd_output_callback_add (struct srd_session *sess, int output_type, srd_pd_output_callback cb, void *cb_data)
 Register/add a decoder output callback function. More...
 
const GSList * srd_decoder_list (void)
 Returns the list of loaded protocol decoders. More...
 
struct srd_decodersrd_decoder_get_by_id (const char *id)
 Get the decoder with the specified ID. More...
 
int srd_decoder_load (const char *name)
 Load a protocol decoder module into the embedded Python interpreter. More...
 
char * srd_decoder_doc_get (const struct srd_decoder *dec)
 Return a protocol decoder's docstring. More...
 
int srd_decoder_unload (struct srd_decoder *dec)
 Unload the specified protocol decoder. More...
 
int srd_decoder_load_all (void)
 Load all installed protocol decoders. More...
 
int srd_decoder_unload_all (void)
 Unload all loaded protocol decoders. More...
 
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 *channels)
 Set all channels in a decoder instance. More...
 
struct srd_decoder_instsrd_inst_new (struct srd_session *sess, const char *id, GHashTable *options)
 Create a new protocol decoder instance. More...
 
int srd_inst_stack (struct srd_session *sess, 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 (struct srd_session *sess, const char *inst_id)
 Find a decoder instance by its instance ID. More...
 
int srd_log_loglevel_set (int loglevel)
 Set the libsigrokdecode loglevel. More...
 
int srd_log_loglevel_get (void)
 Get the libsigrokdecode loglevel. More...
 
int srd_log_callback_set (srd_log_callback cb, void *cb_data)
 Set the libsigrokdecode log callback to the specified function. More...
 
int srd_log_callback_set_default (void)
 Set the libsigrokdecode log callback to the default built-in one. More...
 
const char * srd_strerror (int error_code)
 Return a human-readable error string for the given libsigrokdecode error code. More...
 
const char * srd_strerror_name (int error_code)
 Return the "name" string of the given libsigrokdecode error code. More...
 
int srd_package_version_major_get (void)
 Get the major libsigrokdecode package version number. More...
 
int srd_package_version_minor_get (void)
 Get the minor libsigrokdecode package version number. More...
 
int srd_package_version_micro_get (void)
 Get the micro libsigrokdecode package version number. More...
 
const char * srd_package_version_string_get (void)
 Get the libsigrokdecode package version number as a string. More...
 
int srd_lib_version_current_get (void)
 Get the "current" part of the libsigrokdecode library version number. More...
 
int srd_lib_version_revision_get (void)
 Get the "revision" part of the libsigrokdecode library version number. More...
 
int srd_lib_version_age_get (void)
 Get the "age" part of the libsigrokdecode library version number. More...
 
const char * srd_lib_version_string_get (void)
 Get the libsigrokdecode library version number as a string. More...
 

Detailed Description

The public libsigrokdecode header file to be used by frontends.

This is the only file that libsigrokdecode users (frontends) are supposed to use and include. There are other header files which get installed with libsigrokdecode, but those are not meant to be used directly by frontends.

The correct way to get/use the libsigrokdecode API functions is:

#include <libsigrokdecode/libsigrokdecode.h>

Definition in file libsigrokdecode.h.

Macro Definition Documentation

#define SRD_API   __attribute__((visibility("default")))

Definition at line 110 of file libsigrokdecode.h.

#define SRD_PRIV   __attribute__((visibility("hidden")))

Definition at line 117 of file libsigrokdecode.h.

Typedef Documentation

typedef int(* srd_log_callback) (void *cb_data, int loglevel, const char *format, va_list args)

Definition at line 307 of file libsigrokdecode.h.

typedef void(* srd_pd_output_callback) (struct srd_proto_data *pdata, void *cb_data)

Definition at line 260 of file libsigrokdecode.h.

Enumeration Type Documentation

Enumerator
SRD_CONF_SAMPLERATE 

Definition at line 135 of file libsigrokdecode.h.

Status/error codes returned by libsigrokdecode functions.

Enumerator
SRD_OK 

No error.

SRD_ERR 

Generic/unspecified error.

SRD_ERR_MALLOC 

Malloc/calloc/realloc error.

SRD_ERR_ARG 

Function argument error.

SRD_ERR_BUG 

Errors hinting at internal bugs.

SRD_ERR_PYTHON 

Python C API error.

SRD_ERR_DECODERS_DIR 

Protocol decoder path invalid.

Definition at line 67 of file libsigrokdecode.h.

Enumerator
SRD_LOG_NONE 

Output no messages at all.

SRD_LOG_ERR 

Output error messages.

SRD_LOG_WARN 

Output warnings.

SRD_LOG_INFO 

Output informational messages.

SRD_LOG_DBG 

Output debug messages.

SRD_LOG_SPEW 

Output very noisy debug messages.

Definition at line 83 of file libsigrokdecode.h.

Enumerator
SRD_OUTPUT_ANN 
SRD_OUTPUT_PYTHON 
SRD_OUTPUT_BINARY 
SRD_OUTPUT_META 

Definition at line 128 of file libsigrokdecode.h.