From 6072a981096462a971e86700441c6746f9b27a6d Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Thu, 15 Sep 2011 18:34:36 +0200 Subject: [PATCH] handsfree: Implement inband ring settings --- src/handsfree.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/handsfree.c b/src/handsfree.c index 797fe69..2bf2284 100644 --- a/src/handsfree.c +++ b/src/handsfree.c @@ -43,17 +43,38 @@ static GSList *g_drivers = NULL; struct ofono_handsfree { + ofono_bool_t inband_ringing; const struct ofono_handsfree_driver *driver; void *driver_data; struct ofono_atom *atom; }; +void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf, + ofono_bool_t enabled) +{ + DBusConnection *conn = ofono_dbus_get_connection(); + const char *path = __ofono_atom_get_path(hf->atom); + dbus_bool_t dbus_enabled = enabled; + + if (hf->inband_ringing == enabled) + return; + + hf->inband_ringing = enabled; + + ofono_dbus_signal_property_changed(conn, path, + OFONO_HANDSFREE_INTERFACE, + "InbandRinging", DBUS_TYPE_BOOLEAN, + &dbus_enabled); +} + static DBusMessage *handsfree_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { + struct ofono_handsfree *hf = data; DBusMessage *reply; DBusMessageIter iter; DBusMessageIter dict; + dbus_bool_t inband_ringing; reply = dbus_message_new_method_return(msg); if (reply == NULL) @@ -64,6 +85,11 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn, dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, OFONO_PROPERTIES_ARRAY_SIGNATURE, &dict); + + inband_ringing = hf->inband_ringing; + ofono_dbus_dict_append(&dict, "InbandRinging", DBUS_TYPE_BOOLEAN, + &inband_ringing); + dbus_message_iter_close_container(&iter, &dict); return reply; -- 2.7.4