gscope_interface

Name

gscope_interface -- Interface data structures for the gscope package.

Synopsis



enum        GscopeSignalDataType;
enum        gscope_rw_flag;
void        (*GSCOPE_RW_FUNC)               (gscope_rw_flag read_write_flag,
                                             void *arg1,
                                             void *arg2,
                                             float *value);
typedef     GscopeSignalData;
enum        GscopeSignalLine;
typedef     GscopeSignal;
typedef     GscopeParameter;

Description

The data structures below allow applications to specify their signals and parameters to gscope.

Details

enum GscopeSignalDataType

typedef enum {
        INTEGER, SHORT, FLOAT, FUNC, NONE
} GscopeSignalDataType;

Data type of a signal or a parameter. This data type determines how a signal is read from the application and how a parameter is read from or written to the application.

INTEGERData is a pointer to an integer.
SHORTData is a pointer to a short.
FLOATData is a pointer to a float.
FUNCData is a function of type GSCOPE_RW_FUNC.
NONEData is invalid.


enum gscope_rw_flag

typedef enum {
        GSCOPE_READ_DATA, GSCOPE_WRITE_DATA
} gscope_rw_flag;

When a signal is specified as a function of type GSCOPE_RW_FUNC (see GscopeSignalDataType), this flag is passed as the first parameter to the function.

GSCOPE_READ_DATASignal or parameter data will be read from the function.
GSCOPE_WRITE_DATAParameter data should be written by the function.


GSCOPE_RW_FUNC ()

void        (*GSCOPE_RW_FUNC)               (gscope_rw_flag read_write_flag,
                                             void *arg1,
                                             void *arg2,
                                             float *value);

This is a function type. Functions of this type allow gscope signals and parameters to be read and write arbitrary data.

read_write_flag :When function is called with GSCOPE_READ_DATA, value is read from this function (out variable). When function is called with GSCOPE_WRITE_DATA, value is written to this function (in variable).
arg1 :An argument specified by the application in GscopeSignalData and passed as is to this function.
arg2 :A second argument specified by the application in GscopeSignalData and passed as is to this function.
value :Value read or written to this function. When read_write_flag is GSCOPE_READ_DATA, this value should be filled with the signal data that should be plotted or a parameter data. When read_write_flag is GSCOPE_WRITE_DATA, this value can be used to modify an application parameter.


GscopeSignalData

typedef struct {
        GscopeSignalDataType type;
        void *obj;
        void *arg1;
        void *arg2;
} GscopeSignalData;

Gscope signal data is encapsulated in this structure. Depending on the type (see GscopeSignalDataType), obj is a pointer to an integer, short, float or a function. arg1 and arg2 are used when obj is a function of type GSCOPE_RW_FUNC and the arg1 and arg2 values are passed to the function when the obj function is invoked.


enum GscopeSignalLine

typedef enum {
        STEP_SIGNAL = 0x0, LINE_SIGNAL = 0x1, POINT_SIGNAL = 0x2, 
        VERTICAL_SIGNAL = 0x3, NO_LINE_SIGNAL = 0x4
} GscopeSignalLine;

Different types of lines drawn by the scope.

STEP_SIGNALLine is drawn horizontally and then vertically between consecutive signal data points.
LINE_SIGNALStraight line is drawn between consecutive signal data points.
POINT_SIGNALData points are drawn but not connected by a line.
VERTICAL_SIGNALVertical line is drawn from the bottom of the scope to the y-coordinate of the signal data point.
NO_LINE_SIGNALLine type is invalid.


GscopeSignal

typedef struct {
        char *title;
        GscopeSignalData signal;
        gchar *color;
        gfloat min;
        gfloat max;
        GscopeSignalLine line;
        gboolean hidden;
        gfloat filter;
} GscopeSignal;

Signal data type passed to the scope. Title is the name of the signal. signal allows reading and writing signal data. color is the signal color. When color is not specified, the system chooses an arbitrary color for the signal. Min and max are minimum and maximum values that will be plotted on the scope by default (when yzoom is 1 and ybias is 0). line is the signal line type. hidden determines whether is signal is hidden (it is visible by default). filter is a value between 0 and 1. When it is 0 (the default), the signal is not low-pass filtered.


GscopeParameter

typedef struct {
        char *title;
        GscopeSignalData parameter;
        gfloat lower;   /* The lower and upper values are not enforced when 
                           lower == upper */
        gfloat upper;
} GscopeParameter;

Parameter data type passed to the scope. Its fields are similar to the fields in GscopeSignal. Title is the name of the parameter. Lower and upper ensure that a parameter value is never set below or above these values. Parameters can be placed hierarchically. For hierarchical parameters, make the title have slashes. For instance, two parameters with titles "ipv4/ip_forward" and "ipv4/tcp_keepalive_time" will be grouped under the name "ipv4" in the preferences menu.

See Also

GtkScopeApp, GtkScope