ble advertizing data update dynamically in the prigram

Hi

I want to update the ble advertising data in my program. In nrf5340 the bt_le_adv_start() command should run only once in the main program.

Is it possible to change the advertising data of ble device in broadcast non connectable mode by bt_data_bytes() or bt_data() commands or

any other means. Its also preferable to use extended mode to be able to use 256 bytes of data while broadcasting.

Thank you in advance for your support.

Best regards.

  • Hi

    Thank you very much. I have tested it and it did work.

  • Hi again

    Would you please to explain a little more about bt_le_ext_adv_create() usage. Should I still use these lines:

    static uint8_t adv_array[29] = {0};

    static const struct bt_data ad[] = {
    BT_DATA(BT_DATA_BIG_INFO, adv_array, sizeof(adv_array)),
    };

    // Set Scan Response data //
    static const struct bt_data sd[] = {
    BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
    };

    and

    bt_enable(NULL);
    bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, ad, ARRAY_SIZE(ad),0,0);

    or I should completely change them and define new struct variables compatible with bt_le_ext_adv_create().

  • Hello,

    saeed mahvis said:
    or I should completely change them and define new struct variables compatible with bt_le_ext_adv_create()

    Disclaimer: I have not used the extended advertisements. Check the input parameters.

    Well... With the snippet above, first of all, you are not using sd anywhere, just so you know.

    Is there a reason you are using BT_DATA_BIG_INFO? Do you know what it refers to, or did you just take it because it contains the name "BIG"?

    If you don't know what it is (I don't), I suggest you stick with the BT_DATA_MANUFACTURER_DATA, which is a field where you can use completely custom data. That may not be the case in "BT_DATA_BIG_INFO".

    BR,

    Edvin

  • The BT_DATA_BIG_INFO macro in the nRF Connect SDK is used to define a Bluetooth advertising data structure for broadcasting information about a Broadcast Isochronous Group (BIG). This is part of the Bluetooth LE Audio features, which allow for synchronized audio streaming to multiple devices.

Related