An advertisement data that contains manufacturing data

Hi 

As shown in the title, I want to add manufacturing data(BT_DATA_MANUFACTURER_DATA) to the advertisement data.

The *.conf seems to only define the device name...

I want to be able to  modify manufacturing data dynamically. 

let me know if anything I need to change, thanks!

OS: windows 10
Hardware used: nrf5340 dk
example:C:\ncs\v2.5.1\nrf\samples\matter\lock

Parents
  • Hello,

    By dynamically, I assume you mean during runtime?

    If so, you can have a look at this little side project I did once.

    In main.c I only used the function simple_ad_start(), which is defined in the file remote.c.

    It is a bit messy, but I hope it may give an idea for you to start with.

    Best regards,

    Edvin

  • Hi Edvin

    The problem I am currently encountering is that the advertisement data of matter cannot be accompanied by manufacturing data.

    when I turn on the discoverable over Bluetooth LE(Matter), the manufacturing data were disappeared

    The dynamically changing advertisement data part should have been completed, but it seems that only work with "general" BLE broadcasts

    void Sunion::BleService::SetManufData(uint8_t *buff)
    {
    	int err = 0;
        bt_le_adv_param advParams;
        advParams.id           = BT_ID_DEFAULT;
        advParams.options      = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME;
        advParams.interval_min = mAdvertisingRequest.minInterval;
        advParams.interval_max = mAdvertisingRequest.maxInterval;
    
    	const bt_data scanResponseData[]    = { BT_DATA(BT_DATA_UUID128_ALL, kBTUuid, sizeof(kBTUuid)) };
    	const bt_data * scanResponseDataPtr = sizeof(kBTUuid) > 0 ? scanResponseData : nullptr;
    	const size_t scanResponseDataLen    = sizeof(kBTUuid) > 0 ? sizeof(scanResponseData) / sizeof(scanResponseData[0]) : 0u;
    
    	const char *name = bt_get_name();
        const bt_data advertisingData[] = { BT_DATA(BT_DATA_FLAGS, &kAdvertisingFlags, sizeof(kAdvertisingFlags)),
                                            BT_DATA(BT_DATA_NAME_COMPLETE, name, strlen(CONFIG_BT_DEVICE_NAME)),
    										BT_DATA(BT_DATA_MANUFACTURER_DATA, buff, 12) };
    
    
        // Restart advertising
        err = bt_le_adv_stop();
        // VerifyOrReturnError(err == 0, MapErrorZephyr(err));
    
        err = bt_le_adv_start(&advParams, advertisingData, sizeof(advertisingData) / sizeof(advertisingData[0]), scanResponseDataPtr,
                              scanResponseDataLen);
    }

  • How much data are you trying to push out through the advertising packet?

    The Flags are only a couple of bytes, and then you have 12 bytes of manufacturer specific data. What is the CONFIG_BT_DEVICE_NAME? How many ascii-characters?

    Remember that all BLE advertising is limited to 31 bytes, so if your device name is 20 characters, that leaves only 11 bytes for the rest. See if you can get the manufacturer specific data if you remove the BT_DATA_NAME_COMPLETE from your advertising data (as a test). 

    If it doesn't work, what is the return value from bt_le_adv_start()? Try printing it to your log.

    Best regards,

    Edvin

  • Hi Edvin

    I created a custom service similar to Nordic UART Service (NUS) and it broadcasts the device name(7 bytes) and manufacturing data(12 bytes) correctly.

    But when I switch to matter broadcast, the manufacturing data disappears, only the device name remains.

    I think they should be stored in different data structures,and I know that "bt_set_name" function can change the device name of matter broadcast.

  • Hi Edvin

    I created a custom service similar to Nordic UART Service (NUS) and it broadcasts the device name(7 bytes) and manufacturing data(12 bytes) correctly.

    But when I switch to matter broadcast, the manufacturing data disappears, only the device name remains.

    I think they should be stored in different data structures,and I know that "bt_set_name" function can change the device name of matter broadcast.

    The manufacturer data specification documented in 5.4.2.8 Manufacturer-specific data from Matter-Core-Specification, Version 1.2. 

Reply
  • Hi Edvin

    I created a custom service similar to Nordic UART Service (NUS) and it broadcasts the device name(7 bytes) and manufacturing data(12 bytes) correctly.

    But when I switch to matter broadcast, the manufacturing data disappears, only the device name remains.

    I think they should be stored in different data structures,and I know that "bt_set_name" function can change the device name of matter broadcast.

    The manufacturer data specification documented in 5.4.2.8 Manufacturer-specific data from Matter-Core-Specification, Version 1.2. 

Children
No Data
Related