<?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>Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29836/send-and-receive-a-string-via-access-layer</link><description>Hi Team 
 I studied the examples for Bluetooth 5 mesh but i didn&amp;#39;t find an example to communicate through
access leyer. Can you give us some example lines of code, how this can be done? I&amp;#39;m working with the light-switch demo at the moment.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Apr 2019 14:07:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29836/send-and-receive-a-string-via-access-layer" /><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/181654?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 14:07:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7796d56-28c4-4412-b9bd-46241527eaf2</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Please create a new devzone case. We will take a look at it there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/181586?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 12:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6e45d45-4c6a-4763-8239-0129a0810a59</guid><dc:creator>Guille</dc:creator><description>&lt;p&gt;Hello Bjorn:&lt;/p&gt;
&lt;p&gt;I have the&amp;nbsp;nrf5SDKforMeshv310src folder and I can&amp;#39;t make it works, propertly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could you give me some advice of the steps that I need to cover?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks a lot&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/129729?ContentTypeID=1</link><pubDate>Wed, 25 Apr 2018 11:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9553734-cf49-4567-abe5-2188461114f6</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Please create a new thread for this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/129626?ContentTypeID=1</link><pubDate>Tue, 24 Apr 2018 18:00:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa489d13-01e0-4c49-82fb-c9e00993eafc</guid><dc:creator>husain.smb</dc:creator><description>&lt;p&gt;Hi Bjorn,&lt;/p&gt;
&lt;p&gt;So I have implemented the above code. Now I am able to take inputs from the UART port of the client&amp;nbsp; and send it to the UART port of the Server. But I am unable to do vice versa.But when I change the address from 0xCAFE to 0x0001 which is the provisioner address(in this case the client) the string I send from the server is printed on the debug terminal.But I am not able to find the place where it is received.I checked and it does not come into the handle_incoming() function as is the case with the =&amp;gt; Client to Server communication.&lt;/p&gt;
&lt;p&gt;Can you please help me figure this out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/128949?ContentTypeID=1</link><pubDate>Thu, 19 Apr 2018 10:59:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f46e210a-5dae-49c1-bfe4-d481c8d9d3db</guid><dc:creator>vijayrakesh</dc:creator><description>&lt;p&gt;I tried for this but its not working for me.. I there any working code to share&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/127841?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 12:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:336b1c2a-d036-439d-872c-de5357ab2cb2</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;As explained in my answer, this example only shows how to broadcast a message to all nodes. Could you please create a new devzone case &amp;amp; we will take a look at it there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/127777?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 09:28:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f350686-d2ee-4e8d-95fd-5fe2e4314e48</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;How to set the address to unicast address instead of&amp;nbsp;&lt;code&gt;0xCAFE&amp;nbsp;&lt;/code&gt;?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/127399?ContentTypeID=1</link><pubDate>Mon, 09 Apr 2018 10:37:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0da92e92-cb9b-4e98-9d96-6d10487cf663</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Not that I know of but my guess is that this would be quite similar to the example above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/126219?ContentTypeID=1</link><pubDate>Wed, 28 Mar 2018 07:44:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99659b46-5e58-4345-92c4-70df38fa402f</guid><dc:creator>Igor</dc:creator><description>&lt;p&gt;Is there any working example of server&amp;lt;-&amp;gt;client mesh reliable send/receive available?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/124566?ContentTypeID=1</link><pubDate>Thu, 15 Mar 2018 12:09:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:730d0856-a3bb-47b5-b98b-51bcce054ddc</guid><dc:creator>Pooja</dc:creator><description>&lt;p&gt;How we send string through advertising packet with unicast address and ttl value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/123957?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 14:12:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:617cea9d-979a-4935-8c05-7bc8247dda78</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;See the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/31256/receiving-simple-message-mesh/123576" target="_blank" rel="noopener noreferrer"&gt;comment I posted here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/123853?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 09:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee44481d-b012-4137-8cc1-db3aaad1d122</guid><dc:creator>Pooja</dc:creator><description>&lt;p&gt;how other node receive the published message?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/123577?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:14:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6afb5bc1-93da-4acb-b1bf-abfb76820d02</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Sorry for the delayed response. What is&amp;nbsp;currently not working for you in the above example?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/121775?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 10:58:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:175420ac-7147-44b4-8bf8-6fe5c3c65ffe</guid><dc:creator>Kvadratukas</dc:creator><description>&lt;p&gt;has anyone made this work and or willing to share a working example?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118555?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2018 06:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40fcd02d-3c90-49cd-97b5-7d014ea2502d</guid><dc:creator>swap007</dc:creator><description>&lt;p&gt;Thank you Bjorn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118551?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 12:50:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0d0a375-5a52-4735-999e-d74ec5f607d8</guid><dc:creator>Gerry</dc:creator><description>&lt;p&gt;Thanks Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118554?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2018 11:42:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe82b412-9139-47a3-be3e-d6cf43384f32</guid><dc:creator>koustubhavachat</dc:creator><description>&lt;p&gt;I am also facing the similar issue as mentioned above. A device is not getting provisioned.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118553?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2018 10:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:150fd08f-24aa-4a7f-a911-87517496238f</guid><dc:creator>Aman Chandan</dc:creator><description>&lt;p&gt;Hi Bjørn, when I run these projects, the provisioning is not getting established.This is client code rtt log.
&amp;lt;t:      59167&amp;gt;, provisioner.c,  227, Local provisioning link established
&amp;lt;t:      60998&amp;gt;, provisioner.c,  212, Using static authentication
&amp;lt;t:      72481&amp;gt;, provisioner.c,  221, Static authentication data provided
&amp;lt;t:     108612&amp;gt;, provisioner.c,  235, Unexpected event: 13.
&amp;lt;t:     112053&amp;gt;, provisioner.c,  182, Local provisioning link closed
&amp;lt;t:     112056&amp;gt;, provisioner.c,  185, Provisioning failed. Retrying...
&amp;lt;t:     175442&amp;gt;, provisioner.c,  227, Local provisioning link established
Can you help me to resolve this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118552?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2018 04:13:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:089d24a4-99f4-4401-acad-fab6db4d9595</guid><dc:creator>swap007</dc:creator><description>&lt;p&gt;Hi Bjørn, Thank you for your reply.
could u please upload &amp;quot;simple_message&amp;quot; folder which u mentioned to copy in models?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send and receive a string via access layer</title><link>https://devzone.nordicsemi.com/thread/118550?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2018 15:30:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e48a3efe-02e2-4039-8b8f-507a6d557730</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Sorry for the confusion. I have tried to find out what the reason is that the client is not provisioning correctly, but it seems the issue is more complicated than I thought. Instead of posting a solution which currently does not work &amp;amp; only works for an outdated Mesh SDK, I think it would be best for now to explain how messaging can work on a theoretical level with mesh in the access layer. Sorry for any confusion caused.&lt;/p&gt;
&lt;p&gt;You can most likely base mesh messaging off of the light switch example in the Mesh SDK v1.0.0. &lt;strong&gt;In the light switch client example main.c file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To make this simple, I will assume you only want to send a message from one node to all of the other nodes on the mesh network. In order to do this, we can use the &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/simple_5F00_message.zip"&gt;simple_message model&lt;/a&gt; created by an application engineer at Nordic. You&amp;#39;ll want to download the file &amp;amp; extract it to the models folder in the Mesh SDK v1.0.0. I would get rid of one of the folders, so that the path to the folders &lt;code&gt;img, include, simple_message &amp;amp; src&lt;/code&gt; become &lt;code&gt;MeshSDK/models/simple_message&lt;/code&gt; instead of &lt;code&gt;MeshSDK/models/simple_message/simple_message&lt;/code&gt; You&amp;#39;ll want to include the simple_message_client.c file in the Simple OnOff Model folder in SES. In addition, you&amp;#39;ll want to include the header files located in the &lt;code&gt;models/simple_message/include&lt;/code&gt; folder. See &lt;a href="https://devzone.nordicsemi.com/blogs/1032/segger-embedded-studio-a-cross-platform-ide-w-no-c/"&gt;this tutorial for help&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t status=0;
uint8_t buffer[30];
uint8_t length;
uint16_t address;
access_message_tx_t msg;
length= SEGGER_RTT_Read(0,buffer, sizeof(buffer));
           if (length)
            {
              msg.opcode.opcode =simple_message_OPCODE_SEND;
              msg.opcode.company_id = 0x0059; // Nordic&amp;#39;s company ID
      
              msg.p_buffer = (const uint8_t *) &amp;amp;buffer[0];
              msg.length =length;
              address = 0xCAFE;
              address_set(address);
              SEGGER_RTT_printf(0,&amp;quot;Sending to group address 0x%04x\n&amp;quot;, address);
              status= access_model_publish(m_clients[0].model_handle, &amp;amp;msg);

              if (status == NRF_ERROR_INVALID_STATE ||
              status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
               {
                 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
                  hal_led_blink_ms(LEDS_MASK, 50, 4);
               }
               else
               {
                     ERROR_CHECK(status);
               }
            }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To send a message, you could have two instances of Segger RTT viewer open. The status variable is used later in the code to see if the device is busy &amp;amp; to check for any errors that might have occurred. Going through the code, you will then need a buffer to store the message you want to send from one node to another node. The next variable is the length of the input message &amp;amp; is updated once the SEGGER_RTT_Read() function reads the input from the RTT terminal. Next, you can declare an address, which in our case will be the broadcast address to all of the other mesh nodes.&lt;/p&gt;
&lt;p&gt;You will also need to declare a variable &lt;code&gt;access_message_tx_t msg;&lt;/code&gt; of struct &lt;code&gt;access_message_txt_t&lt;/code&gt;. This struct is defined in the &lt;code&gt;access.h&lt;/code&gt; file.
The next statement after the if block sets the 14-bit or 7-bit Bluetooth SIG defined opcode or 6-bit vendor specific opcode (see &lt;code&gt;access.h&lt;/code&gt;). The &lt;code&gt;simple_message_OPCODE_SEND&lt;/code&gt; is defined in the simple message model. Then, you want to set the company ID, which in this case is Nordic&amp;#39;s company ID. The next line sets the pointer to the address where the message starts. I am assuming you start the message at the buffer index 0. You also need to define the length of the message. As mentioned previously, the address is set to the broadcast address for all of the mesh nodes.&lt;/p&gt;
&lt;p&gt;The address_set function is defined as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    void address_set(uint16_t addr)
{
   ERROR_CHECK(dsm_address_publish_add(addr, &amp;amp;m_central_handle));
   ERROR_CHECK(access_model_publish_address_set(m_server.model_handle, m_central_handle));
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;amp; checks for errors. Then, you can add a print command to make understand what is happening in the real time terminal &amp;amp; call the access_model_publish function (see &lt;code&gt;access.c&lt;/code&gt; &amp;amp; &lt;code&gt;access.h&lt;/code&gt;). This function publishes an access layer message to the publish address of the model, which in our case is the broadcast address to all of the nodes.&lt;/p&gt;
&lt;p&gt;Lastly, some checks are done to ensure that the device is not busy or one last error_check is done.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inside the &lt;strong&gt;message_server&lt;/strong&gt; main.c file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Use the same code as above but make a few changes:&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;access_model_publish()&lt;/code&gt; function, use this statement instead:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;status= access_model_publish(m_server.model_handle, &amp;amp;msg);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That should hopefully be the main things to be able to broadcast a message from one node to every other node (regardless of whether the node is a client or a server). I have not tested this to make sure it works in the latest Mesh SDK, so there could be some errors. Hope that helps!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>