Debian Codegraph @

camlibs/kodak/dc210/dc210.h

raw
1 /* dc210.h
2 *
3 * Copyright (C) 2002 Michel Koltan <[email protected]>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
19 */
20
21 #ifndef CAMLIBS_KODAK_DC210_DC210_H
22 #define CAMLIBS_KODAK_DC210_DC210_H
23
24 typedef enum {
25 DC210_TOGGLE_OFF = 0,
26 DC210_TOGGLE_ON = 1
27 } dc210_toggle_type;
28
29 typedef enum {
30 DC210_FULL_PICTURE = 0,
31 DC210_CFA_THUMB = 1,
32 DC210_RGB_THUMB = 2
33 } dc210_picture_type;
34
35 typedef enum {
36 DC210_FILE_TYPE_JPEG = 3,
37 DC210_FILE_TYPE_FPX = 4
38 } dc210_file_type_type;
39
40 typedef enum {
41 DC210_FLASH_AUTO = 0,
42 DC210_FLASH_FORCE = 1,
43 DC210_FLASH_NONE = 2
44 } dc210_flash_type;
45
46 typedef enum {
47 DC210_FILE_640 = 0,
48 DC210_FILE_1152 = 1
49 } dc210_resolution_type;
50
51 typedef enum {
52 DC210_LOW_COMPRESSION = 1,
53 DC210_MEDIUM_COMPRESSION = 2,
54 DC210_HIGH_COMPRESSION = 3
55
56 } dc210_compression_type;
57
58 typedef enum {
59 DC210_ZOOM_58 = 0,
60 DC210_ZOOM_51 = 1,
61 DC210_ZOOM_41 = 2,
62 DC210_ZOOM_34 = 3,
63 DC210_ZOOM_29 = 4,
64 DC210_ZOOM_MACRO = 37
65 } dc210_zoom_type;
66
67 typedef struct {
68
69 unsigned char open;
70 int program;
71 int space;
72
73 } dc210_card_status;
74
75 typedef struct {
76 char camera_type_id;
77 char firmwareMajor;
78 char firmwareMinor;
79 char battery;
80 char acstatus;
81 long int time;
82 dc210_zoom_type zoom;
83 char flash_charged;
84 dc210_compression_type compression_type;
85 signed char exp_compensation;
86 dc210_flash_type flash;
87 char preflash;
88 dc210_resolution_type resolution;
89 dc210_file_type_type file_type;
90 int totalPicturesTaken;
91 int totalFlashesFired;
92 int numPicturesInCamera;
93 dc210_card_status card_status;
94 int remainingLow;
95 int remainingMedium;
96 int remainingHigh;
97 int card_space;
98 char album_name[12];
99 } dc210_status;
100
101 typedef struct {
102 char camera_type;
103 dc210_file_type_type file_type;
104 dc210_resolution_type resolution;
105 dc210_compression_type compression;
106 int picture_number;
107 int picture_size;
108 int preview_size;
109 int picture_time;
110 char flash_used;
111 dc210_flash_type flash;
112 char preflash;
113 dc210_zoom_type zoom;
114 char f_number;
115 char battery;
116 int exposure_time;
117 char image_name[13];
118 } dc210_picture_info ;
119
120 #undef DEBUG
121 #define TIMEOUT 500
122 #define RETRIES 5
123 #define GP_MODULE "kodak-dc210"
124
125 #ifdef DEBUG
126 #define DC210_DEBUG(msg, params...) fprintf(stderr, msg, ##params)
127 #else
128 #define DC210_DEBUG GP_DEBUG
129 #endif
130
131 /* I really don't get it, why I have a shift of seven hours in
132 each direction to get/set the camara time correctly. I'm afraid
133 it's dependent on the timezone (and an outdated clib)*/
134
135 /* #define CAMERA_EPOC 852094800*/
136 #define CAMERA_GET_EPOC 852094800 - 25200
137 #define CAMERA_SET_EPOC 852094800 + 25200
138
139 /* Packet sizes */
140 #define DC210_CMD_DATA_SIZE 58
141 #define DC210_STATUS_SIZE 256
142 #define DC210_PICINFO_SIZE 256
143 #define DC210_CARD_BLOCK_SIZE 512
144 #define DC210_DIRLIST_SIZE 256
145 #define DC210_DOWNLOAD_BLOCKSIZE 1024
146
147 /* Commands */
148 #define DC210_SET_RESOLUTION 0x36 /* implemented */
149 #define DC210_SET_FILE_TYPE 0x37 /* implemented */
150 #define DC210_SET_SPEED 0x41 /* implemented */
151 #define DC210_GET_ALBUM_FILENAMES 0x4A /* returns information on all files in packets of size 256 */
152 #define DC210_GET_PICTURE 0x64 /* implemented */
153 #define DC210_GET_PICINFO 0x65 /* implemented */
154 #define DC210_GET_THUMB 0x66 /* implemented */
155 #define DC210_SET_QUALITY 0x71 /* implemented */
156 #define DC210_SET_FLASH 0x72 /* implemented */
157 #define DC210_SET_FOCUS 0x73 /* not acknowledged */
158 #define DC210_SET_DELAY 0x74 /* implemented, but effect unknown */
159 #define DC210_SET_TIME 0x75 /* implemented, but probably with timezone bug */
160 #define DC210_SET_ZOOM 0x78 /* implemented */
161 #define DC210_DELETE_PICTURE 0x7B /* implemented */
162 #define DC210_TAKE_PICTURE 0x7C /* implemented */
163 #define DC210_CHECK_BATTERY 0x7E /* implemented */
164 #define DC210_GET_STATUS 0x7F /* implemented */
165
166 #define DC210_SET_EXPOSURE 0x80 /* implemented */
167 #define DC210_RESET 0x8A /* working, but not yet implemented */
168 #define DC210_FIRMWARE_MODE_SET 0x8D /* working, but not yet implemented */
169
170 /* Filename commands */
171 #define DC210_CARD_GET_PICINFO 0x91 /* implemented */
172 #define DC210_CARD_GET_SUMMARY 0x92 /* not implemented */
173 #define DC210_CARD_READ_THUMB 0x93 /* implemented */
174 #define DC210_CARD_FORMAT 0x95 /* implemented */
175 #define DC210_OPEN_CARD 0x96 /* implemented */
176 #define DC210_CLOSE_CARD 0x97 /* implemented */
177 #define DC210_CARD_STATUS 0x98 /* is working, returns packet of size 16 */
178 #define DC210_CARD_GET_DIRECTORY 0x99 /* not implemented */
179 #define DC210_CARD_READ_FILE 0x9A /* implemented */
180 #define DC210_CARD_UNKNOWN_COMMAND1 0x9C /* not implemented */
181 #define DC210_CARD_FILE_DEL 0x9D /* implemented */
182 #define DC210_CARD_UNKNOWN_COMMAND2 0x9E /* not implemented */
183
184 /* Responses */
185 #define DC210_COMMAND_COMPLETE 0x00
186 #define DC210_PACKET_FOLLOWING 0x01
187 #define DC210_CMD_PACKET_FOLLOWING 0x80
188 #define DC210_CAMERA_READY 0x08
189 #define DC210_COMMAND_ACK 0xD1
190 #define DC210_CORRECT_PACKET 0xD2
191 #define DC210_COMMAND_NAK 0xE1
192 #define DC210_EXECUTION_ERROR 0xE2
193 #define DC210_ILLEGAL_PACKET 0xE3
194 #define DC210_CANCEL 0xE4
195 #define DC210_BUSY 0xF0
196
197 /* initialization */
198 int dc210_init_port (Camera *camera);
199
200 /* set procedures */
201 int dc210_set_compression (Camera * camera, dc210_compression_type compression);
202 int dc210_set_flash (Camera * camera, dc210_flash_type flash, char preflash);
203 int dc210_set_zoom (Camera * camera, dc210_zoom_type zoom);
204 int dc210_set_file_type (Camera * camera, dc210_file_type_type file_type);
205 int dc210_set_resolution (Camera * camera, dc210_resolution_type res);
206 int dc210_set_speed (Camera *camera, int speed);
207 int dc210_set_delay (Camera * camera);
208 int dc210_set_exp_compensation (Camera * camera, signed int compensation);
209
210 /* information */
211 int dc210_get_status (Camera *camera, dc210_status *status);
212 int dc210_get_picture_info (Camera *camera, dc210_picture_info *picinfo, unsigned int picno);
213 int dc210_get_picture_info_by_name (Camera *camera, dc210_picture_info *picinfo, const char * filename);
214 int dc210_get_filenames (Camera *camera, CameraList *list, GPContext *context);
215 int dc210_get_picture_number (Camera *camera, const char * filename);
216
217 /* picture actions */
218 int dc210_take_picture (Camera * camera, GPContext *context);
219 int dc210_capture (Camera *camera, CameraFilePath *path, GPContext *context);
220
221 int dc210_download_last_picture (Camera * camera, CameraFile *file, dc210_picture_type type, GPContext *context);
222 int dc210_download_picture_by_name (Camera * camera, CameraFile *file, const char *filename, dc210_picture_type type, GPContext *context);
223
224 int dc210_delete_picture (Camera * camera, unsigned int picno);
225 int dc210_delete_last_picture (Camera * camera );
226 int dc210_delete_picture_by_name (Camera * camera, const char * filename );
227
228 /* other actions */
229 int dc210_open_card (Camera * camera);
230
231 /* callbacks */
232 int dc210_system_time_callback (Camera * camera, CameraWidget * widget, GPContext * context);
233 int dc210_format_callback(Camera * camera, CameraWidget * widget, GPContext * context);
234 #ifdef DEBUG
235 int dc210_debug_callback(Camera * camera, CameraWidget * widget, GPContext * context);
236 #endif
237
238 #endif /* !defined(CAMLIBS_KODAK_DC210_DC210_H) */
239