]> git.street.me.uk Git - andy/viking.git/blame - src/babel.h
Allow an acquire datasource method to *not* have to use a threading mechanism.
[andy/viking.git] / src / babel.h
CommitLineData
1d1bc3c1
EB
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 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _VIKING_BABEL_H
24#define _VIKING_BABEL_H
25
a25c4c50
GB
26#include <glib.h>
27
28#include "viktrwlayer.h"
29
722b5481
RN
30G_BEGIN_DECLS
31
072cbb13
GB
32/**
33 * BabelProgressCode:
34 * @BABEL_DIAG_OUTPUT: a line of diagnostic output is available. The pointer is to a
35 * NULL-terminated line of diagnostic output from gpsbabel.
36 * @BABEL_DONE: gpsbabel finished, or %NULL if no callback is needed.
37 *
38 * Used when calling #BabelStatusFunc.
39 */
1d1bc3c1
EB
40typedef enum {
41 BABEL_DIAG_OUTPUT,
42 BABEL_DONE,
43} BabelProgressCode;
44
072cbb13
GB
45/**
46 * BabelStatusFunc:
47 *
48 * Callback function.
49 */
7b3479e3 50typedef void (*BabelStatusFunc)(BabelProgressCode, gpointer, gpointer);
1d1bc3c1 51
79e0f36e
GB
52/**
53 * BabelMode:
54 *
55 * Store the Read/Write support offered by gpsbabel for a given format.
56 */
57typedef struct {
58 unsigned waypointsRead : 1;
59 unsigned waypointsWrite : 1;
60 unsigned tracksRead : 1;
61 unsigned tracksWrite : 1;
62 unsigned routesRead : 1;
63 unsigned routesWrite : 1;
64} BabelMode;
65
66/**
67 * BabelDevice:
68 * @name: gpsbabel's identifier of the device
69 * @label: human readable label
70 *
71 * Representation of a supported device.
72 */
73typedef struct {
74 BabelMode mode;
75 gchar *name;
76 gchar *label;
77} BabelDevice;
78
79/**
80 * BabelFile:
81 * @name: gpsbabel's identifier of the device
82 * @ext: file's extension for this format
83 * @label: human readable label
84 *
85 * Representation of a supported file format.
86 */
87typedef struct {
88 BabelMode mode;
89 gchar *name;
90 gchar *ext;
91 gchar *label;
92} BabelFile;
93
94GList *a_babel_file_list;
95GList *a_babel_device_list;
96
ff33b163 97gboolean a_babel_convert( VikTrwLayer *vt, const char *babelargs, BabelStatusFunc cb, gpointer user_data );
9181183a 98gboolean a_babel_convert_from( VikTrwLayer *vt, const char *babelargs, const char *file, BabelStatusFunc cb, gpointer user_data );
28c82d8b 99gboolean a_babel_convert_from_shellcommand ( VikTrwLayer *vt, const char *input_cmd, const char *input_file_type, BabelStatusFunc cb, gpointer user_data );
533bbf34 100gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char *input_type, BabelStatusFunc cb, gpointer user_data );
6f94db6d 101gboolean a_babel_convert_to( VikTrwLayer *vt, VikTrack *track, const char *babelargs, const char *file, BabelStatusFunc cb, gpointer user_data );
8cf048bd 102
18ec873d
GB
103void a_babel_init ();
104void a_babel_uninit ();
105
722b5481
RN
106G_END_DECLS
107
1d1bc3c1 108#endif