summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2018-07-15 22:36:36 +0200
committermvglasow <michael -at- vonglasow.com>2018-07-15 22:36:36 +0200
commita17b5532c5841bc6f50d6ab5efacc6fbeb049b25 (patch)
tree6834688c846a09e854f608af87abc74bef65c25e
parent26b903b3588812a7115f09cbba9ec02aab56ee6f (diff)
downloadnavit-a17b5532c5841bc6f50d6ab5efacc6fbeb049b25.tar.gz
Add:traffic/traff_android:Skeleton plugin, not functional yet
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rwxr-xr-xCMakeLists.txt2
-rw-r--r--navit/traffic/traff_android/CMakeLists.txt1
-rw-r--r--navit/traffic/traff_android/traffic_traff_android.c99
3 files changed, 102 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9ae2039d..3eec2ffc6 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -501,6 +501,7 @@ add_module(speech/espeak "Default" FALSE)
add_module(speech/iphone "Default" FALSE)
add_module(traffic/dummy "Default" TRUE)
add_module(traffic/null "Default" TRUE)
+add_module(traffic/traff_android "Default" FALSE)
add_module(vehicle/android "Default" FALSE)
add_module(vehicle/iphone "Default" FALSE)
add_module(vehicle/wince "Default" FALSE)
@@ -707,6 +708,7 @@ if(ANDROID)
set_with_reason(graphics/null "Android detected" FALSE)
set_with_reason(graphics/android "Android detected" TRUE)
set_with_reason(speech/android "Android detected" TRUE)
+ set_with_reason(traffic/traff_android "Android detected" TRUE)
set_with_reason(vehicle/android "Android detected" TRUE)
set_with_reason(vehicle/file "Android detected" FALSE)
set_with_reason(map/filter "Android detected" FALSE)
diff --git a/navit/traffic/traff_android/CMakeLists.txt b/navit/traffic/traff_android/CMakeLists.txt
new file mode 100644
index 000000000..5e5f06df1
--- /dev/null
+++ b/navit/traffic/traff_android/CMakeLists.txt
@@ -0,0 +1 @@
+module_add_library(traffic_traff_android traffic_traff_android.c)
diff --git a/navit/traffic/traff_android/traffic_traff_android.c b/navit/traffic/traff_android/traffic_traff_android.c
new file mode 100644
index 000000000..71392076e
--- /dev/null
+++ b/navit/traffic/traff_android/traffic_traff_android.c
@@ -0,0 +1,99 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2018 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * @file traffic_traff_android.c
+ *
+ * @brief The TraFF plugin for Android
+ *
+ * This plugin receives TraFF feeds via Android broadcasts.
+ */
+
+#include <string.h>
+#include <time.h>
+
+#ifdef _POSIX_C_SOURCE
+#include <sys/types.h>
+#endif
+#include "glib_slice.h"
+#include "config.h"
+#include "coord.h"
+#include "item.h"
+#include "xmlconfig.h"
+#include "traffic.h"
+#include "plugin.h"
+#include "debug.h"
+
+/**
+ * @brief Stores information about the plugin instance.
+ */
+struct traffic_priv {
+ struct navit * nav; /**< The navit instance */
+};
+
+struct traffic_message ** traffic_traff_android_get_messages(struct traffic_priv * this_);
+
+/**
+ * @brief Returns an empty traffic report.
+ *
+ * @return Always `NULL`
+ */
+struct traffic_message ** traffic_traff_android_get_messages(struct traffic_priv * this_) {
+ return NULL;
+}
+
+/**
+ * @brief The methods implemented by this plugin
+ */
+static struct traffic_methods traffic_traff_android_meth = {
+ traffic_traff_android_get_messages,
+};
+
+/**
+ * @brief Registers a new traff_android traffic plugin
+ *
+ * @param nav The navit instance
+ * @param meth Receives the traffic methods
+ * @param attrs The attributes for the map
+ * @param cbl
+ *
+ * @return A pointer to a `traffic_priv` structure for the plugin instance
+ */
+static struct traffic_priv * traffic_traff_android_new(struct navit *nav, struct traffic_methods *meth,
+ struct attr **attrs, struct callback_list *cbl) {
+ struct traffic_priv *ret;
+
+ dbg(lvl_debug, "enter");
+
+ ret = g_new0(struct traffic_priv, 1);
+ *meth = traffic_traff_android_meth;
+
+ return ret;
+}
+
+/**
+ * @brief Initializes the traffic plugin.
+ *
+ * This function is called once on startup.
+ */
+void plugin_init(void) {
+ dbg(lvl_debug, "enter");
+
+ plugin_register_category_traffic("traff_android", traffic_traff_android_new);
+}