Instrument Neutral Distributed Interface INDI  1.9.5
stvdriver.h
Go to the documentation of this file.
1 #if 0
2 STV driver
3 Copyright (C) 2006 Markus Wildi, markus.wildi@datacomm.ch
4 
5 This library is free software;
6 you can redistribute it and / or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation;
9 either
10 version 2.1 of the License, or (at your option) any later version.
11 
12 This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY;
14 without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library;
20 if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
22 #endif
23 
24 #pragma once
25 
26 #define OFF 0
27 #define ON 1
28 
29 #define REQUEST_DOWNLOAD 0x00
30 #define REQUEST_DOWNLOAD_ALL 0x01
31 #define DOWNLOAD_COMPLETE 0x02
32 #define REQUEST_BUFFER_STATUS 0x03
33 #define REQUEST_IMAGE_INFO 0x04
34 #define REQUEST_IMAGE_DATA 0x05
35 #define ACK 0x06
36 #define REQUEST_COMPRESSED_IMAGE_DATA 0x07
37 #define SEND_KEY_PATTERN 0x08
38 #define DISPLAY_ECHO 0x09
39 #define FILE_STATUS 0x0b
40 #define REQUEST_ACK 0x10
41 #define NACK 0x15
42 
43 /* Rotary Knob Key Patterns */
44 #define LR_ROTARY_DECREASE_PATTERN 0x8000
45 #define LR_ROTARY_INCREASE_PATTERN 0x4000
46 #define UD_ROTARY_DECREASE_PATTERN 0x2000
47 #define UD_ROTARY_INCREASE_PATTERN 0x1000
48 #define SHIFT_PATTERN 0x0008 /* increases rotary speed when 1 */
49 
50 /* Mode Key Patterns */
51 #define CAL_KEY_PATTERN 0x0100
52 #define TRACK_KEY_PATTERN 0x0200
53 #define DISPLAY_KEY_PATTERN 0x0400
54 #define FILEOPS_KEY_PATTERN 0x0800
55 #define A_KEY_PATTERN 0x0010
56 #define SETUP_KEY_PATTERN 0x0020
57 #define B_KEY_PATTERN 0x0040
58 #define INT_KEY_PATTERN 0x0080
59 #define FOCUS_KEY_PATTERN 0x0001
60 #define IMAGE_KEY_PATTERN 0x0002
61 #define MONITOR_KEY_PATTERN 0x0004
62 
63 /* The following bit masks have been take from Sbig's documentation */
64 #define ID_BITS_MASK 0x0001 /* mask for no bits*/
65 #define ID_BITS_10 0x0001 /* image is full 10 bits*/
66 #define ID_BITS_8 0x0000 /* image from focus, only 8 bits*/
67 #define ID_UNITS_MASK 0x0002 /* mask for units for scope*/
68 #define ID_UNITS_INCHES 0x0002 /* units were inches*/
69 #define ID_UNITS_CM 0x0000 /* units were cm*/
70 #define ID_SCOPE_MASK 0x0004 /* mask for telescope type*/
71 #define ID_SCOPE_REFRACTOR 0x0004 /* scope was refractor*/
72 #define ID_SCOPE_REFLECTOR 0x0000 /* scope was reflector*/
73 #define ID_DATETIME_MASK 0x0008 /* mask for date/time valid*/
74 #define ID_DATETIME_VALID 0x0008 /* date/time was set*/
75 #define ID_DATETIME_INVALID 0x0000 /* date/time was not set*/
76 #define ID_BIN_MASK 0x0030 /* mask for binning mode*/
77 #define ID_BIN_1X1 0x0010 /* binning was 1x1*/
78 #define ID_BIN_2X2 0x0020 /* binning was 2x2*/
79 #define ID_BIN_3X3 0x0030 /* binning was 3x3*/
80 #define ID_PM_MASK 0x0400 /* mask for am/pm in time*/
81 #define ID_PM_PM 0x0400 /* time was pm, add 12 hours*/
82 #define ID_PM_AM 0x0000 /* time was am, don;t add 12 hours*/
83 #define ID_FILTER_MASK 0x0800 /* mask for filter status*/
84 #define ID_FILTER_LUNAR 0x0800 /* lunar filter was used for image*/
85 #define ID_FILTER_NP 0x0000 /* no filter was used for image*/
86 #define ID_DARKSUB_MASK 0x1000 /* mask for dark subtraction*/
87 #define ID_DARKSUB_YES 0x1000 /* image was dark subtracted*/
88 #define ID_DARKSUB_NO 0x0000 /* image was not dark subtracted*/
89 #define ID_MOSAIC_MASK 0x6000 /* mask for mosaic status*/
90 #define ID_MOSAIC_NONE 0x0000 /* no mosaic, one image per frame*/
91 #define ID_MOSAIC_SMALL 0x2000 /* small mosaic: 40x40 pixels/image*/
92 #define ID_MOSAIC_LARGE 0x4000 /* large mosaic: 106x100 pixels/image*/
93 
94 /* IMAGE_INFO - data for the image
95 
96  Notes:
97  height - 0 or 0xFFFF if no data present
98  exposure - 100-60000 = 1.00 - 600 secs by 0.01
99  60001-60999 = 0.001 - 0.999 secs by 0.001
100  packedDate - bits 6-0 = year - 1999 (0 -127)
101  bits 11-7 = day ( 1-31)
102  bits 15-12 = month (1-12)
103  packedTime - bits 6-0 = seconds (0-59)
104  bits 7-12 = minutes (0-59)
105  bits 15-13 = hours mod 12 (0-11)
106  + bit in descriptor can add 12
107 */
108 
109 typedef struct
110 {
111  unsigned int descriptor; /* set of bits*/
112  unsigned int height, width; /* image sze */
113  unsigned int top, left; /* position in buffer */
114  double exposure; /* exposure time */
115  unsigned int noExposure; /* number of exposures added */
116  unsigned int analogGain; /*analog gain */
117  int digitalGain; /* digital gain */
118  unsigned int focalLength; /*focal length of telescope */
119  unsigned int aperture; /* aperture diameter */
120  unsigned int packedDate; /* date of image */
121  unsigned int year;
122  unsigned int month;
123  unsigned int day;
124  unsigned int packedTime; /* time of image */
125  unsigned int seconds; /* time of image */
126  unsigned int minutes; /* time of image */
127  unsigned int hours; /* time of image */
128  double ccdTemp; /* temperature of ccd in 1/100 deg C */
129  unsigned int siteID; /* site id */
130  unsigned int eGain; /* eGain in 1/100th e/ADU */
131  unsigned int background; /* background for display */
132  unsigned int range; /* range for display */
133  unsigned int pedestal; /* Track and Accumulate pedestal */
134  unsigned int ccdTop, ccdLeft; /* position of pixels on CCD array */
135  unsigned int adcResolution; /* value, 8 or 10 bits */
136  unsigned int units; /* 0= cm, 1=inch */
137  unsigned int telescopeType; /* 0=refractor, 1= reflector */
138  unsigned int dateTimeValid; /* 0= valid */
139  unsigned int binning; /* 1x1=1, 2x2=2, 3x3=3 */
140  unsigned int filterStatus; /* 0= no filter, 1= lunar filter */
141  unsigned int darkFrameSuntracted; /* 0= no, 1= yes */
142  unsigned int imageIsMosaic; /* 0=no, 1=40x40 pixels, 2=106x100 pixels */
143  double pixelSize; /* 7.4 um */
144  double minValue; /* Pixel Contents */
145  double maxValue;
146 
147 } IMAGE_INFO;
148 /*
149  * $Id: serial.h 49 2006-08-25 18:07:14Z lukas $
150  *
151  * Copyright (C) 2006, Lukas Zimmermann, Basel, Switzerland.
152  *
153  *
154  This program is free software; you can redistribute it and/or modify
155  it under the terms of the GNU General Public License as published by
156  the Free Software Foundation; either version 2, or (at your option)
157  any later version.
158 
159  This program is distributed in the hope that it will be useful,
160  but WITHOUT ANY WARRANTY; without even the implied warranty of
161  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162  GNU General Public License for more details.
163 
164  You should have received a copy of the GNU General Public License
165  along with this program; if not, write to the Free Software Foundation,
166  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
167 
168  Or visit http://www.gnu.org/licenses/gpl.html.
169 */
170 
171 #define PARITY_NONE 0
172 #define PARITY_EVEN 1
173 #define PARITY_ODD 2
174 
175 typedef unsigned char byte; /* define byte type */
176 
177 /* Restores terminal settings of open serial port device and close the file. */
178 void shutdown_serial(int fd);
179 
180 /* Opens and initializes a serial device and returns it's file descriptor. */
181 int init_serial(char *device_name, int bit_rate, int word_size, int parity, int stop_bits);
182 
183 /* Calculates the 16 bit CRC of an array of bytes and returns it. */
184 unsigned int calc_crc(byte byte_array[], int size);
IMAGE_INFO::aperture
unsigned int aperture
Definition: stvdriver.h:119
IMAGE_INFO::width
unsigned int width
Definition: stvdriver.h:112
IMAGE_INFO::digitalGain
int digitalGain
Definition: stvdriver.h:117
IMAGE_INFO::seconds
unsigned int seconds
Definition: stvdriver.h:125
fd
int fd
Definition: indiserver.c:117
IMAGE_INFO::background
unsigned int background
Definition: stvdriver.h:131
Aux::ANY
@ ANY
Definition: celestronauxpacket.h:86
IMAGE_INFO::telescopeType
unsigned int telescopeType
Definition: stvdriver.h:137
IMAGE_INFO::minValue
double minValue
Definition: stvdriver.h:144
IMAGE_INFO::pixelSize
double pixelSize
Definition: stvdriver.h:143
IMAGE_INFO::packedDate
unsigned int packedDate
Definition: stvdriver.h:120
shutdown_serial
void shutdown_serial(int fd)
Definition: stvdriver.c:1501
IMAGE_INFO::top
unsigned int top
Definition: stvdriver.h:113
IMAGE_INFO::binning
unsigned int binning
Definition: stvdriver.h:139
IMAGE_INFO::filterStatus
unsigned int filterStatus
Definition: stvdriver.h:140
IMAGE_INFO::units
unsigned int units
Definition: stvdriver.h:136
IMAGE_INFO::hours
unsigned int hours
Definition: stvdriver.h:127
IMAGE_INFO::descriptor
unsigned int descriptor
Definition: stvdriver.h:111
IMAGE_INFO::year
unsigned int year
Definition: stvdriver.h:121
IMAGE_INFO::range
unsigned int range
Definition: stvdriver.h:132
IMAGE_INFO::maxValue
double maxValue
Definition: stvdriver.h:145
IMAGE_INFO::focalLength
unsigned int focalLength
Definition: stvdriver.h:118
IMAGE_INFO::analogGain
unsigned int analogGain
Definition: stvdriver.h:116
byte
unsigned char byte
Definition: stvdriver.h:175
IMAGE_INFO::packedTime
unsigned int packedTime
Definition: stvdriver.h:124
IMAGE_INFO::adcResolution
unsigned int adcResolution
Definition: stvdriver.h:135
calc_crc
unsigned int calc_crc(byte byte_array[], int size)
IMAGE_INFO::eGain
unsigned int eGain
Definition: stvdriver.h:130
IMAGE_INFO::exposure
double exposure
Definition: stvdriver.h:114
IMAGE_INFO::dateTimeValid
unsigned int dateTimeValid
Definition: stvdriver.h:138
IMAGE_INFO::noExposure
unsigned int noExposure
Definition: stvdriver.h:115
IMAGE_INFO::ccdTop
unsigned int ccdTop
Definition: stvdriver.h:134
IMAGE_INFO::ccdTemp
double ccdTemp
Definition: stvdriver.h:128
IMAGE_INFO::pedestal
unsigned int pedestal
Definition: stvdriver.h:133
IMAGE_INFO::darkFrameSuntracted
unsigned int darkFrameSuntracted
Definition: stvdriver.h:141
IMAGE_INFO
Definition: stvdriver.h:109
IMAGE_INFO::imageIsMosaic
unsigned int imageIsMosaic
Definition: stvdriver.h:142
init_serial
int init_serial(char *device_name, int bit_rate, int word_size, int parity, int stop_bits)
Definition: stvdriver.c:1526
IMAGE_INFO::siteID
unsigned int siteID
Definition: stvdriver.h:129
IMAGE_INFO::minutes
unsigned int minutes
Definition: stvdriver.h:126
IMAGE_INFO::month
unsigned int month
Definition: stvdriver.h:122
IMAGE_INFO::day
unsigned int day
Definition: stvdriver.h:123