summaryrefslogtreecommitdiff
path: root/libgphoto2_port/gphoto2/gphoto2-port-info-list.h
blob: ea8635a764b7856b6b996dc3e47aea6d93c45a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/** \file
 *
 * \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
 *
 * \par License
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * \par
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details. 
 *
 * \par
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GPHOTO2_PORT_INFO_LIST_H__
#define __GPHOTO2_PORT_INFO_LIST_H__

/**
 * \brief The gphoto port type.
 *
 * Enumeration specifying the port type.
 * The enum is providing bitmasks, but most code uses it as
 * just the one specific values.
 */
typedef enum { 
	GP_PORT_NONE        =      0,	/**< \brief No specific type associated. */
	GP_PORT_SERIAL      = 1 << 0,	/**< \brief Serial port. */
	GP_PORT_USB         = 1 << 2,	/**< \brief USB port. */
	GP_PORT_DISK        = 1 << 3,	/**< \brief Disk / local mountpoint port. */
	GP_PORT_PTPIP       = 1 << 4	/**< \brief PTP/IP port. */
} GPPortType;

/**
 * \brief Information about the current port.
 * 
 * Specific information about the current port. Usually taken from the
 * "--port=XXXX" setting from the frontend.
 *
 * This is not to be confused with the driver configurable port settings
 * in \ref GPPortSettings.
 */
typedef struct _GPPortInfo {
	GPPortType type;	/**< \brief The type of this port. */
	char name[64];		/**< \brief The name of this port (usb:) */
	char path[4096];	/**< \brief The path of this port (whatever is after the :) */

	/* Private */
	char library_filename[1024];	/**< \brief Internal pathname of the port driver. Do not use outside of the port library. */
} GPPortInfo;

#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS
typedef struct _GPPortInfo_v240 {
        GPPortType type;
        char name[64];
        char path[64];

        /* Private */
        char library_filename[1024];
} GPPortInfo_v240;
#endif

#include <gphoto2/gphoto2-port.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#ifdef _GPHOTO2_INTERNAL_CODE
#include <gphoto2/gphoto2-port-log.h>
extern const StringFlagItem gpi_gphoto_port_type_map[];
#endif

/* Internals are private */
typedef struct _GPPortInfoList GPPortInfoList;

int gp_port_info_list_new  (GPPortInfoList **list);
int gp_port_info_list_free (GPPortInfoList *list);

int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info);

int gp_port_info_list_load (GPPortInfoList *list);

int gp_port_info_list_count (GPPortInfoList *list);

int gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path);
int gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name);

int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info);

const char *gp_port_message_codeset (const char*);

/* DEPRECATED */
typedef GPPortInfo gp_port_info;

#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS
int gp_port_info_list_append_v240 (GPPortInfoList *list, GPPortInfo_v240 info);
int gp_port_info_list_append_v250 (GPPortInfoList *list, GPPortInfo info);
asm(".symver gp_port_info_list_append_v240, gp_port_info_list_append@LIBGPHOTO2_0_0");
asm(".symver gp_port_info_list_append_v250, gp_port_info_list_append@@LIBGPHOTO2_5_0");
#define gp_port_info_list_append gp_port_info_list_append_v250

int gp_port_info_list_get_info_v240 (GPPortInfoList *list, int n, GPPortInfo_v240 *info);
int gp_port_info_list_get_info_v250 (GPPortInfoList *list, int n, GPPortInfo *info);
asm(".symver gp_port_info_list_get_info_v240, gp_port_info_list_get_info@LIBGPHOTO2_0_0");
asm(".symver gp_port_info_list_get_info_v250, gp_port_info_list_get_info@@LIBGPHOTO2_5_0");
#define gp_port_info_list_get_info gp_port_info_list_get_info_v250
#endif

/**
 * Name of the environment variable which may contain the path where
 * to look for the IO libs. If this environment variable is not defined,
 * use the compiled-in default constant.
 *
 * \internal Internal use only.
 */
#ifdef _GPHOTO2_INTERNAL_CODE
#define IOLIBDIR_ENV "IOLIBS"
#endif /* _GPHOTO2_INTERNAL_CODE */


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __GPHOTO2_PORT_INFO_LIST_H__ */