graphics_win32=no; graphics_win32_reason=default
speech_android=no; speech_android_reason=default
speech_cmdline=yes; speech_cmdline_reason=default
+speech_dbus=no; speech_dbus_reason=default
speech_espeak=no; speech_espeak_reason=default
speech_speech_dispatcher=yes; speech_speech_dispatcher_reason=default
vehicle_demo=yes; vehicle_demo_reason=default
AC_DEFINE(USE_BINDING_DBUS, 1, [Build with binding dbus])
vehicle_gpsd_dbus="yes"
vehicle_gpsd_dbus_reason="dbus binding present"
+ speech_dbus="yes"
+ speech_dbus_reason="dbus binding present"
fi
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
AM_CONDITIONAL(BINDING_DBUS, test "x${binding_dbus}" = "xyes")
AM_CONDITIONAL(VEHICLE_GPSD_DBUS, test "x${vehicle_gpsd_dbus}" = "xyes")
+AM_CONDITIONAL(SPEECH_DBUS, test "x${speech_dbus}" = "xyes")
AC_ARG_WITH(dbus-service-dir, [ --with-dbus-service-dir specify where the dbus service dir resides], DBUS_SERVICE_DIR=$withval, DBUS_SERVICE_DIR="$datarootdir/dbus-1/services")
AC_SUBST(DBUS_SERVICE_DIR)
navit/speech/Makefile
navit/speech/android/Makefile
navit/speech/cmdline/Makefile
+navit/speech/dbus/Makefile
navit/speech/espeak/Makefile
navit/speech/speech_dispatcher/Makefile
navit/support/Makefile
echo "Speech types:"
echo " android: $speech_android ($speech_android_reason)"
echo " cmdline: $speech_cmdline ($speech_cmdline_reason)"
+echo " dbus: $speech_dbus ($speech_dbus_reason)"
echo " espeak: $speech_espeak ($speech_espeak_reason)"
echo " speech_dispatcher: $speech_speech_dispatcher ($speech_speech_dispatcher_reason)"
dbg(0,"enter %s %s %s\n",opath,command,interface);
msg = dbus_message_new_signal(opath, interface, "signal");
if (msg) {
- if (in && in[0]) {
- encode_attr(msg, in[0]);
+ if (in) {
+ while (*in) {
+ encode_attr(msg, *in);
+ in++;
+ }
}
dbus_connection_send(connection, msg, &dbus_serial);
dbus_connection_flush(connection);
PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui))
PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs))
PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs))
-PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent))
PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs))
PLUGIN_TYPE(event, (struct event_methods *meth))
PLUGIN_TYPE(font, (void *meth))
speech_new(struct attr *parent, struct attr **attrs)
{
struct speech *this_;
- struct speech_priv *(*speech_new)(struct speech_methods *meth, struct attr **attrs);
+ struct speech_priv *(*speech_new)(struct speech_methods *meth, struct attr **attrs, struct attr *parent);
struct attr *attr;
attr=attr_search(attrs, NULL, attr_type);
return NULL;
}
this_=g_new0(struct speech, 1);
- this_->priv=speech_new(&this_->meth, attrs);
+ this_->priv=speech_new(&this_->meth, attrs, parent);
this_->attrs=attr_list_dup(attrs);
dbg(1, "say=%p\n", this_->meth.say);
dbg(1,"priv=%p\n", this_->priv);
if SPEECH_CMDLINE
SUBDIRS += cmdline
endif
+if SPEECH_DBUS
+ SUBDIRS += dbus
+endif
if SPEECH_ESPEAK
SUBDIRS += espeak
endif
--- /dev/null
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=speech_dbus
+modulespeech_LTLIBRARIES = libspeech_dbus.la
+libspeech_dbus_la_SOURCES = speech_dbus.c
+libspeech_dbus_la_LDFLAGS = -module -avoid-version @NAVIT_MODULE_LDFLAGS@
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 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.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+#include "config.h"
+#include "item.h"
+#include "plugin.h"
+#include "navit.h"
+#include "attr.h"
+#include "callback.h"
+#include "speech.h"
+
+struct speech_priv {
+ struct navit *nav;
+};
+
+static int
+speech_dbus_say(struct speech_priv *this, const char *text)
+{
+ struct attr attr1,attr2,cb,*attr_list[3];
+ int valid=0;
+ attr1.type=attr_type;
+ attr1.u.str="speech";
+ attr2.type=attr_data;
+ attr2.u.str=(char *)text;
+ attr_list[0]=&attr1;
+ attr_list[1]=&attr2;
+ attr_list[2]=NULL;
+ if (navit_get_attr(this->nav, attr_callback_list, &cb, NULL))
+ callback_list_call_attr_4(cb.u.callback_list, attr_command, "dbus_send_signal", attr_list, NULL, &valid);
+ return 0;
+}
+
+static void
+speech_dbus_destroy(struct speech_priv *this) {
+ g_free(this);
+}
+
+static struct speech_methods speech_dbus_meth = {
+ speech_dbus_destroy,
+ speech_dbus_say,
+};
+
+static struct speech_priv *
+speech_dbus_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent) {
+ struct speech_priv *this;
+ if (!parent || parent->type != attr_navit)
+ return NULL;
+ this=g_new(struct speech_priv,1);
+ this->nav=parent->u.navit;
+ *meth=speech_dbus_meth;
+ return this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_speech_type("dbus", speech_dbus_new);
+}