1 #ifndef KLEINK10_H
2 
3 /*
4  * Argyll Color Correction System
5  *
6  * Klein K10 related defines
7  *
8  * Author: Graeme W. Gill
9  * Date:   29/4/2014
10  *
11  * Copyright 2001 - 2014, 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  * Based on DTP02.h & specbos.h
18  */
19 
20 /*
21    If you make use of the instrument driver code here, please note
22    that it is the author(s) of the code who take responsibility
23    for its operation. Any problems or queries regarding driving
24    instruments with the Argyll drivers, should be directed to
25    the Argyll's author(s), and not to any other party.
26 
27    If there is some instrument feature or function that you
28    would like supported here, it is recommended that you
29    contact Argyll's author(s) first, rather than attempt to
30    modify the software yourself, if you don't have firm knowledge
31    of the instrument communicate protocols. There is a chance
32    that an instrument could be damaged by an incautious command
33    sequence, and the instrument companies generally cannot and
34    will not support developers that they have not qualified
35    and agreed to support.
36  */
37 
38 #include "inst.h"
39 
40 #ifdef __cplusplus
41 	extern "C" {
42 #endif
43 
44 /* Fake Error codes */
45 #define K10_INTERNAL_ERROR			0xff01		/* Internal software error */
46 #define K10_TIMEOUT				    0xff02		/* Communication timeout */
47 #define K10_COMS_FAIL				0xff03		/* Communication failure */
48 #define K10_UNKNOWN_MODEL			0xff04		/* Not a JETI kleink10 */
49 #define K10_DATA_PARSE_ERROR  		0xff05		/* Read data parsing error */
50 
51 //#define K10_SPOS_EMIS				0xff06		/* Needs to be in emsissive configuration */
52 //#define K10_SPOS_AMB				0xff07		/* Needs to be in ambient configuration */
53 
54 /* Real instrument error code */
55 #define K10_OK						0
56 
57 /* Other errors */
58 #define K10_CMD_VERIFY				0x1000		/* Didn't echo the commamd */
59 #define K10_BAD_RETVAL				0x1001		/* Error code return value can't be parsed */
60 
61 #define K10_FIRMWARE				0x2001		/* Firmware error */
62 
63 #define K10_BLACK_EXCESS			0x2010		/* Black Excessive */
64 #define K10_BLACK_OVERDRIVE			0x2011		/* Black Overdrive */
65 #define K10_BLACK_ZERO				0x2012		/* Black Zero */
66 
67 #define K10_OVER_HIGH_RANGE			0x2020		/* Over High Range */
68 #define K10_TOP_OVER_RANGE			0x2021		/* Top over range */
69 #define K10_BOT_UNDER_RANGE			0x2022		/* Bottom under range */
70 #define K10_AIMING_LIGHTS			0x2023		/* Aiming lights on when measuring */
71 
72 #define K10_RANGE_CHANGE           	0x2024		/* Range changed during measurment */
73 #define K10_NOREFR_FOUND           	0x2025		/* Unable to measure refresh rate */
74 #define K10_NOTRANS_FOUND       	0x2026		/* No delay measurment transition found */
75 
76 #define K10_BLACK_CAL_INIT       	0x2027		/* Instrument not setup for bcal */
77 #define K10_BLACK_CAL_FAIL       	0x2028		/* Black calibration failed */
78 
79 #define K10_UNKNOWN			 		0x2030		/* Unknown error code */
80 
81 #define K10_INT_MALLOC		 		0x3000		/* Malloc failed */
82 
83 typedef enum {
84 	k10_k1     = 0,	/* K-1 */
85 	k10_k8     = 1,	/* K-8 */
86 	k10_k10    = 2,	/* K-10 */
87 	k10_k10a   = 3,	/* K-10-A */
88 	k10_kv10a  = 4,	/* KV-10-A */
89 } k10_dtype;
90 
91 /* Klein K10 communication object */
92 struct _kleink10 {
93 	INST_OBJ_BASE
94 
95 	amutex lock;				/* Command lock */
96 
97 	k10_dtype model;			/* Klein kleink10 model number */
98 	char serial_no[21];			/* Serial number */
99 	char firm_ver[21];			/* Firmware version number */
100 	int comdel;					/* Estimated communication delay to the instrument */
101 
102 	inst_mode mode;				/* Currently instrument mode */
103 
104 	inst_opt_type trig;			/* Reading trigger mode */
105 
106 	int autor;					/* Auto range state, nz = on */
107 	int lights;					/* Target light state, nz = on */
108 
109 	inst_disptypesel *dtlist;	/* Current display Type list */
110 	int     ndtlist;			/* Number of valid dtlist entries */
111 	int     cbid;				/* current calibration base ID, 0 if not a base */
112 	int     ucbid;				/* Underlying base ID if being used for matrix, 0 othewise */
113 	disptech dtech;				/* Display technology enum */
114 	double  ccmat[3][3];		/* Colorimeter correction matrix */
115 
116 	volatile double whitestamp;	/* meas_delay() white timestamp */
117 
118 	}; typedef struct _kleink10 kleink10;
119 
120 /* Constructor */
121 extern kleink10 *new_kleink10(icoms *icom, instType itype);
122 
123 #ifdef __cplusplus
124 	}
125 #endif
126 
127 #define KLEINK10_H
128 #endif /* KLEINK10_H */
129