libgphoto2 photo camera library (libgphoto2) API  2.4.11
gphoto2-port-library.h
Go to the documentation of this file.
1 
24 #ifndef __GPHOTO2_PORT_LIBRARY_H__
25 #define __GPHOTO2_PORT_LIBRARY_H__
26 
28 #include <gphoto2/gphoto2-port.h>
29 
39 typedef struct _GPPortOperations {
40  int (*init) (GPPort *);
41  int (*exit) (GPPort *);
42  int (*open) (GPPort *);
43  int (*close) (GPPort *);
44  int (*read) (GPPort *, char *, int);
45  int (*check_int)(GPPort *, char *, int, int);
46  int (*write) (GPPort *, const char *, int);
47  int (*update) (GPPort *);
48 
49  /* Pointers to devices. Please note these are stubbed so there is
50  no need to #ifdef GP_PORT_* anymore. */
51 
52  /* for serial devices */
53  int (*get_pin) (GPPort *, GPPin, GPLevel*);
54  int (*set_pin) (GPPort *, GPPin, GPLevel);
55  int (*send_break)(GPPort *, int);
56  int (*flush) (GPPort *, int);
57 
58  /* for USB devices */
59  int (*find_device)(GPPort * dev, int idvendor, int idproduct);
60  int (*find_device_by_class)(GPPort * dev, int class, int subclass, int protocol);
61  int (*clear_halt) (GPPort * dev, int ep);
62  int (*msg_write) (GPPort * dev, int request, int value, int index,
63  char *bytes, int size);
64  int (*msg_read) (GPPort * dev, int request, int value, int index,
65  char *bytes, int size);
66  int (*msg_interface_write) (GPPort * dev, int request,
67  int value, int index, char *bytes, int size);
68  int (*msg_interface_read) (GPPort * dev, int request,
69  int value, int index, char *bytes, int size);
70  int (*msg_class_write) (GPPort * dev, int request,
71  int value, int index, char *bytes, int size);
72  int (*msg_class_read) (GPPort * dev, int request,
73  int value, int index, char *bytes, int size);
74 
75  /* For USB disk direct IO devices */
76  int (*seek) (GPPort * dev, int offset, int whence);
77 
78  /* For USB Mass Storage raw SCSI ports */
79  int (*send_scsi_cmd) (GPPort *port, int to_dev,
80  char *cmd, int cmd_size,
81  char *sense, int sense_size,
82  char *data, int data_size);
83 
85 
86 typedef GPPortType (* GPPortLibraryType) (void);
87 typedef int (* GPPortLibraryList) (GPPortInfoList *list);
88 
89 typedef GPPortOperations *(* GPPortLibraryOperations) (void);
90 
91 /*
92  * If you want to write an io library, you need to implement the following
93  * functions. Everything else in your io library should be declared static.
94  */
95 
96 GPPortType gp_port_library_type (void);
97 int gp_port_library_list (GPPortInfoList *list);
98 
99 GPPortOperations *gp_port_library_operations (void);
100 
101 #endif /* __GPHOTO2_PORT_LIBRARY_H__ */
enum _GPPin GPPin
Serial pins.
The GPhoto port structure.
Definition: gphoto2-port.h:151
Definition: gphoto2-port-info-list.c:69
enum _GPLevel GPLevel
Level to pull specific lines.
The port operations.
Definition: gphoto2-port-library.h:39
struct _GPPortOperations GPPortOperations
The port operations.
GPPortType
The gphoto port type.
Definition: gphoto2-port-info-list.h:34