GSList *devices = NULL;
-void device_scan(void)
+void sr_device_scan(void)
{
GSList *plugins, *l;
struct sr_device_plugin *plugin;
*/
for (l = plugins; l; l = l->next) {
plugin = l->data;
- device_plugin_init(plugin);
+ sr_device_plugin_init(plugin);
}
}
-int device_plugin_init(struct sr_device_plugin *plugin)
+int sr_device_plugin_init(struct sr_device_plugin *plugin)
{
int num_devices, num_probes, i;
num_devices = plugin->init(NULL);
for (i = 0; i < num_devices; i++) {
num_probes = (int)plugin->get_device_info(i, SR_DI_NUM_PROBES);
- device_new(plugin, i, num_probes);
+ sr_device_new(plugin, i, num_probes);
}
return num_devices;
}
-void device_close_all(void)
+void sr_device_close_all(void)
{
struct sr_device *device;
device = devices->data;
if (device->plugin && device->plugin->close)
device->plugin->close(device->plugin_index);
- device_destroy(device);
+ sr_device_destroy(device);
}
}
-GSList *device_list(void)
+GSList *sr_device_list(void)
{
if (!devices)
- device_scan();
+ sr_device_scan();
return devices;
}
-struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
+struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
int num_probes)
{
struct sr_device *device;
devices = g_slist_append(devices, device);
for (i = 0; i < num_probes; i++)
- device_probe_add(device, NULL);
+ sr_device_probe_add(device, NULL);
return device;
}
-void device_clear(struct sr_device *device)
+void sr_device_clear(struct sr_device *device)
{
unsigned int pnum;
return;
for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
- device_probe_clear(device, pnum);
+ sr_device_probe_clear(device, pnum);
}
-void device_destroy(struct sr_device *device)
+void sr_device_destroy(struct sr_device *device)
{
unsigned int pnum;
devices = g_slist_remove(devices, device);
if (device->probes) {
for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
- device_probe_clear(device, pnum);
+ sr_device_probe_clear(device, pnum);
g_slist_free(device->probes);
}
g_free(device);
}
-void device_probe_clear(struct sr_device *device, int probenum)
+void sr_device_probe_clear(struct sr_device *device, int probenum)
{
- struct probe *p;
+ struct sr_probe *p;
p = probe_find(device, probenum);
if (!p)
}
}
-void device_probe_add(struct sr_device *device, char *name)
+void sr_device_probe_add(struct sr_device *device, char *name)
{
- struct probe *p;
+ struct sr_probe *p;
char probename[16];
int probenum;
probenum = g_slist_length(device->probes) + 1;
- p = g_malloc0(sizeof(struct probe));
+ p = g_malloc0(sizeof(struct sr_probe));
p->index = probenum;
p->enabled = TRUE;
if (name) {
device->probes = g_slist_append(device->probes, p);
}
-struct probe *probe_find(struct sr_device *device, int probenum)
+struct sr_probe *probe_find(struct sr_device *device, int probenum)
{
GSList *l;
- struct probe *p, *found_probe;
+ struct sr_probe *p, *found_probe;
found_probe = NULL;
for (l = device->probes; l; l = l->next) {
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_probe_name(struct sr_device *device, int probenum, char *name)
+void sr_device_probe_name(struct sr_device *device, int probenum, char *name)
{
- struct probe *p;
+ struct sr_probe *p;
p = probe_find(device, probenum);
if (!p)
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_clear(struct sr_device *device)
+void sr_device_trigger_clear(struct sr_device *device)
{
- struct probe *p;
+ struct sr_probe *p;
unsigned int pnum;
if (!device->probes)
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_set(struct sr_device *device, int probenum, char *trigger)
+void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger)
{
- struct probe *p;
+ struct sr_probe *p;
p = probe_find(device, probenum);
if (!p)
}
-gboolean device_has_hwcap(struct sr_device *device, int hwcap)
+gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
{
int *capabilities, i;