libsigrok  0.4.0
sigrok hardware access and backend library
Data Structures | Macros | Typedefs | Enumerations
libsigrok.h File Reference

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

#include <stdio.h>
#include <sys/time.h>
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
#include <libsigrok/proto.h>
#include <libsigrok/version.h>
+ Include dependency graph for libsigrok.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sr_trigger
 The representation of a trigger, consisting of one or more stages containing one or more matches on a channel. More...
 
struct  sr_trigger_stage
 A trigger stage. More...
 
struct  sr_trigger_match
 A channel to match and what to match it on. More...
 
struct  sr_rational
 
struct  sr_datafeed_packet
 Packet in a sigrok data feed. More...
 
struct  sr_datafeed_header
 Header of a sigrok data feed. More...
 
struct  sr_datafeed_meta
 Datafeed payload for type SR_DF_META. More...
 
struct  sr_datafeed_logic
 Logic datafeed payload for type SR_DF_LOGIC. More...
 
struct  sr_datafeed_analog_old
 Analog datafeed payload for type SR_DF_ANALOG_OLD. More...
 
struct  sr_datafeed_analog
 Analog datafeed payload for type SR_DF_ANALOG. More...
 
struct  sr_analog_encoding
 
struct  sr_analog_meaning
 
struct  sr_analog_spec
 
struct  sr_option
 Generic option struct used by various subsystems. More...
 
struct  sr_resource
 Resource descriptor. More...
 
struct  sr_channel
 Information on single channel. More...
 
struct  sr_channel_group
 Structure for groups of channels that have common properties. More...
 
struct  sr_config
 Used for setting or getting value of a config item. More...
 
struct  sr_key_info
 Information about a key. More...
 
struct  sr_dev_driver
 Device driver data. More...
 
struct  sr_serial_port
 Serial port descriptor. More...
 

Macros

#define SR_MAX_CHANNELNAME_LEN   32
 
#define SR_HZ(n)   (n)
 
#define SR_KHZ(n)   ((n) * (uint64_t)(1000ULL))
 
#define SR_MHZ(n)   ((n) * (uint64_t)(1000000ULL))
 
#define SR_GHZ(n)   ((n) * (uint64_t)(1000000000ULL))
 
#define SR_HZ_TO_NS(n)   ((uint64_t)(1000000000ULL) / (n))
 
#define SR_API   __attribute__((visibility("default")))
 
#define SR_PRIV   __attribute__((visibility("hidden")))
 

Typedefs

typedef int(* sr_receive_data_callback) (int fd, int revents, void *cb_data)
 Type definition for callback function for data reception. More...
 

Enumerations

enum  sr_error_code {
  SR_OK = 0,
  SR_ERR = -1,
  SR_ERR_MALLOC = -2,
  SR_ERR_ARG = -3,
  SR_ERR_BUG = -4,
  SR_ERR_SAMPLERATE = -5,
  SR_ERR_NA = -6,
  SR_ERR_DEV_CLOSED = -7,
  SR_ERR_TIMEOUT = -8,
  SR_ERR_CHANNEL_GROUP = -9,
  SR_ERR_DATA =-10,
  SR_ERR_IO =-11
}
 Status/error codes returned by libsigrok functions. More...
 
enum  sr_loglevel {
  SR_LOG_NONE = 0,
  SR_LOG_ERR = 1,
  SR_LOG_WARN = 2,
  SR_LOG_INFO = 3,
  SR_LOG_DBG = 4,
  SR_LOG_SPEW = 5
}
 libsigrok loglevels. More...
 
enum  sr_datatype {
  SR_T_UINT64 = 10000,
  SR_T_STRING,
  SR_T_BOOL,
  SR_T_FLOAT,
  SR_T_RATIONAL_PERIOD,
  SR_T_RATIONAL_VOLT,
  SR_T_KEYVALUE,
  SR_T_UINT64_RANGE,
  SR_T_DOUBLE_RANGE,
  SR_T_INT32,
  SR_T_MQ
}
 Data types used by sr_config_info(). More...
 
enum  sr_packettype {
  SR_DF_HEADER = 10000,
  SR_DF_END,
  SR_DF_META,
  SR_DF_TRIGGER,
  SR_DF_LOGIC,
  SR_DF_ANALOG_OLD,
  SR_DF_FRAME_BEGIN,
  SR_DF_FRAME_END,
  SR_DF_ANALOG
}
 Value for sr_datafeed_packet.type. More...
 
enum  sr_mq {
  SR_MQ_VOLTAGE = 10000,
  SR_MQ_CURRENT,
  SR_MQ_RESISTANCE,
  SR_MQ_CAPACITANCE,
  SR_MQ_TEMPERATURE,
  SR_MQ_FREQUENCY,
  SR_MQ_DUTY_CYCLE,
  SR_MQ_CONTINUITY,
  SR_MQ_PULSE_WIDTH,
  SR_MQ_CONDUCTANCE,
  SR_MQ_POWER,
  SR_MQ_GAIN,
  SR_MQ_SOUND_PRESSURE_LEVEL,
  SR_MQ_CARBON_MONOXIDE,
  SR_MQ_RELATIVE_HUMIDITY,
  SR_MQ_TIME,
  SR_MQ_WIND_SPEED,
  SR_MQ_PRESSURE,
  SR_MQ_PARALLEL_INDUCTANCE,
  SR_MQ_PARALLEL_CAPACITANCE,
  SR_MQ_PARALLEL_RESISTANCE,
  SR_MQ_SERIES_INDUCTANCE,
  SR_MQ_SERIES_CAPACITANCE,
  SR_MQ_SERIES_RESISTANCE,
  SR_MQ_DISSIPATION_FACTOR,
  SR_MQ_QUALITY_FACTOR,
  SR_MQ_PHASE_ANGLE,
  SR_MQ_DIFFERENCE,
  SR_MQ_COUNT,
  SR_MQ_POWER_FACTOR,
  SR_MQ_APPARENT_POWER,
  SR_MQ_MASS
}
 Measured quantity, sr_analog_meaning.mq. More...
 
enum  sr_unit {
  SR_UNIT_VOLT = 10000,
  SR_UNIT_AMPERE,
  SR_UNIT_OHM,
  SR_UNIT_FARAD,
  SR_UNIT_KELVIN,
  SR_UNIT_CELSIUS,
  SR_UNIT_FAHRENHEIT,
  SR_UNIT_HERTZ,
  SR_UNIT_PERCENTAGE,
  SR_UNIT_BOOLEAN,
  SR_UNIT_SECOND,
  SR_UNIT_SIEMENS,
  SR_UNIT_DECIBEL_MW,
  SR_UNIT_DECIBEL_VOLT,
  SR_UNIT_UNITLESS,
  SR_UNIT_DECIBEL_SPL,
  SR_UNIT_CONCENTRATION,
  SR_UNIT_REVOLUTIONS_PER_MINUTE,
  SR_UNIT_VOLT_AMPERE,
  SR_UNIT_WATT,
  SR_UNIT_WATT_HOUR,
  SR_UNIT_METER_SECOND,
  SR_UNIT_HECTOPASCAL,
  SR_UNIT_HUMIDITY_293K,
  SR_UNIT_DEGREE,
  SR_UNIT_HENRY,
  SR_UNIT_GRAM,
  SR_UNIT_CARAT,
  SR_UNIT_OUNCE,
  SR_UNIT_TROY_OUNCE,
  SR_UNIT_POUND,
  SR_UNIT_PENNYWEIGHT,
  SR_UNIT_GRAIN,
  SR_UNIT_TAEL,
  SR_UNIT_MOMME,
  SR_UNIT_TOLA,
  SR_UNIT_PIECE
}
 Unit of measured quantity, sr_analog_meaning.unit. More...
 
enum  sr_mqflag {
  SR_MQFLAG_AC = 0x01,
  SR_MQFLAG_DC = 0x02,
  SR_MQFLAG_RMS = 0x04,
  SR_MQFLAG_DIODE = 0x08,
  SR_MQFLAG_HOLD = 0x10,
  SR_MQFLAG_MAX = 0x20,
  SR_MQFLAG_MIN = 0x40,
  SR_MQFLAG_AUTORANGE = 0x80,
  SR_MQFLAG_RELATIVE = 0x100,
  SR_MQFLAG_SPL_FREQ_WEIGHT_A = 0x200,
  SR_MQFLAG_SPL_FREQ_WEIGHT_C = 0x400,
  SR_MQFLAG_SPL_FREQ_WEIGHT_Z = 0x800,
  SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT = 0x1000,
  SR_MQFLAG_SPL_TIME_WEIGHT_S = 0x2000,
  SR_MQFLAG_SPL_TIME_WEIGHT_F = 0x4000,
  SR_MQFLAG_SPL_LAT = 0x8000,
  SR_MQFLAG_SPL_PCT_OVER_ALARM = 0x10000,
  SR_MQFLAG_DURATION = 0x20000,
  SR_MQFLAG_AVG = 0x40000,
  SR_MQFLAG_REFERENCE = 0x80000,
  SR_MQFLAG_UNSTABLE = 0x100000
}
 Values for sr_analog_meaning.mqflags. More...
 
enum  sr_trigger_matches {
  SR_TRIGGER_ZERO = 1,
  SR_TRIGGER_ONE,
  SR_TRIGGER_RISING,
  SR_TRIGGER_FALLING,
  SR_TRIGGER_EDGE,
  SR_TRIGGER_OVER,
  SR_TRIGGER_UNDER
}
 
enum  sr_resource_type { SR_RESOURCE_FIRMWARE = 1 }
 Resource type. More...
 
enum  sr_output_flag { SR_OUTPUT_INTERNAL_IO_HANDLING = 0x01 }
 Output module flags. More...
 
enum  sr_channeltype {
  SR_CHANNEL_LOGIC = 10000,
  SR_CHANNEL_ANALOG
}
 Constants for channel type. More...
 
enum  sr_keytype {
  SR_KEY_CONFIG,
  SR_KEY_MQ,
  SR_KEY_MQFLAGS
}
 
enum  sr_configcap {
  SR_CONF_GET = (1 << 31),
  SR_CONF_SET = (1 << 30),
  SR_CONF_LIST = (1 << 29)
}
 Configuration capabilities. More...
 
enum  sr_configkey {
  SR_CONF_LOGIC_ANALYZER = 10000,
  SR_CONF_OSCILLOSCOPE,
  SR_CONF_MULTIMETER,
  SR_CONF_DEMO_DEV,
  SR_CONF_SOUNDLEVELMETER,
  SR_CONF_THERMOMETER,
  SR_CONF_HYGROMETER,
  SR_CONF_ENERGYMETER,
  SR_CONF_DEMODULATOR,
  SR_CONF_POWER_SUPPLY,
  SR_CONF_LCRMETER,
  SR_CONF_ELECTRONIC_LOAD,
  SR_CONF_SCALE,
  SR_CONF_CONN = 20000,
  SR_CONF_SERIALCOMM,
  SR_CONF_MODBUSADDR,
  SR_CONF_SAMPLERATE = 30000,
  SR_CONF_CAPTURE_RATIO,
  SR_CONF_PATTERN_MODE,
  SR_CONF_RLE,
  SR_CONF_TRIGGER_SLOPE,
  SR_CONF_AVERAGING,
  SR_CONF_AVG_SAMPLES,
  SR_CONF_TRIGGER_SOURCE,
  SR_CONF_HORIZ_TRIGGERPOS,
  SR_CONF_BUFFERSIZE,
  SR_CONF_TIMEBASE,
  SR_CONF_FILTER,
  SR_CONF_VDIV,
  SR_CONF_COUPLING,
  SR_CONF_TRIGGER_MATCH,
  SR_CONF_SAMPLE_INTERVAL,
  SR_CONF_NUM_HDIV,
  SR_CONF_NUM_VDIV,
  SR_CONF_SPL_WEIGHT_FREQ,
  SR_CONF_SPL_WEIGHT_TIME,
  SR_CONF_SPL_MEASUREMENT_RANGE,
  SR_CONF_HOLD_MAX,
  SR_CONF_HOLD_MIN,
  SR_CONF_VOLTAGE_THRESHOLD,
  SR_CONF_EXTERNAL_CLOCK,
  SR_CONF_SWAP,
  SR_CONF_CENTER_FREQUENCY,
  SR_CONF_NUM_LOGIC_CHANNELS,
  SR_CONF_NUM_ANALOG_CHANNELS,
  SR_CONF_VOLTAGE,
  SR_CONF_VOLTAGE_TARGET,
  SR_CONF_CURRENT,
  SR_CONF_CURRENT_LIMIT,
  SR_CONF_ENABLED,
  SR_CONF_CHANNEL_CONFIG,
  SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED,
  SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
  SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD,
  SR_CONF_OVER_CURRENT_PROTECTION_ENABLED,
  SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE,
  SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD,
  SR_CONF_CLOCK_EDGE,
  SR_CONF_AMPLITUDE,
  SR_CONF_REGULATION,
  SR_CONF_OVER_TEMPERATURE_PROTECTION,
  SR_CONF_OUTPUT_FREQUENCY,
  SR_CONF_OUTPUT_FREQUENCY_TARGET,
  SR_CONF_MEASURED_QUANTITY,
  SR_CONF_EQUIV_CIRCUIT_MODEL,
  SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE,
  SR_CONF_SESSIONFILE = 40000,
  SR_CONF_CAPTUREFILE,
  SR_CONF_CAPTURE_UNITSIZE,
  SR_CONF_POWER_OFF,
  SR_CONF_DATA_SOURCE,
  SR_CONF_PROBE_FACTOR,
  SR_CONF_LIMIT_MSEC = 50000,
  SR_CONF_LIMIT_SAMPLES,
  SR_CONF_LIMIT_FRAMES,
  SR_CONF_CONTINUOUS,
  SR_CONF_DATALOG,
  SR_CONF_DEVICE_MODE,
  SR_CONF_TEST_MODE
}
 Configuration keys. More...
 
enum  sr_dev_inst_type {
  SR_INST_USB = 10000,
  SR_INST_SERIAL,
  SR_INST_SCPI,
  SR_INST_USER,
  SR_INST_MODBUS
}
 Types of device instance, struct sr_dev_inst.type. More...
 
enum  sr_dev_inst_status {
  SR_ST_NOT_FOUND = 10000,
  SR_ST_INITIALIZING,
  SR_ST_INACTIVE,
  SR_ST_ACTIVE,
  SR_ST_STOPPING
}
 Device instance status, struct sr_dev_inst.status. More...
 

Detailed Description

The public libsigrok header file to be used by frontends.

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

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

Definition in file libsigrok.h.

Macro Definition Documentation

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

Definition at line 121 of file libsigrok.h.

#define SR_GHZ (   n)    ((n) * (uint64_t)(1000000000ULL))

Definition at line 89 of file libsigrok.h.

Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().

#define SR_HZ (   n)    (n)

Definition at line 86 of file libsigrok.h.

Referenced by sr_si_string_u64().

#define SR_HZ_TO_NS (   n)    ((uint64_t)(1000000000ULL) / (n))

Definition at line 91 of file libsigrok.h.

#define SR_KHZ (   n)    ((n) * (uint64_t)(1000ULL))

Definition at line 87 of file libsigrok.h.

Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().

#define SR_MAX_CHANNELNAME_LEN   32

Definition at line 83 of file libsigrok.h.

Referenced by sr_session_load().

#define SR_MHZ (   n)    ((n) * (uint64_t)(1000000ULL))

Definition at line 88 of file libsigrok.h.

Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().

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

Definition at line 128 of file libsigrok.h.

Typedef Documentation

typedef int(* sr_receive_data_callback) (int fd, int revents, void *cb_data)

Type definition for callback function for data reception.

Definition at line 134 of file libsigrok.h.

Enumeration Type Documentation

Constants for channel type.

Enumerator
SR_CHANNEL_LOGIC 

Channel type is logic channel.

SR_CHANNEL_ANALOG 

Channel type is analog channel.

Definition at line 593 of file libsigrok.h.

Configuration capabilities.

Enumerator
SR_CONF_GET 

Value can be read.

SR_CONF_SET 

Value can be written.

SR_CONF_LIST 

Possible values can be enumerated.

Definition at line 656 of file libsigrok.h.

Configuration keys.

Enumerator
SR_CONF_LOGIC_ANALYZER 

The device can act as logic analyzer.

SR_CONF_OSCILLOSCOPE 

The device can act as an oscilloscope.

SR_CONF_MULTIMETER 

The device can act as a multimeter.

SR_CONF_DEMO_DEV 

The device is a demo device.

SR_CONF_SOUNDLEVELMETER 

The device can act as a sound level meter.

SR_CONF_THERMOMETER 

The device can measure temperature.

SR_CONF_HYGROMETER 

The device can measure humidity.

SR_CONF_ENERGYMETER 

The device can measure energy consumption.

SR_CONF_DEMODULATOR 

The device can act as a signal demodulator.

SR_CONF_POWER_SUPPLY 

The device can act as a programmable power supply.

SR_CONF_LCRMETER 

The device can act as an LCR meter.

SR_CONF_ELECTRONIC_LOAD 

The device can act as an electronic load.

SR_CONF_SCALE 

The device can act as a scale.

SR_CONF_CONN 

Specification on how to connect to a device.

In combination with SR_CONF_SERIALCOMM, this is a serial port in the form which makes sense to the OS (e.g., /dev/ttyS0). Otherwise this specifies a USB device, either in the form of

<bus>.<address> 

(decimal, e.g. 1.65) or

<vendorid>.<productid> 

(hexadecimal, e.g. 1d6b.0001).

SR_CONF_SERIALCOMM 

Serial communication specification, in the form:

<baudrate>/<databits><parity><stopbits> 

Example: 9600/8n1

The string may also be followed by one or more special settings, in the form "/key=value". Supported keys and their values are:

rts 0,1 set the port's RTS pin to low or high dtr 0,1 set the port's DTR pin to low or high flow 0 no flow control 1 hardware-based (RTS/CTS) flow control 2 software-based (XON/XOFF) flow control

This is always an optional parameter, since a driver typically knows the speed at which the device wants to communicate.

SR_CONF_MODBUSADDR 

Modbus slave address specification.

This is always an optional parameter, since a driver typically knows the default slave address of the device.

SR_CONF_SAMPLERATE 

The device supports setting its samplerate, in Hz.

SR_CONF_CAPTURE_RATIO 

The device supports setting a pre/post-trigger capture ratio.

SR_CONF_PATTERN_MODE 

The device supports setting a pattern (pattern generator mode).

SR_CONF_RLE 

The device supports run-length encoding (RLE).

SR_CONF_TRIGGER_SLOPE 

The device supports setting trigger slope.

SR_CONF_AVERAGING 

The device supports averaging.

SR_CONF_AVG_SAMPLES 

The device supports setting number of samples to be averaged over.

SR_CONF_TRIGGER_SOURCE 

Trigger source.

SR_CONF_HORIZ_TRIGGERPOS 

Horizontal trigger position.

SR_CONF_BUFFERSIZE 

Buffer size.

SR_CONF_TIMEBASE 

Time base.

SR_CONF_FILTER 

Filter.

SR_CONF_VDIV 

Volts/div.

SR_CONF_COUPLING 

Coupling.

SR_CONF_TRIGGER_MATCH 

Trigger matches.

SR_CONF_SAMPLE_INTERVAL 

The device supports setting its sample interval, in ms.

SR_CONF_NUM_HDIV 

Number of horizontal divisions, as related to SR_CONF_TIMEBASE.

SR_CONF_NUM_VDIV 

Number of vertical divisions, as related to SR_CONF_VDIV.

SR_CONF_SPL_WEIGHT_FREQ 

Sound pressure level frequency weighting.

SR_CONF_SPL_WEIGHT_TIME 

Sound pressure level time weighting.

SR_CONF_SPL_MEASUREMENT_RANGE 

Sound pressure level measurement range.

SR_CONF_HOLD_MAX 

Max hold mode.

SR_CONF_HOLD_MIN 

Min hold mode.

SR_CONF_VOLTAGE_THRESHOLD 

Logic low-high threshold range.

SR_CONF_EXTERNAL_CLOCK 

The device supports using an external clock.

SR_CONF_SWAP 

The device supports swapping channels.

Typical this is between buffered and unbuffered channels.

SR_CONF_CENTER_FREQUENCY 

Center frequency.

The input signal is downmixed by this frequency before the ADC anti-aliasing filter.

SR_CONF_NUM_LOGIC_CHANNELS 

The device supports setting the number of logic channels.

SR_CONF_NUM_ANALOG_CHANNELS 

The device supports setting the number of analog channels.

SR_CONF_VOLTAGE 

Current voltage.

  • type: double
  • get: get measured voltage
SR_CONF_VOLTAGE_TARGET 

Maximum target voltage.

  • type: double
  • get: get target voltage
  • set: change target voltage
SR_CONF_CURRENT 

Current current.

  • type: double
  • get: get measured current
SR_CONF_CURRENT_LIMIT 

Current limit.

  • type: double
  • get: get current limit
  • set: change current limit
SR_CONF_ENABLED 

Enabling/disabling channel.

  • type: boolean
  • get: true if currently enabled
  • set: enable/disable
SR_CONF_CHANNEL_CONFIG 

Channel configuration.

  • type: string
  • get: get current setting
  • set: change current setting
  • list: array of possible values
SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED 

Over-voltage protection (OVP) feature.

  • type: boolean
  • get: true if currently enabled
  • set: enable/disable
SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE 

Over-voltage protection (OVP) active.

  • type: boolean
  • get: true if device has activated OVP, i.e. the output voltage exceeds the over-voltage protection threshold.
SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD 

Over-voltage protection (OVP) threshold.

  • type: double (voltage)
  • get: get current threshold
  • set: set new threshold
SR_CONF_OVER_CURRENT_PROTECTION_ENABLED 

Over-current protection (OCP) feature.

  • type: boolean
  • get: true if currently enabled
  • set: enable/disable
SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE 

Over-current protection (OCP) active.

  • type: boolean
  • get: true if device has activated OCP, i.e. the current current exceeds the over-current protection threshold.
SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD 

Over-current protection (OCP) threshold.

  • type: double (current)
  • get: get current threshold
  • set: set new threshold
SR_CONF_CLOCK_EDGE 

Choice of clock edge for external clock ("r" or "f").

SR_CONF_AMPLITUDE 

Amplitude of a source without strictly-defined MQ.

SR_CONF_REGULATION 

Channel regulation get: "CV", "CC" or "UR", denoting constant voltage, constant current or unregulated.

SR_CONF_OVER_TEMPERATURE_PROTECTION 

Over-temperature protection (OTP)

SR_CONF_OUTPUT_FREQUENCY 

Output frequency in Hz.

SR_CONF_OUTPUT_FREQUENCY_TARGET 

Output frequency target in Hz.

SR_CONF_MEASURED_QUANTITY 

Measured quantity.

SR_CONF_EQUIV_CIRCUIT_MODEL 

Equivalent circuit model.

SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE 

Over-temperature protection (OTP) active.

SR_CONF_SESSIONFILE 

Session filename.

SR_CONF_CAPTUREFILE 

The device supports specifying a capturefile to inject.

SR_CONF_CAPTURE_UNITSIZE 

The device supports specifying the capturefile unit size.

SR_CONF_POWER_OFF 

Power off the device.

SR_CONF_DATA_SOURCE 

Data source for acquisition.

If not present, acquisition from the device is always "live", i.e. acquisition starts when the frontend asks and the results are sent out as soon as possible.

If present, it indicates that either the device has no live acquisition capability (for example a pure data logger), or there is a choice. sr_config_list() returns those choices.

In any case if a device has live acquisition capabilities, it is always the default.

SR_CONF_PROBE_FACTOR 

The device supports setting a probe factor.

SR_CONF_LIMIT_MSEC 

The device supports setting a sample time limit (how long the sample acquisition should run, in ms).

SR_CONF_LIMIT_SAMPLES 

The device supports setting a sample number limit (how many samples should be acquired).

SR_CONF_LIMIT_FRAMES 

The device supports setting a frame limit (how many frames should be acquired).

SR_CONF_CONTINUOUS 

The device supports continuous sampling.

Neither a time limit nor a sample number limit has to be supplied, it will just acquire samples continuously, until explicitly stopped by a certain command.

SR_CONF_DATALOG 

The device has internal storage, into which data is logged.

This starts or stops the internal logging.

SR_CONF_DEVICE_MODE 

Device mode for multi-function devices.

SR_CONF_TEST_MODE 

Self test mode.

Definition at line 666 of file libsigrok.h.

Data types used by sr_config_info().

Enumerator
SR_T_UINT64 
SR_T_STRING 
SR_T_BOOL 
SR_T_FLOAT 
SR_T_RATIONAL_PERIOD 
SR_T_RATIONAL_VOLT 
SR_T_KEYVALUE 
SR_T_UINT64_RANGE 
SR_T_DOUBLE_RANGE 
SR_T_INT32 
SR_T_MQ 

Definition at line 137 of file libsigrok.h.

Device instance status, struct sr_dev_inst.status.

Enumerator
SR_ST_NOT_FOUND 

The device instance was not found.

SR_ST_INITIALIZING 

The device instance was found, but is still booting.

SR_ST_INACTIVE 

The device instance is live, but not in use.

SR_ST_ACTIVE 

The device instance is actively in use in a session.

SR_ST_STOPPING 

The device is winding down its session.

Definition at line 1076 of file libsigrok.h.

Types of device instance, struct sr_dev_inst.type.

Enumerator
SR_INST_USB 

Device instance type for USB devices.

SR_INST_SERIAL 

Device instance type for serial port devices.

SR_INST_SCPI 

Device instance type for SCPI devices.

SR_INST_USER 

Device-instance type for user-created "devices".

SR_INST_MODBUS 

Device instance type for Modbus devices.

Definition at line 1062 of file libsigrok.h.

Status/error codes returned by libsigrok functions.

Enumerator
SR_OK 

No error.

SR_ERR 

Generic/unspecified error.

SR_ERR_MALLOC 

Malloc/calloc/realloc error.

SR_ERR_ARG 

Function argument error.

SR_ERR_BUG 

Errors hinting at internal bugs.

SR_ERR_SAMPLERATE 

Incorrect samplerate.

SR_ERR_NA 

Not applicable.

SR_ERR_DEV_CLOSED 

Device is closed, but must be open.

SR_ERR_TIMEOUT 

A timeout occurred.

SR_ERR_CHANNEL_GROUP 

A channel group must be specified.

SR_ERR_DATA 

Data is invalid.

SR_ERR_IO 

Input/output error.

Definition at line 66 of file libsigrok.h.

enum sr_keytype
Enumerator
SR_KEY_CONFIG 
SR_KEY_MQ 
SR_KEY_MQFLAGS 

Definition at line 635 of file libsigrok.h.

libsigrok loglevels.

Enumerator
SR_LOG_NONE 

Output no messages at all.

SR_LOG_ERR 

Output error messages.

SR_LOG_WARN 

Output warnings.

SR_LOG_INFO 

Output informational messages.

SR_LOG_DBG 

Output debug messages.

SR_LOG_SPEW 

Output very noisy debug messages.

Definition at line 94 of file libsigrok.h.

enum sr_mq

Measured quantity, sr_analog_meaning.mq.

Enumerator
SR_MQ_VOLTAGE 
SR_MQ_CURRENT 
SR_MQ_RESISTANCE 
SR_MQ_CAPACITANCE 
SR_MQ_TEMPERATURE 
SR_MQ_FREQUENCY 
SR_MQ_DUTY_CYCLE 

Duty cycle, e.g.

on/off ratio.

SR_MQ_CONTINUITY 

Continuity test.

SR_MQ_PULSE_WIDTH 
SR_MQ_CONDUCTANCE 
SR_MQ_POWER 

Electrical power, usually in W, or dBm.

SR_MQ_GAIN 

Gain (a transistor's gain, or hFE, for example).

SR_MQ_SOUND_PRESSURE_LEVEL 

Logarithmic representation of sound pressure relative to a reference value.

SR_MQ_CARBON_MONOXIDE 

Carbon monoxide level.

SR_MQ_RELATIVE_HUMIDITY 

Humidity.

SR_MQ_TIME 

Time.

SR_MQ_WIND_SPEED 

Wind speed.

SR_MQ_PRESSURE 

Pressure.

SR_MQ_PARALLEL_INDUCTANCE 

Parallel inductance (LCR meter model).

SR_MQ_PARALLEL_CAPACITANCE 

Parallel capacitance (LCR meter model).

SR_MQ_PARALLEL_RESISTANCE 

Parallel resistance (LCR meter model).

SR_MQ_SERIES_INDUCTANCE 

Series inductance (LCR meter model).

SR_MQ_SERIES_CAPACITANCE 

Series capacitance (LCR meter model).

SR_MQ_SERIES_RESISTANCE 

Series resistance (LCR meter model).

SR_MQ_DISSIPATION_FACTOR 

Dissipation factor.

SR_MQ_QUALITY_FACTOR 

Quality factor.

SR_MQ_PHASE_ANGLE 

Phase angle.

SR_MQ_DIFFERENCE 

Difference from reference value.

SR_MQ_COUNT 

Count.

SR_MQ_POWER_FACTOR 

Power factor.

SR_MQ_APPARENT_POWER 

Apparent power.

SR_MQ_MASS 

Mass.

Definition at line 178 of file libsigrok.h.

enum sr_mqflag

Values for sr_analog_meaning.mqflags.

Enumerator
SR_MQFLAG_AC 

Voltage measurement is alternating current (AC).

SR_MQFLAG_DC 

Voltage measurement is direct current (DC).

SR_MQFLAG_RMS 

This is a true RMS measurement.

SR_MQFLAG_DIODE 

Value is voltage drop across a diode, or NAN.

SR_MQFLAG_HOLD 

Device is in "hold" mode (repeating the last measurement).

SR_MQFLAG_MAX 

Device is in "max" mode, only updating upon a new max value.

SR_MQFLAG_MIN 

Device is in "min" mode, only updating upon a new min value.

SR_MQFLAG_AUTORANGE 

Device is in autoranging mode.

SR_MQFLAG_RELATIVE 

Device is in relative mode.

SR_MQFLAG_SPL_FREQ_WEIGHT_A 

Sound pressure level is A-weighted in the frequency domain, according to IEC 61672:2003.

SR_MQFLAG_SPL_FREQ_WEIGHT_C 

Sound pressure level is C-weighted in the frequency domain, according to IEC 61672:2003.

SR_MQFLAG_SPL_FREQ_WEIGHT_Z 

Sound pressure level is Z-weighted (i.e.

not at all) in the frequency domain, according to IEC 61672:2003.

SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT 

Sound pressure level is not weighted in the frequency domain, albeit without standards-defined low and high frequency limits.

SR_MQFLAG_SPL_TIME_WEIGHT_S 

Sound pressure level measurement is S-weighted (1s) in the time domain.

SR_MQFLAG_SPL_TIME_WEIGHT_F 

Sound pressure level measurement is F-weighted (125ms) in the time domain.

SR_MQFLAG_SPL_LAT 

Sound pressure level is time-averaged (LAT), also known as Equivalent Continuous A-weighted Sound Level (LEQ).

SR_MQFLAG_SPL_PCT_OVER_ALARM 

Sound pressure level represented as a percentage of measurements that were over a preset alarm level.

SR_MQFLAG_DURATION 

Time is duration (as opposed to epoch, ...).

SR_MQFLAG_AVG 

Device is in "avg" mode, averaging upon each new value.

SR_MQFLAG_REFERENCE 

Reference value shown.

SR_MQFLAG_UNSTABLE 

Unstable value (hasn't settled yet).

Definition at line 335 of file libsigrok.h.

Output module flags.

Enumerator
SR_OUTPUT_INTERNAL_IO_HANDLING 

If set, this output module writes the output itself.

Definition at line 580 of file libsigrok.h.

Value for sr_datafeed_packet.type.

Enumerator
SR_DF_HEADER 

Payload is sr_datafeed_header.

SR_DF_END 

End of stream (no further data).

SR_DF_META 

Payload is struct sr_datafeed_meta.

SR_DF_TRIGGER 

The trigger matched at this point in the data feed.

No payload.

SR_DF_LOGIC 

Payload is struct sr_datafeed_logic.

SR_DF_ANALOG_OLD 

DEPRECATED! Use SR_DF_ANALOG instead.

SR_DF_FRAME_BEGIN 

Beginning of frame.

No payload.

SR_DF_FRAME_END 

End of frame.

No payload.

SR_DF_ANALOG 

Payload is struct sr_datafeed_analog.

Definition at line 154 of file libsigrok.h.

Resource type.

Since
0.4.0
Enumerator
SR_RESOURCE_FIRMWARE 

Definition at line 563 of file libsigrok.h.

Enumerator
SR_TRIGGER_ZERO 
SR_TRIGGER_ONE 
SR_TRIGGER_RISING 
SR_TRIGGER_FALLING 
SR_TRIGGER_EDGE 
SR_TRIGGER_OVER 
SR_TRIGGER_UNDER 

Definition at line 393 of file libsigrok.h.

enum sr_unit

Unit of measured quantity, sr_analog_meaning.unit.

Enumerator
SR_UNIT_VOLT 

Volt.

SR_UNIT_AMPERE 

Ampere (current).

SR_UNIT_OHM 

Ohm (resistance).

SR_UNIT_FARAD 

Farad (capacity).

SR_UNIT_KELVIN 

Kelvin (temperature).

SR_UNIT_CELSIUS 

Degrees Celsius (temperature).

SR_UNIT_FAHRENHEIT 

Degrees Fahrenheit (temperature).

SR_UNIT_HERTZ 

Hertz (frequency, 1/s, [Hz]).

SR_UNIT_PERCENTAGE 

Percent value.

SR_UNIT_BOOLEAN 

Boolean value.

SR_UNIT_SECOND 

Time in seconds.

SR_UNIT_SIEMENS 

Unit of conductance, the inverse of resistance.

SR_UNIT_DECIBEL_MW 

An absolute measurement of power, in decibels, referenced to 1 milliwatt (dBu).

SR_UNIT_DECIBEL_VOLT 

Voltage in decibel, referenced to 1 volt (dBV).

SR_UNIT_UNITLESS 

Measurements that intrinsically do not have units attached, such as ratios, gains, etc.

Specifically, a transistor's gain (hFE) is a unitless quantity, for example.

SR_UNIT_DECIBEL_SPL 

Sound pressure level, in decibels, relative to 20 micropascals.

SR_UNIT_CONCENTRATION 

Normalized (0 to 1) concentration of a substance or compound with 0 representing a concentration of 0%, and 1 being 100%.

This is represented as the fraction of number of particles of the substance.

SR_UNIT_REVOLUTIONS_PER_MINUTE 

Revolutions per minute.

SR_UNIT_VOLT_AMPERE 

Apparent power [VA].

SR_UNIT_WATT 

Real power [W].

SR_UNIT_WATT_HOUR 

Consumption [Wh].

SR_UNIT_METER_SECOND 

Wind speed in meters per second.

SR_UNIT_HECTOPASCAL 

Pressure in hectopascal.

SR_UNIT_HUMIDITY_293K 

Relative humidity assuming air temperature of 293 Kelvin (rF).

SR_UNIT_DEGREE 

Plane angle in 1/360th of a full circle.

SR_UNIT_HENRY 

Henry (inductance).

SR_UNIT_GRAM 

Mass in gram [g].

SR_UNIT_CARAT 

Mass in carat [ct].

SR_UNIT_OUNCE 

Mass in ounce [oz].

SR_UNIT_TROY_OUNCE 

Mass in troy ounce [oz t].

SR_UNIT_POUND 

Mass in pound [lb].

SR_UNIT_PENNYWEIGHT 

Mass in pennyweight [dwt].

SR_UNIT_GRAIN 

Mass in grain [gr].

SR_UNIT_TAEL 

Mass in tael (variants: Hong Kong, Singapore/Malaysia, Taiwan)

SR_UNIT_MOMME 

Mass in momme.

SR_UNIT_TOLA 

Mass in tola.

SR_UNIT_PIECE 

Pieces (number of items).

Definition at line 241 of file libsigrok.h.