1 /** \file
2  *
3  * \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
4  *
5  * \par License
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * \par
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * \par
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA  02110-1301  USA
22  */
23 
24 #ifndef __GPHOTO2_PORT_INFO_LIST_H__
25 #define __GPHOTO2_PORT_INFO_LIST_H__
26 
27 /**
28  * \brief The gphoto port type.
29  *
30  * Enumeration specifying the port type.
31  * The enum is providing bitmasks, but most code uses it as
32  * just the one specific values.
33  */
34 typedef enum {
35 	GP_PORT_NONE        =      0,	/**< \brief No specific type associated. */
36 	GP_PORT_SERIAL      = 1 << 0,	/**< \brief Serial port. */
37 	GP_PORT_USB         = 1 << 2,	/**< \brief USB port. */
38 	GP_PORT_DISK        = 1 << 3,	/**< \brief Disk / local mountpoint port. */
39 	GP_PORT_PTPIP       = 1 << 4,	/**< \brief PTP/IP port. */
40 	GP_PORT_USB_DISK_DIRECT = 1 << 5, /**< \brief Direct IO to an usb mass storage device. */
41 	GP_PORT_USB_SCSI    = 1 << 6,	/**< \brief USB Mass Storage raw SCSI port. */
42 	GP_PORT_IP          = 1 << 7	/**< \brief generic IP address port. */
43 } GPPortType;
44 
45 /**
46  * \brief Information about the current port.
47  *
48  * Specific information about the current port. Usually taken from the
49  * "--port=XXXX" setting from the frontend.
50  *
51  * This is not to be confused with the driver configurable port settings
52  * in \ref GPPortSettings.
53  */
54 struct _GPPortInfo;
55 typedef struct _GPPortInfo *GPPortInfo;
56 
57 #include <gphoto2/gphoto2-port.h>
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif /* __cplusplus */
62 
63 #ifdef _GPHOTO2_INTERNAL_CODE
64 #include <gphoto2/gphoto2-port-log.h>
65 extern const StringFlagItem gpi_gphoto_port_type_map[];
66 #endif
67 
68 int gp_port_info_new (GPPortInfo *info);
69 int gp_port_info_get_name (GPPortInfo info, char **name);
70 int gp_port_info_set_name (GPPortInfo info, const char *name);
71 int gp_port_info_get_path (GPPortInfo info, char **path);
72 int gp_port_info_set_path (GPPortInfo info, const char *path);
73 int gp_port_info_get_type (GPPortInfo info, GPPortType *type);
74 int gp_port_info_set_type (GPPortInfo info, const GPPortType type);
75 int gp_port_info_get_library_filename (GPPortInfo info, char **lib);
76 int gp_port_info_set_library_filename (GPPortInfo info, char *lib);
77 
78 /* Internals are private */
79 typedef struct _GPPortInfoList GPPortInfoList;
80 
81 int gp_port_info_list_new  (GPPortInfoList **list);
82 int gp_port_info_list_free (GPPortInfoList *list);
83 
84 int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info);
85 
86 int gp_port_info_list_load (GPPortInfoList *list);
87 
88 int gp_port_info_list_count (GPPortInfoList *list);
89 
90 int gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path);
91 int gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name);
92 
93 int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info);
94 
95 const char *gp_port_message_codeset (const char*);
96 
97 /**
98  * Name of the environment variable which may contain the path where
99  * to look for the IO libs. If this environment variable is not defined,
100  * use the compiled-in default constant.
101  *
102  * \internal Internal use only.
103  */
104 #ifdef _GPHOTO2_INTERNAL_CODE
105 #define IOLIBDIR_ENV "IOLIBS"
106 #endif /* _GPHOTO2_INTERNAL_CODE */
107 
108 
109 #ifdef __cplusplus
110 }
111 #endif /* __cplusplus */
112 
113 #endif /* __GPHOTO2_PORT_INFO_LIST_H__ */
114