libsigrok  0.3.0
sigrok hardware access and backend library
Data Fields
sr_output_format Struct Reference

Output (file) format driver. More...

#include <libsigrok.h>

+ Collaboration diagram for sr_output_format:

Data Fields

char * id
 A unique ID for this output format. More...
 
char * description
 A short description of the output format. More...
 
int(* init )(struct sr_output *o)
 This function is called once, at the beginning of an output stream. More...
 
int(* receive )(struct sr_output *o, const struct sr_datafeed_packet *packet, GString **out)
 This function is passed a copy of every packed in the data feed. More...
 
int(* cleanup )(struct sr_output *o)
 This function is called after the caller is finished using the output module, and can be used to free any internal resources the module may keep. More...
 

Detailed Description

Output (file) format driver.

Definition at line 460 of file libsigrok.h.

Field Documentation

int(* sr_output_format::cleanup) (struct sr_output *o)

This function is called after the caller is finished using the output module, and can be used to free any internal resources the module may keep.

Return values
SR_OKSuccess
otherNegative error code.

Definition at line 525 of file libsigrok.h.

Referenced by sr_output_free().

char* sr_output_format::description

A short description of the output format.

Must not be NULL.

This can be displayed by frontends, e.g. when selecting the output format for saving a file.

Definition at line 477 of file libsigrok.h.

char* sr_output_format::id

A unique ID for this output format.

Must not be NULL.

It can be used by frontends to select this output format for use.

For example, calling sigrok-cli with -O hex will select the hexadecimal text output format.

Definition at line 469 of file libsigrok.h.

int(* sr_output_format::init) (struct sr_output *o)

This function is called once, at the beginning of an output stream.

The device struct will be available in the output struct passed in, as well as the param field – which may be NULL or an empty string, if no parameter was passed.

The module can use this to initialize itself, create a struct for keeping state and storing it in the internal field.

Parameters
oPointer to the respective 'struct sr_output'.
Return values
SR_OKSuccess
otherNegative error code.

Definition at line 494 of file libsigrok.h.

Referenced by sr_output_new().

int(* sr_output_format::receive) (struct sr_output *o, const struct sr_datafeed_packet *packet, GString **out)

This function is passed a copy of every packed in the data feed.

Any output generated by the output module in response to the packet should be returned in a newly allocated GString out, which will be freed by the caller.

Packets not of interest to the output module can just be ignored, and the out parameter set to NULL.

Parameters
oPointer to the respective 'struct sr_output'.
sdiThe device instance that generated the packet.
packetThe complete packet.
outA pointer where a GString * should be stored if the module generates output, or NULL if not.
Return values
SR_OKSuccess
otherNegative error code.

Definition at line 514 of file libsigrok.h.

Referenced by sr_output_send().


The documentation for this struct was generated from the following file: