Configuring data in BLE Advertisement header

Hi,

I'm trying to construct a BLE advertisement whose header satisfies the following requirements:

I am configuring my BLE advertisement as such, and I believe this is correct:

uint8_t manufDataBuff[]={0xFA, 0xFF, 0x0D, 0x77, 0x02, 0x10, 0x31, 0x32,
                         0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30,
                         0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
                         0x39, 0x30, 0x00, 0x00, 0x00};
struct bt_data dt_bt_conn_ad[] = {
    {
        .type = 0x16,  // Service Data
        .data_len = sizeof(manufDataBuff),  // 30 bytes
        .data = manufDataBuff,
    }
};

struct bt_le_adv_param param = *(BT_LE_ADV_NCONN);
param.interval_min = 1000;
param.interval_max = 1000;

// setting BT_LE_ADV_CONN_NAME instead of BT_LE_ADV_CONN automatically sets a scan response containing the device name
int err = bt_le_adv_start(&param, dt_bt_conn_ad, ARRAY_SIZE(dt_bt_conn_ad), NULL, 0);
I don't currently have a way to scan for and read out the data in the header to confirm. Do you know if my code would satisfy the requirements, particularly for the Preamble and Access Address (I couldn't find a way to explicitly set the PHY to LE 1M or the Access Address, but I assume these are correct by default?).
Thanks,
Michael 
Parents
  • You have the helpers for initializing the advertising parameters BT_LE_ADV_PARAM_INIT, it is recommended to use them so that the rest of the members of the structure of the bt_le_adv_param are initialized properly to a default state.

    I would recommend you to use the below initializing the params.

    struct bt_le_adv_param params =
    	BT_LE_ADV_PARAM_INIT( BT_LE_ADV_OPT_SCANNABLE |
    			     1000,
    			     1000,
    			     NULL);

    (I couldn't find a way to explicitly set the PHY to LE 1M or the Access Address, but I assume these are correct by default?).

    By default it is 1M for advertising. So yes you are correct, you do not need to configure the PHY for advertising on 1M PHY.

Reply
  • You have the helpers for initializing the advertising parameters BT_LE_ADV_PARAM_INIT, it is recommended to use them so that the rest of the members of the structure of the bt_le_adv_param are initialized properly to a default state.

    I would recommend you to use the below initializing the params.

    struct bt_le_adv_param params =
    	BT_LE_ADV_PARAM_INIT( BT_LE_ADV_OPT_SCANNABLE |
    			     1000,
    			     1000,
    			     NULL);

    (I couldn't find a way to explicitly set the PHY to LE 1M or the Access Address, but I assume these are correct by default?).

    By default it is 1M for advertising. So yes you are correct, you do not need to configure the PHY for advertising on 1M PHY.

Children
No Data
Related