This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't send dynamically allocated array over bluetooth mesh

Hello everyone!

I'm new to bluetooth mesh or even to C programming and i don't understand the following:

I want to send messages over Bluetooth Mesh from an nRF52840 to another, to do this i used the light_switch example and modified the "send_reliable_message()" method inside "simple_on_off_client.c".
I have no problem with sending simple variable or a constant string array but if i declare an array dynamically and fill it with info that i want to send to the server, the server dont get the right data.   

Example:

The above image shows what inside the puffer that is sent over the mesh.
What i cant understand is that why can i send something like this: const char payload[5] = "Hello", but cant send the above? Am i missing something here?

Thank you for the help in advance.

Specifics:
Development software, with versions: SDKs = NordicMeshSDK_2.0.1, nRF5_SDK_15.0.0; IDE = SEGGER 3.34, SoftDevice = s140
Computer platform, with versions: Windows 10 with spring update
Hardware revisions: nRF52840

Related