diff options
author | Gowtham Anandha Babu <gowtham.ab@samsung.com> | 2015-04-16 18:23:19 +0530 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2015-04-17 16:37:51 +0300 |
commit | 82eff76b10c106501d59f3989eeb5573bcf73235 (patch) | |
tree | 2f422b15b1abe91a549dc59b9fb58604cf33dcdf /unit/test-gatt.c | |
parent | dce0b7df9b6294961e0b355234a87391dc187b1e (diff) | |
download | bluez-82eff76b10c106501d59f3989eeb5573bcf73235.tar.gz |
unit/gatt: Add TP/GAW/CL/BV-06-C test
Verify that a Generic Attribute Profile client can reliably write
a characteristic selected by handle.
Diffstat (limited to 'unit/test-gatt.c')
-rw-r--r-- | unit/test-gatt.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/unit/test-gatt.c b/unit/test-gatt.c index 6c12f85d8..d60eab07f 100644 --- a/unit/test-gatt.c +++ b/unit/test-gatt.c @@ -1138,6 +1138,37 @@ static const struct test_step test_long_write_12 = { .length = 0x03 }; +static void test_reliable_write_cb(bool success, bool reliable_error, + 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); + + g_assert(!reliable_error); + + context_quit(context); +} + +static void test_reliable_write(struct context *context) +{ + const struct test_step *step = context->data->step; + + g_assert(bt_gatt_client_write_long_value(context->client, true, + step->handle, 0, step->value, + step->length, test_reliable_write_cb, + context, NULL)); +} + +static const struct test_step test_reliable_write_1 = { + .handle = 0x0007, + .func = test_reliable_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) { @@ -3780,6 +3811,14 @@ int main(int argc, char *argv[]) 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff), raw_pdu(0x01, 0x16, 0x73, 0x00, 0x03)); + define_test_client("/TP/GAW/CL/BV-06-C", test_client, service_db_1, + &test_reliable_write_1, + SERVICE_DATA_1_PDUS, + raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03), + raw_pdu(0x17, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03), + raw_pdu(0x18, 0x01), + raw_pdu(0x19)); + define_test_server("/TP/GAW/SR/BV-06-C/small", test_server, ts_small_db, NULL, raw_pdu(0x03, 0x00, 0x02), |