esp-nimble-cpp icon indicating copy to clipboard operation
esp-nimble-cpp copied to clipboard

NimBLELocalValueAttribute::setValue() doesn't accept a char*??

Open chmorgan opened this issue 2 months ago • 2 comments

Shouldn't it accept a char* as there is a SetValue(const char*) method?

/firmware/main/hw/BleImpl.cpp
In file included from /firmware/components/esp-nimble-cpp/src/NimBLECharacteristic.h:30,
                 from /firmware/main/hw/BleImpl.cpp:5:
/firmware/components/esp-nimble-cpp/src/NimBLELocalValueAttribute.h: In instantiation of 'void NimBLELocalValueAttribute::setValue(const T&) [with T = char*]':
/sms001/firmware/main/hw/BleImpl.cpp:119:34:   required from here
  119 |                 pLogsTx->setValue(string);
      |                 ~~~~~~~~~~~~~~~~~^~~~~~~~
/firmware/components/esp-nimble-cpp/src/NimBLELocalValueAttribute.h:88:28: error: no matching function for call to 'NimBLEAttValue::setValue<char*>(char* const&)'
   88 |         m_value.setValue<T>(val);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~

chmorgan avatar Sep 28 '25 14:09 chmorgan

I noticed this as well today, will investigate. Workaround for now is setValue((uint8_t*)val, strlen(val));

h2zero avatar Sep 28 '25 23:09 h2zero

@h2zero yep, that's what I've been using

chmorgan avatar Sep 29 '25 01:09 chmorgan