All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santiago Carot-Nemesio <sancane@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Santiago Carot-Nemesio <sancane@gmail.com>
Subject: [PATCH 6/8] Disable final measurements indication when last watcher is removed
Date: Thu, 20 Oct 2011 11:46:49 +0200	[thread overview]
Message-ID: <1319104011-27747-7-git-send-email-sancane@gmail.com> (raw)
In-Reply-To: <1319104011-27747-6-git-send-email-sancane@gmail.com>

---
 thermometer/thermometer.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 4a03fc6..9b14e6f 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -532,7 +532,30 @@ static void enable_final_measurement(struct thermometer *t)
 
 static void disable_final_measurement(struct thermometer *t)
 {
-	/* TODO: disable final measurements */
+	struct characteristic *ch;
+	struct descriptor *desc;
+	bt_uuid_t btuuid;
+	uint8_t atval[2];
+	gchar *msg;
+
+	ch = get_characteristic(t, TEMPERATURE_MEASUREMENT_UUID);
+	if (ch == NULL) {
+		DBG("Temperature measurement characteristic not found");
+		return;
+	}
+
+	bt_uuid16_create(&btuuid, GATT_CLIENT_CHARAC_CFG_UUID);
+	desc = get_descriptor(ch, &btuuid);
+	if (desc == NULL) {
+		DBG("Client characteristic configuration descriptor not found");
+		return;
+	}
+
+	atval[0] = 0x00;
+	atval[1] = 0x00;
+	msg = g_strdup("Disable final measurement");
+	gatt_write_char(t->attrib, desc->handle, atval, 2,
+						final_measurement_cb, msg);
 }
 
 static void watcher_exit(DBusConnection *conn, void *user_data)
-- 
1.7.6.1


  reply	other threads:[~2011-10-20  9:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  9:46 Health Thermometer Profile Santiago Carot-Nemesio
2011-10-20  9:46 ` [PATCH 1/8] Process characteristic descriptors in thermometer service Santiago Carot-Nemesio
2011-10-20  9:46   ` [PATCH 2/8] Get valid range descriptor if it is supported Santiago Carot-Nemesio
2011-10-20  9:46     ` [PATCH 3/8] Implement D-Bus register watcher function Santiago Carot-Nemesio
2011-10-20  9:46       ` [PATCH 4/8] Implement D-Bus unregister " Santiago Carot-Nemesio
2011-10-20  9:46         ` [PATCH 5/8] Enable final measurement indications when first watcher is enabled Santiago Carot-Nemesio
2011-10-20  9:46           ` Santiago Carot-Nemesio [this message]
2011-10-20  9:46             ` [PATCH 7/8] Manage watcher's disconnections from the bus Santiago Carot-Nemesio
2011-10-20  9:46               ` [PATCH 8/8] Implement D-Bus get properties function Santiago Carot-Nemesio
2011-10-20 11:18           ` [PATCH 5/8] Enable final measurement indications when first watcher is enabled Anderson Lizardo
2011-10-20 12:54             ` Santiago Carot
2011-10-20 11:07     ` [PATCH 2/8] Get valid range descriptor if it is supported Anderson Lizardo
2011-10-20 11:11   ` [PATCH 1/8] Process characteristic descriptors in thermometer service Anderson Lizardo
  -- strict thread matches above, loose matches on Subject: below --
2011-10-24 17:04 Health Thermometer Profile Santiago Carot-Nemesio
2011-10-24 17:04 ` [PATCH 1/8] Process characteristic descriptors in the thermometer service Santiago Carot-Nemesio
2011-10-24 17:04   ` [PATCH 2/8] Get valid range descriptor if it is supported Santiago Carot-Nemesio
2011-10-24 17:04     ` [PATCH 3/8] Implement D-Bus register watcher function Santiago Carot-Nemesio
2011-10-24 17:04       ` [PATCH 4/8] Implement D-Bus unregister " Santiago Carot-Nemesio
2011-10-24 17:04         ` [PATCH 5/8] Enable final measurement indications when first watcher is enabled Santiago Carot-Nemesio
2011-10-24 17:04           ` [PATCH 6/8] Disable final measurements indication when last watcher is removed Santiago Carot-Nemesio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319104011-27747-7-git-send-email-sancane@gmail.com \
    --to=sancane@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.