sr_config_get() of SR_CONF_SAMPLERATE now returns a GVARIANT_TYPE_DICTIONARY.
This dictionary contains a single key-value pair. Possible values for the key:
- "samplerates": the value is an array of GVARIANT_TYPE_UINT64 representing
all valid samplerates.
- "samplerate-steps": the value is an array of GVARIANT_TYPE_UINT64 with
exactly three members, which represent the lowest samplerate, highest
samplerate, and the minimum step, respectively.
sr_config_get() provides a GVariant owned by the caller, so it must be
released with g_variant_unref() when done.
sr_config_set() takes a GVariant from the caller which may be floating;
it will be properly sunk and release after use by this function. Thus
the output of g_variant_new_*() may be used as an argument.
sr_config_list() also provides a GVariant owned by the caller, to be
unreferenced when done.
sr_config_make() can take a floating reference.
Expresses the time between samples, in milliseconds. This can be used
for devices with a samplerate > 1 second, such as dataloggers, which
cannot be expressed with SR_CONF_SAMPLERATE.
This is essential if a format contains e.g. the number of probes; the
init() function needs to initialize the sr_dev_inst struct, but needs
access to the file to properly add the probes to it.
This takes an sr_config key and returns a list of possible values for
that key to be submitted with config_set(). The format of the list and
its contents is dependent on the key.
This will replace the SR_DI_* keys that returned such a list before,
such as SR_DI_SAMPLERATES.
This patch marks packet structures and their payloads as const.
This indicates to packet receivers that modifications to these are
not allowed. In general all pointers should be marked const unless
modification of the referenced data is explicitly allowed.
Having concentration as a unit is vague, as it can be expressed in
many ways. In the context of sigrok, concentration means a normalized
number from 0 to 1.
Document its meaning.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Not all drivers use subdrivers. The only reason the subdriver field was
introduced was to accomodate the model of serial-dmm.
The sr_dev_driver struct is available to the frontend. Exposing the subdriver
field creates the problem of exposing knowledge of libsigrok's internal driver
layout, even though the drivers are designed to be a flat list to the frontend.
Store the subdriver in the dev_context struct of serial-dmm.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Store/use the receive_data() function and a pointer to the driver struct
in the dmms[] array. Use a ".subdriver" entry in the driver struct.
Use a macro to simplify hw_init() wrappers.
In the case of USB drivers, a driver's dev_acquisition_stop() cannot
simply remove its fd sources from the session and close its devices:
a USB transfer might still be underway, and it needs to be finished
(and its memory freed) properly.
An sr_dev_inst->status value is added: SR_ST_STOPPING, which should
be set when the driver's dev_acquisition_stop() is called, and acts
as a marker for the USB event handler to wind up its operations.
In order for dev_acquisition_stop() to be able to set the sdi status,
however, it needs to be unconstified.
Whenever we added a field to the enums in libsigrok.h, we were running
the risk of breaking ABI compatibility. Any reordering of existing values
or the addition of entries other than at the bottom of the list would
cause an ABI breakage.
By hardcoding the values we ensure that any added field will have an
unused value, and will not take a value previously used by a different
flag. By doing this, we avoid confusing frontends compiled with an
earlier API.
We use 10000 as the first entry of each enum, and each "category" gets
an explicit number (10000, 20000, 30000, and so on).
Also avoid making the first value of an enum zero. A value of zero is
used as terminator item in some lists.
Remove explicit "DUMMY" (terminator) enum entries, they're not needed.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
- Turn SR_OK/SR_ERR_* and SR_LOG_* into proper enums.
- Use /**< Foo. */ for Doxygen comments that are on the same line as
the (e.g.) enum entry they document. If the comment is not on the
same line (but rather directly above the enum entry) a simple
/** Foo. */ comment is sufficient.
- Use /** */ instead of /* */ in some places, so that Doxygen actually uses
the respective comments.
- Various smaller cosmetic fixes or cleanups.