1 #ifndef DTP22_H
2 
3 /*
4  * Argyll Color Correction System
5  *
6  * Xrite DTP22 related defines
7  *
8  * Author: Graeme W. Gill
9  * Date:   17/11/2006
10  *
11  * Copyright 2001 - 2013, Graeme W. Gill
12  * All rights reserved.
13  *
14  * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :-
15  * see the License2.txt file for licencing details.
16  */
17 
18 /*
19    If you make use of the instrument driver code here, please note
20    that it is the author(s) of the code who take responsibility
21    for its operation. Any problems or queries regarding driving
22    instruments with the Argyll drivers, should be directed to
23    the Argyll's author(s), and not to any other party.
24 
25    If there is some instrument feature or function that you
26    would like supported here, it is recommended that you
27    contact Argyll's author(s) first, rather than attempt to
28    modify the software yourself, if you don't have firm knowledge
29    of the instrument communicate protocols. There is a chance
30    that an instrument could be damaged by an incautious command
31    sequence, and the instrument companies generally cannot and
32    will not support developers that they have not qualified
33    and agreed to support.
34  */
35 
36 #include "inst.h"
37 
38 #ifdef __cplusplus
39 	extern "C" {
40 #endif
41 
42 /* Note: update dtp22_interp_error() and dtp22_interp_code() in dtp22.c */
43 /* if anything of these #defines are added or subtracted */
44 
45 /* Fake Error codes */
46 #define DTP22_INTERNAL_ERROR			0x61		/* Internal software error */
47 #define DTP22_COMS_FAIL					0x62		/* Communication failure */
48 #define DTP22_UNKNOWN_MODEL				0x63		/* Not a DPT22 */
49 #define DTP22_DATA_PARSE_ERROR  		0x64		/* Read data parsing error */
50 #define DTP22_UNKN_OEM		    		0x69		/* Unrecognized OEM */
51 #define DTP22_BAD_PASSWORD	    		0x6A		/* Password wasn't accepted */
52 
53 /* Real error code */
54 #define DTP22_OK   						0x00
55 
56 #define DTP22_BAD_COMMAND				0x01
57 #define DTP22_PRM_RANGE					0x02
58 #define DTP22_MEMORY_OVERFLOW			0x04
59 #define DTP22_INVALID_BAUD_RATE			0x05
60 #define DTP22_TIMEOUT					0x07
61 #define DTP22_SYNTAX_ERROR				0x08
62 #define DTP22_INCORRECT_DATA_FORMAT 	0x09
63 #define DTP22_WEAK_LAMP             	0x10
64 #define DTP22_LAMP_FAILED             	0x11
65 #define DTP22_UNSTABLE_CAL             	0x12
66 #define DTP22_CAL_GAIN_ERROR           	0x13
67 #define DTP22_SENSOR_FAILURE           	0x14
68 #define DTP22_BLACK_CAL_TOO_HIGH       	0x15
69 #define DTP22_UNSTABLE_BLACK_CAL       	0x16
70 #define DTP22_CAL_MEM_ERROR          	0x17
71 #define DTP22_FILTER_MOTOR          	0x21
72 #define DTP22_LAMP_FAILED_READING      	0x22
73 #define DTP22_POWER_INTR_READING      	0x23
74 #define DTP22_SIG_OFFSETS_READING      	0x24
75 #define DTP22_RD_SWITCH_TO_SOON      	0x25
76 #define DTP22_OVERRANGE              	0x26
77 #define DTP22_FILT_POS_ERROR           	0x28
78 #define DTP22_FACT_TST_CONNECT         	0x2A
79 #define DTP22_FACT_TST_LAMP_INH        	0x2B
80 
81 
82 #define DTP22_EEPROM_FAILURE			0x70
83 #define DTP22_PROGRAM_WRITE_FAIL		0x71
84 #define DTP22_MEMORY_WRITE_FAIL			0x72
85 
86 /* DTP22 communication object */
87 struct _dtp22 {
88 	INST_OBJ_BASE
89 
90 	/* *** DTP41 private data **** */
91 	unsigned char key[4];		/* Challenge/response key */
92 	int keyvalid;				/* nz if key is valid */
93 	int serno;					/* Serial number of instrument */
94 	int oemsn;					/* Serial number of OEM */
95 	int plaqueno;				/* Serial number of calibration plaque */
96 	inst_mode    mode;			/* Currently instrument mode */
97 	inst_mode    lastmode;		/* Last requested mode */
98 	int	need_cal;				/* White calibration needed flag */
99 	int noutocalib;				/* Don't mode change or auto calibrate */
100 	inst_opt_type trig;			/* Reading trigger mode */
101 
102 	xcalstd native_calstd;		/* Instrument native calibration standard */
103 	xcalstd target_calstd;		/* Returned calibration standard */
104 
105 	}; typedef struct _dtp22 dtp22;
106 
107 /* Constructor */
108 extern dtp22 *new_dtp22(icoms *icom, instType itype);
109 
110 #ifdef __cplusplus
111 	}
112 #endif
113 
114 #define DTP22_H
115 #endif /* DTP22_H */
116