BLE Advertising raw data via scan response - bt_le_adv_start


frv
 

Hi,


I don't know what I'm doing wrong when trying to advertise raw data via the scan_response function parameter in bt_le_adv_start, probably overlooking something stupid, but I don't get this to work at least if I try to use the bd1 as parameter in the "bt_le_adv_start" function :



       struct bt_data bd[] = { BT_DATA_BYTES(0x00, 0x22, 0x0a, 0x01, 0x02, 0x03, 0x0a, 0x33), };

        u8_t bdData[] = {0x22, 0x0a, 0x01, 0x02, 0x03, 0x0a, 0x33};

        struct bt_data bd1[0];
        bd1[0].type = 0x0;
        bd1[0].data = bdData;
        bd1[0].data_len = sizeof(bdData);

        printk("size of data = %d\n", sizeof(bdData));
        //printk("data = %s\n length = %d", bd[0].data, bd[0].data_len);

        err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), bd, ARRAY_SIZE(bd));
        if (err) {
                printk("Advertising failed to start (err %d)\n", err);
                return;
        }

However it works when constructing the data via BT_DATA_BYTES thus via  using the bd data variable (see first line of coding) ...

Any idea what I'm doing wrong?

Thanks in advance,
Best regards,
Frank


Join devel@lists.zephyrproject.org to automatically receive all group messages.