X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/c6acf18ddc123a52e92f0757310cefc9292b46a7..e798750dac9da7e633ed1f1307fc507a7ab51cf2:/src/babel.h diff --git a/src/babel.h b/src/babel.h index c037b6e8..ae2fa959 100644 --- a/src/babel.h +++ b/src/babel.h @@ -3,6 +3,7 @@ * * Copyright (C) 2003-2005, Evan Battaglia * Copyright (C) 2005, Alex Foobarian + * Copyright (C) 2015, Rob Norris * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +51,22 @@ typedef enum { */ typedef void (*BabelStatusFunc)(BabelProgressCode, gpointer, gpointer); +/** + * ProcessOptions: + * + * All values are defaulted to NULL + * + * Need to specify at least one of babelargs, URL or shell_command + */ +typedef struct { + gchar* babelargs; // The standard initial arguments to gpsbabel (if gpsbabel is to be used) - normally should include the input file type (-i) option. + gchar* filename; // Input filename (or device port e.g. /dev/ttyS0) + gchar* input_file_type; // If NULL then uses internal file format handler (GPX only ATM), otherwise specify gpsbabel input type like "kml","tcx", etc... + gchar* url; // URL input rather than a filename + gchar* babel_filters; // Optional filter arguments to gpsbabel + gchar* shell_command; // Optional shell command to run instead of gpsbabel - but will be (Unix) platform specific +} ProcessOptions; + /** * BabelMode: * @@ -95,16 +112,20 @@ typedef struct { GList *a_babel_file_list; GList *a_babel_device_list; -gboolean a_babel_convert( VikTrwLayer *vt, const char *babelargs, BabelStatusFunc cb, gpointer user_data, gpointer options ); -gboolean a_babel_convert_from( VikTrwLayer *vt, const char *babelargs, const char *file, BabelStatusFunc cb, gpointer user_data, gpointer options ); -gboolean a_babel_convert_from_shellcommand ( VikTrwLayer *vt, const char *input_cmd, const char *input_file_type, BabelStatusFunc cb, gpointer user_data, gpointer options ); -gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char *input_type, BabelStatusFunc cb, gpointer user_data, DownloadMapOptions *options ); -gboolean a_babel_convert_from_url_or_shell ( VikTrwLayer *vt, const char *input, const char *input_type, BabelStatusFunc cb, gpointer user_data, DownloadMapOptions *options ); +void a_babel_foreach_file_with_mode (BabelMode mode, GFunc func, gpointer user_data); +void a_babel_foreach_file_read_any (GFunc func, gpointer user_data); + +// NB needs to match typedef VikDataSourceProcessFunc in acquire.h +gboolean a_babel_convert_from ( VikTrwLayer *vt, ProcessOptions *process_options, BabelStatusFunc cb, gpointer user_data, DownloadFileOptions *download_options ); + gboolean a_babel_convert_to( VikTrwLayer *vt, VikTrack *track, const char *babelargs, const char *file, BabelStatusFunc cb, gpointer user_data ); void a_babel_init (); +void a_babel_post_init (); void a_babel_uninit (); +gboolean a_babel_available (); + G_END_DECLS #endif