# 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 } GPPortOperations;
    00075
    00076 typedef GPPortType (* GPPortLibraryType) (void);
    00077 typedef int (* GPPortLibraryList)       (GPPortInfoList *list);
    00078
    00079 typedef GPPortOperations *(* GPPortLibraryOperations) (void);
    00080
    00081 /*
    00082  * If you want to write an io library, you need to implement the following
    00083  * functions. Everything else in your io library should be declared static.
    00084  */
    00085
    00086 GPPortType gp_port_library_type       (void);
    00087 int gp_port_library_list       (GPPortInfoList *list);
    00088
    00089 GPPortOperations *gp_port_library_operations (void);
    00090
    00091 #endif /* __GPHOTO2_PORT_LIBRARY_H__ */