This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Directed Advertising not seen by the addressed device

Hi,

I am testing direct advertising with two nRF52-DK. One performs a direct advertising and the other scans for the directed adverts. Unfortunately, the scanning device cannot see the directed advertising packages.

For simplicty and to reduce variables, I have set a test where I use the below code on a nRF52 dk (nRF52832) and the BLE tool on the nRF Connect SDK for Desktop (using a nRF52840-donge). I have hardcoded the dongle address on the directed advertiser code. Unfortunately, I still cannot see the directed advertising packages. Why is that? Any help most welcome.

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(11_directed_adv)

# NORDIC SDK APP START
target_sources(app PRIVATE
  src/main.c
)
# NORDIC SDK APP END

prj.conf file:

#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
#CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_BOARD_ENABLE_DCDC=n

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_DEVICE_NAME="directed_adv"
CONFIG_BT_PRIVACY=n
CONFIG_BT_EXT_ADV_MAX_ADV_SET=1

CONFIG_BT_GATT_CLIENT=y

CONFIG_BT_SETTINGS=y

CONFIG_HEAP_MEM_POOL_SIZE=1024

CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y


# RTT Log Enanble
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_RTT_CONSOLE=y
CONFIG_PRINTK=y

/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

/** @file
 *  @brief Nordic Battery Service Client sample
 */

#include <zephyr/types.h>

#include <errno.h>
#include <sys/printk.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/gatt.h>
//#include <bluetooth/gatt_dm.h>
#include <bluetooth/uuid.h>

#include <settings/settings.h>

#include <logging/log.h>


#define BT_GAP_ADV_INT_MIN        0x0020  /* 20 ms */
#define BT_GAP_ADV_INT_MAX        0x0020  /* 20 ms */

#define BT_ADV_5S_TIMEOUT         0x01F4  /* N=500 ;  Time = N * 10ms = 5s */
#define BT_ADV_30S_TIMEOUT        0x0BB8  /* N=3000 ; Time = N * 10ms = 30s */
#define BT_ADV_60S_TIMEOUT        0x1770  /* N=6000 ; Time = N * 10ms = 60s */


static uint8_t manu_data[7] = {   0xff, 0x3a,   /* Manufacturer */
                                  0x00, 0x00,   /* Major */
                                  0x00, 0x00,   /* Minor */
                                  0x00};        /* Nb of hops */

static const struct bt_data directed_b2b_ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_LIMITED | BT_LE_AD_NO_BREDR)),
        BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(0xFFFE)),
        BT_DATA(BT_DATA_MANUFACTURER_DATA, &manu_data, sizeof(manu_data)),
};

static bt_addr_le_t connecting_peer_addr;

static struct bt_le_adv_param directed_b2b_param =
                                      BT_LE_ADV_PARAM_INIT( BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_USE_NAME |
                                                            BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY,
                                      BT_GAP_ADV_FAST_INT_MIN_2, \
                                      BT_GAP_ADV_FAST_INT_MAX_2, &connecting_peer_addr);


static struct bt_le_ext_adv *directed_b2b_adv;

//==============================================================================
// advertising: directed
//==============================================================================

static void directed_b2b_adv_sent(struct bt_le_ext_adv *adv,
                     struct bt_le_ext_adv_sent_info *info)
{
  printk("Directed B2B adv timeout\n");
}

static void directed_b2b_adv_connected(struct bt_le_ext_adv *adv,
			  struct bt_le_ext_adv_connected_info *info)
{
  printk("Directed B2B Connected\n");
}

static struct bt_le_ext_adv_cb directed_b2b_adv_callbacks =
{
  .sent = directed_b2b_adv_sent,
  .connected = directed_b2b_adv_connected,
  .scanned = NULL
};
      
//==============================================================================
// bt_ready bluetooth init
//==============================================================================

static void bt_ready(int err)
{
  // TODO: Handle  init errors
  if (err) {
    printk("Bluetooth init failed (err %d)\n", err);
    return;
  }

  printk("Bluetooth initialized\n");

  if (IS_ENABLED(CONFIG_SETTINGS)) {
          settings_load();
  }

  // Directed B2B Advetising Create
  err = bt_le_ext_adv_create(&directed_b2b_param, &directed_b2b_adv_callbacks, &directed_b2b_adv);
  if (err)
  {
    printk("Failed to create directed advertiser set (%d)", err);
    return;
  }

  // set extended directed B2B advertising data
  err = bt_le_ext_adv_set_data(directed_b2b_adv, directed_b2b_ad, ARRAY_SIZE(directed_b2b_ad), NULL, 0);
  if (err)
  {
    printk("Failed to set directed advertising data (%d)", err);
    return;
  }
  
  struct bt_le_ext_adv_start_param directed_b2b_adv_start_param = {
                                    .timeout = BT_ADV_30S_TIMEOUT, 
                                    .num_events = 0};
   
  connecting_peer_addr.type = 0x01;
  connecting_peer_addr.a.val[0] = 0xf0;
  connecting_peer_addr.a.val[1] = 0x0f;
  connecting_peer_addr.a.val[2] = 0x34;
  connecting_peer_addr.a.val[3] = 0x56;
  connecting_peer_addr.a.val[4] = 0x45;
  connecting_peer_addr.a.val[5] = 0xc7;

  directed_b2b_param.peer = &connecting_peer_addr;
  err = bt_le_ext_adv_update_param(directed_b2b_adv, &directed_b2b_param);
  if (err)
  {
    printk("Failed to update directed advertising data (%d)", err);
    return;
  }
  
  err = bt_le_ext_adv_start(directed_b2b_adv, &directed_b2b_adv_start_param);
  if (err)
  {
    printk("Failed to start Directed advertising(%d)\n", err);
    return;
  }
  
  char addr[BT_ADDR_LE_STR_LEN];
  bt_addr_le_to_str(directed_b2b_param.peer, addr, sizeof(addr));
  printk("Directed B2B Advertising Started addr: %s\n", addr);

}

//==============================================================================
// main
//==============================================================================

void main(void)
{
  int err;

  printk("11-directed_adv init\n");

  err = bt_enable(bt_ready);
  if (err) {
          printk("Bluetooth init failed (err %d)\n", err);
          return;
  }
}

Direct Advertiser logs

*** Booting Zephyr OS build v2.7.0-ncs1  ***
11-directed_adv init
[00:00:01.327,239] <inf> fs_nvs: 6 Sectors of 4096 bytes
[00:00:01.327,270] <inf> fs_nvs: alloc wra: 0, f70
[00:00:01.327,270] <inf> fs_nvs: data wra: 0, 118
[00:00:01.327,392] <inf> sdc_hci_driver: SoftDevice Controller build revision: 
                                         df c0 4e d6 1f 7c 66 09  0a f5 2b a0 98 f2 43 64 |..N..|f. ..+...Cd
                                         62 c5 a6 2a                                      |b..*             
[00:00:01.330,413] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:01.330,413] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:01.330,413] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 223.20160 Build 1719410646
[00:00:01.330,718] <inf> bt_hci_core: No ID address. App must call settings_load()
Bluetooth initialized
[00:00:01.330,902] <err> settings: set-value failure. key: bt/keys/e394a91ee9ef1 error(-2)
[00:00:01.331,634] <inf> bt_hci_core: Identity: F2:A4:36:CA:06:73 (random)
[00:00:01.331,634] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x12b0, manufacturer 0x0059
[00:00:01.331,634] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x12b0
Directed B2B Advertising Started addr: C7:45:56:34:0F:F0 (random)

BLE Tool

Parents
  • Hi Armand

    I don't think the Bluetooth application in nRF Connect for Desktop will show anything if a directed advertising packet is received. These packet doesn't really contain any data to show, just the peer address. 
    The same goes for extended advertise packets, I will need to check with the developers if this is supported. 
    I will get this confirmed during office hours tomorrow. 

    Have you tried to set up the other board to run a scanner example instead? 
    This should work, as long as you use comparable settings. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    As stated I did initally test with two nRF52 dev kits (nRF52832). I am going to share here my code for the scanner and the logs on both devices. I cannot get to see any directed advertisement package on the scanner side. Could you run on your side both codes on nRF52dk? Thanks

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(12_directed_adv_scanner)
    
    # NORDIC SDK APP START
    target_sources(app PRIVATE
      src/main.c
    )
    # NORDIC SDK APP END
    

    1768.prj.conf

    /*
     * Copyright (c) 2019 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    /** @file
     *  @brief Nordic Battery Service Client sample
     */
    
    #include <zephyr/types.h>
    #include <stddef.h>
    #include <inttypes.h>
    #include <errno.h>
    #include <zephyr.h>
    #include <sys/printk.h>
    
    #include <bluetooth/bluetooth.h>
    #include <bluetooth/hci.h>
    #include <bluetooth/conn.h>
    #include <bluetooth/uuid.h>
    #include <bluetooth/gatt.h>
    #include <bluetooth/gatt_dm.h>
    #include <bluetooth/scan.h>
    #include <bluetooth/services/bas_client.h>
    #include <dk_buttons_and_leds.h>
    
    #include <settings/settings.h>
    
    #include <logging/log.h>
    
    /**
     * Button to read the battery value
     */
    
    static void scan_filter_match(struct bt_scan_device_info *device_info,
    			      struct bt_scan_filter_match *filter_match,
    			      bool connectable)
    {
    	char addr[BT_ADDR_LE_STR_LEN];
    
    	bt_addr_le_to_str(device_info->recv_info->addr, addr, sizeof(addr));
    
    	printk("Filters matched. Address: %s connectable: %s\n",
    		addr, connectable ? "yes" : "no");
    }
    
    
    static void scan_filter_no_match(struct bt_scan_device_info *device_info,
    				 bool connectable)
    {
    	//int err;
    	char addr[BT_ADDR_LE_STR_LEN];
    
            printk("No Match. Adv Type: 0x%02X Props: 0x%04X\n", device_info->recv_info->adv_type, device_info->recv_info->adv_props);
    
    	if (device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
    		bt_addr_le_to_str(device_info->recv_info->addr, addr,
    				  sizeof(addr));
    		printk("Direct advertising received from %s\n", addr);
    		//bt_scan_stop();
    
    	}
    }
    
    BT_SCAN_CB_INIT(scan_cb, scan_filter_match, scan_filter_no_match,
    		NULL, NULL);
    
    static void scan_init(void)
    {
    	int err;
    
    	struct bt_scan_init_param scan_init = {
    		.connect_if_match = 0,
    		.scan_param = NULL,
    		.conn_param = BT_LE_CONN_PARAM_DEFAULT
    	};
    
    	bt_scan_init(&scan_init);
    	bt_scan_cb_register(&scan_cb);
    }
    
    static void bt_ready(int err)
    {
      char addr_s[BT_ADDR_LE_STR_LEN];
      bt_addr_le_t addr = {0};
      size_t count = 1;
    
      if (IS_ENABLED(CONFIG_SETTINGS)) {
              settings_load();
      }
      bt_id_get(&addr, &count);
      bt_addr_le_to_str(&addr, addr_s, sizeof(addr_s));
    
    
      printk("Starting 12 - Directed Advertising Scanner\n");
      printk("Addr: %s\n", addr_s);
    
      printk("Bluetooth initialized\n");
    
      scan_init();
    
      err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
      if (err) {
              printk("Scanning failed to start (err %d)\n", err);
              return;
      }
    
      printk("Scanning successfully started\n");
    }
    
    void main(void)
    {
      int err;
    
      err = bt_enable(bt_ready);
      if (err) {
              printk("Bluetooth init failed (err %d)\n", err);
              return;
      }
    }
    
    

    LOGS

    Direct advertiser

    *** Booting Zephyr OS build v2.7.0-ncs1  ***
    11-directed_adv init
    [00:00:01.915,771] <inf> fs_nvs: 6 Sectors of 4096 bytes
    [00:00:01.915,802] <inf> fs_nvs: alloc wra: 2, fb0
    [00:00:01.915,802] <inf> fs_nvs: data wra: 2, 448
    [00:00:01.915,924] <inf> sdc_hci_driver: SoftDevice Controller build revision: 
                                             df c0 4e d6 1f 7c 66 09  0a f5 2b a0 98 f2 43 64 |..N..|f. ..+...Cd
                                             62 c5 a6 2a                                      |b..*             
    [00:00:01.918,914] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:01.918,914] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:01.918,945] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 223.20160 Build 1719410646
    [00:00:01.919,219] <inf> bt_hci_core: No ID address. App must call settings_load()
    Bluetooth initialized
    [00:00:01.919,952] <inf> bt_hci_core: Identity: F2:A4:36:CA:06:73 (random)
    [00:00:01.919,952] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x12b0, manufacturer 0x0059
    [00:00:01.919,952] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x12b0
    Directed B2B Advertising Started addr: C1:F9:D7:24:F3:A6 (random)
    Directed B2B adv timeout

    Scanner logs:

    *** Booting Zephyr OS build v2.7.0-ncs1  ***
    [00:00:02.586,242] <inf> fs_nvs: 6 Sectors of 4096 bytes
    [00:00:02.586,242] <inf> fs_nvs: alloc wra: 3, e78
    [00:00:02.586,242] <inf> fs_nvs: data wra: 3, 20c
    [00:00:02.586,395] <inf> sdc_hci_driver: SoftDevice Controller build revision: 
                                             df c0 4e d6 1f 7c 66 09  0a f5 2b a0 98 f2 43 64 |..N..|f. ..+...Cd
                                             62 c5 a6 2a                                      |b..*             
    [00:00:02.589,202] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:02.589,202] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:02.589,202] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 223.20160 Build 1719410646
    [00:00:02.589,477] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:02.589,660] <err> settings: set-value failure. key: bt/name error(-2)
    [00:00:02.589,904] <err> settings: set-value failure. key: bt/mesh/s/2/bind error(-2)
    [00:00:02.590,179] <err> settings: set-value failure. key: bt/mesh/AppKey/0 error(-2)
    [00:00:02.590,423] <err> settings: set-value failure. key: bt/mesh/RPL/1 error(-2)
    [00:00:02.590,698] <err> settings: set-value failure. key: bt/mesh/Seq error(-2)
    [00:00:02.591,064] <err> settings: set-value failure. key: bt/mesh/IV error(-2)
    [00:00:02.591,491] <err> settings: set-value failure. key: bt/mesh/NetKey/0 error(-2)
    [00:00:02.591,918] <err> settings: set-value failure. key: bt/mesh/Net error(-2)
    [00:00:02.592,742] <inf> bt_hci_core: Identity: <log_strdup alloc failed>
    [00:00:02.592,773] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x12b0, manufacturer 0x0059
    [00:00:02.592,773] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x12b0
    Starting 12 - Directed Advertising Scanner
    Addr: C1:F9:D7:24:F3:A6 (random)
    Bluetooth initialized
    Scanning successfully started
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x00 Props: 0x0003
    No Match. Adv Type: 0x04 Props: 0x000A
    No Match. Adv Type: 0x00 Props: 0x0003
    

  • Hi Torbjørn, Any chance to test this? Thanks

  • Hi Armand

    My apologies, I had back to back meetings today and didn't get time. I will do my best to test this tomorrow and get back to you. 

    Best regards
    Torbjørn

  • Hi Armand

    I had a chat with Hung, a colleague of mine, who mentioned that he handled a similar case some time ago (with you possibly). 

    He sent me some code that I could use to test this. 

    I made some minor changes to his code, and was able to get extended directed advertising working. 

    directed_adv_scan.zip

    Please note that you have to find the local address of the scanner by looking at the log output, and update the advertiser code to use this address. 

    Could you give this code a try and see if it works OK?

    Best regards
    Torbjørn

Reply
  • Hi Armand

    I had a chat with Hung, a colleague of mine, who mentioned that he handled a similar case some time ago (with you possibly). 

    He sent me some code that I could use to test this. 

    I made some minor changes to his code, and was able to get extended directed advertising working. 

    directed_adv_scan.zip

    Please note that you have to find the local address of the scanner by looking at the log output, and update the advertiser code to use this address. 

    Could you give this code a try and see if it works OK?

    Best regards
    Torbjørn

Children
  • Hi 

    Thanks for your reply. I have been going through the code and it is my understanding that it will detect any extended advertising but it does not discriminate for directed advertising. Please check the flags it is reading on the central_bas2 sample code:

    static void scan_filter_no_match(struct bt_scan_device_info *device_info,
    				 bool connectable)
    {
    	int err;
    	uint8_t i;
    	struct bt_conn *conn;
    	char addr[BT_ADDR_LE_STR_LEN];
    		bt_addr_le_to_str(device_info->recv_info->addr, addr,
    				  sizeof(addr));
    	if ((addr[0]=='F')&&(addr[1]=='6'))
    	{
    		printk("address %s\n",addr);	
    		for (i=0;i<device_info->adv_data->len;i++)
    		{
    			printk("%x",device_info->adv_data->data[i]);
    		}		  
    		printk("\n");
    	}
    	if ((device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_EXT_ADV) && 
    		(device_info->recv_info->adv_props & BT_GAP_ADV_PROP_EXT_ADV)) {
    		bt_addr_le_to_str(device_info->recv_info->addr, addr,
    				  sizeof(addr));
    		printk("Extended directed advertising received from %s\n", addr);
    	}
    }

    The flags are specific to detect  devices that are performing extended advertising but not exclusively directed advertising:

    if ((device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_EXT_ADV) && 
    		(device_info->recv_info->adv_props & BT_GAP_ADV_PROP_EXT_ADV))
     

    Please check this out.

  • Hi Armand

    This was something I had to add myself to make the directed advertising packets detected properly in the example. 

    When doing extended advertising then the adv_type field will no longer indicate whether or not you are receiving a directed or undirected advertising packet, since adv_type is BT_GAP_ADV_TYPE_EXT_ADV for all extended advertising packets. 

    Instead I had to check the adv_props field in order to figure out whether or not I was receiving an extended directed advertising packet from my advertiser, rather than some other advertise packet from other advertisers in the area. 

    If you want to also be able to read normal directed advertising packets (not using extended advertising) then you need to add a separate check for this. 

    Does that answer your question?

    Best regards
    Torbjørn

  • Thanks for your reply Torbjørn.

    Let's see if we can find some common ground for a solution. I need to set a directed advertising with a timeout.

    1. First implmentation. I use bt_le_ext_adv_start. That function allows to specify an advertising timeout using bt_le_ext_adv_start_param:

    int bt_le_ext_adv_start(struct bt_le_ext_adv *adv,
    			struct bt_le_ext_adv_start_param *param)

    However, it seems that it is not possible to discern at the scanner side if an extended advertisement is directed or not. Is that correct?

    2. Second implementation. Using the standard advertising function bt_le_adv_start. However, that function does not define any configuration for specifying an advertising timeout:

    int bt_le_adv_start(const struct bt_le_adv_param *param,
    		    const struct bt_data *ad, size_t ad_len,
    		    const struct bt_data *sd, size_t sd_len)

    Is it possible to implement a standard directed advertising with a timeout?

    Thanks

  • Hi Torbjørn,

    I finally got it to work. A couple of comments for others to come.

    1. Two config parameters were missing on my prj.conf:

    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_SCAN_WITH_IDENTITY=y

    2. Standard or extended directed advertisments can be filter using the advertising PDU properties:

    if(device_info->recv_info->adv_props & BT_GAP_ADV_PROP_DIRECTED)

    Torbjørn if you confirm this is correct, I will verify this answer.

    Thanks for your help!

  • Hi Armand

    I am happy to hear you figured it out Slight smile

    The check of the adv_props field looks correct, yes. This should filter out directed advertise packets, regardless of whether or not extended advertising is used. 

    Best regards
    Torbjørn

Related