130
111
char tc = '>'; /* Terminating character */
131
112
int ntc = 1; /* Number of terminating characters */
132
113
int rv, se, insize;
134
int xuserm = 0; /* User flags from transmit operation */
136
/* Turn off low level debug messages, and sumarise them here */
137
isdeb = p->icom->debug;
140
if (isdeb) fprintf(stderr,"dtp20: Sending '%s'",icoms_fix(in));
115
a1logd(p->log, 4, "dtp20: Sending '%s'",icoms_fix(in));
142
117
insize = strlen(in);
143
118
if (insize > 0) {
144
119
if ((se = p->icom->usb_control(p->icom, 0x41, 0x00, 0x00, 0x00, (unsigned char *)in, insize, to)) != ICOM_OK) {
145
if (isdeb) fprintf(stderr,"send failed ICOM err 0x%x\n",se);
146
/* If something other than a user terminate, trigger or command */
147
if ((se & ~ICOM_USERM) != ICOM_OK || (se & ICOM_USERM) == ICOM_USER) {
148
p->icom->debug = isdeb;
149
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
151
xuserm = (se & ICOM_USERM);
120
a1logd(p->log, 1, "dtp20: send command failed ICOM err 0x%x\n",se);
121
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
156
125
if ((se = p->icom->read(p->icom, out, bsize, tc, ntc, to)) != 0) {
157
if (isdeb) fprintf(stderr,"response failed ICOM err 0x%x\n",se);
158
p->icom->debug = isdeb;
126
a1logd(p->log, 1, "dtp20: read response failed ICOM err 0x%x\n",se);
159
127
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
162
/* Deal with user terminate, trigger or command on send */
163
if (xuserm != ICOM_OK)
164
return dtp20_interp_code((inst *)p, icoms2dtp20_err(xuserm));
167
131
if (tc == '>' && ntc == 1) { /* Expecting DTP type error code */
168
132
rv = extract_ec(out);
195
158
int rv, se, insize;
199
int xuserm = 0; /* User flags from transmit operation */
201
/* Turn off low level debug messages, and sumarise them here */
202
isdeb = p->icom->debug;
205
if (isdeb) fprintf(stderr,"dtp20: Sending '%s'",icoms_fix(in));
162
a1logd(p->log, 4, "dtp20: Sending '%s'",icoms_fix(in));
207
164
insize = strlen(in);
208
165
if (insize > 0) {
209
166
if ((se = p->icom->usb_control(p->icom, 0x41, 0x00, 0x00, 0x00, (unsigned char *)in, insize, top)) != ICOM_OK) {
210
if (isdeb) fprintf(stderr,"send failed ICOM err 0x%x\n",se);
211
/* If something other than a user terminate, trigger or command */
212
if ((se & ~ICOM_USERM) != ICOM_OK || (se & ICOM_USERM) == ICOM_USER) {
213
p->icom->debug = isdeb;
214
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
216
xuserm = (se & ICOM_USERM);
167
a1logd(p->log, 1, "dtp20: send failed ICOM err 0x%x\n",se);
168
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
225
176
if (rsize > bsize)
227
//printf("~1 doing %d, %d to go\n",rsize, bsize);
229
if ((se = p->icom->usb_read(p->icom, 0x81, (unsigned char *)op, rsize, &bread, top)) != ICOM_OK) {
179
if ((se = p->icom->usb_read(p->icom, NULL, 0x81, (unsigned char *)op, rsize, &bread, top)) != ICOM_OK) {
230
180
if (se == ICOM_SHORT) {
231
if (isdeb) fprintf(stderr,"response failed expected %d got %d ICOM err 0x%x\n",rsize,bread,se);
181
a1logd(p->log, 1, "dtp20: response failed expected %d got %d ICOM err 0x%x\n",
233
if (isdeb) fprintf(stderr,"response failed ICOM err 0x%x\n",se);
184
a1logd(p->log, 1, "dtp20: response failed ICOM err 0x%x\n",se);
235
p->icom->debug = isdeb;
236
186
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
238
//printf("~1 read %d\n",bread);
243
/* Deal with user terminate, trigger or command on send */
244
if (xuserm != ICOM_OK)
245
return dtp20_interp_code((inst *)p, icoms2dtp20_err(xuserm));
249
if (isdeb) fprintf(stderr,"response '%s' ICOM err 0x%x\n",icoms_tohex((unsigned char *)out, bread),rv);
250
p->icom->debug = isdeb;
194
a1logd(p->log, 4, "dtp20: response '%s' ICOM err 0x%x\n",
195
icoms_tohex((unsigned char *)out, bread),rv);
251
196
return dtp20_interp_code((inst *)p, rv);
254
199
/* Establish communications with a DTP20 */
255
/* Use the baud rate given, and timeout in to secs */
256
200
/* Return DTP_COMS_FAIL on failure to establish communications */
258
dtp20_init_coms(inst *pp, int port, baud_rate br, flow_control fc, double tout) {
202
dtp20_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) {
259
203
dtp20 *p = (dtp20 *)pp;
260
204
char buf[MAX_MES_SIZE];
261
206
inst_code ev = inst_ok;
264
p->icom->debug = p->debug; /* Turn on debugging */
265
fprintf(stderr,"dtp20: About to init coms\n");
268
if (p->icom->is_usb_portno(p->icom, port) != instUnknown) {
270
if (p->debug) fprintf(stderr,"dtp20: About to init USB\n");
208
if (p->icom->port_type(p->icom) == icomt_usb) {
210
a1logd(p->log, 4, "dtp20: About to init USB\n");
272
212
/* Set config, interface, write end point, read end point, read quanta */
273
p->icom->set_usb_port(p->icom, port, 1, 0x00, 0x81, icomuf_none, 0, NULL);
213
if ((se = p->icom->set_usb_port(p->icom, 1, 0x00, 0x81, icomuf_none, 0, NULL)) != ICOM_OK) {
214
a1logd(p->log, 1, "dtp20: set_usbe_port failed ICOM err 0x%x\n",se);
215
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
275
218
/* Blind reset it twice - it seems to sometimes hang up */
276
219
/* otherwise under OSX */
278
221
dtp20_command(p, "0PR\r", buf, MAX_MES_SIZE, 0.5);
281
if (p->debug) fprintf(stderr,"dtp20: Failed to find connection to instrument\n");
224
a1logd(p->log, 1, "dtp20: Failed to find connection to instrument\n");
282
225
return inst_coms_fail;
285
228
/* Check instrument is responding */
286
229
if ((ev = dtp20_command(p, "\r", buf, MAX_MES_SIZE, 1.5)) != inst_ok) {
287
if (p->debug) fprintf(stderr,"dtp20: Failed to get a response from instrument\n");
230
a1logd(p->log, 1, "dtp20: Failed to get a response from instrument\n");
288
231
return inst_coms_fail;
234
/* Print the general information returned by instrument */
293
if ((ev = dtp20_command(p, "GI\r", buf, MAX_MES_SIZE, 0.2)) != inst_ok)
237
if ((ev = dtp20_command(p, "GI\r", buf, MAX_MES_SIZE, 0.2)) != inst_ok) {
238
a1logd(p->log, 1, "dtp20: GI command failed with ICOM err 0x%x\n",ev);
295
241
for (j = i = 0; ;i++) {
296
242
if (buf[i] == '<' || buf[i] == '\000')
298
244
if (buf[i] == '\r') {
300
printf(" %s\n",&buf[j]);
246
a1logv(p->log, 1, " %s\n",&buf[j]);
301
247
if (buf[i+1] == '\n')
512
461
if (ttlp != npatch
514
463
|| (id != -1 && id != chid)) {
515
if (p->debug) fprintf(stderr,"Got %d, xpt %d patches, got %d xpt %d strip lgth, got %d xpt %d chart id\n",ttlp,npatch,sl,sip,id,chid);
464
a1logd(p->log, 2, "dtp20: Got %d, xpt %d patches, got %d xpt %d strip lgth, "
465
"got %d xpt %d chart id\n",ttlp,npatch,sl,sip,id,chid);
516
466
return inst_nochmatch;
520
printf("Chart has %d patches, %d per strip, chart id %d\n",ttlp,sl,id);
469
a1logv(p->log, 1, "Chart has %d patches, %d per strip, chart id %d\n",ttlp,sl,id);
522
471
/* Disable multiple data output */
523
472
if ((ev = dtp20_command(p, "001ACF\r", buf, MAX_MES_SIZE, 0.5)) != inst_ok)
664
611
build_strip(p, tbuf, name, npatch, pname, sguide, pwid, gwid, twid);
666
613
if ((ev = dtp20_command(p, tbuf, buf, MAX_MES_SIZE, 1.5)) != inst_ok) {
668
printf("Interactive strip reading won't work on Firmware earlier than V1.03 !\n");
614
a1logv(p->log, 1, "Interactive strip reading won't work on Firmware earlier than V1.03 !\n");
672
if (p->trig == inst_opt_trig_keyb_switch) {
618
if (p->trig == inst_opt_trig_user_switch) {
675
/* Wait for a strip value to turn up, or a user abort/command */
621
/* Wait for a strip value to turn up, or a user command/abort */
677
if ((ev = dtp20_command(p, "CS\r", buf, MAX_MES_SIZE, 0.2)) != inst_ok) {
678
if (ev == (inst_coms_fail | DTP20_TIMEOUT)) {
624
ev = dtp20_command(p, "CS\r", buf, MAX_MES_SIZE, 0.2);
626
if (ev == (inst_coms_fail | DTP20_TIMEOUT)) {
627
/* Ignore transient timeouts */
632
} else if (ev != inst_ok) {
683
633
if ((ev & inst_mask) == inst_needs_cal)
685
if ((ev & inst_mask) != inst_user_trig)
635
return ev; /* Error */
690
638
if (sscanf(buf, " %d ", &stat) != 1)
692
/* Ingnore benign status */
641
/* Ignore benign status */
693
642
if (stat != 4 && stat != 6 && stat != 7) {
643
/* Not ready - Check for user trigger or command */
644
if (p->uicallback != NULL) {
645
if ((ev = p->uicallback(p->uic_cntx, inst_armed)) != inst_ok) {
646
if (ev == inst_user_abort) {
647
return ev; /* Error or user abort */
648
} else if (ev == inst_user_trig) {
649
user_trig = 1; /* User trigger */
704
} else if (p->trig == inst_opt_trig_keyb) {
705
if ((se = icoms_poll_user(p->icom, 1)) != ICOM_TRIG) {
706
/* Abort, term or command */
707
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
659
/* Ready - continue on */
665
/* Notify of trigger */
667
p->uicallback(p->uic_cntx, inst_triggered);
669
} else if (p->trig == inst_opt_trig_user) {
670
if (p->uicallback == NULL) {
671
a1logd(p->log, 1, "dtp20: inst_opt_trig_user but no uicallback function set!\n");
672
return inst_unsupported;
676
if ((ev = p->uicallback(p->uic_cntx, inst_armed)) != inst_ok) {
677
if (ev == inst_user_abort)
679
if (ev == inst_user_trig) {
686
/* Notify of trigger */
688
p->uicallback(p->uic_cntx, inst_triggered);
690
/* Progromatic Trigger */
692
/* Check for abort */
693
if (p->uicallback != NULL
694
&& (ev = p->uicallback(p->uic_cntx, inst_armed)) == inst_user_abort)
714
698
/* Trigger a read if the switch has not been used */
834
819
return inst_no_init;
836
821
/* This combination doesn't make any sense... */
837
if ((p->mode & inst_mode_measurement_mask) == inst_mode_s_ref_spot
838
&& p->trig == inst_opt_trig_keyb_switch) {
839
return inst_wrong_config;
822
if (IMODETST(p->mode, inst_mode_s_ref_spot) && p->trig == inst_opt_trig_user_switch) {
823
return inst_wrong_setup;
842
if (p->trig == inst_opt_trig_keyb_switch) {
826
if (p->trig == inst_opt_trig_user_switch) {
845
/* Wait for a spot value to turn up, or a user abort/command */
829
/* Wait for a sample value to turn up, or a user abort */
847
if ((ev = dtp20_command(p, "CS\r", buf, MAX_MES_SIZE, 0.2)) != inst_ok) {
848
if (ev == (inst_coms_fail | DTP20_TIMEOUT)) {
832
/* Check for user trigger */
833
if (p->uicallback != NULL) {
834
if ((ev = p->uicallback(p->uic_cntx, inst_armed)) != inst_ok) {
835
if (ev == inst_user_abort)
836
return ev; /* User abort */
837
if (ev == inst_user_trig) {
844
/* Check for an instrument switch trigger */
845
ev = dtp20_command(p, "CS\r", buf, MAX_MES_SIZE, 0.2);
847
if (ev == (inst_coms_fail | DTP20_TIMEOUT)) { /* Assume we're waiting for trigger */
852
} else if (ev != inst_ok) {
853
853
if ((ev & inst_mask) == inst_needs_cal)
855
if ((ev & inst_mask) != inst_user_trig)
855
return ev; /* Error */
857
} else { /* Got a CS response */
860
859
if (sscanf(buf, " %d ", &stat) != 1)
874
} else if (p->trig == inst_opt_trig_keyb) {
875
if ((se = icoms_poll_user(p->icom, 1)) != ICOM_TRIG) {
876
/* Abort, term or command */
877
return dtp20_interp_code((inst *)p, icoms2dtp20_err(se));
870
/* Notify of trigger */
872
p->uicallback(p->uic_cntx, inst_triggered);
874
} else if (p->trig == inst_opt_trig_user) {
875
if (p->uicallback == NULL) {
876
a1logd(p->log, 1, "dtp20: inst_opt_trig_user but no uicallback function set!\n");
877
return inst_unsupported;
881
if ((ev = p->uicallback(p->uic_cntx, inst_armed)) != inst_ok) {
882
if (ev == inst_user_abort)
883
return ev; /* Abort */
884
if (ev == inst_user_trig) {
891
/* Notify of trigger */
893
p->uicallback(p->uic_cntx, inst_triggered);
895
/* Progromatic Trigger */
897
/* Check for abort */
898
if (p->uicallback != NULL
899
&& (ev = p->uicallback(p->uic_cntx, inst_armed)) == inst_user_abort)
900
return ev; /* Abort */
884
903
/* Read saved spot values */
885
if ((p->mode & inst_mode_measurement_mask) == inst_mode_s_ref_spot) {
904
if (IMODETST(p->mode, inst_mode_s_ref_spot)) {
941
960
if (sscanf(buf, " %lf %lf %lf ", &val->XYZ[0], &val->XYZ[1], &val->XYZ[2]) != 3) {
942
961
return inst_protocol_error;
963
/* This may not change anything since instrument may clamp */
965
icmClamp3(val->XYZ, val->XYZ);
966
val->loc[0] = '\000';
967
val->mtype = inst_mrt_reflective;
947
969
val->sp.spec_n = 0;
948
970
val->duration = 0.0;
950
972
if (p->mode & inst_mode_spectral) {
953
/* Set to read speactral reflectance */
975
/* Set to read spectral reflectance */
954
976
if ((ev = dtp20_command(p, "0318CF\r", buf, MAX_MES_SIZE, 0.5)) != inst_ok)
956
978
/* Set to binary */
1009
1031
return inst_ok;
1013
/* Determine if a calibration is needed. Returns inst_calt_none if not, */
1014
/* inst_calt_unknown if it is unknown, or inst_calt_XXX if needs calibration, */
1015
/* and the first type of calibration needed. */
1016
inst_cal_type dtp20_needs_calibration(inst *pp) {
1034
/* Return needed and available inst_cal_type's */
1035
static inst_code dtp20_get_n_a_cals(inst *pp, inst_cal_type *pn_cals, inst_cal_type *pa_cals) {
1017
1036
dtp20 *p = (dtp20 *)pp;
1020
return inst_no_coms;
1022
return inst_no_init;
1025
return inst_calt_ref_white;
1027
return inst_calt_unknown;
1037
inst_cal_type n_cals = inst_calt_none;
1038
inst_cal_type a_cals = inst_calt_none;
1041
n_cals |= inst_calt_ref_white;
1042
a_cals |= inst_calt_ref_white;
1044
if (pn_cals != NULL)
1047
if (pa_cals != NULL)
1030
1053
/* Request an instrument calibration. */
1036
1059
/* user to do so, each time the error inst_cal_setup is returned. */
1037
1060
inst_code dtp20_calibrate(
1039
inst_cal_type calt, /* Calibration type. inst_calt_all for all neeeded */
1062
inst_cal_type *calt, /* Calibration type to do/remaining */
1040
1063
inst_cal_cond *calc, /* Current condition/desired condition */
1041
1064
char id[CALIDLEN] /* Condition identifier (ie. white reference ID) */
1043
1066
dtp20 *p = (dtp20 *)pp;
1044
inst_code ev = inst_ok;
1045
1067
char buf[MAX_MES_SIZE];
1069
inst_cal_type needed, available;
1072
return inst_no_coms;
1074
return inst_no_init;
1046
1076
id[0] = '\000';
1049
return inst_no_coms;
1051
return inst_no_init;
1053
if (calt == inst_calt_all)
1054
calt = inst_calt_ref_white;
1056
if (calt != inst_calt_ref_white) {
1078
if ((ev = dtp20_get_n_a_cals((inst *)p, &needed, &available)) != inst_ok)
1081
/* Translate inst_calt_all/needed into something specific */
1082
if (*calt == inst_calt_all
1083
|| *calt == inst_calt_needed
1084
|| *calt == inst_calt_available) {
1085
if (*calt == inst_calt_all)
1086
*calt = (needed & inst_calt_n_dfrble_mask) | inst_calt_ap_flag;
1087
else if (*calt == inst_calt_needed)
1088
*calt = needed & inst_calt_n_dfrble_mask;
1089
else if (*calt == inst_calt_available)
1090
*calt = available & inst_calt_n_dfrble_mask;
1092
a1logd(p->log,4,"dtp20_calibrate: doing calt 0x%x\n",calt);
1094
if ((*calt & inst_calt_n_dfrble_mask) == 0) /* Nothing todo */
1098
/* See if it's a calibration we understand */
1099
if (*calt & ~available & inst_calt_all_mask) {
1057
1100
return inst_unsupported;
1060
if (*calc == inst_calc_man_ref_white) {
1103
if (*calt & inst_calt_ref_white) {
1105
if (*calc != inst_calc_man_ref_white) {
1107
if ((ev = dtp20_command(p, "04SN\r", buf, MAX_MES_SIZE, 4.5)) != inst_ok)
1109
for (cp = buf; *cp >= '0' && *cp <= '9'; cp++)
1113
*calc = inst_calc_man_ref_white;
1114
return inst_cal_setup;
1061
1117
if ((ev = dtp20_command(p, "CR\r", buf, MAX_MES_SIZE, 4.5)) != inst_ok)
1064
1120
p->need_cal = 0;
1065
return inst_ok; /* Calibration done */
1069
if ((ev = dtp20_command(p, "04SN\r", buf, MAX_MES_SIZE, 4.5)) != inst_ok)
1071
for (cp = buf; *cp >= '0' && *cp <= '9'; cp++)
1075
*calc = inst_calc_man_ref_white; /* Need to ask user to do calibration */
1076
return inst_cal_setup;
1121
*calt &= ~inst_calt_ref_white;
1078
return inst_unsupported;
1081
1127
/* Error codes interpretation */
1344
1370
/* Set the instrument capabilities */
1345
1371
static void set_capabilities(dtp20 *p) {
1347
p->cap = inst_ref_spot
1373
p->cap = inst_mode_ref_spot
1374
| inst_mode_ref_strip
1375
| inst_mode_s_ref_spot
1376
| inst_mode_s_ref_chart
1377
| inst_mode_colorimeter
1378
| inst_mode_spectral
1355
p->cap2 = inst2_cal_ref_white
1357
| inst2_keyb_switch_trig
1381
p->cap2 = inst2_prog_trig
1382
| inst2_user_switch_trig
1359
1384
| inst2_has_battery
1387
p->cap3 = inst3_none;
1364
1391
/* Return the instrument capabilities */
1365
inst_capability dtp20_capabilities(inst *pp) {
1392
void dtp20_capabilities(inst *pp,
1394
inst2_capability *cap2,
1395
inst3_capability *cap3) {
1366
1396
dtp20 *p = (dtp20 *)pp;
1368
if (p->cap == inst_unknown)
1398
if (p->cap == inst_mode_none)
1369
1399
set_capabilities(p);
1373
/* Return the instrument capabilities 2 */
1374
inst2_capability dtp20_capabilities2(inst *pp) {
1410
* check measurement mode
1413
dtp20_check_mode(inst *pp, inst_mode m) {
1375
1414
dtp20 *p = (dtp20 *)pp;
1377
if (p->cap2 == inst2_unknown)
1378
set_capabilities(p);
1418
return inst_no_coms;
1420
return inst_no_init;
1422
pp->capabilities(pp, &cap, NULL, NULL);
1426
return inst_unsupported;
1428
/* Check specific modes */
1429
if (!IMODETST(m, inst_mode_ref_spot)
1430
&& !IMODETST(m, inst_mode_ref_strip)
1431
&& !IMODETST(m, inst_mode_s_ref_spot)
1432
&& !IMODETST(m, inst_mode_s_ref_chart)) {
1433
return inst_unsupported;
1383
1440
* set measurement mode
1385
1442
static inst_code
1386
dtp20_set_mode(inst *pp, inst_mode m)
1443
dtp20_set_mode(inst *pp, inst_mode m) {
1388
1444
dtp20 *p = (dtp20 *)pp;
1389
inst_capability cap = pp->capabilities(pp);
1390
inst_mode mm; /* Measurement mode */
1393
return inst_no_coms;
1395
return inst_no_init;
1397
/* The measurement mode portion of the mode */
1398
mm = m & inst_mode_measurement_mask;
1400
/* General check mode against specific capabilities logic: */
1401
if (mm != inst_mode_ref_spot
1402
&& mm != inst_mode_ref_strip
1403
&& mm != inst_mode_s_ref_spot
1404
&& mm != inst_mode_s_ref_chart) {
1405
return inst_unsupported;
1408
if (m & inst_mode_colorimeter)
1409
if (!(cap & inst_colorimeter))
1410
return inst_unsupported;
1412
if (m & inst_mode_spectral)
1413
if (!(cap & inst_spectral))
1414
return inst_unsupported;
1447
if ((ev = dtp20_check_mode(pp, m)) != inst_ok)
1418
1452
return inst_ok;
1422
* set or reset an optional mode
1425
dtp20_set_opt_mode(inst *pp, inst_opt_mode m, ...)
1455
/* Get a status or get or set an option */
1456
static inst_code dtp20_get_set_opt(
1458
inst_opt_type m, /* Requested status type */
1459
...) { /* Status parameters */
1427
1460
dtp20 *p = (dtp20 *)pp;
1430
return inst_no_coms;
1432
return inst_no_init;
1434
1462
/* Record the trigger mode */
1435
1463
if (m == inst_opt_trig_prog
1436
|| m == inst_opt_trig_keyb
1437
|| m == inst_opt_trig_keyb_switch) {
1464
|| m == inst_opt_trig_user
1465
|| m == inst_opt_trig_user_switch) {
1440
1468
return inst_ok;
1443
if (m == inst_opt_trig_return) {
1446
} else if (m == inst_opt_trig_no_return) {
1451
return inst_unsupported;
1454
/* Get a dynamic status */
1455
static inst_code dtp20_get_status(
1457
inst_status_type m, /* Requested status type */
1458
...) { /* Status parameters */
1459
dtp20 *p = (dtp20 *)pp;
1461
1471
if (!p->gotcoms)
1462
1472
return inst_no_coms;
1463
1473
if (!p->inited)
1639
1649
/* !! It's not clear if there is a way of knowing */
1640
1650
/* whether the instrument has a UV filter. */
1642
return inst_unsupported;
1652
/* Use default implementation of other inst_opt_type's */
1658
rv = inst_get_set_opt_def(pp, m, args);
1645
1665
/* Constructor */
1646
extern dtp20 *new_dtp20(icoms *icom, instType itype, int debug, int verb)
1666
extern dtp20 *new_dtp20(icoms *icom, instType itype) {
1649
if ((p = (dtp20 *)calloc(sizeof(dtp20),1)) == NULL)
1650
error("dtp20: malloc failed!");
1653
p->icom = new_icoms();
1660
p->init_coms = dtp20_init_coms;
1661
p->init_inst = dtp20_init_inst;
1662
p->capabilities = dtp20_capabilities;
1663
p->capabilities2 = dtp20_capabilities2;
1664
p->set_mode = dtp20_set_mode;
1665
p->set_opt_mode = dtp20_set_opt_mode;
1666
p->get_status = dtp20_get_status;
1667
p->read_chart = dtp20_read_chart;
1668
p->read_strip = dtp20_read_strip;
1669
p->read_sample = dtp20_read_sample;
1670
p->needs_calibration = dtp20_needs_calibration;
1671
p->calibrate = dtp20_calibrate;
1672
p->interp_error = dtp20_interp_error;
1676
p->cap = inst_unknown; /* Unknown until set */
1677
p->mode = inst_mode_unknown; /* Not in a known mode yet */
1668
if ((p = (dtp20 *)calloc(sizeof(dtp20),1)) == NULL) {
1669
a1loge(icom->log, 1, "new_dtp20: malloc failed!\n");
1673
p->log = new_a1log_d(icom->log);
1675
p->init_coms = dtp20_init_coms;
1676
p->init_inst = dtp20_init_inst;
1677
p->capabilities = dtp20_capabilities;
1678
p->check_mode = dtp20_check_mode;
1679
p->set_mode = dtp20_set_mode;
1680
p->get_set_opt = dtp20_get_set_opt;
1681
p->read_chart = dtp20_read_chart;
1682
p->read_strip = dtp20_read_strip;
1683
p->read_sample = dtp20_read_sample;
1684
p->get_n_a_cals = dtp20_get_n_a_cals;
1685
p->calibrate = dtp20_calibrate;
1686
p->interp_error = dtp20_interp_error;
1690
p->itype = icom->itype;
1691
p->cap = inst_mode_none; /* Unknown until set */
1692
p->mode = inst_mode_none; /* Not in a known mode yet */