summaryrefslogtreecommitdiffstats
path: root/src/handsfree.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2012-12-17 09:25:54 -0600
committerDenis Kenzior <denkenz@gmail.com>2012-12-17 09:50:21 -0600
commit679e3d708b8f1d73b267fc51953d2360504293ef (patch)
treea57bd1aba65b8c7a47eb997e134c606acfd25756 /src/handsfree.c
parent1ffe69527c6e64acc70447c646925363306cdf97 (diff)
downloadofono-679e3d708b8f1d73b267fc51953d2360504293ef.tar.bz2
handsfree: Implement BatteryChargeLevel
Diffstat (limited to 'src/handsfree.c')
-rw-r--r--src/handsfree.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/handsfree.c b/src/handsfree.c
index 40caf930..18be93a2 100644
--- a/src/handsfree.c
+++ b/src/handsfree.c
@@ -48,6 +48,7 @@ struct ofono_handsfree {
ofono_bool_t voice_recognition;
ofono_bool_t voice_recognition_pending;
unsigned int ag_features;
+ unsigned char battchg;
const struct ofono_handsfree_driver *driver;
void *driver_data;
@@ -119,6 +120,29 @@ void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
hf->ag_features = ag_features;
}
+void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
+ unsigned char level)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(hf->atom);
+
+ if (hf == NULL)
+ return;
+
+ if (hf->battchg == level)
+ return;
+
+ hf->battchg = level;
+
+ if (__ofono_atom_get_registered(hf->atom) == FALSE)
+ return;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_HANDSFREE_INTERFACE,
+ "BatteryChargeLevel", DBUS_TYPE_BYTE,
+ &level);
+}
+
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -152,6 +176,9 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
ofono_dbus_dict_append_array(&dict, "Features", DBUS_TYPE_STRING,
&features);
+ ofono_dbus_dict_append(&dict, "BatteryChargeLevel", DBUS_TYPE_BYTE,
+ &hf->battchg);
+
dbus_message_iter_close_container(&iter, &dict);
return reply;