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

How to change publish address on nrf skd connect

Hello,

I'm programming a nrf5340-dk using nrf sdk connect 1.6.0 and i wanted to change the publish address in order to be able to control multiple nodes using only one dev board. I see a lot of examples using dsm and access libraries present in nrf sdk mesh however i can't seem to find them in skd connect.

How can i change the publish addres on nrf connect sdk?

My best regards,

David Abreu

Parents
  • Hi,

    We have an example of this type of behavior in the Bluetooth: Mesh chat example, where the chat model can publish to arbitrary addresses. How this works is described in detail on the Chat sample walk-through page. (Search for "sending of private messages" on that page.) Basically it uses bt_mesh_model_send() with a custom made context:

    int bt_mesh_chat_cli_private_message_send(struct bt_mesh_chat_cli *chat,
    					  uint16_t addr,
    					  const uint8_t *msg)
    {
    	struct bt_mesh_msg_ctx ctx = {
    		.addr = addr,
    		.app_idx = chat->model->keys[0],
    		.send_ttl = BT_MESH_TTL_DEFAULT,
    		.send_rel = true,
    	};
    
    	BT_MESH_MODEL_BUF_DEFINE(buf, BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE,
    				 BT_MESH_CHAT_CLI_MSG_MAXLEN_MESSAGE);
    	bt_mesh_model_msg_init(&buf, BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE);
    
    	net_buf_simple_add_mem(&buf, msg,
    			       strnlen(msg,
    				       CONFIG_BT_MESH_CHAT_CLI_MESSAGE_LENGTH));
    	net_buf_simple_add_u8(&buf, '\0');
    
    	return bt_mesh_model_send(chat->model, &ctx, &buf, NULL, NULL);
    }

    Regards,
    Terje

Reply
  • Hi,

    We have an example of this type of behavior in the Bluetooth: Mesh chat example, where the chat model can publish to arbitrary addresses. How this works is described in detail on the Chat sample walk-through page. (Search for "sending of private messages" on that page.) Basically it uses bt_mesh_model_send() with a custom made context:

    int bt_mesh_chat_cli_private_message_send(struct bt_mesh_chat_cli *chat,
    					  uint16_t addr,
    					  const uint8_t *msg)
    {
    	struct bt_mesh_msg_ctx ctx = {
    		.addr = addr,
    		.app_idx = chat->model->keys[0],
    		.send_ttl = BT_MESH_TTL_DEFAULT,
    		.send_rel = true,
    	};
    
    	BT_MESH_MODEL_BUF_DEFINE(buf, BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE,
    				 BT_MESH_CHAT_CLI_MSG_MAXLEN_MESSAGE);
    	bt_mesh_model_msg_init(&buf, BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE);
    
    	net_buf_simple_add_mem(&buf, msg,
    			       strnlen(msg,
    				       CONFIG_BT_MESH_CHAT_CLI_MESSAGE_LENGTH));
    	net_buf_simple_add_u8(&buf, '\0');
    
    	return bt_mesh_model_send(chat->model, &ctx, &buf, NULL, NULL);
    }

    Regards,
    Terje

Children
No Data
Related