<?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>Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56921/adding-simple-onoff-model-to-generic-onoff-server-example</link><description>Hello, 
 I&amp;#39;m using Mesh SDk4.0.0 and SD v7.0.1. I have tested the light switch client and server examples. 
 Now I want to add some more models for additional functionality. I want to start with adding simple onOff model present in models\vendor\simple_on_off</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Mar 2020 13:27:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56921/adding-simple-onoff-model-to-generic-onoff-server-example" /><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/241850?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 13:27:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e0ebe50-1b42-4285-9c48-84b038951acb</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;There was error in initializing the model here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initializing and adding models\n&amp;quot;);
    //NOTE Only SimpleOnOffServer will be initialized. To use both models, constants in nrf_mesh_config.h should be adjusted to allow more models.
    //app_model_init();
//    ERROR_CHECK(simple_on_off_server_init(&amp;amp;my_simple_onoff_server_0, APP_ONOFF_ELEMENT_INDEX)); //NOTE Added
//    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;My Simple OnOff Model Handle: %d\n&amp;quot;, my_simple_onoff_server_0.model_handle);
    ERROR_CHECK(simple_message_server_init(&amp;amp;my_simple_message_server_0, APP_ONOFF_ELEMENT_INDEX)); //NOTE Added
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;My Simple Message Model Handle: %d\n&amp;quot;, my_simple_message_server_0.model_handle);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After this, I was able to receive data from provisioner/mobile app.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/239135?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 13:43:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:876546e0-8d22-48f3-a451-ce0de0294aac</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;May be you could shed a light on it?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/joakim_2d00_jakobsen"&gt;Joakim Jakobsen&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/238567?ContentTypeID=1</link><pubDate>Fri, 06 Mar 2020 14:57:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74fcb7a8-a15a-4f77-a5db-caad7a4f8631</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;I have tried to translate what I receive, this is what I receive:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;2392286&amp;gt;, main.c,&amp;nbsp; 137, &amp;Aacute;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It seems that I receive character&amp;nbsp;&lt;strong&gt;&amp;Aacute;&lt;/strong&gt; in the data field which is equivalent to &lt;strong&gt;0xC1&lt;/strong&gt; hex. Hence I&amp;#39;m receiving the Opcode sent from Mesh app instead of actual data. Any pointer why I&amp;#39;m getting this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/238338?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 14:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:405f42aa-cdd2-4dd1-bc0f-d881af5846f4</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;Thanks Matevz,&lt;/p&gt;
&lt;p&gt;Using this method I have added &lt;strong&gt;simple_onoff_model&lt;/strong&gt; and tested it, working fine. I also added &lt;strong&gt;simple_message_server&lt;/strong&gt; which seems working as provisioning is successful and can send data. But the data is not as expected. I was expecting a string but some garbage is being received.&lt;/p&gt;
&lt;p&gt;On sending data, in the &lt;strong&gt;my_simple_message_server_set_cb()&lt;/strong&gt; function, I get response on RTT like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;t:    3497967&amp;gt;, main.c,  136, MySimpleMessageServer set CB scr=&#x4;, dst=&#x2; data: &amp;#176;, len: 2&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m attaching the project and simple_message_model files.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mesh_5F00_light_5F00_server_5F00_modified_5F00_code.zip"&gt;devzone.nordicsemi.com/.../mesh_5F00_light_5F00_server_5F00_modified_5F00_code.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have also noticed that in the &lt;strong&gt;Vendor Model Controls (nRF Mesh&lt;/strong&gt;&amp;nbsp;mobile app), Parameters does not allow to send data more than one byte, how to send a string through it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/238145?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 20:42:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a330e816-b5f0-4f2a-b01a-3c110b3ff609</guid><dc:creator>Matevz B</dc:creator><description>&lt;p&gt;Hi Aftab,&lt;/p&gt;
&lt;p&gt;I have just accomplished your first task - implementing SimpleOnOff Server into LightSwitchServer Example.&lt;/p&gt;
&lt;p&gt;I commented out the initialization of the GenericOnOffServer and I only initialize SimpleOnOffServer.&lt;/p&gt;
&lt;p&gt;In addition to modifying the main.c file, simple_on_off_server.c should be added to the folder structure of the solution and in project options include folder of SimpleOnOffServer must be added to user include directories of preprocessor. (I hope I did not forget anything).&lt;/p&gt;
&lt;p&gt;Below is the modified main.c file. All changes are noted with a comment //NOTE. Additionaly button 2 alternatively calls get and set callbacks for testing purposes.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Copyright (c) 2010 - 2019, 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_gatt.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;
#include &amp;quot;proxy.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_server.h&amp;quot;
#include &amp;quot;simple_on_off_server.h&amp;quot; //NOTE Added.

/* 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;example_common.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;app_onoff.h&amp;quot;
#include &amp;quot;ble_softdevice_support.h&amp;quot;

#define ONOFF_SERVER_0_LED          (BSP_LED_0)
#define ONOFF_SERVER_2_LED          (BSP_LED_2) //NOTE Added.
#define APP_ONOFF_ELEMENT_INDEX     (0)

static bool m_device_provisioned;

uint8_t my_test_uint8_t = 0; //NOTE Added for testing.

/*************************************************************************************************/
static void app_onoff_server_set_cb(const app_onoff_server_t * p_server, bool onoff);
static void app_onoff_server_get_cb(const app_onoff_server_t * p_server, bool * p_present_onoff);


/* Generic OnOff server structure definition and initialization */
APP_ONOFF_SERVER_DEF(m_onoff_server_0,
                     APP_CONFIG_FORCE_SEGMENTATION,
                     APP_CONFIG_MIC_SIZE,
                     app_onoff_server_set_cb,
                     app_onoff_server_get_cb)

/* Callback for updating the hardware state */
static void app_onoff_server_set_cb(const app_onoff_server_t * p_server, bool onoff)
{
    /* Resolve the server instance here if required, this example uses only 1 instance. */

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Setting GPIO value: %d\n&amp;quot;, onoff)

    hal_led_pin_set(ONOFF_SERVER_0_LED, onoff);
}

/* Callback for reading the hardware state */
static void app_onoff_server_get_cb(const app_onoff_server_t * p_server, bool * p_present_onoff)
{
    /* Resolve the server instance here if required, this example uses only 1 instance. */

    *p_present_onoff = hal_led_pin_get(ONOFF_SERVER_0_LED);
}

static void app_model_init(void)
{
    /* Instantiate onoff server on element index APP_ONOFF_ELEMENT_INDEX */
    ERROR_CHECK(app_onoff_init(&amp;amp;m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX));
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;App OnOff Model Handle: %d\n&amp;quot;, m_onoff_server_0.server.model_handle);
}


// NOTE define set and get callbacks
// This callback is called when a message with opcode set (0xC1) is received. 
// It sets selected output to received bool value, and returns the new bool value
static bool my_simple_onoff_server_set_cb(const simple_on_off_server_t * p_self, bool onoff)
{
  /* If there are more servers, resolve it here. See above. */
  __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;MySimpleOnOffServer set CB setting GPIO value: %d\n&amp;quot;, onoff);
  hal_led_pin_set(ONOFF_SERVER_2_LED, onoff);
  return hal_led_pin_get(ONOFF_SERVER_2_LED);
}

// This callback is called when a message with opcode get (0xC2) is received.
// It returns the state of the output.
static bool my_simple_onoff_server_get_cb(const simple_on_off_server_t * p_self)
{
  /* If there are more servers, resolve it here. See above. */
  __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;MySimpleOnOffServer get CB reporting value: %d\n&amp;quot;, hal_led_pin_get(ONOFF_SERVER_2_LED));
  return hal_led_pin_get(ONOFF_SERVER_2_LED);
}

//NOTE instantiate my_simple_onoff_server_0
static simple_on_off_server_t my_simple_onoff_server_0 =
{
	.model_handle = NULL, //model_handle of type access_model_handle_t will be provided by init function.
	.get_cb = my_simple_onoff_server_get_cb, //Pointer to get callback function.
	.set_cb = my_simple_onoff_server_set_cb  //Pointer to set callback function.
};


/*************************************************************************************************/

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);
    switch (button_number)
    {
        /* Pressing SW1 on the Development Kit will result in LED state to toggle and trigger
        the STATUS message to inform client about the state change. This is a demonstration of
        state change publication due to local event. */
        case 0:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;User action \n&amp;quot;);
            hal_led_pin_set(ONOFF_SERVER_0_LED, !hal_led_pin_get(ONOFF_SERVER_0_LED));
            app_onoff_status_publish(&amp;amp;m_onoff_server_0);
            break;
        }

        /* NOTE: Added: &amp;quot;Button 2&amp;quot; is my test button. */
        case 1:
        {
            // Test what callbacks do:
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Test Button pressed: %u\n&amp;quot;, ++my_test_uint8_t);
            switch (my_test_uint8_t &amp;amp; 1)
            {
              case 0:
              {
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Will call CB set with param: %u\n&amp;quot;, !hal_led_pin_get(ONOFF_SERVER_2_LED));
                my_simple_onoff_server_set_cb(&amp;amp;my_simple_onoff_server_0, !hal_led_pin_get(ONOFF_SERVER_2_LED));
                break;
              }
              case 1:
              {
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Will call CB get.\n&amp;quot;);
                bool my_test_bool;
                my_test_bool = my_simple_onoff_server_get_cb(&amp;amp;my_simple_onoff_server_0);
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;CB get reporting: %u\n&amp;quot;, my_test_bool);
                break;
              }
            }

          break;
        }


        /* NOTE Changed: Pressing &amp;quot;Button 3&amp;quot; i.e. SW2 changes &amp;quot;LED3&amp;quot; i.e. LED2 (And sends status change msg TODO later) */
        case 2:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Custom User action button 2\n&amp;quot;);
            hal_led_pin_set(ONOFF_SERVER_2_LED, !hal_led_pin_get(ONOFF_SERVER_2_LED));
            ERROR_CHECK(simple_on_off_server_status_publish(&amp;amp;my_simple_onoff_server_0, hal_led_pin_get(ONOFF_SERVER_2_LED)));
            break;
        }


        /* Initiate node reset */
        case 3:
        {
            /* Clear all the states to reset the node. */
            if (mesh_stack_is_device_provisioned())
            {
#if MESH_FEATURE_GATT_PROXY_ENABLED
                (void) proxy_stop();
#endif
                mesh_stack_config_clear();
                node_reset();
            }
            else
            {
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;The device is unprovisioned. Resetting has no effect.\n&amp;quot;);
            }
            break;
        }

        default:
            break;
    }
}

static void app_rtt_input_handler(int key)
{
    if (key &amp;gt;= &amp;#39;0&amp;#39; &amp;amp;&amp;amp; key &amp;lt;= &amp;#39;4&amp;#39;)
    {
        uint32_t button_number = key - &amp;#39;0&amp;#39;;
        button_event_handler(button_number);
    }
}

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);
}

static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initializing and adding models\n&amp;quot;);
    //NOTE Only SimpleOnOffServer will be initialized. To use both models, constants in nrf_mesh_config.h should be adjusted to allow more models.
    //app_model_init();
    ERROR_CHECK(simple_on_off_server_init(&amp;amp;my_simple_onoff_server_0, APP_ONOFF_ELEMENT_INDEX)); //NOTE Added
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;My Simple OnOff Model Handle: %d\n&amp;quot;, my_simple_onoff_server_0.model_handle);
}

static void mesh_init(void)
{
    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             = NULL,
        .models.models_init_cb   = models_init_cb,
        .models.config_server_cb = config_server_evt_cb
    };

    uint32_t status = mesh_stack_init(&amp;amp;init_params, &amp;amp;m_device_provisioned);
    switch (status)
    {
        case NRF_ERROR_INVALID_DATA:
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Data in the persistent memory was corrupted. Device starts as unprovisioned.\n&amp;quot;);
            break;
        case NRF_SUCCESS:
            break;
        default:
            ERROR_CHECK(status);
    }
}

static void initialize(void)
{
    __LOG_INIT(LOG_SRC_APP | LOG_SRC_FRIEND, LOG_LEVEL_DBG1, LOG_CALLBACK_DEFAULT);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BLE Mesh Light Switch Server Demo -----\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(app_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 = EX_URI_LS_SERVER
        };
        ERROR_CHECK(mesh_provisionee_prov_start(&amp;amp;prov_start_params));
    }

    mesh_app_uuid_print(nrf_mesh_configure_device_uuid_get());

    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)
{
    initialize();
    start();

    for (;;)
    {
        (void)sd_app_evt_wait();
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I did not implement the Client yet.&lt;/p&gt;
&lt;p&gt;I hope this helps.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Matevz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/234824?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 09:18:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e688201-85c7-4707-bafe-5dc9b07f97bc</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry about the delay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There shouldn&amp;#39;t be anything that you need to change in the mobile app. The error should be derived from your app.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You mention that you are getting an&amp;nbsp;NRF_ERROR_NOT_FOUND. Have you debugged your application to figure out exactly where this error is returned?&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/232495?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 09:42:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16e76b80-90ff-4dab-b30f-bf919bcd38d3</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/joakim_2d00_jakobsen"&gt;Joakim Jakobsen&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have made a video of the provisioning process where it starts and collapses midway. Do I need to change something in the mobile app as well? Any thing to add to this?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2020_5F00_02_5F00_04_5F00_17_5F00_09_5F00_25_5F00_trim.mp4"&gt;devzone.nordicsemi.com/.../2020_5F00_02_5F00_04_5F00_17_5F00_09_5F00_25_5F00_trim.mp4&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/231834?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 10:19:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e0fa149-30a5-4d87-93d7-cc901e62042a</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;&lt;span&gt;I tried to add another model to the light switch server example but I get &lt;strong&gt;error 5 while provisioning&lt;/strong&gt;, the provision starts but disappears half way, the device re-appears in the scan window. I&amp;#39;m using Mesh SDK v4.0.0.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m adding new model like in attached main.c file. In my case, have made these changes to nrf_mesh_config_app.h:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;//#define ACCESS_MODEL_COUNT (3)
#define ACCESS_MODEL_COUNT (4)

/**
* The number of elements in the application.
*
* @warning If the application is to support _multiple instances_ of the _same_ model, these instances
* cannot be in the same element and a separate element is needed for each new instance of the same model.
*/
//#define ACCESS_ELEMENT_COUNT (1)
#define ACCESS_ELEMENT_COUNT (2)

/**
* The number of allocated subscription lists for the application.
*
* @note This value must equal @ref ACCESS_MODEL_COUNT minus the number of
* models operating on shared states.
*/
#define ACCESS_SUBSCRIPTION_LIST_COUNT (ACCESS_MODEL_COUNT)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following is the RTT view log:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;t: 0&amp;gt;, main.c, 286, ----- BLE Mesh Light Switch Server Demo -----
&amp;lt;t: 10731&amp;gt;, main.c, 255, Initializing and adding models
&amp;lt;t: 10734&amp;gt;, main.c, 143, App OnOff Model Handle: 2
&amp;lt;t: 10737&amp;gt;, main.c, 146, App OnOff Model Handle: 3
&amp;lt;t:10770&amp;gt;, main.c, 274, Data in the persistent memory was corrupted. Device starts as unprovisioned.
&amp;lt;t: 15638&amp;gt;, mesh_app_utils.c, 65, Device UUID (raw): 5611860C225C174DB4D8F89A59153D41
&amp;lt;t: 15641&amp;gt;, mesh_app_utils.c, 70, Device UUID : 0C861156-5C22-4D17-B4D8-F89A59153D41
&amp;lt;t: 682946&amp;gt;, ble_softdevice_support.c, 104, Successfully updated connection parameters
&amp;lt;t: 758640&amp;gt;, ble_softdevice_support.c, 104, Successfully updated connection parameters
&amp;lt;t: 957812&amp;gt;, app_error_weak.c, 119, Mesh error 5 at 0x00000000 (:0)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the main.c file:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/31364.main.c"&gt;devzone.nordicsemi.com/.../31364.main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/231689?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 14:27:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2793f06-a2c1-4bf9-b6c4-989d3f1af668</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/joakim_2d00_jakobsen"&gt;Joakim Jakobsen&lt;/a&gt;, Is there a guide/documentation to use Simple On/Off model in a mesh application instead of Generic On/Off model? I want to expand from there as Simple On/Off is easier to modify.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/231371?ContentTypeID=1</link><pubDate>Tue, 28 Jan 2020 11:28:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a5f8b0a-c397-4b27-8336-4234abc7ca24</guid><dc:creator>Aftab</dc:creator><description>&lt;p&gt;The tickets you have mentioned are related to&amp;nbsp;&lt;span&gt;nrf5SDKforMeshv310src and Mesh SDk 1.0, both pretty outdated. The functions they mentioned are pretty different in Mesh SDk 4.0 I&amp;#39;m using.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding Simple OnOff Model to Generic OnOff Server Example</title><link>https://devzone.nordicsemi.com/thread/231185?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 14:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d009fb47-1bdd-49cd-a6a8-e13e0ac76b0d</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Apart from the documentation we have on the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.meshsdk.v4.0.0/md_models_vendor_simple_on_off_README.html" rel="noopener noreferrer" target="_blank"&gt;Simple On/Off model&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.meshsdk.v4.0.0/md_doc_libraries_how_to_models.html" rel="noopener noreferrer" target="_blank"&gt;Creating new models&lt;/a&gt;, we don&amp;#39;t have any more detailed guide on how to create and implement the model.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are having any specific problems with&amp;nbsp;creating a new model, you can post a ticket here on Devzone so that we can help you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As for sending a string instead of a bool, you can take a look at these previous tickets on the same topic:&amp;nbsp;&lt;br /&gt;&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;&amp;nbsp;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/46092/send-string-in-a-mesh-with-nrf52dk"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/46092/send-string-in-a-mesh-with-nrf52dk&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>