aboutsummaryrefslogtreecommitdiffstats
path: root/thermometer/thermometer.c
diff options
context:
space:
mode:
authorSantiago Carot-Nemesio <sancane@gmail.com>2011-10-13 17:29:16 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2011-10-17 11:08:28 +0300
commit3e7ecc4309c3f82648eebcffe4b1d353f2d6775b (patch)
tree8fa1393da0f40131ea6be62722967e04f4089eff /thermometer/thermometer.c
parentf32430664309aca64a21449abf37d53b7e5f5d5c (diff)
downloadbluez-3e7ecc4309c3f82648eebcffe4b1d353f2d6775b.tar.gz
bluez-3e7ecc4309c3f82648eebcffe4b1d353f2d6775b.tar.xz
bluez-3e7ecc4309c3f82648eebcffe4b1d353f2d6775b.zip
Unregister Health Thermometer Interface
Diffstat (limited to 'thermometer/thermometer.c')
-rw-r--r--thermometer/thermometer.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 40a021ea..d43eb596 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -52,6 +52,17 @@ static void destroy_thermometer(gpointer user_data)
g_free(t);
}
+static gint cmp_device(gconstpointer a, gconstpointer b)
+{
+ const struct thermometer *t = a;
+ const struct btd_device *dev = b;
+
+ if (dev == t->dev)
+ return 0;
+
+ return -1;
+}
+
static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -145,5 +156,15 @@ int thermometer_register(DBusConnection *connection, struct btd_device *device,
void thermometer_unregister(struct btd_device *device)
{
- /* TODO: Unregister Health Thermometer Interface */
+ struct thermometer *t;
+ GSList *l;
+
+ l = g_slist_find_custom(thermometers, device, cmp_device);
+ if (l == NULL)
+ return;
+
+ t = l->data;
+ thermometers = g_slist_remove(thermometers, t);
+ g_dbus_unregister_interface(t->conn, device_get_path(t->dev),
+ THERMOMETER_INTERFACE);
}