<?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>Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87304/accessing-mesh-relay-data-from-the-application-layer-in-zephyr</link><description>Is there a way to access the data that comes into a provisioned node and is relayed on the mesh network, from the application layer in Zephyr? 
 I have a battery models erver and I set it up for publishing to a certain address 
 On another device I subscribed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Apr 2022 13:33:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87304/accessing-mesh-relay-data-from-the-application-layer-in-zephyr" /><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/365606?ContentTypeID=1</link><pubDate>Fri, 29 Apr 2022 13:33:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e71d3b36-e6e3-406f-ba7f-1106465a3984</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;Update2&lt;/p&gt;
&lt;p&gt;Set up publication and subscription to battery model - all succeeded&lt;/p&gt;
&lt;p&gt;Battery client and server set up as above&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Tried calling bt_mesh_battery_cli_get(batt_client,NULL,NULL) - get an error -125&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Stumped. Please help&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/365487?ContentTypeID=1</link><pubDate>Thu, 28 Apr 2022 22:00:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caa474a9-7d80-4ef6-afb3-c331b4ac5069</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;Update&lt;/p&gt;
&lt;p&gt;I added a battery model client and set up&amp;nbsp; a handler but I&amp;#39;m still not getting any battery info on the receiving side&lt;/p&gt;
&lt;p&gt;The client is instantiated as follows&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; bt_mesh_battery_cli &amp;nbsp;_batt_client = &lt;/span&gt;&lt;span&gt;BT_MESH_BATTERY_CLI_INIT&lt;/span&gt;&lt;span&gt;(&amp;amp;batt_cli_handler);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; bt_mesh_model root_models&lt;/span&gt;&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; = {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_MODEL_CFG_SRV&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_MODEL_HEALTH_SRV&lt;/span&gt;&lt;span&gt;(&amp;amp;_health_srv, &amp;amp;_health_pub), &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;//TODO: FW reporting. Possibly use level server?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;// config and health clients needed for mesh shell,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_MODEL_BATTERY_SRV&lt;/span&gt;&lt;span&gt;(&amp;amp;_batt_srv), &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_MODEL_CFG_CLI&lt;/span&gt;&lt;span&gt;(&amp;amp;_config_client),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_MODEL_BATTERY_CLI&lt;/span&gt;&lt;span&gt;(&amp;amp;_batt_client),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; bt_mesh_elem elements&lt;/span&gt;&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; = {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;BT_MESH_ELEM&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, root_models, vnd_models),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I then provision the device and enable publish on the battery model.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;mesh mod-pub 0x00ab 0x100c 0xC002 0 0 5 74 2 200&lt;/div&gt;
&lt;div&gt;That succeeds and I see messages from my &amp;quot;get&amp;quot; opcode handler in the debug log&lt;/div&gt;
&lt;div&gt;Then I provision a second device and subscribe to the battery server like so&lt;/div&gt;
&lt;div&gt;&amp;nbsp;mesh mod-sub-add 0x100 0xC002 0x100c&lt;/div&gt;
&lt;div&gt;This also succeeds&amp;nbsp;&lt;/div&gt;
&lt;div&gt;I see that the messages arrive&amp;nbsp; in the log (see below)&lt;/div&gt;
&lt;div&gt;But my&amp;nbsp;&lt;span&gt;batt_cli_handler function is not called.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;What am I missing?&lt;/div&gt;
&lt;div&gt;Thanks&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;00&amp;gt; [00:03:55.746,795] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_decode: 28 bytes: 689acc3f34f33bdb64a2426c9b21cf38aed1a8ff82ee42a7dd145947&lt;br /&gt;00&amp;gt; [00:03:55.746,826] &amp;lt;dbg&amp;gt; bt_mesh_net_keys: bt_mesh_net_cred_find: &lt;br /&gt;00&amp;gt; [00:03:55.746,826] &amp;lt;dbg&amp;gt; bt_mesh_net: net_decrypt: NID 0x68&lt;br /&gt;00&amp;gt; [00:03:55.746,826] &amp;lt;dbg&amp;gt; bt_mesh_net: net_decrypt: IVI 0 net-&amp;gt;iv_index 0x00000000&lt;br /&gt;00&amp;gt; [00:03:55.746,856] &amp;lt;dbg&amp;gt; bt_mesh_net: net_decrypt: src 0x00ab&lt;br /&gt;00&amp;gt; [00:03:55.746,948] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_decode: Decryption successful. Payload len 24&lt;br /&gt;00&amp;gt; [00:03:55.746,978] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_decode: src 0x00ab dst 0xc002 ttl 5&lt;br /&gt;00&amp;gt; [00:03:55.747,039] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_decode: PDU: 68050000b400abc0026361ef25f1233a49acf4bcc8ad5865&lt;br /&gt;00&amp;gt; [00:03:55.747,161] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_relay: TTL 5 CTL 0 dst 0xc002&lt;br /&gt;00&amp;gt; [00:03:55.747,192] &amp;lt;dbg&amp;gt; bt_mesh_net: bt_mesh_net_relay: Relaying packet. TTL is now 4&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/365250?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 15:16:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e66c6b7a-b22f-4fe1-b98d-aa83ee0ff296</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;I see, thank you for help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/365140?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 09:31:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f694547-89f9-4557-ba67-1d15aa06c93e</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;No worries.&lt;/p&gt;
[quote user="AndyM"]My expectation is&amp;nbsp; that if&amp;nbsp; node A&amp;nbsp; battery model is configured to publish to an address 123 and node B battery model is subscribed to receive messages from address 123,&amp;nbsp;node B should receive a message from node A when it publishes it&amp;nbsp;[/quote]
&lt;p&gt;This is correct, given that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The models are of correct types for the message (e.g. a battery server model publishing a Generic Battery Status message, and a battery client model receiving it.)&lt;/li&gt;
&lt;li&gt;Both models are bound to the same application key (through configuration)&lt;/li&gt;
&lt;/ul&gt;
[quote user="AndyM"]how can this message be examined at the application layer? Is&amp;nbsp; there an opcode handler that I need to implement?[/quote]
&lt;p&gt;Please have a look at the API documentation for the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/bluetooth_services/mesh/gen_battery_srv.html"&gt;Generic Battery Server&lt;/a&gt; and the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/bluetooth_services/mesh/gen_battery_cli.html"&gt;Generic Battery Client&lt;/a&gt; libraries. For the server model, the state (i.e. the battery state) is kept in memory controlled by the application layer. For the client side, the call to &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/bluetooth_services/mesh/gen_battery_cli.html#c.bt_mesh_battery_cli_get"&gt;bt_mesh_battery_cli_get()&lt;/a&gt; will either block (filling the provided memory with the response before it returns) or it will call a callback function (if said memory pointer is NULL).&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><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/364997?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 14:51:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bad46ab3-b97b-4b91-82e8-3ab76443e0bb</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;The former. The model that the message is addressed to, in this case a battery server model. It is configured to publish to a group address. My expectation is&amp;nbsp; that if&amp;nbsp; node A&amp;nbsp; battery model is configured to publish to an address 123 and node B battery model is subscribed to receive messages from address 123,&amp;nbsp;node B should receive a message from node A when it publishes it&amp;nbsp; If that understanding is correct, how can this message be examined at the application layer? Is&amp;nbsp; there an opcode handler that I need to implement? Sorry I&amp;#39;m still a newbie in mesh..Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing mesh relay data from the application layer in Zephyr</title><link>https://devzone.nordicsemi.com/thread/364946?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 12:24:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4044ee0a-86fa-4542-be91-1da4e9bd4e9b</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are we talking about receiving data on the device and model that the message is addressed for, or are we talking about looking at the data on a Relay node in-between? On Relay nodes you cannot see messages that are not addressed to the node, and the messages are also often encrypted using an application key that is not present on the Relay node.&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>