[PATCH BlueZ 03/10] thermometer: Use GAttrib buffer

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

 



This patch replaces the static local buffer by the GAttrib internal
buffer to temporarily store the output ATT PDU.
---
 thermometer/thermometer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 4a44177..c2256b6 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -1135,9 +1135,10 @@ static void ind_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
 {
 	struct thermometer *t = user_data;
 	const struct characteristic *ch;
-	uint8_t opdu[ATT_MAX_MTU];
+	uint8_t *opdu;
 	uint16_t handle, olen;
 	GSList *l;
+	int plen;
 
 	if (len < 3) {
 		DBG("Bad pdu received");
@@ -1158,7 +1159,8 @@ static void ind_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
 	else if (g_strcmp0(ch->attr.uuid, MEASUREMENT_INTERVAL_UUID) == 0)
 		proc_measurement_interval(t, pdu, len);
 
-	olen = enc_confirmation(opdu, sizeof(opdu));
+	opdu = g_attrib_get_buffer(t->attrib, &plen);
+	olen = enc_confirmation(opdu, plen);
 
 	if (olen > 0)
 		g_attrib_send(t->attrib, 0, opdu[0], opdu, olen, NULL, NULL,
-- 
1.7.8.6

--
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