libgphoto2 (libgphoto2): libgphoto2_port/libgphoto2_port/gphoto2-port-library.h Source File

Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# gphoto2-port-library.h

    00001 /* gphoto2-port-library.h
    00002  *
    00003  * Copyright © 2001 Lutz Müller <lutz@users.sf.net>
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Lesser General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Lesser General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Lesser General Public
    00016  * License along with this library; if not, write to the
    00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018  * Boston, MA 02111-1307, USA.
    00019  */
    00020
    00021 #ifndef __GPHOTO2_PORT_LIBRARY_H__
    00022 #define __GPHOTO2_PORT_LIBRARY_H__
    00023
    00024 #include <gphoto2-port-info-list.h>
    00025 #include <gphoto2-port.h>
    00026
    00027 typedef struct _GPPortOperations GPPortOperations;
    00028 struct _GPPortOperations {
    00029         int (*init)     (GPPort *);
    00030         int (*exit)     (GPPort *);
    00031         int (*open)     (GPPort *);
    00032         int (*close)    (GPPort *);
    00033         int (*read)     (GPPort *,       char *, int);
    00034         int (*check_int)(GPPort *,      char *, int, int);
    00035         int (*write)    (GPPort *, const char *, int);
    00036         int (*update)   (GPPort *);
    00037
    00038         /* Pointers to devices. Please note these are stubbed so there is
    00039          no need to #ifdef GP_PORT_* anymore. */
    00040
    00041         /* for serial devices */
    00042         int (*get_pin)   (GPPort *, GPPin, GPLevel*);
    00043         int (*set_pin)   (GPPort *, GPPin, GPLevel);
    00044         int (*send_break)(GPPort *, int);
    00045         int (*flush)     (GPPort *, int);
    00046
    00047         /* for USB devices */
    00048         int (*find_device)(GPPort * dev, int idvendor, int idproduct);
    00049         int (*find_device_by_class)(GPPort * dev, int class, int subclass, int protocol);
    00050         int (*clear_halt) (GPPort * dev, int ep);
    00051         int (*msg_write)  (GPPort * dev, int request, int value, int index,
    00052                                 char *bytes, int size);
    00053         int (*msg_read)   (GPPort * dev, int request, int value, int index,
    00054                                 char *bytes, int size);
    00055         int (*msg_interface_write)  (GPPort * dev, int request,
    00056                                 int value, int index, char *bytes, int size);
    00057         int (*msg_interface_read)  (GPPort * dev, int request,
    00058                                 int value, int index, char *bytes, int size);
    00059 };
    00060
    00061 typedef GPPortType (* GPPortLibraryType) (void);
    00062 typedef int (* GPPortLibraryList)       (GPPortInfoList *list);
    00063
    00064 typedef GPPortOperations *(* GPPortLibraryOperations) (void);
    00065
    00066 /*
    00067  * If you want to write an io library, you need to implement the following
    00068  * functions. Everything else in your io library should be declared static.
    00069  */
    00070
    00071 GPPortType gp_port_library_type       (void);
    00072 int gp_port_library_list       (GPPortInfoList *list);
    00073
    00074 GPPortOperations *gp_port_library_operations (void);
    00075
    00076 #endif /* __GPHOTO2_PORT_LIBRARY_H__ */