]> sigrok.org Git - libsigrok.git/blame_incremental - src/hardware/agilent-dmm/sched.c
device.c: Whitespace/cosmetics and typo fixes.
[libsigrok.git] / src / hardware / agilent-dmm / sched.c
... / ...
CommitLineData
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config.h>
21#include <glib.h>
22#include <stdlib.h>
23#include <string.h>
24#include <math.h>
25#include <libsigrok/libsigrok.h>
26#include "libsigrok-internal.h"
27#include "agilent-dmm.h"
28
29static void dispatch(const struct sr_dev_inst *sdi)
30{
31 struct dev_context *devc;
32 const struct agdmm_job *jobs;
33 int64_t now;
34 int i;
35
36 devc = sdi->priv;
37 jobs = devc->profile->jobs;
38 now = g_get_monotonic_time() / 1000;
39 for (i = 0; (&jobs[i])->interval; i++) {
40 if (now - devc->jobqueue[i] > (&jobs[i])->interval) {
41 sr_spew("Running job %d.", i);
42 (&jobs[i])->send(sdi);
43 devc->jobqueue[i] = now;
44 }
45 }
46}
47
48static void receive_line(const struct sr_dev_inst *sdi)
49{
50 struct dev_context *devc;
51 const struct agdmm_recv *recvs, *recv;
52 GRegex *reg;
53 GMatchInfo *match;
54 int i;
55
56 devc = sdi->priv;
57
58 /* Strip CRLF */
59 while (devc->buflen) {
60 if (*(devc->buf + devc->buflen - 1) == '\r'
61 || *(devc->buf + devc->buflen - 1) == '\n')
62 *(devc->buf + --devc->buflen) = '\0';
63 else
64 break;
65 }
66 sr_spew("Received '%s'.", devc->buf);
67
68 recv = NULL;
69 recvs = devc->profile->recvs;
70 for (i = 0; (&recvs[i])->recv_regex; i++) {
71 reg = g_regex_new((&recvs[i])->recv_regex, 0, 0, NULL);
72 if (g_regex_match(reg, (char *)devc->buf, 0, &match)) {
73 recv = &recvs[i];
74 break;
75 }
76 g_match_info_unref(match);
77 g_regex_unref(reg);
78 }
79 if (recv) {
80 recv->recv(sdi, match);
81 g_match_info_unref(match);
82 g_regex_unref(reg);
83 } else
84 sr_dbg("Unknown line '%s'.", devc->buf);
85
86 /* Done with this. */
87 devc->buflen = 0;
88}
89
90SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data)
91{
92 struct sr_dev_inst *sdi;
93 struct dev_context *devc;
94 struct sr_serial_dev_inst *serial;
95 int len;
96
97 (void)fd;
98
99 if (!(sdi = cb_data))
100 return TRUE;
101
102 if (!(devc = sdi->priv))
103 return TRUE;
104
105 serial = sdi->conn;
106 if (revents == G_IO_IN) {
107 /* Serial data arrived. */
108 while (AGDMM_BUFSIZE - devc->buflen - 1 > 0) {
109 len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1);
110 if (len < 1)
111 break;
112 devc->buflen += len;
113 *(devc->buf + devc->buflen) = '\0';
114 if (*(devc->buf + devc->buflen - 1) == '\n') {
115 /* End of line */
116 receive_line(sdi);
117 break;
118 }
119 }
120 }
121
122 dispatch(sdi);
123
124 if (sr_sw_limits_check(&devc->limits))
125 sdi->driver->dev_acquisition_stop(sdi);
126
127 return TRUE;
128}
129
130static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd)
131{
132 struct sr_serial_dev_inst *serial;
133 char buf[32];
134
135 serial = sdi->conn;
136
137 sr_spew("Sending '%s'.", cmd);
138 strncpy(buf, cmd, 28);
139 if (!strncmp(buf, "*IDN?", 5))
140 strcat(buf, "\r\n");
141 else
142 strcat(buf, "\n\r\n");
143 if (serial_write_blocking(serial, buf, strlen(buf), SERIAL_WRITE_TIMEOUT_MS) < (int)strlen(buf)) {
144 sr_err("Failed to send.");
145 return SR_ERR;
146 }
147
148 return SR_OK;
149}
150
151static int send_stat(const struct sr_dev_inst *sdi)
152{
153 return agdmm_send(sdi, "STAT?");
154}
155
156static int recv_stat_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
157{
158 struct dev_context *devc;
159 char *s;
160
161 devc = sdi->priv;
162 s = g_match_info_fetch(match, 1);
163 sr_spew("STAT response '%s'.", s);
164
165 /* Max, Min or Avg mode -- no way to tell which, so we'll
166 * set both flags to denote it's not a normal measurement. */
167 if (s[0] == '1')
168 devc->cur_mqflags |= SR_MQFLAG_MAX | SR_MQFLAG_MIN;
169 else
170 devc->cur_mqflags &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN);
171
172 if (s[1] == '1')
173 devc->cur_mqflags |= SR_MQFLAG_RELATIVE;
174 else
175 devc->cur_mqflags &= ~SR_MQFLAG_RELATIVE;
176
177 /* Triggered or auto hold modes. */
178 if (s[2] == '1' || s[3] == '1')
179 devc->cur_mqflags |= SR_MQFLAG_HOLD;
180 else
181 devc->cur_mqflags &= ~SR_MQFLAG_HOLD;
182
183 /* Temp/aux mode. */
184 if (s[7] == '1')
185 devc->mode_tempaux = TRUE;
186 else
187 devc->mode_tempaux = FALSE;
188
189 /* Continuity mode. */
190 if (s[16] == '1')
191 devc->mode_continuity = TRUE;
192 else
193 devc->mode_continuity = FALSE;
194
195 g_free(s);
196
197 return SR_OK;
198}
199
200static int recv_stat_u124x(const struct sr_dev_inst *sdi, GMatchInfo *match)
201{
202 struct dev_context *devc;
203 char *s;
204
205 devc = sdi->priv;
206 s = g_match_info_fetch(match, 1);
207 sr_spew("STAT response '%s'.", s);
208
209 /* Max, Min or Avg mode -- no way to tell which, so we'll
210 * set both flags to denote it's not a normal measurement. */
211 if (s[0] == '1')
212 devc->cur_mqflags |= SR_MQFLAG_MAX | SR_MQFLAG_MIN;
213 else
214 devc->cur_mqflags &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN);
215
216 if (s[1] == '1')
217 devc->cur_mqflags |= SR_MQFLAG_RELATIVE;
218 else
219 devc->cur_mqflags &= ~SR_MQFLAG_RELATIVE;
220
221 /* Hold mode. */
222 if (s[7] == '1')
223 devc->cur_mqflags |= SR_MQFLAG_HOLD;
224 else
225 devc->cur_mqflags &= ~SR_MQFLAG_HOLD;
226
227 g_free(s);
228
229 return SR_OK;
230}
231
232static int recv_stat_u125x(const struct sr_dev_inst *sdi, GMatchInfo *match)
233{
234 struct dev_context *devc;
235 char *s;
236
237 devc = sdi->priv;
238 s = g_match_info_fetch(match, 1);
239 sr_spew("STAT response '%s'.", s);
240
241 /* Peak hold mode. */
242 if (s[4] == '1')
243 devc->cur_mqflags |= SR_MQFLAG_MAX;
244 else
245 devc->cur_mqflags &= ~SR_MQFLAG_MAX;
246
247 /* Triggered hold mode. */
248 if (s[7] == '1')
249 devc->cur_mqflags |= SR_MQFLAG_HOLD;
250 else
251 devc->cur_mqflags &= ~SR_MQFLAG_HOLD;
252
253 g_free(s);
254
255 return SR_OK;
256}
257
258static int recv_stat_u128x(const struct sr_dev_inst *sdi, GMatchInfo *match)
259{
260 struct dev_context *devc;
261 char *s;
262
263 devc = sdi->priv;
264 s = g_match_info_fetch(match, 1);
265 sr_spew("STAT response '%s'.", s);
266
267 /* Max, Min or Avg mode -- no way to tell which, so we'll
268 * set both flags to denote it's not a normal measurement. */
269 if (s[0] == '1')
270 devc->cur_mqflags |= SR_MQFLAG_MAX | SR_MQFLAG_MIN | SR_MQFLAG_AVG;
271 else
272 devc->cur_mqflags &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN | SR_MQFLAG_AVG);
273
274 /* Peak hold mode. */
275 if (s[4] == '4')
276 devc->cur_mqflags |= SR_MQFLAG_MAX;
277 else
278 devc->cur_mqflags &= ~SR_MQFLAG_MAX;
279
280 /* Null function. */
281 if (s[1] == '1')
282 devc->cur_mqflags |= SR_MQFLAG_RELATIVE;
283 else
284 devc->cur_mqflags &= ~SR_MQFLAG_RELATIVE;
285
286 /* Triggered or auto hold modes. */
287 if (s[7] == '1' || s[11] == '1')
288 devc->cur_mqflags |= SR_MQFLAG_HOLD;
289 else
290 devc->cur_mqflags &= ~SR_MQFLAG_HOLD;
291
292 g_free(s);
293
294 return SR_OK;
295}
296
297static int send_fetc(const struct sr_dev_inst *sdi)
298{
299 struct dev_context *devc;
300 devc = sdi->priv;
301 if (devc->mode_squarewave)
302 return SR_OK;
303 return agdmm_send(sdi, "FETC?");
304}
305
306static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
307{
308 struct dev_context *devc;
309 struct sr_datafeed_packet packet;
310 struct sr_datafeed_analog analog;
311 struct sr_analog_encoding encoding;
312 struct sr_analog_meaning meaning;
313 struct sr_analog_spec spec;
314 float fvalue;
315 const char *s;
316 char *mstr;
317
318 sr_spew("FETC reply '%s'.", g_match_info_get_string(match));
319 devc = sdi->priv;
320
321 if (devc->cur_mq == -1)
322 /* Haven't seen configuration yet, so can't know what
323 * the fetched float means. Not really an error, we'll
324 * get metadata soon enough. */
325 return SR_OK;
326
327 s = g_match_info_get_string(match);
328 if (!strcmp(s, "-9.90000000E+37") || !strcmp(s, "+9.90000000E+37")) {
329 /* An invalid measurement shows up on the display as "O.L", but
330 * comes through like this. Since comparing 38-digit floats
331 * is rather problematic, we'll cut through this here. */
332 fvalue = NAN;
333 } else {
334 mstr = g_match_info_fetch(match, 1);
335 if (sr_atof_ascii(mstr, &fvalue) != SR_OK) {
336 g_free(mstr);
337 sr_dbg("Invalid float.");
338 return SR_ERR;
339 }
340 g_free(mstr);
341 if (devc->cur_exponent != 0)
342 fvalue *= powf(10, devc->cur_exponent);
343 }
344
345 sr_analog_init(&analog, &encoding, &meaning, &spec,
346 devc->cur_digits - devc->cur_exponent);
347 analog.meaning->mq = devc->cur_mq;
348 analog.meaning->unit = devc->cur_unit;
349 analog.meaning->mqflags = devc->cur_mqflags;
350 analog.meaning->channels = sdi->channels;
351 analog.num_samples = 1;
352 analog.data = &fvalue;
353 encoding.digits = devc->cur_encoding - devc->cur_exponent;
354 packet.type = SR_DF_ANALOG;
355 packet.payload = &analog;
356 sr_session_send(sdi, &packet);
357
358 sr_sw_limits_update_samples_read(&devc->limits, 1);
359
360 return SR_OK;
361}
362
363static int send_conf(const struct sr_dev_inst *sdi)
364{
365 return agdmm_send(sdi, "CONF?");
366}
367
368static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
369{
370 struct dev_context *devc;
371 char *mstr, *rstr;
372 int resolution;
373
374 sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
375 devc = sdi->priv;
376
377 rstr = g_match_info_fetch(match, 2);
378 if (rstr)
379 sr_atoi(rstr, &resolution);
380 g_free(rstr);
381
382 mstr = g_match_info_fetch(match, 1);
383 if (!strcmp(mstr, "V")) {
384 devc->cur_mq = SR_MQ_VOLTAGE;
385 devc->cur_unit = SR_UNIT_VOLT;
386 devc->cur_mqflags = 0;
387 devc->cur_exponent = 0;
388 devc->cur_digits = 4 - resolution;
389 } else if (!strcmp(mstr, "MV")) {
390 if (devc->mode_tempaux) {
391 devc->cur_mq = SR_MQ_TEMPERATURE;
392 /* No way to detect whether Fahrenheit or Celsius
393 * is used, so we'll just default to Celsius. */
394 devc->cur_unit = SR_UNIT_CELSIUS;
395 devc->cur_mqflags = 0;
396 devc->cur_exponent = 0;
397 devc->cur_digits = 1;
398 } else {
399 devc->cur_mq = SR_MQ_VOLTAGE;
400 devc->cur_unit = SR_UNIT_VOLT;
401 devc->cur_mqflags = 0;
402 devc->cur_exponent = -3;
403 devc->cur_digits = 5 - resolution;
404 }
405 } else if (!strcmp(mstr, "A")) {
406 devc->cur_mq = SR_MQ_CURRENT;
407 devc->cur_unit = SR_UNIT_AMPERE;
408 devc->cur_mqflags = 0;
409 devc->cur_exponent = 0;
410 devc->cur_digits = 3 - resolution;
411 } else if (!strcmp(mstr, "UA")) {
412 devc->cur_mq = SR_MQ_CURRENT;
413 devc->cur_unit = SR_UNIT_AMPERE;
414 devc->cur_mqflags = 0;
415 devc->cur_exponent = -6;
416 devc->cur_digits = 8 - resolution;
417 } else if (!strcmp(mstr, "FREQ")) {
418 devc->cur_mq = SR_MQ_FREQUENCY;
419 devc->cur_unit = SR_UNIT_HERTZ;
420 devc->cur_mqflags = 0;
421 devc->cur_exponent = 0;
422 devc->cur_digits = 2 - resolution;
423 } else if (!strcmp(mstr, "RES")) {
424 if (devc->mode_continuity) {
425 devc->cur_mq = SR_MQ_CONTINUITY;
426 devc->cur_unit = SR_UNIT_BOOLEAN;
427 } else {
428 devc->cur_mq = SR_MQ_RESISTANCE;
429 devc->cur_unit = SR_UNIT_OHM;
430 }
431 devc->cur_mqflags = 0;
432 devc->cur_exponent = 0;
433 devc->cur_digits = 1 - resolution;
434 } else if (!strcmp(mstr, "DIOD")) {
435 devc->cur_mq = SR_MQ_VOLTAGE;
436 devc->cur_unit = SR_UNIT_VOLT;
437 devc->cur_mqflags = SR_MQFLAG_DIODE;
438 devc->cur_exponent = 0;
439 devc->cur_digits = 3;
440 } else if (!strcmp(mstr, "CAP")) {
441 devc->cur_mq = SR_MQ_CAPACITANCE;
442 devc->cur_unit = SR_UNIT_FARAD;
443 devc->cur_mqflags = 0;
444 devc->cur_exponent = 0;
445 devc->cur_digits = 9 - resolution;
446 } else
447 sr_dbg("Unknown first argument.");
448 g_free(mstr);
449
450 /* This is based on guess, supposing similarity with other models. */
451 devc->cur_encoding = devc->cur_digits + 1;
452
453 if (g_match_info_get_match_count(match) == 4) {
454 mstr = g_match_info_fetch(match, 3);
455 /* Third value, if present, is always AC or DC. */
456 if (!strcmp(mstr, "AC")) {
457 devc->cur_mqflags |= SR_MQFLAG_AC;
458 if (devc->cur_mq == SR_MQ_VOLTAGE)
459 devc->cur_mqflags |= SR_MQFLAG_RMS;
460 } else if (!strcmp(mstr, "DC")) {
461 devc->cur_mqflags |= SR_MQFLAG_DC;
462 } else {
463 sr_dbg("Unknown first argument '%s'.", mstr);
464 }
465 g_free(mstr);
466 } else
467 devc->cur_mqflags &= ~(SR_MQFLAG_AC | SR_MQFLAG_DC);
468
469 return SR_OK;
470}
471
472static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match)
473{
474 struct dev_context *devc;
475 char *mstr, *rstr, *m2;
476 int resolution;
477
478 sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
479 devc = sdi->priv;
480
481 devc->mode_squarewave = 0;
482
483 rstr = g_match_info_fetch(match, 4);
484 if (rstr && sr_atoi(rstr, &resolution) == SR_OK) {
485 devc->cur_digits = -resolution;
486 devc->cur_encoding = -resolution + 1;
487 }
488 g_free(rstr);
489
490 mstr = g_match_info_fetch(match, 1);
491 if (!strncmp(mstr, "VOLT", 4)) {
492 devc->cur_mq = SR_MQ_VOLTAGE;
493 devc->cur_unit = SR_UNIT_VOLT;
494 devc->cur_mqflags = 0;
495 devc->cur_exponent = 0;
496 if (mstr[4] == ':') {
497 if (!strncmp(mstr + 5, "ACDC", 4)) {
498 /* AC + DC offset */
499 devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS;
500 } else if (!strncmp(mstr + 5, "AC", 2)) {
501 devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_RMS;
502 } else if (!strncmp(mstr + 5, "DC", 2)) {
503 devc->cur_mqflags |= SR_MQFLAG_DC;
504 }
505 } else
506 devc->cur_mqflags |= SR_MQFLAG_DC;
507 } else if (!strncmp(mstr, "CURR", 4)) {
508 devc->cur_mq = SR_MQ_CURRENT;
509 devc->cur_unit = SR_UNIT_AMPERE;
510 devc->cur_mqflags = 0;
511 devc->cur_exponent = 0;
512 if (mstr[4] == ':') {
513 if (!strncmp(mstr + 5, "ACDC", 4)) {
514 /* AC + DC offset */
515 devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS;
516 } else if (!strncmp(mstr + 5, "AC", 2)) {
517 devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_RMS;
518 } else if (!strncmp(mstr + 5, "DC", 2)) {
519 devc->cur_mqflags |= SR_MQFLAG_DC;
520 }
521 } else
522 devc->cur_mqflags |= SR_MQFLAG_DC;
523 } else if (!strcmp(mstr, "RES")) {
524 devc->cur_mq = SR_MQ_RESISTANCE;
525 devc->cur_unit = SR_UNIT_OHM;
526 devc->cur_mqflags = 0;
527 devc->cur_exponent = 0;
528 } else if (!strcmp(mstr, "COND")) {
529 devc->cur_mq = SR_MQ_CONDUCTANCE;
530 devc->cur_unit = SR_UNIT_SIEMENS;
531 devc->cur_mqflags = 0;
532 devc->cur_exponent = 0;
533 } else if (!strcmp(mstr, "CAP")) {
534 devc->cur_mq = SR_MQ_CAPACITANCE;
535 devc->cur_unit = SR_UNIT_FARAD;
536 devc->cur_mqflags = 0;
537 devc->cur_exponent = 0;
538 } else if (!strncmp(mstr, "FREQ", 4) || !strncmp(mstr, "FC1", 3)) {
539 devc->cur_mq = SR_MQ_FREQUENCY;
540 devc->cur_unit = SR_UNIT_HERTZ;
541 devc->cur_mqflags = 0;
542 devc->cur_exponent = 0;
543 } else if (!strcmp(mstr, "CONT")) {
544 devc->cur_mq = SR_MQ_CONTINUITY;
545 devc->cur_unit = SR_UNIT_BOOLEAN;
546 devc->cur_mqflags = 0;
547 devc->cur_exponent = 0;
548 } else if (!strcmp(mstr, "DIOD")) {
549 devc->cur_mq = SR_MQ_VOLTAGE;
550 devc->cur_unit = SR_UNIT_VOLT;
551 devc->cur_mqflags = SR_MQFLAG_DIODE;
552 devc->cur_exponent = 0;
553 devc->cur_digits = 4;
554 devc->cur_encoding = 5;
555 } else if (!strncmp(mstr, "T1", 2) || !strncmp(mstr, "T2", 2) ||
556 !strncmp(mstr, "TEMP", 2)) {
557 devc->cur_mq = SR_MQ_TEMPERATURE;
558 m2 = g_match_info_fetch(match, 2);
559 if (!strcmp(m2, "FAR"))
560 devc->cur_unit = SR_UNIT_FAHRENHEIT;
561 else
562 devc->cur_unit = SR_UNIT_CELSIUS;
563 g_free(m2);
564 devc->cur_mqflags = 0;
565 devc->cur_exponent = 0;
566 devc->cur_digits = 1;
567 devc->cur_encoding = 2;
568 } else if (!strcmp(mstr, "SCOU")) {
569 /*
570 * Switch counter, not supported. Not sure what values
571 * come from FETC in this mode, or how they would map
572 * into libsigrok.
573 */
574 } else if (!strncmp(mstr, "CPER:", 5)) {
575 devc->cur_mq = SR_MQ_CURRENT;
576 devc->cur_unit = SR_UNIT_PERCENTAGE;
577 devc->cur_mqflags = 0;
578 devc->cur_exponent = 0;
579 devc->cur_digits = 2;
580 devc->cur_encoding = 3;
581 } else if (!strcmp(mstr, "SQU")) {
582 /*
583 * Square wave output, not supported. FETC just return
584 * an error in this mode, so don't even call it.
585 */
586 devc->mode_squarewave = 1;
587 } else {
588 sr_dbg("Unknown first argument '%s'.", mstr);
589 }
590 g_free(mstr);
591
592 return SR_OK;
593}
594
595/* This comes in whenever the rotary switch is changed to a new position.
596 * We could use it to determine the major measurement mode, but we already
597 * have the output of CONF? for that, which is more detailed. However
598 * we do need to catch this here, or it'll show up in some other output. */
599static int recv_switch(const struct sr_dev_inst *sdi, GMatchInfo *match)
600{
601 (void)sdi;
602
603 sr_spew("Switch '%s'.", g_match_info_get_string(match));
604
605 return SR_OK;
606}
607
608/* Poll keys/switches and values at 7Hz, mode at 1Hz. */
609SR_PRIV const struct agdmm_job agdmm_jobs_u12xx[] = {
610 { 143, send_stat },
611 { 1000, send_conf },
612 { 143, send_fetc },
613 ALL_ZERO
614};
615
616SR_PRIV const struct agdmm_recv agdmm_recvs_u123x[] = {
617 { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u123x },
618 { "^\\*([0-9])$", recv_switch },
619 { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc },
620 { "^\"(V|MV|A|UA|FREQ),(\\d),(AC|DC)\"$", recv_conf_u123x },
621 { "^\"(RES|CAP),(\\d)\"$", recv_conf_u123x},
622 { "^\"(DIOD)\"$", recv_conf_u123x },
623 ALL_ZERO
624};
625
626SR_PRIV const struct agdmm_recv agdmm_recvs_u124x[] = {
627 { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u124x },
628 { "^\\*([0-9])$", recv_switch },
629 { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc },
630 { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
631 { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
632 { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
633 { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
634 { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x },
635 { "^\"(DIOD)\"$", recv_conf_u124x_5x },
636 ALL_ZERO
637};
638
639SR_PRIV const struct agdmm_recv agdmm_recvs_u125x[] = {
640 { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u125x },
641 { "^\\*([0-9])$", recv_switch },
642 { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc },
643 { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
644 { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
645 { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
646 { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
647 { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x },
648 { "^\"(DIOD)\"$", recv_conf_u124x_5x },
649 ALL_ZERO
650};
651
652SR_PRIV const struct agdmm_recv agdmm_recvs_u128x[] = {
653 { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u128x },
654 { "^\\*([0-9])$", recv_switch },
655 { "^([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))$", recv_fetc },
656 { "^\"(VOLT|CURR|RES|COND|CAP|FREQ|FC1|FC100) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
657 { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
658 { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
659 { "^\"(FREQ:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
660 { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x },
661 { "^\"(TEMP:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x },
662 { "^\"(DIOD|SQU)\"$", recv_conf_u124x_5x },
663 ALL_ZERO
664};