* [PATCH 0/6] Add Write Characteristic Value client TC
@ 2015-02-24 11:17 Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test Gowtham Anandha Babu
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Adds the below client test cases:
1) Write Characteristic Value - by Client
2) Write Characteristic Value - Invalid Handle
3) Write Characteristic Value - Write Not Permitted
4) Write Characteristic Value - Insufficient Authorization
5) Write Characteristic Value - Insufficient Authentication
6) Write Characteristic Value - Insufficient Encryption Key Size
Gowtham Anandha Babu (6):
unit/test-gatt: Add TP/GAW/CL/BV-03-C test
unit/test-gatt: Add TP/GAW/CL/BI-02-C test
unit/test-gatt: Add TP/GAW/CL/BI-03-C test
unit/test-gatt: Add TP/GAW/CL/BI-04-C test
unit/test-gatt: Add TP/GAW/CL/BI-05-C test
unit/test-gatt: Add TP/GAW/CL/BI-06-C test
unit/test-gatt.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 106 insertions(+), 2 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 13:09 ` Luiz Augusto von Dentz
2015-02-24 11:17 ` [PATCH 2/6] unit/test-gatt: Add TP/GAW/CL/BI-02-C test Gowtham Anandha Babu
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify that a Generic Attribute Profile client can write a
Characteristic Value selected by handle.
---
unit/test-gatt.c | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 3ab5340..66b5794 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -141,7 +141,7 @@ struct context {
raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
raw_pdu(0x08, 0x05, 0x00, 0x08, 0x00, 0x03, 0x28), \
- raw_pdu(0x09, 0x07, 0x06, 0x00, 0x02, 0x07, 0x00, 0x29, \
+ raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00, 0x29, \
0x2a), \
raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28), \
raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a), \
@@ -759,6 +759,34 @@ static const struct test_step test_read_12 = {
.expected_att_ecode = 0x80,
};
+static void test_write_cb(bool success, uint8_t att_ecode, void *user_data)
+{
+ struct context *context = user_data;
+ const struct test_step *step = context->data->step;
+
+ g_assert(att_ecode == step->expected_att_ecode);
+
+ context_quit(context);
+}
+
+static void test_write(struct context *context)
+{
+ const struct test_step *step = context->data->step;
+
+ g_assert(bt_gatt_client_write_value(context->client, step->handle, step->value,
+ step->length, test_write_cb, context, NULL));
+}
+
+static const uint8_t write_data_1[] = {0x01, 0x02, 0x03};
+
+static const struct test_step test_write_1 = {
+ .handle = 0x0007,
+ .func = test_write,
+ .expected_att_ecode = 0,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -957,7 +985,7 @@ static struct gatt_db *make_service_data_1_db(void)
PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 4),
CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
BT_ATT_PERM_READ,
- BT_GATT_CHRC_PROP_READ, ""),
+ BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE, ""),
DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
"Manufacturer Name"),
{ }
@@ -2845,5 +2873,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0a, 0x03, 0x00),
raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
+ define_test_client("/TP/GAW/CL/BV-03-C", test_client, service_db_1,
+ &test_write_1,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x13));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] unit/test-gatt: Add TP/GAW/CL/BI-02-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 3/6] unit/test-gatt: Add TP/GAW/CL/BI-03-C test Gowtham Anandha Babu
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify Generic Attribute Profile client behavior when the
Write Characteristic Value procedure fails due to invalid
handle.
---
unit/test-gatt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 66b5794..9781b0e 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -787,6 +787,14 @@ static const struct test_step test_write_1 = {
.length = 0x03
};
+static const struct test_step test_write_2 = {
+ .handle = 0x0000,
+ .func = test_write,
+ .expected_att_ecode = 0x01,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2879,5 +2887,11 @@ int main(int argc, char *argv[])
raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
raw_pdu(0x13));
+ define_test_client("/TP/GAW/CL/BI-02-C", test_client, service_db_1,
+ &test_write_2,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] unit/test-gatt: Add TP/GAW/CL/BI-03-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 2/6] unit/test-gatt: Add TP/GAW/CL/BI-02-C test Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 4/6] unit/test-gatt: Add TP/GAW/CL/BI-04-C test Gowtham Anandha Babu
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify Generic Attribute Profile client behavior when the
Write Characteristic Value procedure fails due to write
not permitted.
---
unit/test-gatt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 9781b0e..e8085b6 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -795,6 +795,14 @@ static const struct test_step test_write_2 = {
.length = 0x03
};
+static const struct test_step test_write_3 = {
+ .handle = 0x0007,
+ .func = test_write,
+ .expected_att_ecode = 0x03,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2893,5 +2901,11 @@ int main(int argc, char *argv[])
raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
+ define_test_client("/TP/GAW/CL/BI-03-C", test_client, service_db_1,
+ &test_write_3,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x01, 0x12, 0x07, 0x00, 0x03));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] unit/test-gatt: Add TP/GAW/CL/BI-04-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
` (2 preceding siblings ...)
2015-02-24 11:17 ` [PATCH 3/6] unit/test-gatt: Add TP/GAW/CL/BI-03-C test Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 5/6] unit/test-gatt: Add TP/GAW/CL/BI-05-C test Gowtham Anandha Babu
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify Generic Attribute Profile client behavior when the
Write Characteristic Value procedure fails due to insufficient
authorization.
---
unit/test-gatt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index e8085b6..7a0c686 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -803,6 +803,14 @@ static const struct test_step test_write_3 = {
.length = 0x03
};
+static const struct test_step test_write_4 = {
+ .handle = 0x0007,
+ .func = test_write,
+ .expected_att_ecode = 0x08,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2907,5 +2915,11 @@ int main(int argc, char *argv[])
raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
raw_pdu(0x01, 0x12, 0x07, 0x00, 0x03));
+ define_test_client("/TP/GAW/CL/BI-04-C", test_client, service_db_1,
+ &test_write_4,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x01, 0x12, 0x07, 0x00, 0x08));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] unit/test-gatt: Add TP/GAW/CL/BI-05-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
` (3 preceding siblings ...)
2015-02-24 11:17 ` [PATCH 4/6] unit/test-gatt: Add TP/GAW/CL/BI-04-C test Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 6/6] unit/test-gatt: Add TP/GAW/CL/BI-06-C test Gowtham Anandha Babu
2015-02-24 15:30 ` [PATCH 0/6] Add Write Characteristic Value client TC Luiz Augusto von Dentz
6 siblings, 0 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify Generic Attribute Profile client behavior when the
Write Characteristic Value procedure fails due to insufficient
authentication.
---
unit/test-gatt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 7a0c686..effd149 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -811,6 +811,14 @@ static const struct test_step test_write_4 = {
.length = 0x03
};
+static const struct test_step test_write_5 = {
+ .handle = 0x0007,
+ .func = test_write,
+ .expected_att_ecode = 0x05,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2921,5 +2929,11 @@ int main(int argc, char *argv[])
raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
raw_pdu(0x01, 0x12, 0x07, 0x00, 0x08));
+ define_test_client("/TP/GAW/CL/BI-05-C", test_client, service_db_1,
+ &test_write_5,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x01, 0x12, 0x07, 0x00, 0x05));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] unit/test-gatt: Add TP/GAW/CL/BI-06-C test
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
` (4 preceding siblings ...)
2015-02-24 11:17 ` [PATCH 5/6] unit/test-gatt: Add TP/GAW/CL/BI-05-C test Gowtham Anandha Babu
@ 2015-02-24 11:17 ` Gowtham Anandha Babu
2015-02-24 15:30 ` [PATCH 0/6] Add Write Characteristic Value client TC Luiz Augusto von Dentz
6 siblings, 0 replies; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 11:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu
Verify Generic Attribute Profile client behavior when the Write
Characteristic Value procedure fails due to insufficient encryption
key size.
---
unit/test-gatt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index effd149..deac101 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -819,6 +819,14 @@ static const struct test_step test_write_5 = {
.length = 0x03
};
+static const struct test_step test_write_6 = {
+ .handle = 0x0007,
+ .func = test_write,
+ .expected_att_ecode = 0x0c,
+ .value = write_data_1,
+ .length = 0x03
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2935,5 +2943,11 @@ int main(int argc, char *argv[])
raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
raw_pdu(0x01, 0x12, 0x07, 0x00, 0x05));
+ define_test_client("/TP/GAW/CL/BI-06-C", test_client, service_db_1,
+ &test_write_6,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
+ raw_pdu(0x01, 0x12, 0x07, 0x00, 0x0c));
+
return tester_run();
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
2015-02-24 11:17 ` [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test Gowtham Anandha Babu
@ 2015-02-24 13:09 ` Luiz Augusto von Dentz
2015-02-24 13:24 ` Gowtham Anandha Babu
0 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-02-24 13:09 UTC (permalink / raw)
To: Gowtham Anandha Babu; +Cc: linux-bluetooth@vger.kernel.org, Bharat Panda, cpgs
Hi Gowtham,
On Tue, Feb 24, 2015 at 1:17 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Verify that a Generic Attribute Profile client can write a
> Characteristic Value selected by handle.
> ---
> unit/test-gatt.c | 38 ++++++++++++++++++++++++++++++++++++--
> 1 file changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/unit/test-gatt.c b/unit/test-gatt.c
> index 3ab5340..66b5794 100644
> --- a/unit/test-gatt.c
> +++ b/unit/test-gatt.c
> @@ -141,7 +141,7 @@ struct context {
> raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
> raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
> raw_pdu(0x08, 0x05, 0x00, 0x08, 0x00, 0x03, 0x28), \
> - raw_pdu(0x09, 0x07, 0x06, 0x00, 0x02, 0x07, 0x00, 0x29, \
> + raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00, 0x29, \
> 0x2a), \
Is this a bug or something else that you need to change from 0x02 to 0x0a?
> raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28), \
> raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a), \
> @@ -759,6 +759,34 @@ static const struct test_step test_read_12 = {
> .expected_att_ecode = 0x80,
> };
>
> +static void test_write_cb(bool success, uint8_t att_ecode, void *user_data)
> +{
> + struct context *context = user_data;
> + const struct test_step *step = context->data->step;
> +
> + g_assert(att_ecode == step->expected_att_ecode);
> +
> + context_quit(context);
> +}
> +
> +static void test_write(struct context *context)
> +{
> + const struct test_step *step = context->data->step;
> +
> + g_assert(bt_gatt_client_write_value(context->client, step->handle, step->value,
> + step->length, test_write_cb, context, NULL));
> +}
> +
> +static const uint8_t write_data_1[] = {0x01, 0x02, 0x03};
> +
> +static const struct test_step test_write_1 = {
> + .handle = 0x0007,
> + .func = test_write,
> + .expected_att_ecode = 0,
> + .value = write_data_1,
> + .length = 0x03
> +};
> +
> static void att_write_cb(struct gatt_db_attribute *att, int err,
> void *user_data)
> {
> @@ -957,7 +985,7 @@ static struct gatt_db *make_service_data_1_db(void)
> PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 4),
> CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
> BT_ATT_PERM_READ,
> - BT_GATT_CHRC_PROP_READ, ""),
> + BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE, ""),
> DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
> "Manufacturer Name"),
> { }
> @@ -2845,5 +2873,11 @@ int main(int argc, char *argv[])
> raw_pdu(0x0a, 0x03, 0x00),
> raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
>
> + define_test_client("/TP/GAW/CL/BV-03-C", test_client, service_db_1,
> + &test_write_1,
> + SERVICE_DATA_1_PDUS,
> + raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
> + raw_pdu(0x13));
> +
> return tester_run();
> }
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
2015-02-24 13:09 ` Luiz Augusto von Dentz
@ 2015-02-24 13:24 ` Gowtham Anandha Babu
2015-02-24 13:27 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 11+ messages in thread
From: Gowtham Anandha Babu @ 2015-02-24 13:24 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz'
Cc: linux-bluetooth, 'Bharat Panda', cpgs
Hi Luiz,
> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
> owner@vger.kernel.org] On Behalf Of Luiz Augusto von Dentz
> Sent: Tuesday, February 24, 2015 6:40 PM
> To: Gowtham Anandha Babu
> Cc: linux-bluetooth@vger.kernel.org; Bharat Panda; cpgs@samsung.com
> Subject: Re: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
>
> Hi Gowtham,
>
> On Tue, Feb 24, 2015 at 1:17 PM, Gowtham Anandha Babu
> <gowtham.ab@samsung.com> wrote:
> > Verify that a Generic Attribute Profile client can write a
> > Characteristic Value selected by handle.
> > ---
> > unit/test-gatt.c | 38 ++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 36 insertions(+), 2 deletions(-)
> >
> > diff --git a/unit/test-gatt.c b/unit/test-gatt.c index
> > 3ab5340..66b5794 100644
> > --- a/unit/test-gatt.c
> > +++ b/unit/test-gatt.c
> > @@ -141,7 +141,7 @@ struct context {
> > raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
> > raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
> > raw_pdu(0x08, 0x05, 0x00, 0x08, 0x00, 0x03, 0x28), \
> > - raw_pdu(0x09, 0x07, 0x06, 0x00, 0x02, 0x07, 0x00, 0x29, \
> > + raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00,
> > + 0x29, \
> > 0x2a), \
>
> Is this a bug or something else that you need to change from 0x02 to 0x0a?
This is to change the characteristic properties from 0x02 (BT_GATT_CHRC_PROP_READ)
to 0x0a (BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE), so that we are able to write a value
to that characteristic.
BT_GATT_CHRC_PROP_READ - 0x02
BT_GATT_CHRC_PROP_WRITE - 0x08
(BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE) - 0x0a
Regards,
Gowtham Anandha Babu
>
> > raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28), \
> > raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a), \
> > @@ -759,6 +759,34 @@ static const struct test_step test_read_12 = {
> > .expected_att_ecode = 0x80,
> > };
> >
> > +static void test_write_cb(bool success, uint8_t att_ecode, void
> > +*user_data) {
> > + struct context *context = user_data;
> > + const struct test_step *step = context->data->step;
> > +
> > + g_assert(att_ecode == step->expected_att_ecode);
> > +
> > + context_quit(context);
> > +}
> > +
> > +static void test_write(struct context *context) {
> > + const struct test_step *step = context->data->step;
> > +
> > + g_assert(bt_gatt_client_write_value(context->client, step->handle,
> step->value,
> > + step->length, test_write_cb, context,
> > +NULL)); }
> > +
> > +static const uint8_t write_data_1[] = {0x01, 0x02, 0x03};
> > +
> > +static const struct test_step test_write_1 = {
> > + .handle = 0x0007,
> > + .func = test_write,
> > + .expected_att_ecode = 0,
> > + .value = write_data_1,
> > + .length = 0x03
> > +};
> > +
> > static void att_write_cb(struct gatt_db_attribute *att, int err,
> > void
> > *user_data) { @@ -957,7 +985,7 @@ static struct gatt_db
> > *make_service_data_1_db(void)
> > PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 4),
> >
> CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
> > BT_ATT_PERM_READ,
> > - BT_GATT_CHRC_PROP_READ, ""),
> > + BT_GATT_CHRC_PROP_READ
> > + | BT_GATT_CHRC_PROP_WRITE, ""),
> > DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID,
> BT_ATT_PERM_READ,
> > "Manufacturer Name"),
> > { }
> > @@ -2845,5 +2873,11 @@ int main(int argc, char *argv[])
> > raw_pdu(0x0a, 0x03, 0x00),
> > raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
> >
> > + define_test_client("/TP/GAW/CL/BV-03-C", test_client, service_db_1,
> > + &test_write_1,
> > + SERVICE_DATA_1_PDUS,
> > + raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
> > + raw_pdu(0x13));
> > +
> > return tester_run();
> > }
> > --
> > 1.9.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Luiz Augusto von Dentz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org More majordomo
> info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
2015-02-24 13:24 ` Gowtham Anandha Babu
@ 2015-02-24 13:27 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-02-24 13:27 UTC (permalink / raw)
To: Gowtham Anandha Babu; +Cc: linux-bluetooth@vger.kernel.org, Bharat Panda, cpgs
Hi Gowtham,
On Tue, Feb 24, 2015 at 3:24 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Hi Luiz,
>
>> -----Original Message-----
>> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
>> owner@vger.kernel.org] On Behalf Of Luiz Augusto von Dentz
>> Sent: Tuesday, February 24, 2015 6:40 PM
>> To: Gowtham Anandha Babu
>> Cc: linux-bluetooth@vger.kernel.org; Bharat Panda; cpgs@samsung.com
>> Subject: Re: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test
>>
>> Hi Gowtham,
>>
>> On Tue, Feb 24, 2015 at 1:17 PM, Gowtham Anandha Babu
>> <gowtham.ab@samsung.com> wrote:
>> > Verify that a Generic Attribute Profile client can write a
>> > Characteristic Value selected by handle.
>> > ---
>> > unit/test-gatt.c | 38 ++++++++++++++++++++++++++++++++++++--
>> > 1 file changed, 36 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/unit/test-gatt.c b/unit/test-gatt.c index
>> > 3ab5340..66b5794 100644
>> > --- a/unit/test-gatt.c
>> > +++ b/unit/test-gatt.c
>> > @@ -141,7 +141,7 @@ struct context {
>> > raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
>> > raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
>> > raw_pdu(0x08, 0x05, 0x00, 0x08, 0x00, 0x03, 0x28), \
>> > - raw_pdu(0x09, 0x07, 0x06, 0x00, 0x02, 0x07, 0x00, 0x29, \
>> > + raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00,
>> > + 0x29, \
>> > 0x2a), \
>>
>> Is this a bug or something else that you need to change from 0x02 to 0x0a?
>
> This is to change the characteristic properties from 0x02 (BT_GATT_CHRC_PROP_READ)
> to 0x0a (BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE), so that we are able to write a value
> to that characteristic.
>
> BT_GATT_CHRC_PROP_READ - 0x02
> BT_GATT_CHRC_PROP_WRITE - 0x08
> (BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE) - 0x0a
Well then it should be fine.
>
> Regards,
> Gowtham Anandha Babu
>
>>
>> > raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28), \
>> > raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a), \
>> > @@ -759,6 +759,34 @@ static const struct test_step test_read_12 = {
>> > .expected_att_ecode = 0x80,
>> > };
>> >
>> > +static void test_write_cb(bool success, uint8_t att_ecode, void
>> > +*user_data) {
>> > + struct context *context = user_data;
>> > + const struct test_step *step = context->data->step;
>> > +
>> > + g_assert(att_ecode == step->expected_att_ecode);
>> > +
>> > + context_quit(context);
>> > +}
>> > +
>> > +static void test_write(struct context *context) {
>> > + const struct test_step *step = context->data->step;
>> > +
>> > + g_assert(bt_gatt_client_write_value(context->client, step->handle,
>> step->value,
>> > + step->length, test_write_cb, context,
>> > +NULL)); }
>> > +
>> > +static const uint8_t write_data_1[] = {0x01, 0x02, 0x03};
>> > +
>> > +static const struct test_step test_write_1 = {
>> > + .handle = 0x0007,
>> > + .func = test_write,
>> > + .expected_att_ecode = 0,
>> > + .value = write_data_1,
>> > + .length = 0x03
>> > +};
>> > +
>> > static void att_write_cb(struct gatt_db_attribute *att, int err,
>> > void
>> > *user_data) { @@ -957,7 +985,7 @@ static struct gatt_db
>> > *make_service_data_1_db(void)
>> > PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 4),
>> >
>> CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
>> > BT_ATT_PERM_READ,
>> > - BT_GATT_CHRC_PROP_READ, ""),
>> > + BT_GATT_CHRC_PROP_READ
>> > + | BT_GATT_CHRC_PROP_WRITE, ""),
>> > DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID,
>> BT_ATT_PERM_READ,
>> > "Manufacturer Name"),
>> > { }
>> > @@ -2845,5 +2873,11 @@ int main(int argc, char *argv[])
>> > raw_pdu(0x0a, 0x03, 0x00),
>> > raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
>> >
>> > + define_test_client("/TP/GAW/CL/BV-03-C", test_client, service_db_1,
>> > + &test_write_1,
>> > + SERVICE_DATA_1_PDUS,
>> > + raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
>> > + raw_pdu(0x13));
>> > +
>> > return tester_run();
>> > }
>> > --
>> > 1.9.1
>> >
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe
>> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>> --
>> Luiz Augusto von Dentz
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org More majordomo
>> info at http://vger.kernel.org/majordomo-info.html
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/6] Add Write Characteristic Value client TC
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
` (5 preceding siblings ...)
2015-02-24 11:17 ` [PATCH 6/6] unit/test-gatt: Add TP/GAW/CL/BI-06-C test Gowtham Anandha Babu
@ 2015-02-24 15:30 ` Luiz Augusto von Dentz
6 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-02-24 15:30 UTC (permalink / raw)
To: Gowtham Anandha Babu; +Cc: linux-bluetooth@vger.kernel.org, Bharat Panda, cpgs
Hi Gowtham,
On Tue, Feb 24, 2015 at 1:17 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Adds the below client test cases:
> 1) Write Characteristic Value - by Client
> 2) Write Characteristic Value - Invalid Handle
> 3) Write Characteristic Value - Write Not Permitted
> 4) Write Characteristic Value - Insufficient Authorization
> 5) Write Characteristic Value - Insufficient Authentication
> 6) Write Characteristic Value - Insufficient Encryption Key Size
>
>
> Gowtham Anandha Babu (6):
> unit/test-gatt: Add TP/GAW/CL/BV-03-C test
> unit/test-gatt: Add TP/GAW/CL/BI-02-C test
> unit/test-gatt: Add TP/GAW/CL/BI-03-C test
> unit/test-gatt: Add TP/GAW/CL/BI-04-C test
> unit/test-gatt: Add TP/GAW/CL/BI-05-C test
> unit/test-gatt: Add TP/GAW/CL/BI-06-C test
>
> unit/test-gatt.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 106 insertions(+), 2 deletions(-)
>
> --
> 1.9.1
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-02-24 15:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 11:17 [PATCH 0/6] Add Write Characteristic Value client TC Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test Gowtham Anandha Babu
2015-02-24 13:09 ` Luiz Augusto von Dentz
2015-02-24 13:24 ` Gowtham Anandha Babu
2015-02-24 13:27 ` Luiz Augusto von Dentz
2015-02-24 11:17 ` [PATCH 2/6] unit/test-gatt: Add TP/GAW/CL/BI-02-C test Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 3/6] unit/test-gatt: Add TP/GAW/CL/BI-03-C test Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 4/6] unit/test-gatt: Add TP/GAW/CL/BI-04-C test Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 5/6] unit/test-gatt: Add TP/GAW/CL/BI-05-C test Gowtham Anandha Babu
2015-02-24 11:17 ` [PATCH 6/6] unit/test-gatt: Add TP/GAW/CL/BI-06-C test Gowtham Anandha Babu
2015-02-24 15:30 ` [PATCH 0/6] Add Write Characteristic Value client TC Luiz Augusto von Dentz
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.