Closed straccio closed 3 years ago
Thanks! I’ll add this shortly.
Thanks to you! :P
Just a quick note on this, you can create a std::string beginning with \0, it just needs to be done by specifying the length.
std::string dataStr((char*)data, length);
pAdvData->addData(dataStr);
I have tried but it doesn't work. Before calling addData the string size is correctly; inside the adData the size of the string is truncated at \0 position.
I think that happen because passing the string to the function call the copy of the object ad that cause the issue.
The correct way must be use the variable as std::basic_string<unsigned char/uint8_t>
That's odd, I can't reproduce that here. If I use the url beacon example with a http://www. address and change the eddyStoneData construction to std::string eddyStoneData(ret_data, ret_data[7]+8);
it works just fine.
I'll still add this anyway so a std::string doesn't need to be used.
Sorry for the delay, I pushed this patch just now in commit 3976074.
resolved
Good morning, i had to add an overload to the function addData of NinBLEAdvertising class in order to bypass the problem caused by the using of std::string as raw binary buffer.
Here the overload:
You can test this case with the eddystone beacon example by changing the url with one that start with "http://www.", because this match eddystone_url_prefix_subs at 0 index.
Best regards and good job