<?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>Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45926/simple_on_off-model-on-nrf52832</link><description>Hello to everyonel. 
 I am working with the Light_switch example of Mesh 3.1 on nRF52832 (PCA10040). At this moment, I am trying to understand how I can send a message from the server to the client in the network. I found this publication on Github that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Apr 2019 20:17:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45926/simple_on_off-model-on-nrf52832" /><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181179?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 20:17:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d13e85a1-e056-400a-9ae0-e0f90ee645dd</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;I understand, but to do that, do I need to create a new model?, or&amp;nbsp;I only have to add the server and client to both projects?&lt;br /&gt;If the second choice is the best, can you show me how to do that?&lt;br /&gt;Thank you again for your support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181178?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 20:12:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16d07f68-b6ef-4808-94f8-9cca70992265</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;Ahh I see.&lt;/p&gt;
&lt;p&gt;In this case what I would do is put both a client and a server model on both nodes.&lt;/p&gt;
&lt;p&gt;Have node 1 client publish to node 2 server&lt;/p&gt;
&lt;p&gt;Then have node 2 client publish the random value to node 1 server to turn led on.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think modifying the status response is the best way to go as the server model shouldn&amp;#39;t be sending new data to the client model. The status should only be the value it received from the client not a new value. I have never attempted to modify the server response as I think this doesn&amp;#39;t follow the mesh specification.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181176?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 19:57:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca5a8ba7-aa68-406c-b312-83cca7f6f0f7</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;I&amp;#39;m checking the dimming examples for server and client, but I don&amp;#39;t understand how It can help me to control the server&amp;#39;s response.&lt;br /&gt;Maybe I didn&amp;#39;t explain it well:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0825.2.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;This is what I want to do. Sorry If I don&amp;#39;t understand that level model do exactly that, but isn&amp;#39;t clear for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181174?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 19:35:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75cd070a-8a76-4070-a7c1-91b2613c9ad8</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;Yes you will have to do both. If you go through the examples you will see they define those functions, then create them, then call them&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181173?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 19:32:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c739262a-4f7b-466b-97ab-214640a24e6a</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;Ok, but right now, the&amp;nbsp;&amp;nbsp;&amp;quot;generic_level_client_set&amp;quot; function is already created on &amp;quot;generic_level_client.c&amp;quot;. I have to declare the funcion also in main.c file or is enough with add the&amp;nbsp;&amp;nbsp;generic_level_client.c path and call the function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181165?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 18:49:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eedd1746-f503-4e62-bb9c-a69ee60822bf</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;I mean the generic_levels, you can see examples of them if you go to the dimming folder in the Mesh SDK. To use those function you have to first define them in the main. This is all shown in the example dimming client and server programs. the example light switch programs also demonstrate how to use the on_off models.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181164?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 18:30:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad6a4f11-ed3a-408e-a0f1-6c8ea0df7d8a</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;I putted the &amp;quot;generic_level_client_set&amp;quot; inside a button in the event handler (//***** signal):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;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);
    //int VAL = 0;

    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);

            uint8_t is_nested; //**************************************************************************************
            ERROR_CHECK(sd_nvic_critical_region_enter(&amp;amp;is_nested));
            generic_level_client_set(&amp;amp;m_clients, &amp;amp;set_params, &amp;amp;transition_params);
            ERROR_CHECK(sd_nvic_critical_region_exit(is_nested));
            break;

        case 2:
        case 3:
            /* 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[1].model_handle);
            status = generic_onoff_client_set(&amp;amp;m_clients[1], &amp;amp;set_params, &amp;amp;transition_params);
            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;
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is it correct? When the press the button 0, the function works, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181162?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 18:22:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51287649-61cd-41c0-aa36-711dd86d3eee</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;Ok, I&amp;acute;ll try it. With generic level models, you mean generic_onoff_client and&amp;nbsp;&lt;span&gt;generic&lt;/span&gt;&lt;span&gt;_onoff&lt;/span&gt;&lt;span&gt;_server, right?&lt;/span&gt;&lt;br /&gt;If I get a problem, I&amp;acute;ll tell you.&lt;br /&gt;Thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181161?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 17:46:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdd196aa-3f31-43be-9b42-0b75c5eb4d37</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;1. Those function that I sent you are part of the stock generic level models. To be able to use them you have to include the .c and .h files for the models. Once the models have been included in your project you can call the functions in your main. &amp;nbsp;The example dimming programs already contain those functions and would be a good place to start when trying to understand how the models work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. You use the nested functions when calling a client function in the main.c file&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3.You don&amp;#39;t need to handle the status message from the server. However the variable that you will modify &amp;nbsp;are the &amp;quot;set_params&amp;quot; structure in the client and the &amp;quot;present_level&amp;quot; on the server.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181146?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 16:06:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e30053a4-d4f4-4050-be53-086136f9e815</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;Ok, so, the clients function send a request of callback and, then, the server responses with the another function.&lt;br /&gt;I have three questions:&lt;br /&gt;1) the client/server functions that you made, are going to be created on main.c file or I have to create them on another file?&lt;br /&gt;2) The same with the nested function, where do I have to create it?&lt;br /&gt;3) To handle the server&amp;#39;s answer, what&amp;#39;s the variable I have to modify?&lt;br /&gt;Thank you for your support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/181038?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 12:11:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:883d0014-e6bd-4b0c-91dc-6a6c9e68c015</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;So for the generic client model use the function&lt;/p&gt;
&lt;pre&gt;generic_level_client_set(&amp;amp;m_clients, &amp;amp;set_params, &amp;amp;transition_params);&lt;/pre&gt;
&lt;pre&gt;to publish the level/message you want to send.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then on the server side use the function&lt;/pre&gt;
&lt;pre&gt;static void app_level_server_set_cb(const app_level_server_t * p_server, int16_t present_level){}&lt;br /&gt;&lt;br /&gt;to handle the message you received.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Also this may help you as this is something I needed to do to successfully be able to publish messages inside the main&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;pre&gt;uint8_t is_nested;&lt;br /&gt;&lt;br /&gt;ERROR_CHECK(sd_nvic_critical_region_enter(&amp;amp;is_nested));
&lt;/pre&gt;
&lt;pre&gt;generic_level_client_set(&amp;amp;m_clients, &amp;amp;set_params, &amp;amp;transition_params);&lt;/pre&gt;
&lt;pre&gt;ERROR_CHECK(sd_nvic_critical_region_exit(is_nested));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This makes sure you are not in a critical region when publishing the message and avoids a mesh assert error.&lt;br /&gt;&lt;br /&gt;Check here for more info on critical region&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38479/mesh-sdk-2-2-0-bug-in-mesh_opt_core_adv_set"&gt;devzone.nordicsemi.com/.../mesh-sdk-2-2-0-bug-in-mesh_opt_core_adv_set&lt;/a&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/180871?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 21:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c331bf1d-8efc-4e89-b272-217492971380</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;Can you show me how it works?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/180870?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 21:27:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6971f7a-061b-4166-827b-0636dd2d2241</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;So I don&amp;#39;t think modifying the status message will work as it is define in the mesh specification to act in a certain way.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1554758684734v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;What I&amp;#39;ve been doing is using generic_level client to publish a value between -32k and 32k then on the server side I convert that value to the message that I want. This way you won&amp;#39;t have to make a custom model to handle the custom message you want.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/180869?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 21:03:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b877c7a6-4633-4e14-b518-595fe6f4d017</guid><dc:creator>JK0201</dc:creator><description>&lt;p&gt;&lt;span&gt;BubDev, thank you very mucho for your fast answer.&lt;br /&gt;Yeah, I did a mistake calling &amp;quot;nodes&amp;quot; to the models. Is already corrected.&lt;br /&gt;I&amp;#39;ve tried to add the client model to the server project before, but It did&amp;#39;t work well.&lt;br /&gt;So, what I thought is, if the server only answers when the clients send a message, I have to understand how I can modify this answer to put-in the status that I want, not the default.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple_on_off model on nRF52832</title><link>https://devzone.nordicsemi.com/thread/180866?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 20:44:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d4ce4d8-0b23-4e18-abe7-1f52ab84a1a9</guid><dc:creator>BubDev</dc:creator><description>&lt;p&gt;There is no such thing as a &amp;quot;server node&amp;quot; and a &amp;quot;client node&amp;quot;. A node contains elements which contain models. A model can be a server or a client. So a node can have server models in it and client models in it. A server model does not send messages to a client model but instead a client model publishes to an address and a server model subscribes to that address. If you want two way communication between your nodes I suggest you add both a client model and a server model to both your nodes. The best way to achieve adding a new model is to open the example light switch server and clients main.c file side by side and copy over the definitions/functions needed for each type of model. You will need to include the .c and .h files of each generic model.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Servers send a reply to a client if using an acknowledged messages and the response will contain the on/off message that it received. This allows the client to resend the message if the server model received the incorrect value or didn&amp;#39;t receive the value at all. It seems like you are on the right path.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hopes this help a little until the Nordic Devs can get to it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>