<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to change publish address on nrf skd connect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79595/how-to-change-publish-address-on-nrf-skd-connect</link><description>Hello, 
 
 I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Sep 2021 12:40:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79595/how-to-change-publish-address-on-nrf-skd-connect" /><item><title>RE: How to change publish address on nrf skd connect</title><link>https://devzone.nordicsemi.com/thread/329618?ContentTypeID=1</link><pubDate>Wed, 15 Sep 2021 12:40:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73043c4b-c1f5-4979-9626-656b075cae3e</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We have an example of this type of behavior in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/mesh/chat/README.html"&gt;Bluetooth: Mesh chat&lt;/a&gt; example, where the chat model can publish to arbitrary addresses. How this works is described in detail on the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bt_mesh_vendor_model_chat_sample_walk_through.html#chat-sample-walk-through"&gt;Chat sample walk-through&lt;/a&gt; page. (Search for &amp;quot;sending of private messages&amp;quot; on that page.) Basically it uses bt_mesh_model_send() with a custom made context:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;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-&amp;gt;model-&amp;gt;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(&amp;amp;buf, BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE);

	net_buf_simple_add_mem(&amp;amp;buf, msg,
			       strnlen(msg,
				       CONFIG_BT_MESH_CHAT_CLI_MESSAGE_LENGTH));
	net_buf_simple_add_u8(&amp;amp;buf, &amp;#39;\0&amp;#39;);

	return bt_mesh_model_send(chat-&amp;gt;model, &amp;amp;ctx, &amp;amp;buf, NULL, NULL);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>