static gint teleinfo_probe_compare(gconstpointer a, gconstpointer b)
{
- const struct sr_probe *probe = a;
+ const struct sr_channel *probe = a;
const char *name = b;
return strcmp(probe->name, name);
}
-static struct sr_probe *teleinfo_find_probe(struct sr_dev_inst *sdi,
+static struct sr_channel *teleinfo_find_probe(struct sr_dev_inst *sdi,
const char *name)
{
GSList *elem = g_slist_find_custom(sdi->probes, name,
static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *probe_name,
float value, int mq, int unit)
{
- struct dev_context *devc = sdi->priv;
+ struct dev_context *devc;
struct sr_datafeed_packet packet;
- struct sr_datafeed_analog analog = { 0 };
- struct sr_probe *probe = teleinfo_find_probe(sdi, probe_name);
+ struct sr_datafeed_analog analog;
+ struct sr_channel *probe;
+
+ devc = sdi->priv;
+ probe = teleinfo_find_probe(sdi, probe_name);
if (!probe || !probe->enabled)
return;
+ memset(&analog, 0, sizeof(struct sr_datafeed_analog));
analog.probes = g_slist_append(analog.probes, probe);
analog.num_samples = 1;
analog.mq = mq;
const uint8_t *group, char *optarif)
{
char label[9], data[13], control, cr;
- const char *str = (const char *) group;
+ const char *str = (const char *)group;
if (sscanf(str, "\x0A%8s %13s %c%c", label, data, &control, &cr) != 4
|| cr != CR)
return FALSE;
const uint8_t *buf, int len,
char *optarif)
{
- const uint8_t *group_start = memchr(buf, LF, len);
+ const uint8_t *group_start, *group_end;
+
+ group_start = memchr(buf, LF, len);
if (!group_start)
return NULL;
- const uint8_t *group_end = memchr(group_start, CR,
- len - (group_start - buf));
+ group_end = memchr(group_start, CR, len - (group_start - buf));
if (!group_end)
return NULL;
struct sr_serial_dev_inst *serial;
const uint8_t *ptr, *next_ptr, *end_ptr;
int len;
+ int64_t time;
(void)fd;
}
if (devc->limit_msec) {
- int64_t time = (g_get_monotonic_time() - devc->start_time) / 1000;
+ time = (g_get_monotonic_time() - devc->start_time) / 1000;
if (time > (int64_t)devc->limit_msec) {
sr_info("Requested time limit reached.");
sdi->driver->dev_acquisition_stop(sdi, devc->session_cb_data);