1 
2 #ifndef SS_IMP_H
3 
4 /*
5  * Argyll Color Correction System
6  *
7  * Gretag Spectrolino and Spectroscan related
8  * defines and declarations - implementation.
9  *
10  * Author: Graeme W. Gill
11  * Date:   13/7/2005
12  *
13  * Copyright 2005 - 2013 Graeme W. Gill
14  * All rights reserved.
15  *
16  * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :-
17  * see the License2.txt file for licencing details.
18  *
19  * This is an alternative driver to spm/gretag.
20  */
21 
22 /*
23    If you make use of the instrument driver code here, please note
24    that it is the author(s) of the code who take responsibility
25    for its operation. Any problems or queries regarding driving
26    instruments with the Argyll drivers, should be directed to
27    the Argyll's author(s), and not to any other party.
28 
29    If there is some instrument feature or function that you
30    would like supported here, it is recommended that you
31    contact Argyll's author(s) first, rather than attempt to
32    modify the software yourself, if you don't have firm knowledge
33    of the instrument communicate protocols. There is a chance
34    that an instrument could be damaged by an incautious command
35    sequence, and the instrument companies generally cannot and
36    will not support developers that they have not qualified
37    and agreed to support.
38  */
39 
40 #ifdef __cplusplus
41 	extern "C" {
42 #endif
43 
44 /* Communication symbol definitions */
45 /* From the Gretag Spectrolino/Spectroscan */
46 /* Serial Interface manual. */
47 /* We are using the Hex communication method */
48 
49 /* Timout values for commands */
50 #define SH_TMO	0.5			/* Short timout for establishing communications */
51 #define IT_TMO	18.0		/* Initialisation commands */
52 #define MV_TMO	10.0		/* Move commands */
53 #define DF_TMO	6.0			/* Other commands */
54 
55 /* Actual Filter Type */
56 typedef enum {
57 	ss_aft_NoDefined    = 0x00,
58 	ss_aft_NoFilter     = 0x01,
59 	ss_aft_PolFilter    = 0x02,
60 	ss_aft_D65Filter    = 0x03,
61 	ss_aft_UVCutFilter  = 0x05,
62 	ss_aft_CustomFilter = 0x06
63 } ss_aft;
64 
65 /* Article Number Type */
66 
67 /* Baudrate Type */
68 typedef enum {
69 	ss_bt_110   = 0x00,
70 	ss_bt_150   = 0x01,
71 	ss_bt_300   = 0x02,
72 	ss_bt_600   = 0x03,
73 	ss_bt_1200  = 0x04,
74 	ss_bt_2400  = 0x05,
75 	ss_bt_4800  = 0x06,
76 	ss_bt_9600  = 0x07,
77 	ss_bt_19200 = 0x08,
78 	ss_bt_28080 = 0x09,
79 	ss_bt_57600 = 0x0A
80 } ss_bt;
81 
82 /* Color Type */
83 
84 /* COM Float Type */
85 typedef enum {
86 	ss_comft_vPhotometricYRef = 0x01		/* cd/m^2 */
87 } ss_comft;
88 
89 /* Control Type */
90 typedef enum {
91 	ss_ctt_ProtokolWithXonXoff    = 0x1E,
92 	ss_ctt_ProtokolWithoutXonXoff = 0x1F,
93 	ss_ctt_ProtokolWithHardwareHS = 0xCF,
94 	ss_ctt_SetBaud110             = 0x20,
95 	ss_ctt_SetBaud150             = 0x21,
96 	ss_ctt_SetBaud300             = 0x22,
97 	ss_ctt_SetBaud600             = 0x23,
98 	ss_ctt_SetBaud1200            = 0x24,
99 	ss_ctt_SetBaud2400            = 0x25,
100 	ss_ctt_SetBaud4800            = 0x26,
101 	ss_ctt_SetBaud9600            = 0x27,
102 	ss_ctt_SetBaud19200           = 0x28,
103 	ss_ctt_SetBaud28800           = 0x98,
104 	ss_ctt_SetBaud57600           = 0x99,
105 	ss_ctt_SpeakerON              = 0x54,
106 	ss_ctt_SpeakerOFF             = 0x55,
107 	ss_ctt_RemissionMeas          = 0x9B,
108 	ss_ctt_TransmissionMeas       = 0x9C,
109 	ss_ctt_EmissionMeas           = 0x9D,
110 	ss_ctt_PhotometricAbsolute    = 0x9E,
111 	ss_ctt_PhotometricRelative    = 0x9F,
112 	ss_ctt_SetCustomFilter        = 0xA0,
113 	ss_ctt_ReleaseCustomFilter    = 0xA1
114 } ss_ctt;
115 
116 /* Color Space Type */
117 typedef enum {
118 	ss_cst_XyY       = 0x00,
119 	ss_cst_Lab       = 0x01,
120 	ss_cst_LChab     = 0x02,
121 	ss_cst_Luv       = 0x03,
122 	ss_cst_XYZ       = 0x04,
123 	ss_cst_RxRyRz    = 0x05,
124 	ss_cst_HLab      = 0x06,
125 	ss_cst_LABmg     = 0x0B,
126 	ss_cst_LCHmg     = 0x0C,
127 	ss_cst_LCHuv     = 0x0D
128 } ss_cst;
129 
130 /* Date Type */
131 
132 /* Density Filter Spectral Array Type */
133 
134 /* Density Filter Array Type */
135 
136 /* Density Filter Type */
137 typedef enum {
138 	ss_dft_Db    = 0x00,
139 	ss_dft_Dc    = 0x01,
140 	ss_dft_Dm    = 0x02,
141 	ss_dft_Dy    = 0x03,
142 	ss_dft_Dmax  = 0x04,
143 	ss_dft_Dauto = 0x05
144 } ss_dft;
145 
146 /* Device Name Type */
147 
148 /* Device Number Type */
149 typedef enum {
150 	ss_dnot_SPM10       = 0x00,
151 	ss_dnot_SPM50       = 0x01,
152 	ss_dnot_SPM55       = 0x02,
153 	ss_dnot_SPM60       = 0x03,
154 	ss_dnot_SPM100      = 0x04,
155 	ss_dnot_SPM100IInl  = 0x05,
156 	ss_dnot_SPM100II    = 0x06,
157 	ss_dnot_D196        = 0x10,
158 	ss_dnot_D19C        = 0x11,
159 	ss_dnot_D118C       = 0x12,
160 	ss_dnot_DM620       = 0x13,
161 	ss_dnot_SPECTROLINO = 0x20,
162 	ss_dnot_VIDEOLINO   = 0x30,
163 	ss_dnot_SPECTROSCAN = 0x40
164 } ss_dnot;
165 
166 /* Dmax OK Type */
167 typedef enum {
168 	ss_dmot_FALSE = 0x00,
169 	ss_dmot_TRUE  = 0x01
170 } ss_dmot;
171 
172 /* Dmax Type */
173 
174 /* Density Standard Type */
175 typedef enum {
176 	ss_dst_ANSIA   = 0x00,
177 	ss_dst_ANSIT   = 0x01,
178 	ss_dst_DIN     = 0x02,
179 	ss_dst_DINNB   = 0x03,
180 	ss_dst_DS1     = 0x08		/* User defined */
181 } ss_dst;
182 
183 /* Communication Error Type */
184 typedef enum {
185 	ss_cet_NoError            = 0x00,
186 	ss_cet_StopButNoStart     = 0x01,
187 	ss_cet_IllegalCharInRec   = 0x02,
188 	ss_cet_IncorrectRecLen    = 0x03,
189 	ss_cet_IllegalRecType     = 0x04,
190 	ss_cet_NoTagField         = 0x06,
191 	ss_cet_ConvError          = 0x07,
192 	ss_cet_InvalidForEmission = 0x08,
193 	ss_cet_NoAccess           = 0x10,
194 } ss_cet;
195 
196 /* Daylight Color Temperature Type */
197 
198 /* Error Type + augmentation */
199 typedef enum {
200 	ss_et_NoError         = 0x00,
201 	ss_et_MemoryFailure   = 0x01,
202 	ss_et_PowerFailure    = 0x02,
203 	ss_et_LampFailure     = 0x04,
204 	ss_et_HardwareFailure = 0x05,
205 	ss_et_FilterOutOfPos  = 0x06,
206 	ss_et_SendTimeout     = 0x07,
207 	ss_et_DriveError      = 0x08,
208 	ss_et_MeasDisabled    = 0x09,
209 	ss_et_DensCalError    = 0x0A,
210 	ss_et_EPROMFailure    = 0x0D,
211 	ss_et_RemOverFlow     = 0x0E,
212 	ss_et_MemoryError     = 0x10,
213 	ss_et_FullMemory      = 0x11,
214 	ss_et_WhiteMeasOK     = 0x13,
215 	ss_et_NotReady        = 0x15,
216 	ss_et_WhiteMeasWarn   = 0x32,
217 	ss_et_ResetDone       = 0x33,
218 	ss_et_EmissionCalOK   = 0x34,
219 	ss_et_OnlyEmission    = 0x35,
220 	ss_et_CheckSumWrong   = 0x36,
221 	ss_et_NoValidMeas     = 0x37,
222 	ss_et_BackupError     = 0x38,
223 	ss_et_ProgramROMError = 0x3C,
224 
225 	/* Incororate Remote Error Set values into snerr value */
226 	/* Since ss_res is a bit mask, we just prioritize the errors: */
227 	ss_et_NoValidDStd           = 0x41,
228 	ss_et_NoValidWhite          = 0x42,
229 	ss_et_NoValidIllum          = 0x43,
230 	ss_et_NoValidObserver       = 0x44,
231 	ss_et_NoValidMaxLambda      = 0x45,
232 	ss_et_NoValidSpect          = 0x46,
233 	ss_et_NoValidColSysOrIndex  = 0x47,
234 	ss_et_NoValidChar           = 0x48,
235 	ss_et_DorlOutOfRange        = 0x49,
236 	ss_et_ReflectanceOutOfRange = 0x4A,
237 	ss_et_Color1OutOfRange      = 0x4B,
238 	ss_et_Color2OutOfRange      = 0x4C,
239 	ss_et_Color3OutOfRange      = 0x4D,
240 	ss_et_NotAnSROrBoolean      = 0x4E,
241 	ss_et_NoValidValOrRef       = 0x4F,
242 
243 	/* Incorporate scan error codes thus: */
244 	ss_et_DeviceIsOffline    = 0x61,
245 	ss_et_OutOfRange         = 0x62,
246 	ss_et_ProgrammingError   = 0x63,
247 	ss_et_NoUserAccess       = 0x64,
248 	ss_et_NoValidCommand     = 0x65,
249 	ss_et_NoDeviceFound      = 0x66,
250 	ss_et_MeasurementError   = 0x67,
251 	ss_et_NoTransmTable      = 0x68,
252 	ss_et_NotInTransmMode    = 0x69,
253 	ss_et_NotInReflectMode   = 0x6A,
254 
255 	/* Incorporate communication errors thus: */
256 	ss_et_StopButNoStart     = 0x81,
257 	ss_et_IllegalCharInRec   = 0x82,
258 	ss_et_IncorrectRecLen    = 0x83,
259 	ss_et_IllegalRecType     = 0x84,
260 	ss_et_NoTagField         = 0x86,
261 	ss_et_ConvError          = 0x87,
262 	ss_et_InvalidForEmission = 0x88,
263 	ss_et_NoAccess           = 0x90,
264 
265 	/* Add our own communication errors here too. */
266 	ss_et_SerialFail         = 0xF0,
267 	ss_et_SendBufferFull     = 0xF5,
268 	ss_et_RecBufferEmpty     = 0xF6,
269 	ss_et_BadAnsFormat       = 0xF7,
270 	ss_et_BadHexEncoding     = 0xF8,
271 	ss_et_RecBufferOverun    = 0xF9
272 } ss_et;
273 
274 /* Handshake Type */
275 typedef enum {
276 	ss_hst_None     = 0x00,
277 	ss_hst_XonXOff  = 0x01,
278 	ss_hst_Hardware = 0x02,
279 } ss_hst;
280 
281 /* Illuminant Type */
282 typedef enum {
283 	ss_ilt_A       = 0x00,
284 	ss_ilt_C       = 0x01,
285 	ss_ilt_D65     = 0x02,
286 	ss_ilt_D50     = 0x03,
287 	ss_ilt_1       = 0x08,		/* User defined */
288 	ss_ilt_Dxx     = 0x10,		/* Variable daylight table */
289 	ss_ilt_F1      = 0x18,
290 	ss_ilt_F2      = 0x19,
291 	ss_ilt_F3      = 0x1A,
292 	ss_ilt_F4      = 0x1B,
293 	ss_ilt_F5      = 0x1C,
294 	ss_ilt_F6      = 0x1D,
295 	ss_ilt_F7      = 0x1E,
296 	ss_ilt_F8      = 0x1F,
297 	ss_ilt_F9      = 0x20,
298 	ss_ilt_F10     = 0x21,
299 	ss_ilt_F11     = 0x22,
300 	ss_ilt_F12     = 0x23
301 } ss_ilt;
302 
303 /* Keyset - treat as cardinal */
304 typedef enum {
305 	ss_ks_NoKey          = 0x0000,
306 	ss_ks_MeasurementKey = 0x0080
307 } ss_ks;
308 
309 /* Lambda Type */
310 
311 /* Light Level Type */
312 typedef enum {
313 	ss_llt_AllOff   = 0x00,		/* All lights off during standby */
314 	ss_llt_Standby1 = 0x01,		/* Surround is on but measurement lamp is off */
315 	ss_llt_Standby2 = 0x02,		/* Surround is on and measurement lamp is on low */
316 } ss_llt;
317 
318 /* Measurement Mode Type */
319 typedef enum {
320 	ss_mmt_NormalMeas        = 0x00,
321 	ss_mmt_WhiteCalibration  = 0x01,
322 	ss_mmt_WhiteCalWithWarn  = 0x07,
323 	ss_mmt_EmissionCal       = 0x08
324 } ss_mmt;
325 
326 /* New Key Type */
327 typedef enum {
328 	ss_nkt_False  = 0x00,
329 	ss_nkt_True   = 0x01
330 } ss_nkt;
331 
332 /* New Measurement Type */
333 typedef enum {
334 	ss_nmt_NoNewMeas      = 0x00,
335 	ss_nmt_NewMeas        = 0x01,
336 	ss_nmt_NewWhiteCal    = 0x02,
337 	ss_nmt_NewWhiteCalWW  = 0x03,
338 	ss_nmt_NewEmissionCal = 0x04
339 } ss_nmt;
340 
341 /* Observer Type */
342 typedef enum {
343 	ss_ot_TwoDeg   = 0x00,
344 	ss_ot_TenDeg   = 0x01
345 } ss_ot;
346 
347 /* Original White Reference Type */
348 typedef enum {
349 	ss_owrt_OriginalWhiteRef     = 0x00,
350 	ss_owrt_OriginalUserWhiteRef = 0x01,
351 	ss_owrt_NotDefWhiteRef       = 0x02
352 } ss_owrt;
353 
354 
355 /* Output Set Type */
356 typedef enum {
357 	ss_ost_ParameterSet = 0x00,	/* To define measurement of parameters for output */
358 	ss_ost_SpectrumSet  = 0x01,	/* To define spectra for output */
359 	ss_ost_CMetry1Set   = 0x02,	/* To define colorimetry values for output */
360 	ss_ost_CMetry2Set   = 0x03,	/* To define colorimetry values for output */
361 	ss_ost_DensitySet   = 0x04,	/* To define densitometry values for output */
362 	ss_ost_ErrorType    = 0xFF	/* To get the error of the measurement */
363 } ss_ost;
364 
365 /* Output Parameter Set - bit masks */
366 typedef enum {
367 	ss_ops_None         = 0x00,
368 	ss_ops_DStdType     = 0x01,
369 	ss_ops_WBase      	= 0x02,
370 	ss_ops_Illuminant   = 0x04,
371 	ss_ops_Observer  	= 0x08,
372 	ss_ops_ActualFilter = 0x10
373 } ss_ops;
374 
375 /* Output Spectrum Set - bit masks */
376 typedef enum {
377 	ss_oss_None        = 0x00,
378 	ss_oss_Spectrum    = 0x01,
379 	ss_oss_Density     = 0x02
380 } ss_oss;
381 
382 /* Output Colorimetry 1 Set - bit masks */
383 typedef enum {
384 	ss_oc1s_None      = 0x00,
385 	ss_oc1s_xyY       = 0x01,
386 	ss_oc1s_Lab       = 0x02,
387 	ss_oc1s_LChab     = 0x04,
388 	ss_oc1s_Luv       = 0x08,
389 	ss_oc1s_XYZ       = 0x10,
390 	ss_oc1s_RxRyRz    = 0x20,
391 	ss_oc1s_HLab      = 0x40
392 } ss_oc1s;
393 
394 /* Output Colorimetry 2 Set - bit masks */
395 typedef enum {
396 	ss_oc2s_None      = 0x00,
397 	ss_oc2s_LABmg     = 0x01,
398 	ss_oc2s_LCHmg     = 0x02,
399 	ss_oc2s_LChuv     = 0x04
400 } ss_oc2s;
401 
402 /* Output Density Set - bit masks */
403 typedef enum {
404 	ss_ods_None       = 0x00,
405 	ss_ods_Black      = 0x01,
406 	ss_ods_Cyan       = 0x02,
407 	ss_ods_Magenta    = 0x04,
408 	ss_ods_Yellow     = 0x08,
409 	ss_ods_Max        = 0x10,
410 	ss_ods_Auto       = 0x20
411 } ss_ods;
412 
413 /* Type that is one of the above, depending on what ss_ost is selected */
414 typedef union {
415 	ss_ods  od;
416 	ss_oss  os;
417 	ss_oc1s oc1;
418 	ss_oc2s oc2;
419 	ss_ops  op;
420 	int     i;
421 } ss_os;
422 
423 
424 /* Press Time Type */
425 typedef enum {
426 	ss_ptt_Short        = 0x00,
427 	ss_ptt_Long         = 0x01
428 } ss_ptt;
429 
430 /* Reference Type */
431 typedef enum {
432 	ss_rt_SensorRef    = 0x00,
433 	ss_rt_SightRef     = 0x01
434 } ss_rt;
435 
436 /* Reference Valid Type */
437 typedef enum {
438 	ss_rvt_False       = 0x00,
439 	ss_rvt_True        = 0x01
440 } ss_rvt;
441 
442 /* Remaining Positions Type */
443 
444 /* Remote Error Set - bit mask - treat as cardinal */
445 typedef enum {
446 	ss_res_NoError               = 0x0000,
447 	ss_res_NoValidDStd           = 0x0001,
448 	ss_res_NoValidWhite          = 0x0002,
449 	ss_res_NoValidIllum          = 0x0004,
450 	ss_res_NoValidObserver       = 0x0008,
451 	ss_res_NoValidMaxLambda      = 0x0010,
452 	ss_res_NoValidSpect          = 0x0020,
453 	ss_res_NoValidColSysOrIndex  = 0x0040,
454 	ss_res_NoValidChar           = 0x0080,
455 	ss_res_SlopeOutOfRange       = 0x0100,
456 	ss_res_DorlOutOfRange        = 0x0200,
457 	ss_res_ReflectanceOutOfRange = 0x0400,
458 	ss_res_Color1OutOfRange      = 0x0800,
459 	ss_res_Color2OutOfRange      = 0x1000,
460 	ss_res_Color3OutOfRange      = 0x2000,
461 	ss_res_NotAnSROrBoolean      = 0x4000,
462 	ss_res_NoValidValOrRef       = 0x8000,
463 } ss_res;
464 
465 /* Scan Error Type */
466 typedef enum {
467 	ss_set_NoError               = 0x00,
468 	ss_set_DeviceIsOffline       = 0x01,
469 	ss_set_OutOfRange            = 0x02,
470 	ss_set_ProgrammingError      = 0x03,
471 	ss_set_NoUserAccess          = 0x04,
472 	ss_set_NoValidCommand        = 0x05,
473 	ss_set_NoDeviceFound         = 0x06,
474 	ss_set_MeasurementError      = 0x07,
475 	ss_set_NoTransmTable         = 0x08,
476 	ss_set_NotInTransmMode       = 0x09,
477 	ss_set_NotInReflectMode      = 0x0A
478 } ss_set;
479 
480 /* Scan Key Set - bit mask */
481 typedef enum {
482 	ss_sks_EnterKey          = 0x01,
483 	ss_sks_PaperKey          = 0x02,
484 	ss_sks_OnlineKey         = 0x04,
485 	ss_sks_UpDownKey         = 0x08,
486 	ss_sks_MoveRightKey      = 0x10,
487 	ss_sks_MoveLeftKey       = 0x20,
488 	ss_sks_MoveDownKey       = 0x40,
489 	ss_sks_MoveUpKey         = 0x80
490 } ss_sks;
491 
492 /* Serial Number Type */
493 
494 /* Special Status Set - bit mask */
495 typedef enum {
496 	ss_sss_HeadDwnOnMove     = 0x01,	/* Don't lift the head when moving */
497 	ss_sss_TableInTransMode  = 0x10,	/* Table is set to transmission mode */
498 	ss_sss_AllLightsOn       = 0x20		/* Surround light on + low measure light */
499 } ss_sss;
500 
501 /* Spect. Type */
502 typedef enum {
503 	ss_st_LinearSpectrum      = 0x00,
504 	ss_st_DensitySpectrum     = 0x01
505 } ss_st;
506 
507 /* Status Mode Type */
508 typedef enum {
509 	ss_smt_InitAll           = 0x01,
510 	ss_smt_InitWithoutRemote = 0x05
511 } ss_smt;
512 
513 /* Status Set - bit mask */
514 typedef enum {
515 	ss_sts_EnterKeyPressed   = 0x01,
516 	ss_sts_DeviceIsOnline    = 0x10,
517 	ss_sts_DigitizingModeOn  = 0x20,
518 	ss_sts_KeyAckModeOn      = 0x40,
519 	ss_sts_PaperIsHeld       = 0x80
520 } ss_sts;
521 
522 /* Standard Density Filter Type */
523 typedef enum {
524 	ss_sdft_Db    = 0x00,
525 	ss_sdft_Dc    = 0x01,
526 	ss_sdft_Dm    = 0x02,
527 	ss_sdft_Dy    = 0x03
528 } ss_sdft;
529 
530 /* Table Mode Type */
531 typedef enum {
532 	ss_tmt_Reflectance  = 0x00,
533 	ss_tmt_Transmission = 0x01
534 } ss_tmt;
535 
536 /* Table Value Type */
537 typedef enum {
538 	ss_tvt_vDxx1  = 0x60
539 } ss_tvt;
540 
541 /* Target On Off Status Type (Enables/Disables measurement key ?) */
542 typedef enum {
543 	ss_toost_Activated   = 0x00,
544 	ss_toost_Deactivated = 0x01
545 } ss_toost;
546 
547 /* Target Tech Type */
548 typedef enum {
549 	ss_ttt_SPM          = 0x00,
550 	ss_ttt_D190         = 0x01,
551 	ss_ttt_Spectrolino  = 0x02,
552 	ss_ttt_Videolino    = 0x03,
553 	ss_ttt_SpectroScan  = 0x04
554 } ss_ttt;
555 
556 /* White Base Type */
557 typedef enum {
558 	ss_wbt_Pap = 0x00,
559 	ss_wbt_Abs = 0x01
560 } ss_wbt;
561 
562 /* White Reference Position Type */
563 typedef enum {
564 	ss_wrpt_RefTile1 = 0x00,
565 	ss_wrpt_RefTile2 = 0x01
566 } ss_wrpt;
567 
568 /* Zed Koordinate Type Type */
569 typedef enum {
570 	ss_zkt_SensorUp   = 0x00,
571 	ss_zkt_SensorDown = 0x01
572 } ss_zkt;
573 
574 /* Spectrolino request and answer types */
575 typedef enum {
576 	ss_ParameterRequest          = 0x00,
577 	ss_ParameterAnswer           = 0x0B,
578 	ss_SlopeRequest              = 0x01,
579 	ss_SlopeAnswer               = 0x0C,
580 	ss_DensityRequest            = 0x03,
581 	ss_DensityAnswer             = 0x0E,
582 	ss_DmaxRequest               = 0x04,
583 	ss_DmaxAnswer                = 0x0F,
584 	ss_SpectrumRequest           = 0x05,
585 	ss_SpectrumAnswer            = 0x10,
586 	ss_CRequest                  = 0x06,
587 	ss_CAnswer                   = 0x11,
588 	ss_NewMeasureRequest         = 0x07,
589 	ss_NewMeasureAnswer          = 0x12,
590 	ss_NewKeyRequest             = 0x08,
591 	ss_NewKeyAnswer              = 0x13,
592 	ss_ParameterDownload         = 0x16,
593 	ss_SlopeDownload             = 0x17,
594 	ss_DownloadError             = 0x1F,
595 	ss_ExecMeasurement           = 0x20,
596 	ss_ExecWhiteMeasurement      = 0x21,
597 	ss_ExecRefMeasurement        = 0x22,
598 	ss_ExecError                 = 0x25,
599 	ss_ActErrorRequest           = 0x29,
600 	ss_ActErrorAnswer            = 0x2F,
601 	ss_TargetIdRequest           = 0x2B,
602 	ss_TargetIdAnswer            = 0x31,
603 	ss_TargetOnOffStDownload     = 0x33,
604 	ss_IllumTabRequest           = 0x38,
605 	ss_IllumTabAnswer            = 0x39,
606 	ss_IllumTabDownload          = 0x3A,
607 	ss_DensTabRequest            = 0x3B,
608 	ss_DensTabAnswer             = 0x3C,
609 	ss_DensTabDownload           = 0x3D,
610 	ss_GetValNr                  = 0x47,
611 	ss_ValNrAnswer               = 0x48,
612 	ss_SetValNr                  = 0x49,
613 	ss_ExecWhiteRefToOrigDat     = 0x4A,
614 	ss_MeasControlDownload       = 0x4D,
615 	ss_ResetStatusDownload       = 0x5A,
616 	ss_MeasControlRequest        = 0x5B,
617 	ss_MeasControlAnswer         = 0x5C,
618 	ss_SetMeasurementOutput      = 0xB1,
619 	ss_WhiteReferenceRequest     = 0xB3,
620 	ss_WhiteReferenceAnswer      = 0xB4,
621 	ss_DeviceDataRequest         = 0xB5,
622 	ss_DeviceDataAnswer          = 0xB6,
623 	ss_WhiteReferenceDownld      = 0xB7,
624 	ss_SpecParameterRequest      = 0xB8,
625 	ss_SpecParameterAnswer       = 0xB9,
626 	ss_CParameterRequest         = 0xBA,
627 	ss_CParameterAnswer          = 0xBB,
628 	ss_DensityParameterAnswer    = 0xBC,
629 	ss_DensityParameterRequest   = 0xBD,
630 	ss_Printout                  = 0xBE,
631 	ss_FloatRequest              = 0xC0,
632 	ss_FloatAnswer               = 0xC1,
633 	ss_FloatDownload             = 0xC2,
634 	ss_COMErr                    = 0x26
635 } ss_so_cat;
636 
637 /* Spectroscan request and answer types */
638 typedef enum {
639 	ss_ReqPFX                    = 0xD0,		/* Prefix */
640 	ss_AnsPFX                    = 0xD1,		/* Prefix */
641 	ss_MoveAbsolut               = 0x00,
642 	ss_MoveRelative              = 0x01,
643 	ss_MoveHome                  = 0x02,
644 	ss_MoveUp                    = 0x03,
645 	ss_MoveDown                  = 0x04,
646 	ss_OutputActualPosition      = 0x05,
647 	ss_MoveToWhiteRefPos         = 0x06,
648 	ss_MoveAndMeasure            = 0x07,
649 	ss_InitializeDevice          = 0x0A,
650 	ss_ScanSpectrolino           = 0x0B,
651 	ss_InitMotorPosition         = 0x0C,
652 	ss_SetTableMode              = 0x0D,
653 	ss_SetLightLevel             = 0x0E,
654 	ss_SetTransmStandbyPos       = 0x0F,
655 	ss_SetDeviceOnline           = 0x10,
656 	ss_SetDeviceOffline          = 0x11,
657 	ss_HoldPaper                 = 0x12,
658 	ss_ReleasePaper              = 0x13,
659 	ss_SetDigitizingMode         = 0x14,
660 	ss_OutputDigitizingValues    = 0x15,
661 	ss_SetKeyAcknowlge           = 0x16,
662 	ss_ResetKeyAcknowlge         = 0x17,
663 	ss_ChangeBaudRate            = 0x20,
664 	ss_ChangeHandshake           = 0x21,
665 	ss_OutputActualKey           = 0x22,
666 	ss_OutputLastKey             = 0x23,
667 	ss_OutputStatus              = 0x24,
668 	ss_ClearStatus               = 0x25,
669 	ss_SetSpecialStatus          = 0x26,
670 	ss_ClearSpecialStatus        = 0x27,
671 	ss_OutputSpecialStatus       = 0x28,
672 	ss_OutputType                = 0x30,
673 	ss_OutputSerialNumber        = 0x31,
674 	ss_OutputArticleNumber       = 0x32,
675 	ss_OutputProductionDate      = 0x33,
676 	ss_OutputSoftwareVersion     = 0x34,
677 	ss_ErrorAnswer               = 0x80,
678 	ss_PositionAnswer            = 0x81,
679 	ss_KeyAnswer                 = 0x82,
680 	ss_StatusAnswer              = 0x83,
681 	ss_TypeAnswer                = 0x90,
682 	ss_SerialNumberAnswer        = 0x91,
683 	ss_ArticleNumberAnswer       = 0x92,
684 	ss_ProductionDateAnswer      = 0x93,
685 	ss_SoftwareVersionAnswer     = 0x94,
686 	ss_SSCOMErr                  = 0xA0
687 } ss_ss_cat;
688 
689 /* -------------------------- */
690 /* Interface declarations */
691 
692 struct _ss;
693 
694 /* ------------------------------------------- */
695 /* Serialisation for different types functions */
696 
697 /* QUERY: */
698 /* Reset send buffer, and init with start character */
699 void ss_init_send(struct _ss *p);
700 
701 /* Reset send buffer, and add an Spectrolino Request enum */
702 void ss_add_soreq(struct _ss *p, int rq);
703 
704 /* Reset send buffer, and add an SpectroScan Request enum */
705 void ss_add_ssreq(struct _ss *p, int rq);
706 
707 /* Add an int/enum/char into one byte type */
708 void ss_add_1(struct _ss *p, int c);
709 
710 /* Add an int/enum into two byte type */
711 void ss_add_2(struct _ss *p, int s);
712 
713 /* Add an int/enum into four byte type */
714 void ss_add_4(struct _ss *p, int i);
715 
716 /* Add a double into four byte type */
717 void ss_add_double(struct _ss *p, double d);
718 
719 /* Add an  ASCII string into the send buffer. */
720 /* The string will be padded with nul's up to len. */
721 void ss_add_string(struct _ss *p, char *t, int len);
722 
723 /* - - - - - - - - - - - - - - - - - - - - - */
724 /* ANSWER: */
725 
726 /* Return the first enum from the recieve buffer without removing it. */
727 int ss_peek_ans(struct _ss *p);
728 
729 /* Remove a Spectrolino answer enum from the revieve buffer, */
730 /* and check it is correct.  */
731 void ss_sub_soans(struct _ss *p, int cv);
732 
733 /* Remove a SpectroScan Prefix and answer enum from the revieve buffer, */
734 /* and check it is correct.  */
735 void ss_sub_ssans(struct _ss *p, int cv);
736 
737 /* Remove an int/enum/char into one byte type */
738 int ss_sub_1(struct _ss *p);
739 
740 /* Remove an int/enum into two byte type */
741 int ss_sub_2(struct _ss *p);
742 
743 /* Remove an int/enum into four byte type */
744 int ss_sub_4(struct _ss *p);
745 
746 /* Remove a double into four byte type */
747 double ss_sub_double(struct _ss *p);
748 
749 /* Remove an  ASCII string from the receive buffer. */
750 /* The string will be terminated with a nul, so a buffer */
751 /* of len+1 should be provided to return the string in. */
752 void ss_sub_string(struct _ss *p, char *t, int len);
753 
754 /* - - - - - - - - - - - - - - - - - - - - - */
755 /* ERROR CODES: */
756 
757 /* Convert an ss error into an inst_error */
758 inst_code ss_inst_err(struct _ss *p);
759 
760 /* Incorporate a error into the snerr value */
761 void ss_incorp_err(struct _ss *p, ss_et se);
762 
763 /* Incororate Remote Error Set values into snerr value */
764 /* Since ss_res is a bit mask, we just prioritize the errors. */
765 void ss_incorp_remerrset(struct _ss *p, ss_res es);
766 
767 /* Incorporate a scan error into the snerr value */
768 void ss_incorp_scanerr(struct _ss *p, ss_set se);
769 
770 /* Incorporate a device communication error into the snerr value */
771 void ss_incorp_comerr(struct _ss *p, ss_cet se);
772 
773 /* - - - - - - - - - - - - - - - - - - - - - */
774 /* EXECUTION: */
775 
776 /* Interpret an icoms error into a SS error */
777 int icoms2ss_err(int se);
778 
779 /* Terminate the send buffer, and then do a */
780 /* send/receieve to the device. */
781 /* Leave any error in p->snerr */
782 void ss_command(struct _ss *p, double tmo);
783 
784 /* - - - - - - - - - - - - - - - - - - - - */
785 /* Device Initialisation and configuration */
786 
787 /* Reset instrument */
788 inst_code so_do_ResetStatusDownload(
789 struct _ss *p,
790 ss_smt sm		/* Init all or all except communications */
791 );
792 
793 /* Load various parameters, such as: */
794 /* comm flow control, baud rate, speaker, */
795 /* reflective/tranmission/emmission mode, */
796 /* custom filter on/off */
797 inst_code so_do_MeasControlDownload(
798 struct _ss *p,
799 ss_ctt ct			/* Control */
800 );
801 
802 /* Query various current parameters, such as: */
803 /* comm flow control, baud rate, speaker, */
804 /* reflective/tranmission/emmission mode, */
805 /* custom filter on/off. */
806 inst_code so_do_MeasControlRequest(
807 struct _ss *p,
808 ss_ctt ct,		/* Control to query  */
809 ss_ctt *rct		/* Return current state */
810 );
811 
812 /* Queries specific device data */
813 inst_code so_do_DeviceDataRequest(
814 struct _ss *p,
815 char dn[19],		/* Return the device name */
816 ss_dnot *dno,		/* Return device number */
817 char pn[9],			/* Return the part number */
818 unsigned int *sn,	/* Return serial number */
819 char sv[13]			/* Return software version */
820 );
821 
822 /* Query special device data */
823 inst_code so_do_TargetIdRequest(
824 struct _ss *p,
825 char dn[19],	/* Return Device Name */
826 int *sn,		/* Return Serial Number (1-65535) */
827 int *sr,		/* Return Software Release */
828 int *yp,		/* Return Year of production (e.g. 1996) */
829 int *mp,		/* Return Month of production (1-12) */
830 int *dp,		/* Return Day of production (1-31) */
831 int *hp,		/* Return Hour of production (0-23) */
832 int *np,		/* Return Minuite of production (0-59) */
833 ss_ttt *tt,		/* Return Target Tech Type (SPM/Spectrolino etc.) */
834 int *fswl,		/* Return First spectral wavelength (nm) */
835 int *nosw,		/* Return Number of spectral wavelengths */
836 int *dpsw		/* Return Distance between spectral wavelengths (nm) */
837 );
838 
839 /* - - - - - - - - - - - - - */
840 /* Measurement configuration */
841 
842 /* Query the standard or user definable densitometric tables */
843 inst_code so_do_DensTabRequest(
844 struct _ss *p,
845 ss_dst ds,			/* Density standard (ANSI/DIN/User etc.) */
846 ss_dst *rds,		/* Return Density standard (ANSI/DIN/User etc.) */
847 double sp[4][36]	/* Return 4 * 36 spectral weighting values */
848 );
849 
850 /* Download user definable densitometric tables */
851 inst_code so_do_DensTabDownload(
852 struct _ss *p,
853 double sp[4][36]	/* 4 * 36 spectral weighting values */
854 );
855 
856 /* Set slope values for densitometry */
857 inst_code so_do_SlopeDownload(
858 struct _ss *p,
859 double dv[4]	/* Db Dc Dm Dy density values */
860 );
861 
862 /* Query slope values of densitometry */
863 inst_code so_do_SlopeRequest(
864 struct _ss *p,
865 double dv[4]	/* Return Db Dc Dm Dy density values */
866 );
867 
868 /* Set the colorimetric parameters */
869 inst_code so_do_ParameterDownload(
870 struct _ss *p,
871 ss_dst ds,	/* Density standard (ANSI/DIN etc.) */
872 ss_wbt wb,	/* White base (Paper/Absolute) */
873 ss_ilt it,	/* Illuminant type (A/C/D65 etc.) */
874 ss_ot  ot	/* Observer type (2deg/10deg) */
875 );
876 
877 /* Query colorimetric parameters */
878 inst_code so_do_ParameterRequest(
879 struct _ss *p,
880 ss_dst *ds,		/* Return Density Standard */
881 ss_wbt *wb,		/* Return White Base */
882 ss_ilt *it,		/* Return Illuminant type (A/C/D65/User etc.) */
883 ss_ot  *ot,		/* Return Observer type (2deg/10deg) */
884 ss_aft *af		/* Return Filter being used (None/Pol/D65/UV/custom */
885 );
886 
887 /* Query the standard or user defined illuminant tables (Colorimetry) */
888 inst_code so_do_IllumTabRequest(
889 struct _ss *p,
890 ss_ilt it,		/* Illuminant type (A/C/D65/User etc.) */
891 ss_ilt *rit,	/* Return Illuminant type (A/C/D65/User etc.) */
892 double sp[36]	/* Return 36 spectral values */
893 );
894 
895 /* Download user definable illuminant tables (Colorimetry) */
896 inst_code so_do_IllumTabDownload(
897 struct _ss *p,
898 double sp[36]	/* 36 spectral values to set */
899 );
900 
901 /* Query for the color temperature of daylight illuminant Dxx */
902 inst_code so_do_GetValNr(
903 struct _ss *p,
904 int *ct		/* Return color temperature in deg K/100 */
905 );
906 
907 /* Download user definable illuminant tables (Colorimetry) */
908 inst_code so_do_SetValNr(
909 struct _ss *p,
910 int ct		/* Color temperature to set for illuminant Dxx in deg K/100 */
911 );
912 
913 /* Queries the spectra of the white reference for the desired filter */
914 inst_code so_do_WhiteReferenceRequest(
915 struct _ss *p,
916 ss_aft af,		/* Filter being queried (None/Pol/D65/UV/custom */
917 ss_aft *raf,	/* Return filter being queried (None/Pol/D65/UV/custom */
918 double sp[36],	/* Return 36 spectral values */
919 ss_owrt *owr,	/* Return original white reference */
920 char dtn[19]	/* Return name of data table */
921 );
922 
923 /* Load spectra of a user defined white reference for the desired filter. */
924 /* A name can be given to the white reference. */
925 inst_code so_do_WhiteReferenceDownld(
926 struct _ss *p,
927 ss_aft af,		/* Filter being set (None/Pol/D65/UV/custom */
928 double sp[36],	/* 36 spectral values being set */
929 char dtn[19]	/* Name for data table */
930 );
931 
932 /* Query the reference value for the relative photometric (emission) reference value */
933 inst_code so_do_FloatRequest(
934 struct _ss *p,
935 ss_comft comf,		/* Choose common float type (PhotometricYRef) */
936 ss_comft *rcomf,	/* Return common float type (PhotometricYRef) */
937 double *comfv		/* Return the reference value */
938 );
939 
940 /* Set the reference value for the relative photometric (emission) reference value */
941 inst_code so_do_FloatDownload(
942 struct _ss *p,
943 ss_comft comf,		/* Choose common float type (PhotometricYRef) */
944 double comfv		/* The reference value */
945 );
946 
947 /* - - - - - - */
948 /* Calibration */
949 
950 /* Reset the spectra of the respective white reference to the original data */
951 inst_code so_do_ExecWhiteRefToOrigDat(
952 struct _ss *p
953 );
954 
955 
956 /* Perform a Reference Measurement */
957 inst_code so_do_ExecRefMeasurement(
958 struct _ss *p,
959 ss_mmt mm	/* Measurement Mode (Meas/Cal etc.) */
960 );
961 
962 /* Perform a White Measurement - not recommended */
963 /* (ExecRefMeasuremen is preferred instead) */
964 inst_code so_do_ExecWhiteMeasurement(struct _ss *p);
965 
966 /* - - - - - - - - - - - - */
967 /* Performing measurements */
968 
969 /* Perform a Measurement */
970 inst_code so_do_ExecMeasurement(struct _ss *p);
971 
972 /* Define automatic output after each measurement */
973 /* [Note that dealing with the resulting measurement replies */
974 /*  isn't directly supported, currently.] */
975 inst_code so_do_SetMeasurementOutput(
976 struct _ss *p,
977 ss_ost os,		/* Type of output to request */
978 ss_os o			/* bitmask of output */
979 );
980 
981 /* - - - - - - - - */
982 /* Getting results */
983 
984 /* Query Density measurement results and associated parameters */
985 inst_code so_do_DensityParameterRequest(
986 struct _ss *p,
987 ss_cst *rct,	/* Return Color Type (Lab/XYZ etc.) */
988 double dv[4],	/* Return Db Dc Dm Dy density values */
989 ss_sdft *sdf,	/* Return Standard Density Filter (Db/Dc/Dm/Dy) */
990 ss_rvt *rv,		/* Return Reference Valid Flag */
991 ss_aft *af,		/* Return filter being used (None/Pol/D65/UV/custom */
992 ss_wbt *wb,		/* Return white base (Paper/Absolute) */
993 ss_dst *ds,		/* Return Density standard (ANSI/DIN/User etc.) */
994 ss_ilt *rit,	/* Return Illuminant type (A/C/D65/User etc.) */
995 ss_ot  *ot		/* Return Observer type (2deg/10deg) */
996 );
997 
998 /* Query Densitometric measurement values - not recommended */
999 /* (DensityParameterRequest is preferred instead) */
1000 inst_code so_do_DensityRequest(
1001 struct _ss *p,
1002 double dv[4],	/* Return Db Dc Dm Dy density values */
1003 ss_sdft *sdf,	/* Return Standard Density Filter (Db/Dc/Dm/Dy) */
1004 ss_rvt  *rv		/* Return Reference Valid */
1005 );
1006 
1007 /* Query maximum density reading */
1008 inst_code so_do_DmaxRequest(
1009 struct _ss *p,
1010 double *Dmax,	/* Return Value of Maximum Density */
1011 int *lambda,	/* Return wavelength where maximum density was found */
1012 ss_dmot *dmo,	/* Return Dmax OK flag. */
1013 ss_rvt *rv		/* Return Reference Valid Flag */
1014 );
1015 
1016 /* Query Color measurement results and associated parameters */
1017 inst_code so_do_CParameterRequest(
1018 struct _ss *p,
1019 ss_cst ct,		/* Choose Color Type (Lab/XYZ etc.) */
1020 ss_cst *rct,	/* Return Color Type (Lab/XYZ etc.) */
1021 double cv[3],	/* Return 3 color values */
1022 ss_rvt *rv,		/* Return Reference Valid Flag */
1023 ss_aft *af,		/* Return filter being used (None/Pol/D65/UV/custom) */
1024 ss_wbt *wb,		/* Return white base (Paper/Absolute) */
1025 ss_ilt *it,		/* Return Illuminant type (A/C/D65/User etc.) */
1026 ss_ot  *ot		/* Return Observer type (2deg/10deg) */
1027 );
1028 
1029 /* Query Colorimetric measurement results - not recommended */
1030 /* (CParameterRequest is prefered instead) */
1031 inst_code so_do_CRequest(
1032 struct _ss *p,
1033 ss_cst *ct,		/* Return Color Type (Lab/XYZ etc.) */
1034 double *cv[3],	/* Return 3 color values */
1035 ss_rvt *rv		/* Return Reference Valid Flag */
1036 );
1037 
1038 /* Query Spectral measurement results and associated parameters */
1039 inst_code so_do_SpecParameterRequest(
1040 struct _ss *p,
1041 ss_st st,		/* Choose Spectrum Type (Reflectance/Density) */
1042 ss_st *rst,		/* Return Spectrum Type (Reflectance/Density) */
1043 double sp[36],	/* Return 36 spectral values */
1044 ss_rvt *rv,		/* Return Reference Valid Flag */
1045 ss_aft *af,		/* Return filter being used (None/Pol/D65/UV/custom */
1046 ss_wbt *wb		/* Return white base (Paper/Absolute) */
1047 );
1048 
1049 /* Query Spectral measurement results - not recommended */
1050 /* (SpecParameterRequest is preferred instead) */
1051 inst_code so_do_SpectrumRequest(
1052 struct _ss *p,
1053 ss_st *st,		/* Return Spectrum Type (Reflectance/Density) */
1054 double sp[36],	/* Return 36 spectral values */
1055 ss_rvt *rv		/* Return Reference Valid Flag */
1056 );
1057 
1058 /* - - - - - -  */
1059 /* Miscelanious */
1060 
1061 /* Query whether a new measurement was performed since the last accestruct _ss */
1062 inst_code so_do_NewMeasureRequest(
1063 struct _ss *p,
1064 ss_nmt *nm		/* Return New Measurement (None/Meas/White etc.) */
1065 );
1066 
1067 /* Query whether a key was pressed since the last accestruct _ss */
1068 inst_code so_do_NewKeyRequest(
1069 struct _ss *p,
1070 ss_nkt *nk,		/* Return whether a new key was pressed */
1071 ss_ks *k		/* Return the key that was pressed (none/meas) */
1072 );
1073 
1074 /* Query for the general error status */
1075 inst_code so_do_ActErrorRequest(
1076 struct _ss *p
1077 );
1078 
1079 /* Set Target On/Off status (Enables/Disables measurement key ?) */
1080 inst_code so_do_TargetOnOffStDownload(
1081 struct _ss *p,
1082 ss_toost oo		/* Activated/Deactivated */
1083 );
1084 
1085 /* =========================================== */
1086 /* SpectroScan/T specific commands and queries */
1087 
1088 /* - - - - - - - - - - - - - - - - - - - - */
1089 /* Device Initialisation and configuration */
1090 
1091 /* Initialise the device. Scans the Spectrolino */
1092 /* (Doesn't work when device is offline, */
1093 /* takes some seconds for the device to recover after reply.) */
1094 inst_code ss_do_ScanInitializeDevice(struct _ss *p);
1095 
1096 /* Establish communications between the SpectroScan and Spectrolino */
1097 /* at the highest possible baud rate. */
1098 /* (Doesn't work when device is offline ) */
1099 inst_code ss_do_ScanSpectrolino(struct _ss *p);
1100 
1101 /* Establish the zero position of the motors and set the position to 0,0 */
1102 /* (Doesn't work when device is offline ) */
1103 inst_code ss_do_InitMotorPosition(struct _ss *p);
1104 
1105 /* Change the SpectroScan baud rate */
1106 inst_code ss_do_ChangeBaudRate(
1107 struct _ss *p,
1108 ss_bt br		/* Baud rate (110 - 57600) */
1109 );
1110 
1111 /* Change the SpectroScan handshaking mode. */
1112 inst_code ss_do_ChangeHandshake(
1113 struct _ss *p,
1114 ss_hst hs		/* Handshake type (None/XonXoff/HW) */
1115 );
1116 
1117 /* Query the type of XY table */
1118 inst_code ss_do_OutputType(
1119 struct _ss *p,
1120 char dt[19]		/* Return Device Type ("SpectroScan " or "SpectroScanT") */
1121 );
1122 
1123 /* Query the serial number of the XY table */
1124 inst_code ss_do_OutputSerialNumber(
1125 struct _ss *p,
1126 unsigned int *sn	/* Return serial number */
1127 );
1128 
1129 /* Query the part number of the XY table */
1130 inst_code ss_do_OutputArticleNumber(
1131 struct _ss *p,
1132 char pn[9]		/* Return Part Number */
1133 );
1134 
1135 /* Query the production date of the XY table */
1136 inst_code ss_do_OutputProductionDate(
1137 struct _ss *p,
1138 int *yp,	/* Return Year of production (e.g. 1996) */
1139 int *mp,	/* Return Month of production (1-12) */
1140 int *dp		/* Return Day of production (1-31) */
1141 );
1142 
1143 /* Query the Software Version of the XY table */
1144 inst_code ss_do_OutputSoftwareVersion(
1145 struct _ss *p,
1146 char sv[13]		/* Return Software Version */
1147 );
1148 
1149 /* - - - - - - - - - - - - - */
1150 /* Measurement configuration */
1151 
1152 /* Set the SpectroScanT to reflectance or transmission. */
1153 /* The Spectrolino is also automatically set to the corresponding mode. */
1154 /* (Doesn't work when device is offline ) */
1155 inst_code ss_do_SetTableMode(
1156 struct _ss *p,
1157 ss_tmt tm	/* Table mode (Reflectance/Transmission) */
1158 );
1159 
1160 /* - - - - - - - - - - - - - */
1161 /* Table operation */
1162 
1163 /* Set the SpectrScan to online. All moving keys are disabled. */
1164 /* (Only valid when device is in reflectance mode.) */
1165 inst_code ss_do_SetDeviceOnline(struct _ss *p);
1166 
1167 /* Set the SpectrScan to offline. All moving keys are enabled. */
1168 /* (Only valid when device is in reflectance mode.) */
1169 /* (All remote commands to move the device will be ignored.) */
1170 inst_code ss_do_SetDeviceOffline(struct _ss *p);
1171 
1172 /* Enable electrostatic paper hold. */
1173 /* (Not valid when device is offline) */
1174 inst_code ss_do_HoldPaper(struct _ss *p);
1175 
1176 /* Disable electrostatic paper hold. */
1177 /* (Not valid when device is offline) */
1178 inst_code ss_do_ReleasePaper(struct _ss *p);
1179 
1180 /* - - - - - - */
1181 /* Positioning */
1182 
1183 /* Move either the sight or sensor to an absolute position. */
1184 /* (Doesn't work when device is offline or transmissioin mode.) */
1185 inst_code ss_do_MoveAbsolut(
1186 struct _ss *p,
1187 ss_rt  r,	/* Reference (Sensor/Sight) */
1188 double x,	/* X coord in mm, 0-310.0, accurate to 0.1mm */
1189 double y	/* Y coord in mm, 0-230.0, accurate to 0.1mm */
1190 );
1191 
1192 /* Move relative to current position. */
1193 /* (Doesn't work when device is offline or transmissioin mode.) */
1194 inst_code ss_do_MoveRelative(
1195 struct _ss *p,
1196 double x,	/* X distance in mm, 0-310.0, accurate to 0.1mm */
1197 double y	/* Y distance in mm, 0-230.0, accurate to 0.1mm */
1198 );
1199 
1200 /* Move to the home position (== 0,0). */
1201 /* (Doesn't work when device is offline or transmissioin mode.) */
1202 inst_code ss_do_MoveHome(
1203 struct _ss *p
1204 );
1205 
1206 /* Move to the sensor up. */
1207 /* (Doesn't work when device is offline or transmissioin mode.) */
1208 inst_code ss_do_MoveUp(
1209 struct _ss *p
1210 );
1211 
1212 /* Move to the sensor down. */
1213 /* (Doesn't work when device is offline or transmission mode.) */
1214 inst_code ss_do_MoveDown(
1215 struct _ss *p
1216 );
1217 
1218 /* Query the current absolute position of the sensor or sight. */
1219 /* (Doesn't work when device is offline or transmissioin mode.) */
1220 inst_code ss_do_OutputActualPosition(
1221 struct _ss *p,
1222 ss_rt  r,	/* Reference (Sensor/Sight) */
1223 ss_rt  *rr,	/* Return reference (Sensor/Sight) */
1224 double *x,	/* Return the X coord in mm, 0-310.0, accurate to 0.1mm */
1225 double *y,	/* Return the Y coord in mm, 0-230.0, accurate to 0.1mm */
1226 ss_zkt *zk	/* Return the Z coordinate (Up/Down) */
1227 );
1228 
1229 /* Move to the white reference position */
1230 /* (Doesn't work when device is offline or transmissioin mode.) */
1231 inst_code ss_do_MoveToWhiteRefPos(
1232 struct _ss *p,
1233 ss_wrpt wrp		/* White Reference Position (Tile1/Tile2) */
1234 );
1235 
1236 /* - - - - - - - - - - - - */
1237 /* Performing measurements */
1238 
1239 /* Move the sensor to an absolute position, move the */
1240 /* sensor down, execute a measurement, move the head up, */
1241 /* and return spectral measuring results. */
1242 inst_code ss_do_MoveAndMeasure(
1243 struct _ss *p,
1244 double x,		/* X coord in mm, 0-310.0, accurate to 0.1mm */
1245 double y,		/* Y coord in mm, 0-230.0, accurate to 0.1mm */
1246 double sp[36],	/* Return 36 spectral values */
1247 ss_rvt *rv		/* Return Reference Valid Flag */
1248 );
1249 
1250 /* - - - - - -  */
1251 /* Miscelanious */
1252 
1253 /* Set the SpectroScanT transmission light level during standby. */
1254 /* (Only valid on SpectroScanT in transmission mode) */
1255 inst_code ss_do_SetLightLevel(
1256 struct _ss *p,
1257 ss_llt ll	/* Transmission light level (Off/Surround/Low) */
1258 );
1259 
1260 /* Set tranmission standby position. */
1261 /* (Only valid on SpectroScanT in transmission mode) */
1262 inst_code ss_do_SetTransmStandbyPos(
1263 struct _ss *p,
1264 ss_rt  r,	/* Reference (Sensor/Sight) */
1265 double x,	/* X coord in mm, 0-310.0, accurate to 0.1mm */
1266 double y	/* Y coord in mm, 0-230.0, accurate to 0.1mm */
1267 );
1268 
1269 /* Set digitizing mode. Clears digitizing buffer, */
1270 /* and puts the device offline. The user can move */
1271 /* and enter positions. */
1272 inst_code ss_do_SetDigitizingMode(struct _ss *p);
1273 
1274 /* Get last digitized position from memory. */
1275 inst_code ss_do_OutputDigitizingValues(
1276 struct _ss *p,
1277 ss_rt  r,	/* Reference (Sensor/Sight) */
1278 ss_rt  *rr,	/* Return reference (Sensor/Sight) */
1279 int    *nrp,/* Return the number of remaining positions in memory. */
1280 double *x,	/* Return the X coord in mm, 0-310.0, accurate to 0.1mm */
1281 double *y,	/* Return the Y coord in mm, 0-230.0, accurate to 0.1mm */
1282 ss_zkt *zk	/* Return the Z coordinate (Up/Down) */
1283 );
1284 
1285 /* Turn on key aknowledge mode. Causes a KeyAnswer message */
1286 /* to be generated whenever a key is pressed. */
1287 /* (KetAnswer isn't well supported here ?) */
1288 inst_code ss_do_SetKeyAcknowlge(struct _ss *p);
1289 
1290 /* Turn off key aknowledge mode. */
1291 inst_code ss_do_ResetKeyAcknowlge(struct _ss *p);
1292 
1293 /* Query the keys that are currently pressed */
1294 inst_code ss_do_OutputActualKey(
1295 struct _ss *p,
1296 ss_sks *sk,	/* Return Scan Key Set (Key bitmask) */
1297 ss_ptt *pt	/* Return press time (Short/Long) */
1298 );
1299 
1300 /* Query the keys that were last pressed */
1301 inst_code ss_do_OutputLastKey(
1302 struct _ss *p,
1303 ss_sks *sk,	/* Return Scan Key bitmask (Keys) */
1304 ss_ptt *pt	/* Return press time (Short/Long) */
1305 );
1306 
1307 /* Query the status register */
1308 inst_code ss_do_OutputStatus(
1309 struct _ss *p,
1310 ss_sts *st	/* Return status bitmask (Enter key/Online/Digitize/KeyAck/Paper) */
1311 );
1312 
1313 /* Clear the status register */
1314 inst_code ss_do_ClearStatus(
1315 struct _ss *p,
1316 ss_sts st	/* Status to reset (Enter key/Online/Digitize/KeyAck/Paper) */
1317 );
1318 
1319 /* Set the special status register */
1320 /* (Set to all 0 on reset) */
1321 inst_code ss_do_SetSpecialStatus(
1322 struct _ss *p,
1323 ss_sss sss	/* Status bits to set (HeadDwnOnMv/TableInTransMode/AllLightsOn) */
1324 );
1325 
1326 /* Clear the special status register */
1327 inst_code ss_do_ClearSpecialStatus(
1328 struct _ss *p,
1329 ss_sss sss	/* Status bits to clear (HeadDwnOnMv/TableInTransMode/AllLightsOn) */
1330 );
1331 
1332 /* Query the special status register */
1333 inst_code ss_do_OutputSpecialStatus(
1334 struct _ss *p,
1335 ss_sss *sss	/* Return Special Status bits */
1336 );
1337 
1338 #ifdef __cplusplus
1339 	}
1340 #endif
1341 
1342 #define SS_IMP_H
1343 #endif /* SS_IMP_H */
1344