Skip to content

NimBLEAdvertisementData inconsistent replace-vs-append behavior in set* methods #425

@DarioMaechler

Description

@DarioMaechler

ESP-IDF: 5.5.4, esp-nimble-cpp: 2.5.0

Calling NimBLEAdvertising::setName() (and most other set* methods) multiple times appends new data using NimBLEAdvertisementData::addData() to the payload on each call instead of replacing the existing one. set_ for me strongly implies replacement, especially given that e.g. addServiceUUID() exists.

NimBLEAdvertising::setFlags() does this differently: It checks NimBLEAdvertisementData::getDataLocation() first and updates the existing entry in-place.

I'm currently calling NimBLEAdvertising::clearData() before rebuilding the full payload from scratch whenever any value changes, which is functional but wasteful.

Is this append behavior intentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions