libgphoto2 photo camera library (libgphoto2) API  2.5.0
gphoto2-port-library.h
Go to the documentation of this file.
00001 
00024 #ifndef __GPHOTO2_PORT_LIBRARY_H__
00025 #define __GPHOTO2_PORT_LIBRARY_H__
00026 
00027 #include <gphoto2/gphoto2-port-info-list.h>
00028 #include <gphoto2/gphoto2-port.h>
00029 
00039 typedef struct _GPPortOperations {
00040         int (*init)     (GPPort *);
00041         int (*exit)     (GPPort *);
00042         int (*open)     (GPPort *);
00043         int (*close)    (GPPort *);
00044         int (*read)     (GPPort *,       char *, int);
00045         int (*check_int)(GPPort *,      char *, int, int);
00046         int (*write)    (GPPort *, const char *, int);
00047         int (*update)   (GPPort *);
00048 
00049         /* Pointers to devices. Please note these are stubbed so there is
00050          no need to #ifdef GP_PORT_* anymore. */
00051 
00052         /* for serial devices */
00053         int (*get_pin)   (GPPort *, GPPin, GPLevel*);
00054         int (*set_pin)   (GPPort *, GPPin, GPLevel);
00055         int (*send_break)(GPPort *, int);
00056         int (*flush)     (GPPort *, int);
00057 
00058         /* for USB devices */
00059         int (*find_device)(GPPort * dev, int idvendor, int idproduct);
00060         int (*find_device_by_class)(GPPort * dev, int class, int subclass, int protocol);
00061         int (*clear_halt) (GPPort * dev, int ep);
00062         int (*msg_write)  (GPPort * dev, int request, int value, int index,
00063                                 char *bytes, int size);
00064         int (*msg_read)   (GPPort * dev, int request, int value, int index,
00065                                 char *bytes, int size);
00066         int (*msg_interface_write)  (GPPort * dev, int request, 
00067                                 int value, int index, char *bytes, int size);
00068         int (*msg_interface_read)  (GPPort * dev, int request, 
00069                                 int value, int index, char *bytes, int size);
00070         int (*msg_class_write) (GPPort * dev, int request, 
00071                                 int value, int index, char *bytes, int size);
00072         int (*msg_class_read) (GPPort * dev, int request, 
00073                                 int value, int index, char *bytes, int size);
00074 
00075         /* For USB disk direct IO devices */
00076         int (*seek) (GPPort * dev, int offset, int whence);
00077 
00078         /* For USB Mass Storage raw SCSI ports */
00079         int (*send_scsi_cmd) (GPPort *port, int to_dev,
00080                                 char *cmd, int cmd_size,
00081                                 char *sense, int sense_size,
00082                                 char *data, int data_size);
00083 
00084 } GPPortOperations;
00085 
00086 typedef GPPortType (* GPPortLibraryType) (void);
00087 typedef int (* GPPortLibraryList)       (GPPortInfoList *list);
00088 
00089 typedef GPPortOperations *(* GPPortLibraryOperations) (void);
00090 
00091 /*
00092  * If you want to write an io library, you need to implement the following
00093  * functions. Everything else in your io library should be declared static.
00094  */
00095 
00096 GPPortType gp_port_library_type       (void);
00097 int gp_port_library_list       (GPPortInfoList *list);
00098 
00099 GPPortOperations *gp_port_library_operations (void);
00100 
00101 #endif /* __GPHOTO2_PORT_LIBRARY_H__ */