libgphoto2 photo camera library (libgphoto2) API
2.4.14
Main Page
Related Pages
Data Structures
Files
File List
Globals
gphoto2-port.h
Go to the documentation of this file.
1
24
#ifndef __GPHOTO2_PORT_H__
25
#define __GPHOTO2_PORT_H__
26
27
#include <
gphoto2/gphoto2-port-info-list.h
>
28
29
/* For portability */
30
#include <
gphoto2/gphoto2-port-portability.h
>
31
#ifdef OS2
32
#include <gphoto2/gphoto2-port-portability-os2.h>
33
#include <os2.h>
34
#endif
35
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
/* __cplusplus */
39
40
#ifndef TRUE
41
#define TRUE (0==0)
42
#endif
43
44
#ifndef FALSE
45
#define FALSE (1==0)
46
#endif
47
53
typedef
enum
_GPPortSerialParity
54
{
55
GP_PORT_SERIAL_PARITY_OFF
= 0,
56
GP_PORT_SERIAL_PARITY_EVEN
,
57
GP_PORT_SERIAL_PARITY_ODD
58
}
GPPortSerialParity
;
59
61
#define GP_PORT_MAX_BUF_LEN 4096
62
66
typedef
struct
_GPPortSettingsSerial
{
67
char
port
[128];
68
int
speed
;
69
int
bits
;
70
GPPortSerialParity
parity
;
72
int
stopbits
;
73
}
GPPortSettingsSerial
;
74
78
typedef
struct
_GPPortSettingsUSB
{
79
int
inep
;
80
int
outep
;
81
int
intep
;
82
int
config
;
83
int
interface
;
84
int
altsetting
;
86
int
maxpacketsize
;
88
/* must be last to avoid binary incompatibility.
89
* luckily we just need to make sure this struct does not
90
* get larger than _GPPortSettingsSerial. */
91
char
port
[64];
92
}
GPPortSettingsUSB
;
93
97
typedef
struct
_GPPortSettingsDisk
{
98
char
mountpoint
[128];
99
}
GPPortSettingsDisk
;
100
104
typedef
struct
_GPPortSettingsUsbDiskDirect
{
105
char
path
[128];
106
}
GPPortSettingsUsbDiskDirect
;
107
111
typedef
struct
_GPPortSettingsUsbScsi
{
112
char
path
[128];
113
}
GPPortSettingsUsbScsi
;
114
121
typedef
union
_GPPortSettings
{
122
GPPortSettingsSerial
serial
;
123
GPPortSettingsUSB
usb
;
124
GPPortSettingsDisk
disk
;
125
GPPortSettingsUsbDiskDirect
usbdiskdirect
;
126
GPPortSettingsUsbScsi
usbscsi
;
127
}
GPPortSettings
;
128
129
enum
{
130
GP_PORT_USB_ENDPOINT_IN
,
131
GP_PORT_USB_ENDPOINT_OUT
,
132
GP_PORT_USB_ENDPOINT_INT
133
};
134
135
typedef
struct
_GPPortPrivateLibrary GPPortPrivateLibrary;
136
typedef
struct
_GPPortPrivateCore
GPPortPrivateCore
;
137
151
typedef
struct
_GPPort
{
152
/* For your convenience */
153
GPPortType
type
;
155
GPPortSettings
settings
;
156
GPPortSettings
settings_pending
;
158
int
timeout
;
160
GPPortPrivateLibrary *
pl
;
161
GPPortPrivateCore
*
pc
;
162
}
GPPort
;
163
164
int
gp_port_new
(
GPPort
**port);
165
int
gp_port_free
(
GPPort
*port);
166
167
int
gp_port_set_info
(
GPPort
*port,
GPPortInfo
info);
168
int
gp_port_get_info
(
GPPort
*port,
GPPortInfo
*info);
169
170
int
gp_port_open
(
GPPort
*port);
171
int
gp_port_close
(
GPPort
*port);
172
173
int
gp_port_write
(
GPPort
*port,
const
char
*data,
int
size);
174
int
gp_port_read
(
GPPort
*port,
char
*data,
int
size);
175
int
gp_port_check_int
(
GPPort
*port,
char
*data,
int
size);
176
int
gp_port_check_int_fast
(
GPPort
*port,
char
*data,
int
size);
177
178
int
gp_port_get_timeout
(
GPPort
*port,
int
*timeout);
179
int
gp_port_set_timeout
(
GPPort
*port,
int
timeout);
180
181
int
gp_port_set_settings
(
GPPort
*port,
GPPortSettings
settings);
182
int
gp_port_get_settings
(
GPPort
*port,
GPPortSettings
*settings);
183
190
typedef
enum
_GPPin
{
191
GP_PIN_RTS
,
192
GP_PIN_DTR
,
193
GP_PIN_CTS
,
194
GP_PIN_DSR
,
195
GP_PIN_CD
,
196
GP_PIN_RING
197
}
GPPin
;
198
204
typedef
enum
_GPLevel
{
205
GP_LEVEL_LOW
= 0,
206
GP_LEVEL_HIGH
= 1
207
}
GPLevel
;
208
209
int
gp_port_get_pin
(
GPPort
*port,
GPPin
pin,
GPLevel
*level);
210
int
gp_port_set_pin
(
GPPort
*port,
GPPin
pin,
GPLevel
level);
211
212
int
gp_port_send_break
(
GPPort
*port,
int
duration);
213
int
gp_port_flush
(
GPPort
*port,
int
direction);
214
215
int
gp_port_usb_find_device
(
GPPort
*port,
int
idvendor,
int
idproduct);
216
int
gp_port_usb_find_device_by_class
(
GPPort
*port,
int
mainclass,
int
subclass,
int
protocol);
217
int
gp_port_usb_clear_halt
(
GPPort
*port,
int
ep);
218
int
gp_port_usb_msg_write
(
GPPort
*port,
int
request,
int
value,
219
int
index,
char
*bytes,
int
size);
220
int
gp_port_usb_msg_read
(
GPPort
*port,
int
request,
int
value,
221
int
index,
char
*bytes,
int
size);
222
int
gp_port_usb_msg_interface_write
(
GPPort
*port,
int
request,
223
int
value,
int
index,
char
*bytes,
int
size);
224
int
gp_port_usb_msg_interface_read
(
GPPort
*port,
int
request,
225
int
value,
int
index,
char
*bytes,
int
size);
226
int
gp_port_usb_msg_class_write
(
GPPort
*port,
int
request,
227
int
value,
int
index,
char
*bytes,
int
size);
228
int
gp_port_usb_msg_class_read
(
GPPort
*port,
int
request,
229
int
value,
int
index,
char
*bytes,
int
size);
230
231
int
gp_port_seek
(
GPPort
*port,
int
offset,
int
whence);
232
233
int
gp_port_send_scsi_cmd
(
GPPort
*port,
int
to_dev,
234
char
*cmd,
int
cmd_size,
235
char
*sense,
int
sense_size,
236
char
*data,
int
data_size);
237
238
/* Error reporting */
239
int
gp_port_set_error
(
GPPort
*port,
const
char
*format, ...)
240
#ifdef __GNUC__
241
__attribute__((__format__(printf,2,3)))
242
#endif
243
;
244
const
char
*
gp_port_get_error
(
GPPort
*port);
245
246
/* DEPRECATED */
248
typedef
GPPort
gp_port
;
250
typedef
GPPortSettings
gp_port_settings
;
252
#define PIN_CTS GP_PIN_CTS
253
254
#ifdef __cplusplus
255
}
256
#endif
/* __cplusplus */
257
258
#endif
/* __GPHOTO2_PORT_H__ */
259
260
libgphoto2_port
gphoto2
gphoto2-port.h
Generated on Thu Jul 25 2013 22:30:05 for libgphoto2 photo camera library (libgphoto2) API by
1.8.4