summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2013-02-20 18:55:45 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-02-20 21:19:27 -0600
commit850c1811fc7e692f984b70c1e44538c8577679e0 (patch)
treef4afac3f8d070cd187973141ef7d5c6dfdd01f80
parent57a44e8d23a3f9c13f401a7846f1d0068699c90e (diff)
downloadofono-850c1811fc7e692f984b70c1e44538c8577679e0.tar.bz2
handsfree-audio: Add Manager registration
Adds the initial implementation of new experimental Handsfree Audio Manager interface. This patch adds the interface registration and the declaration of it's methods.
-rw-r--r--Makefile.am3
-rw-r--r--src/handsfree-audio.c81
-rw-r--r--src/ofono.h3
3 files changed, 86 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index ef4d3148..76d33b45 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -507,7 +507,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
src/gnssagent.c src/gnssagent.h \
src/cdma-smsutil.h src/cdma-smsutil.c \
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
- src/cdma-provision.c src/handsfree.c
+ src/cdma-provision.c src/handsfree.c \
+ src/handsfree-audio.c
src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ -ldl
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
new file mode 100644
index 00000000..e75c9774
--- /dev/null
+++ b/src/handsfree-audio.c
@@ -0,0 +1,81 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+
+#include <gdbus.h>
+
+#include "ofono.h"
+
+#define HFP_AUDIO_MANAGER_INTERFACE OFONO_SERVICE ".HandsfreeAudioManager"
+
+static DBusMessage *am_get_cards(DBusConnection *conn,
+ DBusMessage *msg, void *user_data)
+{
+ return __ofono_error_not_implemented(msg);
+}
+
+static DBusMessage *am_agent_register(DBusConnection *conn,
+ DBusMessage *msg, void *user_data)
+{
+ return __ofono_error_not_implemented(msg);
+}
+
+static DBusMessage *am_agent_unregister(DBusConnection *conn,
+ DBusMessage *msg, void *user_data)
+{
+ return __ofono_error_not_implemented(msg);
+}
+
+static const GDBusMethodTable am_methods[] = {
+ { GDBUS_METHOD("GetCards",
+ NULL, GDBUS_ARGS({"cards", "a{oa{sv}}"}),
+ am_get_cards) } ,
+ { GDBUS_METHOD("Register",
+ GDBUS_ARGS({"path", "o"}, {"codecs", "ay"}), NULL,
+ am_agent_register) },
+ { GDBUS_METHOD("Unregister",
+ GDBUS_ARGS({"path", "o"}), NULL,
+ am_agent_unregister) },
+ { }
+};
+
+int __ofono_handsfree_audio_manager_init(void)
+{
+ if (!g_dbus_register_interface(ofono_dbus_get_connection(),
+ "/", HFP_AUDIO_MANAGER_INTERFACE,
+ am_methods, NULL, NULL, NULL, NULL)) {
+ return -EIO;
+ }
+
+ return 0;
+}
+
+void __ofono_handsfree_audio_manager_cleanup(void)
+{
+ g_dbus_unregister_interface(ofono_dbus_get_connection(), "/",
+ HFP_AUDIO_MANAGER_INTERFACE);
+}
diff --git a/src/ofono.h b/src/ofono.h
index 15c1dc59..8abaf1e4 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -30,6 +30,9 @@ void __ofono_exit(void);
int __ofono_manager_init(void);
void __ofono_manager_cleanup(void);
+int __ofono_handsfree_audio_manager_init(void);
+void __ofono_handsfree_audio_manager_cleanup(void);
+
void __ofono_modem_shutdown(void);
#include <ofono/log.h>