From: Szymon Janc <szymon.janc@tieto.com>
To: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 7/9] emulator: Extend le advertising function with discoverable flag
Date: Fri, 18 Jul 2014 10:05:24 +0200 [thread overview]
Message-ID: <14957256.nJzz9u0Y1o@uw000953> (raw)
In-Reply-To: <1405585796-12301-7-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Thursday 17 of July 2014 10:29:54 Jakub Tyszkowski wrote:
> This allows to pass additional parameter describing wheter to set
> discoverable flag in advertising data.
> ---
> android/android-tester.c | 2 +-
> emulator/bthost.c | 22 +++++++++++++++++++++-
> emulator/bthost.h | 3 ++-
> tools/l2cap-tester.c | 2 +-
> tools/mgmt-tester.c | 2 +-
> tools/smp-tester.c | 2 +-
> 6 files changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/android/android-tester.c b/android/android-tester.c
> index eb5c513..ff14fc8 100644
> --- a/android/android-tester.c
> +++ b/android/android-tester.c
> @@ -701,7 +701,7 @@ static void setup_powered_emulated_remote(void)
> bthost_set_cmd_complete_cb(bthost, emu_connectable_complete, data);
>
> if (data->hciemu_type == HCIEMU_TYPE_LE)
> - bthost_set_adv_enable(bthost, 0x01);
> + bthost_set_adv_enable(bthost, 0x01, 0x00);
> else
> bthost_write_scan_enable(bthost, 0x03);
> }
> diff --git a/emulator/bthost.c b/emulator/bthost.c
> index 298edcf..d86e02b 100644
> --- a/emulator/bthost.c
> +++ b/emulator/bthost.c
> @@ -747,6 +747,8 @@ static void evt_cmd_complete(struct bthost *bthost, const void *data,
> break;
> case BT_HCI_CMD_LE_LTK_REQ_NEG_REPLY:
> break;
> + case BT_HCI_CMD_LE_SET_ADV_DATA:
> + break;
> default:
> printf("Unhandled cmd_complete opcode 0x%04x\n", opcode);
> break;
> @@ -2072,7 +2074,8 @@ void bthost_write_scan_enable(struct bthost *bthost, uint8_t scan)
> send_command(bthost, BT_HCI_CMD_WRITE_SCAN_ENABLE, &scan, 1);
> }
>
> -void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable)
> +void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable,
> + uint8_t disc_type)
> {
> struct bt_hci_cmd_le_set_adv_parameters cp;
>
> @@ -2080,6 +2083,23 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable)
> send_command(bthost, BT_HCI_CMD_LE_SET_ADV_PARAMETERS,
> &cp, sizeof(cp));
>
> + if (disc_type) {
So this should be called flags since it pass whole flags AD.
Other option would be to expect whole 31 bytes here. I'm not sure how flexible
this could be ie. if providing function for adding AD in TLV style and just
build this to build adv_data here?
> + struct bt_hci_cmd_le_set_adv_data adv_cp;
> +
> + memset(adv_cp.data, 0, 31);
> +
> + adv_cp.data[0] = 0x02; /* Field length */
> + adv_cp.data[1] = 0x01; /* Flags */
> + adv_cp.data[2] = disc_type;
> +
> + adv_cp.data[3] = 0x00; /* Field terminator */
> +
> + adv_cp.len = 1 + adv_cp.data[0];
> +
> + send_command(bthost, BT_HCI_CMD_LE_SET_ADV_DATA, &adv_cp,
> + sizeof(adv_cp));
> + }
> +
> send_command(bthost, BT_HCI_CMD_LE_SET_ADV_ENABLE, &enable, 1);
> }
>
> diff --git a/emulator/bthost.h b/emulator/bthost.h
> index b00bcd6..578e38a 100644
> --- a/emulator/bthost.h
> +++ b/emulator/bthost.h
> @@ -70,7 +70,8 @@ bool bthost_l2cap_req(struct bthost *bthost, uint16_t handle, uint8_t req,
>
> void bthost_write_scan_enable(struct bthost *bthost, uint8_t scan);
>
> -void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable);
> +void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable,
> + uint8_t disc_type);
>
> void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode);
>
> diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
> index 79362b2..6841341 100644
> --- a/tools/l2cap-tester.c
> +++ b/tools/l2cap-tester.c
> @@ -535,7 +535,7 @@ static void setup_powered_client_callback(uint8_t status, uint16_t length,
> bthost = hciemu_client_get_host(data->hciemu);
> bthost_set_cmd_complete_cb(bthost, client_cmd_complete, user_data);
> if (data->hciemu_type == HCIEMU_TYPE_LE)
> - bthost_set_adv_enable(bthost, 0x01);
> + bthost_set_adv_enable(bthost, 0x01, 0x00);
> else
> bthost_write_scan_enable(bthost, 0x03);
> }
> diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
> index a860228..f559a06 100644
> --- a/tools/mgmt-tester.c
> +++ b/tools/mgmt-tester.c
> @@ -2890,7 +2890,7 @@ static void setup_bthost(void)
> bthost = hciemu_client_get_host(data->hciemu);
> bthost_set_cmd_complete_cb(bthost, client_cmd_complete, data);
> if (data->hciemu_type == HCIEMU_TYPE_LE)
> - bthost_set_adv_enable(bthost, 0x01);
> + bthost_set_adv_enable(bthost, 0x01, 0x00);
> else
> bthost_write_scan_enable(bthost, 0x03);
> }
> diff --git a/tools/smp-tester.c b/tools/smp-tester.c
> index 12e0bed..c9639e6 100644
> --- a/tools/smp-tester.c
> +++ b/tools/smp-tester.c
> @@ -411,7 +411,7 @@ static void setup_powered_client_callback(uint8_t status, uint16_t length,
>
> bthost = hciemu_client_get_host(data->hciemu);
> bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data);
> - bthost_set_adv_enable(bthost, 0x01);
> + bthost_set_adv_enable(bthost, 0x01, 0x00);
> }
>
> static void setup_powered_client(const void *test_data)
>
--
Best regards,
Szymon Janc
next prev parent reply other threads:[~2014-07-18 8:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 8:29 [PATCH 1/9] android/tester-ng: Use action and callback defining macros Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 2/9] android/tester-ng: Add test declaration helper macro Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 3/9] android/tester-ng: Use array of statics instead of case pointers Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 4/9] android/tester-ng: Use test case independent naming for props Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 5/9] android/tester-ng: Add start discovery success cases Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 6/9] android/tester-ng: Add cancel discovery cases Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 7/9] emulator: Extend le advertising function with discoverable flag Jakub Tyszkowski
2014-07-18 8:05 ` Szymon Janc [this message]
2014-07-18 8:18 ` Johan Hedberg
2014-07-17 8:29 ` [PATCH 8/9] android/tester-ng: Add remote device found case Jakub Tyszkowski
2014-07-17 8:29 ` [PATCH 9/9] android/tester: Remove old test cases Jakub Tyszkowski
2014-07-18 7:54 ` [PATCH 1/9] android/tester-ng: Use action and callback defining macros Szymon Janc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14957256.nJzz9u0Y1o@uw000953 \
--to=szymon.janc@tieto.com \
--cc=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox