X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffluke-dmm%2Ffluke.c;h=3261390deb405d664ece57cfea210e73c0839990;hb=b02bb45f4cf6378520e5a5b82ff39013cfa270b6;hp=e708518d90f1dd3f003462bced985c955131703e;hpb=a95f142e88fa5368adfabf87544acfdeed7d7604;p=libsigrok.git
diff --git a/src/hardware/fluke-dmm/fluke.c b/src/hardware/fluke-dmm/fluke.c
index e708518d..3261390d 100644
--- a/src/hardware/fluke-dmm/fluke.c
+++ b/src/hardware/fluke-dmm/fluke.c
@@ -17,19 +17,19 @@
* along with this program. If not, see .
*/
+#include
#include
#include
#include
-#include
#include
-#include "libsigrok.h"
+#include
#include "libsigrok-internal.h"
#include "fluke-dmm.h"
-static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
+static struct sr_datafeed_analog_old *handle_qm_18x(const struct sr_dev_inst *sdi,
char **tokens)
{
- struct sr_datafeed_analog *analog;
+ struct sr_datafeed_analog_old *analog;
float fvalue;
char *e, *u;
gboolean is_oor;
@@ -59,7 +59,7 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
while (*e && *e == ' ')
e++;
- analog = g_malloc0(sizeof(struct sr_datafeed_analog));
+ analog = g_malloc0(sizeof(struct sr_datafeed_analog_old));
analog->data = g_malloc(sizeof(float));
analog->channels = sdi->channels;
analog->num_samples = 1;
@@ -154,10 +154,10 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
return analog;
}
-static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi,
+static struct sr_datafeed_analog_old *handle_qm_28x(const struct sr_dev_inst *sdi,
char **tokens)
{
- struct sr_datafeed_analog *analog;
+ struct sr_datafeed_analog_old *analog;
float fvalue;
if (!tokens[1])
@@ -168,7 +168,7 @@ static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi,
return NULL;
}
- analog = g_malloc0(sizeof(struct sr_datafeed_analog));
+ analog = g_malloc0(sizeof(struct sr_datafeed_analog_old));
analog->data = g_malloc(sizeof(float));
analog->channels = sdi->channels;
analog->num_samples = 1;
@@ -362,7 +362,7 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
- struct sr_datafeed_analog analog;
+ struct sr_datafeed_analog_old analog;
float fvalue;
if (!strcmp(tokens[0], "9.9E+37")) {
@@ -397,11 +397,11 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens)
analog.mq = devc->mq;
analog.unit = devc->unit;
analog.mqflags = 0;
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
- sr_session_send(devc->cb_data, &packet);
- devc->num_samples++;
+ sr_session_send(sdi, &packet);
+ sr_sw_limits_update_samples_read(&devc->limits, 1);
}
static void handle_line(const struct sr_dev_inst *sdi)
@@ -409,7 +409,7 @@ static void handle_line(const struct sr_dev_inst *sdi)
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
struct sr_datafeed_packet packet;
- struct sr_datafeed_analog *analog;
+ struct sr_datafeed_analog_old *analog;
int num_tokens, n, i;
char cmd[16], **tokens;
@@ -433,7 +433,7 @@ static void handle_line(const struct sr_dev_inst *sdi)
if (devc->profile->model == FLUKE_187 || devc->profile->model == FLUKE_189) {
devc->expect_response = FALSE;
analog = handle_qm_18x(sdi, tokens);
- } else if (devc->profile->model == FLUKE_287) {
+ } else if (devc->profile->model == FLUKE_287 || devc->profile->model == FLUKE_289) {
devc->expect_response = FALSE;
analog = handle_qm_28x(sdi, tokens);
} else if (devc->profile->model == FLUKE_190) {
@@ -465,10 +465,10 @@ static void handle_line(const struct sr_dev_inst *sdi)
if (analog) {
/* Got a measurement. */
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = analog;
- sr_session_send(devc->cb_data, &packet);
- devc->num_samples++;
+ sr_session_send(sdi, &packet);
+ sr_sw_limits_update_samples_read(&devc->limits, 1);
g_free(analog->data);
g_free(analog);
}
@@ -508,8 +508,8 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data)
}
}
- if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
- sdi->driver->dev_acquisition_stop(sdi, cb_data);
+ if (sr_sw_limits_check(&devc->limits)) {
+ sdi->driver->dev_acquisition_stop(sdi);
return TRUE;
}