Source code upload
[framework/connectivity/libgphoto2.git] / camlibs / sx330z / sx330z.h
1 /* sx330z.h
2  *
3  * Copyright © 2002 Dominik Kuhlen <dkuhlen@fhm.edu>
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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 /*
21  * GPhoto library for sx330z camera ....
22  * first try 6/2002 by Dominik Kuhlen  <dkuhlen@fhm.edu>
23  */
24
25
26 #include <gphoto2/gphoto2-camera.h>
27 #include <gphoto2/gphoto2-context.h>
28
29
30 /* USB spec violating ! */
31 #define USB_REQ_RESERVED 0x04
32
33 /* is this correct ? */
34 #define USB_VENDOR_TRAVELER     0x0d96
35
36 /* this one should work */
37 #define USB_PRODUCT_SX330Z      0x3300
38
39 /* very experimental !!! 
40  * Please report if this works
41  */
42 #define USB_PRODUCT_SX410Z      0x4100
43 /* same as MD6000 */
44 #define USB_PRODUCT_MD9700      0x4102
45
46 /* different requests (are there more ?) */
47 #define SX330Z_REQUEST_INIT     0x0001          /* not sure */
48 #define SX330Z_REQUEST_TOC_SIZE 0x0002
49 #define SX330Z_REQUEST_TOC      0x0003
50 #define SX330Z_REQUEST_IMAGE    0x0004
51 #define SX330Z_REQUEST_DELETE   0x0010
52
53 #define SX_THUMBNAIL 1
54 #define SX_IMAGE 0
55
56
57 /* 0x14 Bytes TOC entry */
58 struct traveler_toc_entry
59 {
60  char           name[12];       /* SIMGxxxx.jpg (not 0 terminated) */
61  int32_t        time;           /* ? */
62  int32_t        size;           /* in bytes (%4096 is 0)*/
63 };
64
65 /* 0x200 Bytes TOC Page */
66 struct traveler_toc_page
67 {
68  int32_t data0;                 /* don't know ? (0) */
69  int32_t data1;                 /* don't know ? (0) */
70  int16_t always1;               /* 1 ? */
71  int16_t numEntries;            /* number of entries in TOC page (0 .. 25)*/
72  struct traveler_toc_entry entries[25]; /* entries */
73 };
74
75 struct _CameraPrivateLibrary 
76 {
77  int usb_product;               /* different Thumbnail size */
78 };
79
80
81 /* 0x20 Bytes  Request  */
82 struct traveler_req
83 {
84  int16_t        always1;                /* 0x01 */
85  int16_t        requesttype;            /* 0x0003 : TOC , 0x0004 Data */
86  int32_t        data;                   /* dontknow */
87  int32_t        timestamp;              /* counter? only 24 bit  */
88  int32_t        offset;                 /* fileoffset */
89  int32_t        size;                   /* transfer bolcksize */
90  char           filename[12];           /* SIMG????jpg for Real image */                                        /* TIMG????jpg for Thumbnail */
91 };
92
93 /* 0x10 Bytes Acknowledge */
94 struct traveler_ack
95 {
96  int32_t always3;       /* 3 */
97  int32_t timestamp;     /* not sure */ 
98  int32_t size;          /* for TOC and other transfers */
99  int32_t dontknow;      /* always 0 */
100 };
101
102
103 /*
104  *  There's not a real initialization,
105  *  but ...
106  */
107 int sx330z_init(Camera *camera,GPContext *context);
108
109
110 /*
111  * Get number of TOC pages 
112  */
113 int sx330z_get_toc_num_pages(Camera *camera,GPContext *context, int32_t *pages);
114
115
116 /*
117  * Get TOC 
118  */
119 int sx330z_get_toc_page(Camera *camera,GPContext *context,struct traveler_toc_page *toc,int page);
120
121 /*
122  *  Load image data (thumbnail(exif) / image)
123  */
124 int sx330z_get_data(Camera *camera,GPContext *context, const char* filename,
125                     char **,unsigned long int *size,int thumbnail);
126
127
128
129 /*
130  *  Delete image 
131  */
132 int sx330z_delete_file(Camera *camera,GPContext *context,const char *filename);
133
134 /*
135  *  Exit camera
136  */
137 int camera_exit(Camera *camera, GPContext *context);