[PATCH 2/6] Confiure C.C.C descriptor during the thermometer configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 thermometer/thermometer.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 2a0fb0f..1746e60 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -340,21 +340,31 @@ static void process_thermometer_desc(struct descriptor *desc)
 	bt_uuid16_create(&btuuid, GATT_CLIENT_CHARAC_CFG_UUID);
 
 	if (bt_uuid_cmp(&desc->uuid, &btuuid) == 0) {
+		uint8_t atval[2];
+
 		if (g_strcmp0(ch->attr.uuid,
 					TEMPERATURE_MEASUREMENT_UUID) == 0) {
-			/* TODO: Check if we have to enable it */
-			DBG("C.C.C in Temperature Measurement");
+			if (g_slist_length(ch->t->fwatchers) == 0)
+				return;
+
+			atval[0] = 0x02;
+			atval[1] = 0x00;
 		} else if (g_strcmp0(ch->attr.uuid,
 					INTERMEDIATE_TEMPERATURE_UUID) == 0) {
-			/* TODO: Check if we have to enable it */
-			DBG("C.C.C in Intermediate Temperature");
+			if (g_slist_length(ch->t->iwatchers) == 0)
+				return;
+
+			atval[0] = 0x01;
+			atval[1] = 0x00;
 		} else if (g_strcmp0(ch->attr.uuid,
 					MEASUREMENT_INTERVAL_UUID) == 0) {
-			/* TODO: Enable indications */
-			DBG("C.C.C in Measurement Interval");
+			atval[0] = 0x02;
+			atval[1] = 0x00;
 		} else
 			goto done;
 
+		gatt_write_char(ch->t->attrib, desc->handle, atval, 2,
+								NULL, NULL);
 		return;
 	}
 
-- 
1.7.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux