libgphoto2 photo camera library (libgphoto2) API 2.5.29

gphoto2-port-library.h
Go to the documentation of this file.
1
24#ifndef LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
25#define LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
26
27#include <gphoto2/gphoto2-port-info-list.h>
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
84 int (*reset) (GPPort *);
85
86} GPPortOperations;
87
88 typedef GPPortType (* GPPortLibraryType) (void);
89 typedef int (* GPPortLibraryList) (GPPortInfoList *list);
90
91 typedef GPPortOperations *(* GPPortLibraryOperations) (void);
92
93/*
94 * If you want to write an io library, you need to implement the following
95 * functions. Everything else in your io library should be declared static.
96 */
97
98 GPPortType gp_port_library_type (void);
99 int gp_port_library_list (GPPortInfoList *list);
100
101 GPPortOperations *gp_port_library_operations (void);
102
103#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H) */
gphoto2-port-info-list.h
GPPortType
GPPortType
The gphoto port type.
Definition: gphoto2-port-info-list.h:34
GPPortOperations
struct _GPPortOperations GPPortOperations
The port operations.
gphoto2-port.h
GPLevel
enum _GPLevel GPLevel
Level to pull specific lines.
GPPin
enum _GPPin GPPin
Serial pins.
_GPPortInfoList
Definition: gphoto2-port-info-list.c:56
_GPPortOperations
The port operations.
Definition: gphoto2-port-library.h:39
_GPPort
The GPhoto port structure.
Definition: gphoto2-port.h:139