* [PATCH 0/8] hfpmodem: Add Apple Siri
@ 2013-12-16 17:52 KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 1/8] doc: Add Siri API KrzysztofX Wilk
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]
This is an integration of the extended features for Apple devices which
are connected via Bluetooth HFP. The plugin provides the Siri availability
and the selection of Eyes Free Mode as defined in the following document:
https://developer.apple.com/hardwaredrivers/bluetoothdesignguidelines.pdf
KrzysztofX Wilk (8):
doc: Add Siri API
dbus: Define Siri DBUS Interface
include: Add Siri interface definition
siri: Add atom implementation
siri: Add atom driver
hfp_hf_bluez4: Enable Siri atom
hfp_hf_bluez5: Enable Siri atom
phonesim: Enable Siri atom
Makefile.am | 10 +-
doc/siri-api.txt | 43 ++++++
drivers/hfpmodem/hfpmodem.c | 2 +
drivers/hfpmodem/hfpmodem.h | 3 +
drivers/hfpmodem/siri.c | 215 ++++++++++++++++++++++++++++
include/dbus.h | 1 +
include/siri.h | 65 +++++++++
plugins/hfp_hf_bluez4.c | 2 +
plugins/hfp_hf_bluez5.c | 2 +
plugins/phonesim.c | 2 +
src/ofono.h | 1 +
src/siri.c | 331 ++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 673 insertions(+), 4 deletions(-)
mode change 100644 => 100755 Makefile.am
create mode 100644 doc/siri-api.txt
mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.c
mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.h
create mode 100755 drivers/hfpmodem/siri.c
create mode 100755 include/siri.h
mode change 100644 => 100755 plugins/hfp_hf_bluez4.c
mode change 100644 => 100755 plugins/hfp_hf_bluez5.c
mode change 100644 => 100755 plugins/phonesim.c
mode change 100644 => 100755 src/ofono.h
create mode 100755 src/siri.c
--
1.7.11.7
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/8] doc: Add Siri API
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 2/8] dbus: Define Siri DBUS Interface KrzysztofX Wilk
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]
---
Makefile.am | 2 +-
doc/siri-api.txt | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
mode change 100644 => 100755 Makefile.am
create mode 100644 doc/siri-api.txt
diff --git a/Makefile.am b/Makefile.am
old mode 100644
new mode 100755
index 513ee14..b89352e
--- a/Makefile.am
+++ b/Makefile.am
@@ -566,7 +566,7 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
doc/calypso-modem.txt doc/message-api.txt \
doc/location-reporting-api.txt \
- doc/certification.txt
+ doc/certification.txt doc/siri-api.txt
test_scripts = test/backtrace \
diff --git a/doc/siri-api.txt b/doc/siri-api.txt
new file mode 100644
index 0000000..6c44231
--- /dev/null
+++ b/doc/siri-api.txt
@@ -0,0 +1,43 @@
+Siri hierarchy [experimental]
+========================
+
+Service org.ofono
+Interface org.ofono.Siri
+Object path [variable prefix]/{modem0,modem1,...}
+
+Methods dict GetProperties()
+
+ Returns all Siri properties. See the
+ properties section for available properties.
+
+ Possible Errors: [service].Error.InProgress
+ [service].Error.Failed
+
+ void SetProperty(string name, variant value)
+
+ Changes the value of the specified property. Only
+ properties that are listed as read-write are
+ changeable. On success a PropertyChanged signal
+ will be emitted.
+
+ Possible Errors: [service].Error.InvalidArguments
+ [service].Error.InProgress
+ [service].Error.Failed
+
+
+Signals PropertyChanged(string property, variant value)
+
+ This signal indicates a changed value of the given
+ property.
+
+
+Properties boolean Enabled [readonly]
+
+ This property indicates whether Siri is available on
+ the device.
+
+ string EyesFreeMode [readwrite]
+
+ This property indicates the state of Siri Eyes Free
+ Mode. The current possible values are: "enabled"
+ and "disabled"
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/8] dbus: Define Siri DBUS Interface
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 1/8] doc: Add Siri API KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 3/8] include: Add Siri interface definition KrzysztofX Wilk
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
---
include/dbus.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/dbus.h b/include/dbus.h
index 44faa7f..e7ccb0b 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -59,6 +59,7 @@ extern "C" {
#define OFONO_GNSS_INTERFACE "org.ofono.AssistedSatelliteNavigation"
#define OFONO_GNSS_POSR_AGENT_INTERFACE "org.ofono.PositioningRequestAgent"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
+#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"
/* CDMA Interfaces */
#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE "org.ofono.cdma.VoiceCallManager"
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/8] include: Add Siri interface definition
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 1/8] doc: Add Siri API KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 2/8] dbus: Define Siri DBUS Interface KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 4/8] siri: Add atom implementation KrzysztofX Wilk
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2869 bytes --]
---
Makefile.am | 2 +-
include/siri.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
create mode 100755 include/siri.h
diff --git a/Makefile.am b/Makefile.am
index b89352e..cd84c14 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
include/cdma-connman.h include/gnss.h \
include/private-network.h include/cdma-netreg.h \
include/cdma-provision.h include/handsfree.h \
- include/handsfree-audio.h
+ include/handsfree-audio.h include/siri.h
nodist_pkginclude_HEADERS = include/version.h
diff --git a/include/siri.h b/include/siri.h
new file mode 100755
index 0000000..4199da1
--- /dev/null
+++ b/include/siri.h
@@ -0,0 +1,65 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-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
+ *
+ */
+
+#ifndef __OFONO_SIRI_H
+#define __OFONO_SIRI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <ofono/types.h>
+
+struct ofono_siri;
+
+typedef void (*ofono_siri_cb_t)(const struct ofono_error *error,
+ struct ofono_siri *siri);
+
+struct ofono_siri_driver {
+ const char *name;
+ int (*probe)(struct ofono_siri *siri, unsigned int vendor,
+ void *data);
+ void (*remove)(struct ofono_siri *siri);
+ void (*set_eyes_free_mode) (struct ofono_siri *siri,
+ ofono_siri_cb_t cb,
+ unsigned int val);
+};
+
+void ofono_siri_set_status(struct ofono_siri *siri, int value);
+
+int ofono_siri_driver_register(const struct ofono_siri_driver *driver);
+void ofono_siri_driver_unregister(const struct ofono_siri_driver *driver);
+
+struct ofono_siri *ofono_siri_create(struct ofono_modem *modem,
+ unsigned int vendor, const char *driver, void *data);
+
+void ofono_siri_register(struct ofono_siri *siri);
+void ofono_siri_remove(struct ofono_siri *siri);
+
+void ofono_siri_set_data(struct ofono_siri *siri, void *data);
+void *ofono_siri_get_data(struct ofono_siri *siri);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_SIRI_H */
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/8] siri: Add atom implementation
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (2 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 3/8] include: Add Siri interface definition KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 5/8] siri: Add atom driver KrzysztofX Wilk
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 10147 bytes --]
---
Makefile.am | 3 +-
src/ofono.h | 1 +
src/siri.c | 331 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 334 insertions(+), 1 deletion(-)
mode change 100644 => 100755 src/ofono.h
create mode 100755 src/siri.c
diff --git a/Makefile.am b/Makefile.am
index cd84c14..371018e 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -521,7 +521,8 @@ src_ofonod_SOURCES = $(builtin_sources) src/ofono.ver \
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
src/cdma-provision.c src/handsfree.c \
src/handsfree-audio.c src/bluetooth.h \
- src/hfp.h
+ src/hfp.h \
+ src/siri.c
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
diff --git a/src/ofono.h b/src/ofono.h
old mode 100644
new mode 100755
index 8abaf1e..c342329
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -151,6 +151,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_CDMA_SMS,
OFONO_ATOM_TYPE_CDMA_NETREG,
OFONO_ATOM_TYPE_HANDSFREE,
+ OFONO_ATOM_TYPE_SIRI,
};
enum ofono_atom_watch_condition {
diff --git a/src/siri.c b/src/siri.c
new file mode 100755
index 0000000..80ba6c9
--- /dev/null
+++ b/src/siri.c
@@ -0,0 +1,331 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-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
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/siri.h>
+
+#include <gdbus.h>
+#include "ofono.h"
+#include "common.h"
+
+static GSList *g_drivers = NULL;
+
+struct ofono_siri {
+ ofono_bool_t siri_status;
+ unsigned int eyes_free_mode;
+ unsigned int pending_eyes_free_mode;
+ const struct ofono_siri_driver *driver;
+ void *driver_data;
+ struct ofono_atom *atom;
+ DBusMessage *pending;
+};
+
+void ofono_siri_set_status(struct ofono_siri *siri, int value)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(siri->atom);
+ dbus_bool_t siri_status;
+
+ if (siri == NULL)
+ return;
+
+ if (value == 1)
+ siri->siri_status = TRUE;
+ else
+ siri->siri_status = FALSE;
+
+ siri_status = siri->siri_status;
+
+ if (__ofono_atom_get_registered(siri->atom) == FALSE)
+ return;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIRI_INTERFACE,
+ "Enabled", DBUS_TYPE_BOOLEAN,
+ &siri_status);
+}
+
+static DBusMessage *siri_get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_siri *siri = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ dbus_bool_t status;
+ const char *eyes_free_str;
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ status = siri->siri_status;
+
+ ofono_dbus_dict_append(&dict, "Enabled", DBUS_TYPE_BOOLEAN,
+ &status);
+
+ if (siri->eyes_free_mode == 0)
+ eyes_free_str = "disabled";
+ else
+ eyes_free_str = "enabled";
+
+ ofono_dbus_dict_append(&dict, "EyesFreeMode", DBUS_TYPE_STRING,
+ &eyes_free_str);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
+static void set_eyes_free_mode_callback(const struct ofono_error *error,
+ struct ofono_siri *siri)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(siri->atom);
+ DBusMessage *reply;
+ const char *eyes_free_str;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ DBG("Set eyes free mode callback returned error %s",
+ telephony_error_to_str(error));
+ reply = __ofono_error_failed(siri->pending);
+ __ofono_dbus_pending_reply(&siri->pending, reply);
+ return;
+ }
+
+ siri->eyes_free_mode = siri->pending_eyes_free_mode;
+
+ if (siri->eyes_free_mode == 0)
+ eyes_free_str = "disabled";
+ else
+ eyes_free_str = "enabled";
+
+ reply = dbus_message_new_method_return(siri->pending);
+ __ofono_dbus_pending_reply(&siri->pending, reply);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIRI_INTERFACE,
+ "EyesFreeMode", DBUS_TYPE_STRING,
+ &eyes_free_str);
+}
+
+static DBusMessage *siri_set_property(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_siri *siri = data;
+ DBusMessageIter iter, var;
+ char *val;
+ const char *name;
+
+ if (siri->pending)
+ return __ofono_error_busy(msg);
+
+ if (dbus_message_iter_init(msg, &iter) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&iter, &name);
+ dbus_message_iter_next(&iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_recurse(&iter, &var);
+
+ if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&var, &val);
+
+ if (g_str_equal(name, "EyesFreeMode") == TRUE) {
+ if (!siri->driver->set_eyes_free_mode)
+ return __ofono_error_not_implemented(msg);
+
+ if (g_str_equal(val, "disabled") == TRUE)
+ siri->pending_eyes_free_mode = 0;
+ else if (g_str_equal(val, "enabled") == TRUE)
+ siri->pending_eyes_free_mode = 1;
+ else
+ return __ofono_error_invalid_args(msg);
+
+ siri->pending = dbus_message_ref(msg);
+ siri->driver->set_eyes_free_mode(siri, set_eyes_free_mode_callback,
+ siri->pending_eyes_free_mode);
+ } else
+ return __ofono_error_invalid_args(msg);
+
+ return NULL;
+}
+
+static const GDBusMethodTable siri_methods[] = {
+ { GDBUS_METHOD("GetProperties",
+ NULL, GDBUS_ARGS({ "properties", "a{sv}"}),
+ siri_get_properties) },
+ { GDBUS_ASYNC_METHOD("SetProperty",
+ GDBUS_ARGS({ "property", "s" }, { "value", "v" }), NULL,
+ siri_set_property) },
+ { }
+};
+
+static const GDBusSignalTable siri_signals[] = {
+ { GDBUS_SIGNAL("PropertyChanged",
+ GDBUS_ARGS({ "name", "s"}, { "value", "v"})) },
+ { }
+};
+
+static void siri_remove(struct ofono_atom *atom)
+{
+ struct ofono_siri *siri = __ofono_atom_get_data(atom);
+
+ DBG("atom: %p", atom);
+
+ if (siri == NULL)
+ return;
+
+ if (siri->driver != NULL && siri->driver->remove != NULL)
+ siri->driver->remove(siri);
+
+ g_free(siri);
+}
+
+struct ofono_siri *ofono_siri_create(struct ofono_modem *modem,
+ unsigned int vendor, const char *driver, void *data)
+{
+ struct ofono_siri *siri;
+ GSList *l;
+
+ if (driver == NULL)
+ return NULL;
+
+ siri = g_try_new0(struct ofono_siri, 1);
+ if (siri == NULL)
+ return NULL;
+
+ siri->atom = __ofono_modem_add_atom(modem,
+ OFONO_ATOM_TYPE_SIRI,
+ siri_remove, siri);
+
+ siri->eyes_free_mode = 0;
+ siri->pending_eyes_free_mode = 0;
+
+ for (l = g_drivers; l; l = l->next) {
+ const struct ofono_siri_driver *drv = l->data;
+
+ if (g_strcmp0(drv->name, driver))
+ continue;
+
+ if (drv->probe(siri, vendor, data) < 0)
+ continue;
+
+ siri->driver = drv;
+ break;
+ }
+
+ return siri;
+}
+
+static void ofono_siri_unregister(struct ofono_atom *atom)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(atom);
+ const char *path = __ofono_atom_get_path(atom);
+ struct ofono_siri *siri = __ofono_atom_get_data(atom);
+
+ if (siri->pending) {
+ DBusMessage *reply = __ofono_error_failed(siri->pending);
+ __ofono_dbus_pending_reply(&siri->pending, reply);
+ }
+
+ ofono_modem_remove_interface(modem, OFONO_SIRI_INTERFACE);
+ g_dbus_unregister_interface(conn, path,
+ OFONO_SIRI_INTERFACE);
+}
+
+void ofono_siri_register(struct ofono_siri *siri)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(siri->atom);
+ const char *path = __ofono_atom_get_path(siri->atom);
+
+ if (!g_dbus_register_interface(conn, path, OFONO_SIRI_INTERFACE,
+ siri_methods, siri_signals, NULL, siri, NULL)) {
+ ofono_error("Could not create %s interface", OFONO_SIRI_INTERFACE);
+ return;
+ }
+
+ ofono_modem_add_interface(modem, OFONO_SIRI_INTERFACE);
+ __ofono_atom_register(siri->atom, ofono_siri_unregister);
+}
+
+int ofono_siri_driver_register(const struct ofono_siri_driver *driver)
+{
+ DBG("driver: %p, name: %s", driver, driver->name);
+
+ if (driver->probe == NULL)
+ return -EINVAL;
+
+ g_drivers = g_slist_prepend(g_drivers, (void *) driver);
+
+ return 0;
+}
+
+void ofono_siri_driver_unregister(const struct ofono_siri_driver *driver)
+{
+ DBG("driver: %p, name: %s", driver, driver->name);
+ g_drivers = g_slist_remove(g_drivers, (void *) driver);
+}
+
+void ofono_siri_remove(struct ofono_siri *siri)
+{
+ __ofono_atom_free(siri->atom);
+}
+
+void ofono_siri_set_data(struct ofono_siri *siri, void *data)
+{
+ siri->driver_data = data;
+}
+
+void *ofono_siri_get_data(struct ofono_siri *siri)
+{
+ return siri->driver_data;
+}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/8] siri: Add atom driver
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (3 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 4/8] siri: Add atom implementation KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 6/8] hfp_hf_bluez4: Enable Siri atom KrzysztofX Wilk
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7368 bytes --]
---
Makefile.am | 3 +-
drivers/hfpmodem/hfpmodem.c | 2 +
drivers/hfpmodem/hfpmodem.h | 3 +
drivers/hfpmodem/siri.c | 215 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 222 insertions(+), 1 deletion(-)
mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.c
mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.h
create mode 100755 drivers/hfpmodem/siri.c
diff --git a/Makefile.am b/Makefile.am
index 371018e..37edf95 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -315,7 +315,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/hfpmodem/network-registration.c \
drivers/hfpmodem/call-volume.c \
drivers/hfpmodem/devinfo.c \
- drivers/hfpmodem/handsfree.c
+ drivers/hfpmodem/handsfree.c \
+ drivers/hfpmodem/siri.c
builtin_modules += speedupmodem
builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/hfpmodem/hfpmodem.c b/drivers/hfpmodem/hfpmodem.c
old mode 100644
new mode 100755
index 1348beb..1f604ac
--- a/drivers/hfpmodem/hfpmodem.c
+++ b/drivers/hfpmodem/hfpmodem.c
@@ -39,6 +39,7 @@ static int hfpmodem_init(void)
hfp_netreg_init();
hfp_call_volume_init();
hfp_handsfree_init();
+ hfp_siri_init();
return 0;
}
@@ -50,6 +51,7 @@ static void hfpmodem_exit(void)
hfp_netreg_exit();
hfp_call_volume_exit();
hfp_handsfree_exit();
+ hfp_siri_exit();
}
OFONO_PLUGIN_DEFINE(hfpmodem, "Hands-Free Profile Driver", VERSION,
diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h
old mode 100644
new mode 100755
index ef7aea5..e10d2ec
--- a/drivers/hfpmodem/hfpmodem.h
+++ b/drivers/hfpmodem/hfpmodem.h
@@ -34,5 +34,8 @@ extern void hfp_voicecall_exit(void);
extern void hfp_handsfree_init(void);
extern void hfp_handsfree_exit(void);
+extern void hfp_siri_init(void);
+extern void hfp_siri_exit(void);
+
extern void hfp_devinfo_init(void);
extern void hfp_devinfo_exit(void);
diff --git a/drivers/hfpmodem/siri.c b/drivers/hfpmodem/siri.c
new file mode 100755
index 0000000..36ef168
--- /dev/null
+++ b/drivers/hfpmodem/siri.c
@@ -0,0 +1,215 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-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
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <gatchat.h>
+#include <gatresult.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/siri.h>
+
+#include "hfpmodem.h"
+#include "hfp.h"
+#include "slc.h"
+
+#define APPLE_SIRI_STATUS_FEATURE 8
+
+static const char *xapl_prefix[] = { "+XAPL=", NULL };
+static const char *aplsiri_prefix[] = { "+APLSIRI:", NULL };
+static const char *aplefm_prefix[] = { "+APLEFM:", NULL };
+
+struct siri_data
+{
+ GAtChat *chat;
+};
+
+static void aplsiri_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_siri *siri = user_data;
+ GAtResultIter iter;
+ gint value;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+APLSIRI:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &value))
+ return;
+
+ ofono_siri_set_status(siri, value);
+}
+
+static void aplsiri_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_siri *siri = user_data;
+ struct siri_data *sd = ofono_siri_get_data(siri);
+ struct ofono_error error;
+ GAtResultIter iter;
+ gint value;
+
+ if (!ok)
+ goto fail;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (error.type != OFONO_ERROR_TYPE_NO_ERROR)
+ goto fail;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+APLSIRI:"))
+ goto fail;
+
+ if (!g_at_result_iter_next_number(&iter, &value))
+ goto fail;
+
+ if (value == 0)
+ goto fail;
+
+ g_at_chat_register(sd->chat, "+APLSIRI:",
+ aplsiri_notify, FALSE, siri, NULL);
+
+ ofono_siri_register(siri);
+
+ ofono_siri_set_status(siri, value);
+
+ return;
+
+fail:
+ ofono_siri_remove(siri);
+}
+
+static void xapl_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_siri *siri = user_data;
+ struct siri_data *sd = ofono_siri_get_data(siri);
+ struct ofono_error error;
+
+ if (!ok) {
+ ofono_siri_remove(siri);
+ return;
+ }
+
+ decode_at_error(&error, g_at_result_final_response(result));
+ if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
+ ofono_siri_remove(siri);
+ return;
+ }
+
+ g_at_chat_send(sd->chat, "AT+APLSIRI?",
+ aplsiri_prefix, aplsiri_cb, siri, NULL);
+}
+
+static int hfp_siri_probe(struct ofono_siri *siri, unsigned int vendor,
+ void *data)
+{
+ struct hfp_slc_info *info = data;
+ struct siri_data *sd;
+ char at_command[64];
+
+ DBG("");
+ sd = g_new0(struct siri_data, 1);
+ sd->chat = g_at_chat_clone(info->chat);
+
+ ofono_siri_set_data(siri, sd);
+
+ snprintf(at_command, sizeof(at_command),
+ "AT+XAPL=Linux-oFono-%s,%d", VERSION,
+ APPLE_SIRI_STATUS_FEATURE);
+
+ g_at_chat_send(sd->chat, at_command, xapl_prefix, xapl_cb,
+ siri, NULL);
+
+ return 0;
+}
+
+static void hfp_siri_remove(struct ofono_siri *siri)
+{
+ struct siri_data *sd = ofono_siri_get_data(siri);
+
+ ofono_siri_set_data(siri, NULL);
+
+ g_at_chat_unref(sd->chat);
+ g_free(sd);
+}
+
+static void hfp_siri_eyes_free_mode_cb(gboolean ok,
+ GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_siri_cb_t cb = cbd->cb;
+ struct ofono_siri *siri = cbd->data;
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ cb(&error, siri);
+}
+
+static void hfp_siri_set_eyes_free_mode(struct ofono_siri *siri,
+ ofono_siri_cb_t cb,
+ unsigned int val)
+{
+ struct siri_data *sd = ofono_siri_get_data(siri);
+ struct cb_data *cbd = cb_data_new(cb, siri);
+ char at_command[16];
+
+ snprintf(at_command, sizeof(at_command), "AT+APLEFM=%d", val);
+
+ if (g_at_chat_send(sd->chat, at_command, aplefm_prefix,
+ hfp_siri_eyes_free_mode_cb,
+ cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+
+ CALLBACK_WITH_FAILURE(cb, NULL);
+}
+
+static struct ofono_siri_driver driver = {
+ .name = "hfpmodem",
+ .probe = hfp_siri_probe,
+ .remove = hfp_siri_remove,
+ .set_eyes_free_mode = hfp_siri_set_eyes_free_mode,
+};
+
+void hfp_siri_init(void)
+{
+ ofono_siri_driver_register(&driver);
+}
+
+void hfp_siri_exit(void)
+{
+ ofono_siri_driver_unregister(&driver);
+}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/8] hfp_hf_bluez4: Enable Siri atom
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (4 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 5/8] siri: Add atom driver KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 7/8] hfp_hf_bluez5: " KrzysztofX Wilk
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
---
plugins/hfp_hf_bluez4.c | 2 ++
1 file changed, 2 insertions(+)
mode change 100644 => 100755 plugins/hfp_hf_bluez4.c
diff --git a/plugins/hfp_hf_bluez4.c b/plugins/hfp_hf_bluez4.c
old mode 100644
new mode 100755
index 450c183..fb491a1
--- a/plugins/hfp_hf_bluez4.c
+++ b/plugins/hfp_hf_bluez4.c
@@ -44,6 +44,7 @@
#include <ofono/voicecall.h>
#include <ofono/call-volume.h>
#include <ofono/handsfree.h>
+#include <ofono/siri.h>
#include <drivers/hfpmodem/slc.h>
@@ -490,6 +491,7 @@ static void hfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", &data->info);
ofono_call_volume_create(modem, 0, "hfpmodem", &data->info);
ofono_handsfree_create(modem, 0, "hfpmodem", &data->info);
+ ofono_siri_create(modem, 0, "hfpmodem", &data->info);
}
static void hfp_post_sim(struct ofono_modem *modem)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/8] hfp_hf_bluez5: Enable Siri atom
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (5 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 6/8] hfp_hf_bluez4: Enable Siri atom KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 8/8] phonesim: " KrzysztofX Wilk
2013-12-18 6:24 ` [PATCH 0/8] hfpmodem: Add Apple Siri Denis Kenzior
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 924 bytes --]
---
plugins/hfp_hf_bluez5.c | 2 ++
1 file changed, 2 insertions(+)
mode change 100644 => 100755 plugins/hfp_hf_bluez5.c
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
old mode 100644
new mode 100755
index 18ed348..aaf779d
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -48,6 +48,7 @@
#include <ofono/call-volume.h>
#include <ofono/handsfree.h>
#include <ofono/handsfree-audio.h>
+#include <ofono/siri.h>
#include <drivers/atmodem/atutil.h>
#include <drivers/hfpmodem/slc.h>
@@ -296,6 +297,7 @@ static void hfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", &hfp->info);
ofono_handsfree_create(modem, 0, "hfpmodem", &hfp->info);
ofono_call_volume_create(modem, 0, "hfpmodem", &hfp->info);
+ ofono_siri_create(modem, 0, "hfpmodem", &hfp->info);
}
static void hfp_post_sim(struct ofono_modem *modem)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 8/8] phonesim: Enable Siri atom
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (6 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 7/8] hfp_hf_bluez5: " KrzysztofX Wilk
@ 2013-12-16 17:52 ` KrzysztofX Wilk
2013-12-18 6:24 ` [PATCH 0/8] hfpmodem: Add Apple Siri Denis Kenzior
8 siblings, 0 replies; 10+ messages in thread
From: KrzysztofX Wilk @ 2013-12-16 17:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 868 bytes --]
---
plugins/phonesim.c | 2 ++
1 file changed, 2 insertions(+)
mode change 100644 => 100755 plugins/phonesim.c
diff --git a/plugins/phonesim.c b/plugins/phonesim.c
old mode 100644
new mode 100755
index b56b3ca..918d2eb
--- a/plugins/phonesim.c
+++ b/plugins/phonesim.c
@@ -60,6 +60,7 @@
#include <ofono/gprs-context.h>
#include <ofono/gnss.h>
#include <ofono/handsfree.h>
+#include <ofono/siri.h>
#include <drivers/atmodem/vendor.h>
#include <drivers/atmodem/atutil.h>
@@ -957,6 +958,7 @@ static void localhfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", info);
ofono_call_volume_create(modem, 0, "hfpmodem", info);
ofono_handsfree_create(modem, 0, "hfpmodem", info);
+ ofono_siri_create(modem, 0, "hfpmodem", info);
}
static struct ofono_modem_driver localhfp_driver = {
--
1.7.11.7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/8] hfpmodem: Add Apple Siri
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
` (7 preceding siblings ...)
2013-12-16 17:52 ` [PATCH 8/8] phonesim: " KrzysztofX Wilk
@ 2013-12-18 6:24 ` Denis Kenzior
8 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2013-12-18 6:24 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2149 bytes --]
Hi Krzysztof,
On 12/16/2013 11:52 AM, KrzysztofX Wilk wrote:
> This is an integration of the extended features for Apple devices which
> are connected via Bluetooth HFP. The plugin provides the Siri availability
> and the selection of Eyes Free Mode as defined in the following document:
> https://developer.apple.com/hardwaredrivers/bluetoothdesignguidelines.pdf
>
> KrzysztofX Wilk (8):
> doc: Add Siri API
> dbus: Define Siri DBUS Interface
> include: Add Siri interface definition
> siri: Add atom implementation
> siri: Add atom driver
> hfp_hf_bluez4: Enable Siri atom
> hfp_hf_bluez5: Enable Siri atom
> phonesim: Enable Siri atom
>
> Makefile.am | 10 +-
> doc/siri-api.txt | 43 ++++++
> drivers/hfpmodem/hfpmodem.c | 2 +
> drivers/hfpmodem/hfpmodem.h | 3 +
> drivers/hfpmodem/siri.c | 215 ++++++++++++++++++++++++++++
> include/dbus.h | 1 +
> include/siri.h | 65 +++++++++
> plugins/hfp_hf_bluez4.c | 2 +
> plugins/hfp_hf_bluez5.c | 2 +
> plugins/phonesim.c | 2 +
> src/ofono.h | 1 +
> src/siri.c | 331 ++++++++++++++++++++++++++++++++++++++++++++
> 12 files changed, 673 insertions(+), 4 deletions(-)
> mode change 100644 => 100755 Makefile.am
> create mode 100644 doc/siri-api.txt
> mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.c
> mode change 100644 => 100755 drivers/hfpmodem/hfpmodem.h
> create mode 100755 drivers/hfpmodem/siri.c
> create mode 100755 include/siri.h
> mode change 100644 => 100755 plugins/hfp_hf_bluez4.c
> mode change 100644 => 100755 plugins/hfp_hf_bluez5.c
> mode change 100644 => 100755 plugins/phonesim.c
> mode change 100644 => 100755 src/ofono.h
> create mode 100755 src/siri.c
>
All patches have been applied. I just fixed up a few minor whitespace
issues and amended the patches. Nothing of substance.
Thanks for doing this. If you have time, would you mind adding a short
blurb in doc/features.txt that mentions this feature?
Regards,
-Denis
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-12-18 6:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-16 17:52 [PATCH 0/8] hfpmodem: Add Apple Siri KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 1/8] doc: Add Siri API KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 2/8] dbus: Define Siri DBUS Interface KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 3/8] include: Add Siri interface definition KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 4/8] siri: Add atom implementation KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 5/8] siri: Add atom driver KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 6/8] hfp_hf_bluez4: Enable Siri atom KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 7/8] hfp_hf_bluez5: " KrzysztofX Wilk
2013-12-16 17:52 ` [PATCH 8/8] phonesim: " KrzysztofX Wilk
2013-12-18 6:24 ` [PATCH 0/8] hfpmodem: Add Apple Siri Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.