<?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>multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42451/multiple-clients-to-server-message-on-mesh</link><description>in the code below. implemented on a mesh form multiple Clients (Publication addresses) to the server (subscriped) to all the clients. 
 The code reads beacon data, removes the Minor ID, combine it with the Client UUID . This needs to be sent to the server</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 10 Feb 2019 17:40:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42451/multiple-clients-to-server-message-on-mesh" /><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/170240?ContentTypeID=1</link><pubDate>Sun, 10 Feb 2019 17:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fa3cc7d-a1b6-47ba-b9ed-15807d10c73c</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Edvin&lt;/p&gt;
&lt;p&gt;I have decided to discard this simple_message model from mesh v1. Its to old and I will now focus my research on the simple_on_off vendor model on mesh v3.1.&lt;/p&gt;
&lt;p&gt;I will start another thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169957?ContentTypeID=1</link><pubDate>Thu, 07 Feb 2019 14:35:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d700b26f-e7cd-42a7-bfb5-1657244d4750</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;HI Edvin thanks for the help so far.&amp;nbsp; I think my message is being sent correctly. I slowed it down by triggering it manually.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/debug_5F00_client_5F00_simple_5F00_message.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;On the server side Im facing the same problems as Narin here&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/31256/receiving-simple-message-mesh/123576"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/31256/receiving-simple-message-mesh/123576&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As&amp;nbsp;per Bjorn I have included the simple_message into main.c (Mesh v3) and changed &lt;code&gt;access_model_publish()&lt;/code&gt;&lt;span&gt;&amp;nbsp;function, use this statement instead:&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;code&gt;status= access_model_publish(m_server.model_handle, &amp;amp;msg);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;However &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;1. m_server is undeclared. -&amp;nbsp;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;2. Where do I extract the message in mesh v3, in the access.c or in simple_message_server.c&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void rx_get_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args)
{
simple_message_server_t * p_server = p_args;
NRF_MESH_ASSERT(p_server-&amp;gt;get_cb != NULL);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Get--&amp;quot;);
reply_status(p_server, p_message);
}&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Once again thank&amp;nbsp;you fpr the help and insight into converting mesh v1 simple_message to mesh v3 simple_message it is highly appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169639?ContentTypeID=1</link><pubDate>Wed, 06 Feb 2019 07:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9e79885-886d-454e-915e-828d1732494b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If you are sending acknowledged messages, then it will matter, because it can only queue so many packets. I suggest you start with the server side, so that you have something that is actually acknowledging the messages. Start to set it up so that you can send one simple message between the two, and take it from there.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169580?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 15:36:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:152bb11e-fa16-4885-9985-f88257f632c6</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;It seems to give&amp;nbsp;&lt;span&gt;Mesh error 7 when the&amp;nbsp; client does not have app bind key and a broadcast address set up. Once these are set up, the mesh error 7 is gone. But it now returns, Cannot send. Device is Busy&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I just need to add here, up to this point I have only been working on the client, The server has not been set up for simple_message yet and is running standard on_off_model. do don&amp;#39;t know if it may have something to do with that. I will now switch over to the server side.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169538?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 14:11:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8331585c-7282-4e22-be70-f4ca65548c54</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. so access_model_publish can return&amp;nbsp;NRF_ERROR_INVALID_PARAM which you can see in access.h.&lt;/p&gt;
&lt;p&gt;If you look at access_model_publish in access.c, you see that it can either return NRF_ERROR_NULL, or it returns the return value of packet_tx().&lt;/p&gt;
&lt;p&gt;Maybe your check_tx_params returns NRF_ERROR_INVALIT_PARAM. Try to debug in this function to figure out where/what function call that returns this value.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169487?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 11:57:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:865e3f2b-6b71-4286-8bdc-88dcdf27bde3</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;It seems to be inside my send message function. in&amp;nbsp;&lt;span&gt;access_model_publish&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;status= access_model_publish(m_clients[0].model_handle, &amp;amp;msg);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169427?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 08:27:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1e418c4-0ce5-439e-b196-d5ad81068eb1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Try to disable optimization on your project (set it to -O0), and then set a break point on line 115 in app_error_weak.c. When it stops there check the variables:&lt;/p&gt;
&lt;p&gt;p_info-&amp;gt;err_code. // it looks like this is 7&lt;br /&gt;pc,&amp;nbsp;&lt;br /&gt;p_info-&amp;gt;p_file_name, //this should contain the file name of the file that received an&amp;nbsp;ERROR_CHECK(err_code) where err_code != 0.&lt;br /&gt;p_info-&amp;gt;line_num // This should point to what line number in that file the ERROR_CHECK is located.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, when you find this, try to look at what function that returned the return value passed into ERROR_CHECK, and what it means when this function returns 7.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/169276?ContentTypeID=1</link><pubDate>Mon, 04 Feb 2019 11:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53824d0d-b97b-47c8-9f03-92587084b9ba</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Edvin I have have gone through the simple_on_off_model in the models/vendor directory )(MESH 3.00) . I then compared it to the old simple_message example from Bjorn for MESH SDK_1. Surprisingly a lot of the code is the same with minor differences. I can provision my newly based&amp;nbsp; simple_message sample without any problems.&lt;/p&gt;
&lt;p&gt;When I send my simple message I get the following error&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;t: 253118&amp;gt;, app_error_weak.c, 119, Mesh error 7 at 0x00026B33&amp;nbsp; (how do I know what this means)&lt;/p&gt;
&lt;p&gt;I also do the following check so I don&amp;#39;t send a message when the device is unprovisioned&lt;/p&gt;
&lt;p&gt;if (m_device_provisioned) {&amp;nbsp;send_message()&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;But I noticed that &amp;quot;&lt;span&gt;&lt;em&gt;m_device_provisioned&lt;/em&gt;&amp;quot; does not become &amp;quot;&lt;em&gt;true&lt;/em&gt;&amp;quot; after initial provisioning, only once the device is provisioned and reset then&amp;nbsp; &amp;quot;&lt;em&gt;m_device_provisioned&lt;/em&gt;&amp;quot; true. Is there another way for me to do this check during&amp;nbsp; the initial provisioning?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;thanks.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166752?ContentTypeID=1</link><pubDate>Mon, 21 Jan 2019 09:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aded6251-cf75-4fa0-ad3e-559ad7f6227a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think that what Bjørn is explaining in the ticket that you linked to is important. It seems like the snippet is for Mesh SDK1.0.0, which is old, and there has been a lot (!) of improvements, so I suggest that you start with SDK for mesh &amp;gt;= 3.0.0, and use the information in this setup to convert the onoff model to a simple_message model.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As long as you don&amp;#39;t change anything with the address setup you don&amp;#39;t have to worry about it, and let the provisioning handle the addresses. You should only need the&amp;nbsp;generic_onoff_client_set() or&amp;nbsp;generic_onoff_client_set_unack() (depending on whether you want the messages to be ACKed or not).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The address is stored in the m_clients[].model_handle when you provision.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166420?ContentTypeID=1</link><pubDate>Fri, 18 Jan 2019 09:20:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3d047c3-ced3-465d-81d5-167fc371e580</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thanks Edvin, I have removed it. I have 10 clients 1 server. I can provision them successfully with the client light switch example. Im trying to implement the following example&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29836/send-and-receive-a-string-via-access-layer"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/29836/send-and-receive-a-string-via-access-layer&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have the following error&amp;nbsp;&amp;nbsp;&amp;nbsp;address_set(address)&amp;nbsp; error ;undefined reference to `address_set&amp;#39;&lt;/p&gt;
&lt;p&gt;Where do I need to set this?&lt;/p&gt;
&lt;p&gt;Does this simple message example work on mesh 3 or 3.1? is there no working example available, it will really help a lot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166350?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 17:39:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35b31b01-2ad5-45ac-8ded-66913151cdd9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;This should not be used directly in main. But in config_server.c it is declared like:&lt;/p&gt;
&lt;p&gt;dsm_handle_t publish_address_handle = DSM_HANDLE_INVALID;&lt;/p&gt;
&lt;p&gt;This is just an empty handle that is populated in dsm_address_publish_add(publish_address, &amp;amp;publish_address_handle);&lt;/p&gt;
&lt;p&gt;If you have the address, you&amp;nbsp;&lt;strong&gt;may&lt;/strong&gt; do this manually, but as I mentioned, this should really (!) be done through the commissioning process. That is the reason why this function is not used in the main.c file in the examples.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you have not already, I suggest you read through the guide on how to run the light switch example here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/Mesh_SDK/v3-1-0/md_examples_light_switch_README"&gt;https://www.nordicsemi.com/DocLib/Content/SDK_Doc/Mesh_SDK/v3-1-0/md_examples_light_switch_README&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Depending on whether you have 2 or 3 nRF devices, you can either use one device as the provisioner(evaluate using the static provisioner), or you can use the nRF Mesh app as the provisioner (evaluate using the nRFMesh mobile app).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166318?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 15:54:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:463176ae-f950-49db-acb9-52110e46ead0</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;sorry yes handle&amp;nbsp;&amp;#39;m_central_handle&amp;#39; undeclared (first use in this function)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Where is this declared in my C and how?&amp;nbsp; If you can show me please.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166175?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 10:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c61a20e-5d7c-4c47-9b7d-db2d7cabe298</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What compiling error do you get?&lt;/p&gt;
&lt;p&gt;m_central_handle (nor m_central_handel) is declared in your main.c file. If you want to send a message to one node instead of all, you must send it on a channel that only one node is subscribing to. This is done during the provisioning. Please check the video link from my previous reply on how to set up publish and subscription channels.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166039?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 14:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5eaf607-930b-4932-afcf-c743e70565bd</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Edvin, I am running the sample light switch. I am capable of using the&amp;nbsp; mobile app and can provision a mesh network. I would like to know if the above simple_message implemented in the light switch&amp;nbsp; example will work. However I dont want to send to all nodes just 1&lt;/p&gt;
&lt;p&gt;&amp;nbsp;My problem with the above code is Im stuck with a compile error&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;m_central_handel is for some reason not declared&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;If you can assist me to get this working it would be great.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

/* HAL */
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;simple_hal.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;

/* Core */
#include &amp;quot;nrf_mesh_config_core.h&amp;quot;
#include &amp;quot;nrf_mesh_configure.h&amp;quot;
#include &amp;quot;nrf_mesh.h&amp;quot;
#include &amp;quot;mesh_stack.h&amp;quot;
#include &amp;quot;device_state_manager.h&amp;quot;
#include &amp;quot;access_config.h&amp;quot;

/* Provisioning and configuration */
#include &amp;quot;mesh_provisionee.h&amp;quot;
#include &amp;quot;mesh_app_utils.h&amp;quot;

/* Models */
#include &amp;quot;generic_onoff_client.h&amp;quot;

/* Logging and RTT */
#include &amp;quot;log.h&amp;quot;
#include &amp;quot;rtt_input.h&amp;quot;

/* Example specific includes */
#include &amp;quot;app_config.h&amp;quot;
#include &amp;quot;nrf_mesh_config_examples.h&amp;quot;
#include &amp;quot;light_switch_example_common.h&amp;quot;
#include &amp;quot;example_common.h&amp;quot;
#include &amp;quot;ble_softdevice_support.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;string.h&amp;quot;
#include &amp;quot;simple_message_common.h&amp;quot;
#define APP_STATE_OFF                (0)
#define APP_STATE_ON                 (1)

#define APP_UNACK_MSG_REPEAT_COUNT   (2)

static generic_onoff_client_t m_clients[CLIENT_MODEL_INSTANCE_COUNT];
static bool                   m_device_provisioned;
char scanner_UUID[17]; // scanner 2 bytes + 1

//#define DSM_NONVIRTUAL_ADDR_MAX (4)

//for below also investigate ? nrf_mesh_rx_cb_t This callback can be used to receive raw advertisement packets
static void rx_cb(const nrf_mesh_adv_packet_rx_data_t * p_rx_data) // used for listening for incoming packets  with function nrf_mesh_rx_cb_set(rx_cb);
{
    LEDS_OFF(BSP_LED_0_MASK);  /* @c LED_RGB_RED_MASK on pca10031 */
    char msg[64];
    char beacon_Minor_ID[5]; // the length of the eMbeacon unique ID
    char Result[24]; // 5+16+1 for nul term
    char beacon_uuid[37]; // the length of EM microelectronics packet**** check this it may be shorter
 


    memcpy(beacon_uuid,p_rx_data-&amp;gt;p_payload, p_rx_data-&amp;gt;length); // copy the UUID of the beacon
 // check if it is a EMbeacon Beacon make in bit 2:9
       if ((beacon_uuid[2]==0x45)|(beacon_uuid[3]==0x4D)|(beacon_uuid[4]==0x42)|(beacon_uuid[5]==0x65)
          |(beacon_uuid[6]==0x61)|(beacon_uuid[7]==0x63)|(beacon_uuid[8]==0x6f)|(beacon_uuid[9]==0x6e)) // EMBeacon name check
// if it is a beacon send PCA10059 (scanner) UUID and Beacon UUID to the server  on the mesh
    {     
      memcpy (beacon_Minor_ID,beacon_uuid + 10,5); // move the 5 unique beacon ID bytes for use in mesh to identify the beacon
      memcpy(Result, (void*) &amp;amp;scanner_UUID[0], 16); // combine Beacon Minor UUID and Scanner complete UUID 
      memcpy(&amp;amp;Result[16], (void*) &amp;amp;beacon_Minor_ID[0], 8); 
 
 // Transmit Result on the mesh  to the gateway server.
     send_message(void) // send hello on the mesh to see tes if it works
      

//Print all incoming into debug terminal
/*
sprintf(msg, &amp;quot;[%02x:%02x:%02x:%02x:%02x:%02x]&amp;quot;,
                 
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[0],
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[1],
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[2],
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[3],
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[4],
                   p_rx_data-&amp;gt;p_metadata-&amp;gt;params.scanner.adv_addr.addr[5]);*/
__LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, msg, p_rx_data-&amp;gt;p_payload, p_rx_data-&amp;gt;length);

            LEDS_ON(BSP_LED_0_MASK);  // @c LED_RGB_RED_MASK on pca10031 
    }
}


//simple send message example
void address_set(uint16_t addr)                 //function for setting address
{
  uint32_t err_code;
  err_code = dsm_address_publish_add(addr, &amp;amp;m_central_handle); //NRF_ERROR_NO_MEM
  ERROR_CHECK(err_code);
  ERROR_CHECK(access_model_publish_address_set(m_clients[0].model_handle, m_central_handle));
}


void send_message(void)                         //function for sending a simple message
{
    uint32_t status=0;
    uint8_t buffer[5] = &amp;quot;hello&amp;quot;;
    uint8_t length;
    uint16_t address;
    access_message_tx_t msg; // declare variable access.h
    length = sizeof(buffer); //SEGGER_RTT_Read(0, buffer, sizeof(buffer));
    
    if(length)
    {
      //no-need:SEGGER_RTT_WriteString(0, &amp;quot;entering message field\n&amp;quot;);
      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);
      printf(0,&amp;quot;Sending to group address 0x%04x\n&amp;quot;, address);
    status= access_model_publish(m_clients[3].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);
      }
    }
}


/* Forward declaration */
static void app_gen_onoff_client_publish_interval_cb(access_model_handle_t handle, void * p_self);
static void app_generic_onoff_client_status_cb(const generic_onoff_client_t * p_self,
                                               const access_message_rx_meta_t * p_meta,
                                               const generic_onoff_status_params_t * p_in);
static void app_gen_onoff_client_transaction_status_cb(access_model_handle_t model_handle,
                                                       void * p_args,
                                                       access_reliable_status_t status);

const generic_onoff_client_callbacks_t client_cbs =
{
    .onoff_status_cb = app_generic_onoff_client_status_cb,
    .ack_transaction_status_cb = app_gen_onoff_client_transaction_status_cb,
    .periodic_publish_cb = app_gen_onoff_client_publish_interval_cb
};

static void device_identification_start_cb(uint8_t attention_duration_s)
{
    hal_led_mask_set(LEDS_MASK, false);
    hal_led_blink_ms(BSP_LED_2_MASK  | BSP_LED_3_MASK, 
                     LED_BLINK_ATTENTION_INTERVAL_MS, 
                     LED_BLINK_ATTENTION_COUNT(attention_duration_s));
}

static void provisioning_aborted_cb(void)
{
    hal_led_blink_stop();
}

static void provisioning_complete_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Successfully provisioned\n&amp;quot;);

#if MESH_FEATURE_GATT_ENABLED
    /* Restores the application parameters after switching from the Provisioning
     * service to the Proxy  */
    gap_params_init();
    conn_params_init();
#endif

    dsm_local_unicast_address_t node_address;
    dsm_local_unicast_addresses_get(&amp;amp;node_address);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Node Address: 0x%04x \n&amp;quot;, node_address.address_start);

    hal_led_blink_stop();
    hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
    hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
}

/* This callback is called periodically if model is configured for periodic publishing */
static void app_gen_onoff_client_publish_interval_cb(access_model_handle_t handle, void * p_self)
{
     __LOG(LOG_SRC_APP, LOG_LEVEL_WARN, &amp;quot;Publish desired message here.\n&amp;quot;);
}

/* Acknowledged transaction status callback, if acknowledged transfer fails, application can
* determine suitable course of action (e.g. re-initiate previous transaction) by using this
* callback.
*/
static void app_gen_onoff_client_transaction_status_cb(access_model_handle_t model_handle,
                                                       void * p_args,
                                                       access_reliable_status_t status)
{
    switch(status)
    {
        case ACCESS_RELIABLE_TRANSFER_SUCCESS:
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Acknowledged transfer success.\n&amp;quot;);
            break;

        case ACCESS_RELIABLE_TRANSFER_TIMEOUT:
            hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Acknowledged transfer timeout.\n&amp;quot;);
            break;

        case ACCESS_RELIABLE_TRANSFER_CANCELLED:
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Acknowledged transfer cancelled.\n&amp;quot;);
            break;

        default:
            ERROR_CHECK(NRF_ERROR_INTERNAL);
            break;
    }
}

/* Generic OnOff client model interface: Process the received status message in this callback */
static void app_generic_onoff_client_status_cb(const generic_onoff_client_t * p_self,
                                               const access_message_rx_meta_t * p_meta,
                                               const generic_onoff_status_params_t * p_in)
{
    if (p_in-&amp;gt;remaining_time_ms &amp;gt; 0)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;OnOff server: 0x%04x, Present OnOff: %d, Target OnOff: %d, Remaining Time: %d ms\n&amp;quot;,
              p_meta-&amp;gt;src.value, p_in-&amp;gt;present_on_off, p_in-&amp;gt;target_on_off, p_in-&amp;gt;remaining_time_ms);
    }
    else
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;OnOff server: 0x%04x, Present OnOff: %d\n&amp;quot;,
              p_meta-&amp;gt;src.value, p_in-&amp;gt;present_on_off);
    }
}

static void node_reset(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- Node reset  -----\n&amp;quot;);
    hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_RESET);
    /* This function may return if there are ongoing flash operations. */
    mesh_stack_device_reset();
}

static void config_server_evt_cb(const config_server_evt_t * p_evt)
{
    if (p_evt-&amp;gt;type == CONFIG_SERVER_EVT_NODE_RESET)
    {
        node_reset();
    }
}

static void button_event_handler(uint32_t button_number)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Button %u pressed\n&amp;quot;, button_number);

    uint32_t status = NRF_SUCCESS;
    generic_onoff_set_params_t set_params;
    model_transition_t transition_params;
    static uint8_t tid = 0;

    /* Button 1: On, Button 2: Off, Client[0]
     * Button 2: On, Button 3: Off, Client[1]
     */

    switch(button_number)
    {
        case 0:
        case 2:
            set_params.on_off = APP_STATE_ON;
            break;

        case 1:
        case 3:
            set_params.on_off = APP_STATE_OFF;
            break;
    }

    set_params.tid = tid++;
    transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;
    transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Sending msg: ONOFF SET %d\n&amp;quot;, set_params.on_off);

    switch (button_number)
    {
        case 0:
        case 1:
            /* Demonstrate acknowledged transaction, using 1st client model instance */
            /* In this examples, users will not be blocked if the model is busy */
            (void)access_model_reliable_cancel(m_clients[0].model_handle);
            status = generic_onoff_client_set(&amp;amp;m_clients[0], &amp;amp;set_params, &amp;amp;transition_params);
            hal_led_pin_set(BSP_LED_0, set_params.on_off);
            break;

        case 2:
        case 3:
            /* Demonstrate un-acknowledged transaction, using 2nd client model instance */
            status = generic_onoff_client_set_unack(&amp;amp;m_clients[1], &amp;amp;set_params,
                                                    &amp;amp;transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_1, set_params.on_off);
            break;
    }

    switch (status)
    {
        case NRF_SUCCESS:
            break;

        case NRF_ERROR_NO_MEM:
        case NRF_ERROR_BUSY:
        case NRF_ERROR_INVALID_STATE:
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Client %u cannot send\n&amp;quot;, button_number);
            hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
            break;

        case NRF_ERROR_INVALID_PARAM:
            /* Publication not enabled for this client. One (or more) of the following is wrong:
             * - An application key is missing, or there is no application key bound to the model
             * - The client does not have its publication state set
             *
             * It is the provisioner that adds an application key, binds it to the model and sets
             * the model&amp;#39;s publication state.
             */
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Publication not configured for client %u\n&amp;quot;, button_number);
            break;

        default:
            ERROR_CHECK(status);
            break;
    }
}

static void rtt_input_handler(int key)
{
    if (key &amp;gt;= &amp;#39;0&amp;#39; &amp;amp;&amp;amp; key &amp;lt;= &amp;#39;3&amp;#39;)
    {
        uint32_t button_number = key - &amp;#39;0&amp;#39;;
        button_event_handler(button_number);
    }
}

static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initializing and adding models\n&amp;quot;);

    for (uint32_t i = 0; i &amp;lt; CLIENT_MODEL_INSTANCE_COUNT; ++i)
    {
        m_clients[i].settings.p_callbacks = &amp;amp;client_cbs;
        m_clients[i].settings.timeout = 0;
        m_clients[i].settings.force_segmented = APP_CONFIG_FORCE_SEGMENTATION;
        m_clients[i].settings.transmic_size = APP_CONFIG_MIC_SIZE;

        ERROR_CHECK(generic_onoff_client_init(&amp;amp;m_clients[i], i + 1));
    }
}

static void mesh_init(void)
{
    uint8_t dev_uuid[NRF_MESH_UUID_SIZE];
    uint8_t node_uuid_prefix[NODE_UUID_PREFIX_LEN] = CLIENT_NODE_UUID_PREFIX;

    ERROR_CHECK(mesh_app_uuid_gen(dev_uuid, node_uuid_prefix, NODE_UUID_PREFIX_LEN));
    mesh_stack_init_params_t init_params =
    {
        .core.irq_priority       = NRF_MESH_IRQ_PRIORITY_LOWEST,
        .core.lfclksrc           = DEV_BOARD_LF_CLK_CFG,
        .core.p_uuid             = dev_uuid,
        .models.models_init_cb   = models_init_cb,
        .models.config_server_cb = config_server_evt_cb
    };
    ERROR_CHECK(mesh_stack_init(&amp;amp;init_params, &amp;amp;m_device_provisioned));
/* Start listening for incoming packets */
    nrf_mesh_rx_cb_set(rx_cb);
}

static void initialize(void)
{
    __LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS | LOG_SRC_BEARER, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- PCA10059 CLIENT -----\n&amp;quot;);

    ERROR_CHECK(app_timer_init());
    hal_leds_init();

#if BUTTON_BOARD
    ERROR_CHECK(hal_buttons_init(button_event_handler));
#endif

    ble_stack_init();

#if MESH_FEATURE_GATT_ENABLED
    gap_params_init();
    conn_params_init();
#endif

    mesh_init();
}

static void start(void)
{
    rtt_input_enable(rtt_input_handler, RTT_INPUT_POLL_PERIOD_MS);

    if (!m_device_provisioned)
    {
        static const uint8_t static_auth_data[NRF_MESH_KEY_SIZE] = STATIC_AUTH_DATA;
        mesh_provisionee_start_params_t prov_start_params =
        {
            .p_static_data    = static_auth_data,
            .prov_complete_cb = provisioning_complete_cb,
            .prov_device_identification_start_cb = device_identification_start_cb,
            .prov_device_identification_stop_cb = NULL,
            .prov_abort_cb = provisioning_aborted_cb,
            .p_device_uri = NULL
        };
        ERROR_CHECK(mesh_provisionee_prov_start(&amp;amp;prov_start_params));
    }

//get this device UUID PCA10059
    const uint8_t *p_uuid = nrf_mesh_configure_device_uuid_get();
    UNUSED_VARIABLE(p_uuid);
    //strncpy (scanner_UUID,p_uuid,17); // copy the uuid
   memcpy(scanner_UUID, p_uuid,17);
    __LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Device UUID &amp;quot;, p_uuid, NRF_MESH_UUID_SIZE);

    ERROR_CHECK(mesh_stack_start());

    hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
 //   hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_START);
}

int main(void)
{ 

    /* Configure board. */
  bsp_board_init(BSP_INIT_LEDS);
  initialize();   
  start();

    for (;;)
    {
   (void)sd_app_evt_wait();
     
          }
}


&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/166019?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 14:16:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e92f4284-a4ab-4b65-93bc-59b3c1830ddf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think it will be easier to start with one of the Mesh SDK examples, rather than starting from scratch. The handles you will get from the provisioner. You need to provision your devices in order to communicate between them. To provision you can either use the light_switch-&amp;gt;provisioner example, or you can use the nRF Mesh app for mobile. For a simple description on how to use this app, please check the youtube link on &lt;a href="https://github.com/NordicPlayground/thingy52-mesh-provisioning-demo"&gt;this site&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/165827?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 18:02:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57cf025c-aa68-4bb6-9cb7-fe606eae1b8d</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thanks Edvin&lt;/p&gt;
&lt;p&gt;Will the simple_message_client work&lt;/p&gt;
&lt;p&gt;for me here? Mesh V3.00&lt;/p&gt;
&lt;p&gt;If so where do I declare&amp;nbsp;m_central_handel -&amp;nbsp; im getting a compile error.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//simple send message example
void address_set(uint16_t addr)                 //function for setting address
{
  uint32_t err_code;
  err_code = dsm_address_publish_add(addr, &amp;amp;m_central_handle); //NRF_ERROR_NO_MEM
  ERROR_CHECK(err_code);
  ERROR_CHECK(access_model_publish_address_set(m_clients[0].model_handle, m_central_handle));
}


void send_message(void)                         //function for sending a simple message
{
    uint32_t status=0;
    uint8_t buffer[5] = &amp;quot;hello&amp;quot;;
    uint8_t length;
    uint16_t address;
    access_message_tx_t msg; // declare variable access.h
    length = sizeof(buffer); //SEGGER_RTT_Read(0, buffer, sizeof(buffer));
    
    if(length)
    {
      //no-need:SEGGER_RTT_WriteString(0, &amp;quot;entering message field\n&amp;quot;);
      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);
      printf(0,&amp;quot;Sending to group address 0x%04x\n&amp;quot;, address);
    status= access_model_publish(m_clients[3].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;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: multiple clients to server  message on Mesh</title><link>https://devzone.nordicsemi.com/thread/165482?ContentTypeID=1</link><pubDate>Mon, 14 Jan 2019 13:39:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:674deea4-d93a-43bc-abe5-8c12d3ae74da</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You must have a model that can transfer your packet. &amp;quot;Model&amp;quot; = Bluetooth mesh &amp;quot;service&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The light switch example uses an on_off_model. This can only transfer a single byte, and it actually only holds a bool, so you need to modify this model to contain a string. See how the publish function is used in the light switch example, and see if you can modify/create a model that holds this array instead of just an on_off state.&lt;/p&gt;
&lt;p&gt;Depending on the number of nodes in your mesh network, using access_model_&lt;strong&gt;reliable&lt;/strong&gt;_publish may not be a good idea. This requires the node that subscribes to the messages to send an ACK, doubling the amount of messages travelling around in your network. If you don&amp;#39;t have too many nodes subscribing, this will probably be ok, but if it was a lighting system, and all the lightbulbs in a warehouse were to ACK all messages, the mesh will be flooded with messages.&amp;nbsp; That being said, there is no maximum number of nodes that can publish on a channel which the server subscribes to. Only the maximum number of nodes in a network will be the theoretical limit for this, which&amp;nbsp; is around 32 000 nodes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>