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

Change payload from light_switch to array of char

Hello,

I'm using the examples light_switch_server_nrf52832 and light_switch_client_nrf52832 to send data over Bluetooth Mesh. Using the description from creating new models from nRF 5 SDK for mesh, I did try the change the payload from both sides. Are there any example of string payload for server and client on Bluetooth Mesh?

  • Hi,

    Unfortunately, we do not have an example for sending a generic length byte array payload. But should not be very difficult to modify the simple on/off server/client to support it.

    // Example use:
    
    const char var_msg[] = "Hello, World!"
    
    access_message_tx_t msg;
    memset(&msg, 0, sizeof(msg));
    msg.opcode.opcode = OPCODE_VARIABLE_LENGTH;
    msg.opcode.company_id = MY_COMPANY_ID;
    msg.p_buffer = (const uint8_t *) & var_msg;
    msg.length = sizeof(var_msg);
    access_publish(model_handle, &msg):

Related