Thread (18 messages) flat view 18 messages, 2 authors, 2012-09-21

Re: [PATCH v6 06/13] heartrate: Read Body Sensor Location characteristics

From: Johan Hedberg <hidden>
Date: 2012-09-21 13:35:22

Hi Andrzej,

On Thu, Sep 20, 2012, Andrzej Kaczmarek wrote:
+static void read_sensor_location_cb(guint8 status, const guint8 *pdu,
+						guint16 len, gpointer user_data)
+{
+	struct heartrate *hr = user_data;
+	uint8_t value;
+	ssize_t vlen;
+
+	if (status != 0) {
+		error("Body Sensor Location read failed: %s",
+							att_ecode2str(status));
+		return;
+	}
+
+	vlen = dec_read_resp(pdu, len, &value, sizeof(value));
+	if (vlen < 0) {
+		error("Protocol error");
+		return;
+	}
+
+	if (vlen != 1) {
+		error("Invalid length for Body Sensor Location");
+		return;
+	}
Minor nitpick: vlen != sizeof(value) would make it more clear exactly
what you want to compare with.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help