shared/att: Add packed struct definition for err_rsp 68/51268/1
authorGowtham Anandha Babu <gowtham.ab@samsung.com>
Fri, 6 Nov 2015 05:08:43 +0000 (10:38 +0530)
committerGowtham Anandha Babu <gowtham.ab@samsung.com>
Fri, 6 Nov 2015 05:08:43 +0000 (10:38 +0530)
Reused the structure definition (bt_att_pdu_error_rsp) defined in
att-types.h by removing uint8_t array for sending err rsp pdu.

git repo link:
https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=bca537e81493f11e99cc47ed7eb7d179410ee762

Change-Id: Ia3eda63d29f52e441f74f0a1f94d8776e91ed708

src/shared/att.c

index 592f818..d7ee5a0 100644 (file)
@@ -679,14 +679,13 @@ static bool opcode_match(uint8_t opcode, uint8_t test_opcode)
 
 static void respond_not_supported(struct bt_att *att, uint8_t opcode)
 {
-       uint8_t pdu[4];
+       struct bt_att_pdu_error_rsp pdu;
 
-       pdu[0] = opcode;
-       pdu[1] = 0;
-       pdu[2] = 0;
-       pdu[3] = BT_ATT_ERROR_REQUEST_NOT_SUPPORTED;
+       pdu.opcode = opcode;
+       pdu.handle = 0x0000;
+       pdu.ecode = BT_ATT_ERROR_REQUEST_NOT_SUPPORTED;
 
-       bt_att_send(att, BT_ATT_OP_ERROR_RSP, pdu, sizeof(pdu), NULL, NULL,
+       bt_att_send(att, BT_ATT_OP_ERROR_RSP, &pdu, sizeof(pdu), NULL, NULL,
                                                                        NULL);
 }