diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-01-08 10:28:00 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-01-08 10:28:00 +0000 |
commit | 7010ffa99da15d980e1c857c50672e9ee0d02ad8 (patch) | |
tree | 087e1aa00095fb8383461999d9940ac7f86c8603 /navit/speech | |
parent | 11cc509bf21091617885191ea9f1a37cd0a3ff18 (diff) | |
download | navit-7010ffa99da15d980e1c857c50672e9ee0d02ad8.tar.gz |
Add:Core:speech_dbus
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2898 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/speech')
-rw-r--r-- | navit/speech/Makefile.am | 3 | ||||
-rw-r--r-- | navit/speech/dbus/Makefile.am | 5 | ||||
-rw-r--r-- | navit/speech/dbus/speech_dbus.c | 77 |
3 files changed, 85 insertions, 0 deletions
diff --git a/navit/speech/Makefile.am b/navit/speech/Makefile.am index ddab19c78..3c232db0b 100644 --- a/navit/speech/Makefile.am +++ b/navit/speech/Makefile.am @@ -5,6 +5,9 @@ endif if SPEECH_CMDLINE SUBDIRS += cmdline endif +if SPEECH_DBUS + SUBDIRS += dbus +endif if SPEECH_ESPEAK SUBDIRS += espeak endif diff --git a/navit/speech/dbus/Makefile.am b/navit/speech/dbus/Makefile.am new file mode 100644 index 000000000..abe285b15 --- /dev/null +++ b/navit/speech/dbus/Makefile.am @@ -0,0 +1,5 @@ +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@ diff --git a/navit/speech/dbus/speech_dbus.c b/navit/speech/dbus/speech_dbus.c new file mode 100644 index 000000000..53ab46f03 --- /dev/null +++ b/navit/speech/dbus/speech_dbus.c @@ -0,0 +1,77 @@ +/** + * 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); +} |