Re: [PATCH 1/6] unit/test-gatt: Add TP/GAW/CL/BV-03-C test

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

 



Hi Gowtham,

On Tue, Feb 24, 2015 at 1:17 PM, Gowtham Anandha Babu
<gowtham.ab@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> 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@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