/**
* Create a new device.
*
- * TODO: 'plugin' can be const.
* TODO: num_probes should be uint16_t.
* TODO: Should return int, so that we can return SR_OK, SR_ERR_* etc.
*
*
* @return Pointer to the newly allocated device, or NULL upon errors.
*/
-struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
- int num_probes)
+struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
+ int plugin_index, int num_probes)
{
struct sr_device *device;
int i;
return NULL;
}
- device->plugin = plugin;
+ device->plugin = (struct sr_device_plugin *)plugin;
device->plugin_index = plugin_index;
devices = g_slist_append(devices, device);
* Note that the probe numbers start at 1 (not 0!).
*
* TODO: Should return int.
- * TODO: device can be const.
* TODO: probenum should be unsigned.
*
* @return A pointer to the requested probe's 'struct sr_probe', or NULL
* if the probe could not be found.
*/
-struct sr_probe *sr_device_probe_find(struct sr_device *device, int probenum)
+struct sr_probe *sr_device_probe_find(const struct sr_device *device,
+ int probenum)
{
GSList *l;
struct sr_probe *p, *found_probe;
* If the probe already has a different name assigned to it, it will be
* removed, and the new name will be saved instead.
*
- * TODO: device can be const?
* TODO: Rename to sr_device_set_probe_name().
*
* @param device TODO
*
* TODO: Better description.
*
- * TODO: device can be const?
- *
* @param device TODO
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
* TODO: Better description.
* TODO: Describe valid format of the 'trigger' string.
*
- * TODO: device can be const?
- *
* @param device TODO. Must not be NULL.
* @param probenum The number of the probe. TODO.
* Note that the probe numbers start at 1 (not 0!).
* Determine whether the specified device has the specified capability.
*
* TODO: Should return int?
- * TODO: device can be const.
*
* @param device Pointer to the device to be checked. Must not be NULL.
* The device's 'plugin' field must not be NULL either.
* FALSE is also returned upon invalid input parameters or other
* error conditions.
*/
-gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
+gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap)
{
int *capabilities, i;
int sr_device_scan(void);
int sr_init_hwplugins(struct sr_device_plugin *plugin);
GSList *sr_device_list(void);
-struct sr_device *sr_device_new(struct sr_device_plugin *plugin,
+struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
int plugin_index, int num_probes);
int sr_device_clear(struct sr_device *device);
void sr_device_destroy(struct sr_device *dev);
-
int sr_device_probe_clear(struct sr_device *device, int probenum);
int sr_device_probe_add(struct sr_device *device, const char *name);
-struct sr_probe *sr_device_probe_find(struct sr_device *device, int probenum);
+struct sr_probe *sr_device_probe_find(const struct sr_device *device,
+ int probenum);
int sr_device_probe_name(struct sr_device *device, int probenum,
const char *name);
-
int sr_device_trigger_clear(struct sr_device *device);
int sr_device_trigger_set(struct sr_device *device, int probenum,
const char *trigger);
-gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
+gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap);
/*--- filter.c --------------------------------------------------------------*/