]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * viking -- GPS Data and Topo Analyzer, Explorer, and Manager | |
3 | * | |
4 | * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net> | |
5 | * Copyright (C) 2005, Alex Foobarian <foobarian@gmail.com> | |
6 | * Copyright (C) 2015, Rob Norris <rw_norris@hotmail.com> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | * | |
22 | */ | |
23 | ||
24 | #ifndef _VIKING_BABEL_H | |
25 | #define _VIKING_BABEL_H | |
26 | ||
27 | #include <glib.h> | |
28 | ||
29 | #include "viktrwlayer.h" | |
30 | #include "download.h" | |
31 | ||
32 | G_BEGIN_DECLS | |
33 | ||
34 | /** | |
35 | * BabelProgressCode: | |
36 | * @BABEL_DIAG_OUTPUT: a line of diagnostic output is available. The pointer is to a | |
37 | * NULL-terminated line of diagnostic output from gpsbabel. | |
38 | * @BABEL_DONE: gpsbabel finished, or %NULL if no callback is needed. | |
39 | * | |
40 | * Used when calling #BabelStatusFunc. | |
41 | */ | |
42 | typedef enum { | |
43 | BABEL_DIAG_OUTPUT, | |
44 | BABEL_DONE, | |
45 | } BabelProgressCode; | |
46 | ||
47 | /** | |
48 | * BabelStatusFunc: | |
49 | * | |
50 | * Callback function. | |
51 | */ | |
52 | typedef void (*BabelStatusFunc)(BabelProgressCode, gpointer, gpointer); | |
53 | ||
54 | /** | |
55 | * ProcessOptions: | |
56 | * | |
57 | * All values are defaulted to NULL | |
58 | * | |
59 | * Need to specify at least one of babelargs, URL or shell_command | |
60 | */ | |
61 | typedef struct { | |
62 | gchar* babelargs; // The standard initial arguments to gpsbabel (if gpsbabel is to be used) - normally should include the input file type (-i) option. | |
63 | gchar* filename; // Input filename (or device port e.g. /dev/ttyS0) | |
64 | gchar* input_file_type; // If NULL then uses internal file format handler (GPX only ATM), otherwise specify gpsbabel input type like "kml","tcx", etc... | |
65 | gchar* url; // URL input rather than a filename | |
66 | gchar* babel_filters; // Optional filter arguments to gpsbabel | |
67 | gchar* shell_command; // Optional shell command to run instead of gpsbabel - but will be (Unix) platform specific | |
68 | } ProcessOptions; | |
69 | ||
70 | /** | |
71 | * BabelMode: | |
72 | * | |
73 | * Store the Read/Write support offered by gpsbabel for a given format. | |
74 | */ | |
75 | typedef struct { | |
76 | unsigned waypointsRead : 1; | |
77 | unsigned waypointsWrite : 1; | |
78 | unsigned tracksRead : 1; | |
79 | unsigned tracksWrite : 1; | |
80 | unsigned routesRead : 1; | |
81 | unsigned routesWrite : 1; | |
82 | } BabelMode; | |
83 | ||
84 | /** | |
85 | * BabelDevice: | |
86 | * @name: gpsbabel's identifier of the device | |
87 | * @label: human readable label | |
88 | * | |
89 | * Representation of a supported device. | |
90 | */ | |
91 | typedef struct { | |
92 | BabelMode mode; | |
93 | gchar *name; | |
94 | gchar *label; | |
95 | } BabelDevice; | |
96 | ||
97 | /** | |
98 | * BabelFile: | |
99 | * @name: gpsbabel's identifier of the format | |
100 | * @ext: file's extension for this format | |
101 | * @label: human readable label | |
102 | * | |
103 | * Representation of a supported file format. | |
104 | */ | |
105 | typedef struct { | |
106 | BabelMode mode; | |
107 | gchar *name; | |
108 | gchar *ext; | |
109 | gchar *label; | |
110 | } BabelFile; | |
111 | ||
112 | GList *a_babel_file_list; | |
113 | GList *a_babel_device_list; | |
114 | ||
115 | void a_babel_foreach_file_with_mode (BabelMode mode, GFunc func, gpointer user_data); | |
116 | void a_babel_foreach_file_read_any (GFunc func, gpointer user_data); | |
117 | ||
118 | // NB needs to match typedef VikDataSourceProcessFunc in acquire.h | |
119 | gboolean a_babel_convert_from ( VikTrwLayer *vt, ProcessOptions *process_options, BabelStatusFunc cb, gpointer user_data, DownloadFileOptions *download_options ); | |
120 | ||
121 | gboolean a_babel_convert_to( VikTrwLayer *vt, VikTrack *track, const char *babelargs, const char *file, BabelStatusFunc cb, gpointer user_data ); | |
122 | ||
123 | void a_babel_init (); | |
124 | void a_babel_post_init (); | |
125 | void a_babel_uninit (); | |
126 | ||
127 | gboolean a_babel_available (); | |
128 | ||
129 | G_END_DECLS | |
130 | ||
131 | #endif |