<?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 vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43529/simple_on_off-vendor-model-on-mesh-3-1</link><description>I am converting the simple_on_off vendor model to send a message on mesh 3.1. 
 the server implemented the simple_on_off model successfully. But but my client runs into 0&amp;gt;, app_error_weak.c, 119, Mesh error 8 at 0x00000000 (:0) straight away. 
 I suspect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Feb 2019 09:12:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43529/simple_on_off-vendor-model-on-mesh-3-1" /><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/171049?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 09:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d80c52f-6815-45ae-a726-27466109bd77</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Great to see that you solved the problem! I would like to wish you good luck with further work!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170958?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 15:57:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad0d58a7-dfe7-48a6-8465-1ed2c04f9165</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Andreas I have managed to compile and run the Vendor_client model&lt;/p&gt;
&lt;p&gt;problem was as per below p.uuid=NULL,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; 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,//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));
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Complete main.c for vendor client on off model below&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_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;

/* Provisioning and configuration */
#include &amp;quot;mesh_provisionee.h&amp;quot;
#include &amp;quot;mesh_app_utils.h&amp;quot;

/* Models */

#include &amp;quot;simple_on_off_client.h&amp;quot;
#include &amp;quot;simple_on_off_common.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;

#define APP_STATE_OFF                (0)
#define APP_STATE_ON                 (1)

#define APP_UNACK_MSG_REPEAT_COUNT   (2)

 #define DEV_BOARD_LF_CLK_CFG  { \
        .source = NRF_SDH_CLOCK_LF_SRC, \
        .rc_ctiv = NRF_SDH_CLOCK_LF_RC_CTIV, \
        .rc_temp_ctiv = NRF_SDH_CLOCK_LF_RC_TEMP_CTIV, \
        .accuracy = NRF_SDH_CLOCK_LF_ACCURACY \
    }
#define RTT_INPUT_POLL_PERIOD_MS (100)
#define GROUP_MSG_REPEAT_COUNT (2)

#define LED_BLINK_INTERVAL_MS (200)
#define LED_BLINK_SHORT_INTERVAL_MS (50)
#define LED_BLINK_CNT_START (2)
#define LED_BLINK_CNT_RESET (3)
#define LED_BLINK_CNT_PROV (4)
#define LED_BLINK_CNT_NO_REPLY (6)

static simple_on_off_client_t m_clients[CLIENT_MODEL_INSTANCE_COUNT];
//static const uint8_t m_client_node_uuid[NRF_MESH_UUID_SIZE] = CLIENT_NODE_UUID;
static bool m_device_provisioned;

//static void client_status_cb(const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src);
static bool client_publication_configured(void) {
  dsm_handle_t pub_addr_handle;
  for (uint8_t i = 0; i &amp;lt; CLIENT_MODEL_INSTANCE_COUNT; i++) {
    if (access_model_publish_address_get(m_clients[i].model_handle, &amp;amp;pub_addr_handle) == NRF_SUCCESS) {
      if (pub_addr_handle == DSM_HANDLE_INVALID) {
        return false;
      }
    } else {
      return false;
    }
  }

  return true;
}


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;);

  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_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
  hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
}

static uint32_t server_index_get(const simple_on_off_client_t *p_client) {
  uint32_t index = p_client - &amp;amp;m_clients[0];
  NRF_MESH_ASSERT(index &amp;lt; SERVER_NODE_COUNT);
  return index;
}

static void client_publish_timeout_cb(access_model_handle_t handle, void *p_self) {
  __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;Acknowledged send timedout\n&amp;quot;);
}

static void client_status_cb(const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src) {
  uint32_t server_index = server_index_get(p_self);

  //__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;server status received \n&amp;quot;,p_self);
  switch (status) {
  case SIMPLE_ON_OFF_STATUS_ON:
    hal_led_pin_set(BSP_LED_0 + server_index, true);
    break;

  case SIMPLE_ON_OFF_STATUS_OFF:
    hal_led_pin_set(BSP_LED_0 + server_index, false);
    break;

  case SIMPLE_ON_OFF_STATUS_ERROR_NO_REPLY:
    hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
    break;

  case SIMPLE_ON_OFF_STATUS_CANCELLED:
  default:
    __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;Unknown status \n&amp;quot;);
    break;
  }
}

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);
  //uint32_t status = config_client_node_reset();
  //__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR,&amp;quot;Node Reset Status:0x%08lX\n&amp;quot;,status); 
  /* 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);

  if (client_publication_configured()) {
    uint32_t status = NRF_SUCCESS;
    switch (button_number) {
    case 0:
    case 1:
      /* send unicast message, with inverted GPIO pin value */
     
      status = simple_on_off_client_set(&amp;amp;m_clients[button_number],
          !hal_led_pin_get(BSP_LED_0 + button_number));

      break;

    case 2:
    case 3:
      
      /* send a group message to the ODD group, with inverted GPIO pin value */
      status = simple_on_off_client_set_unreliable(&amp;amp;m_clients[button_number],
          !hal_led_pin_get(BSP_LED_0 + button_number),
          GROUP_MSG_REPEAT_COUNT);
      hal_led_pin_set(BSP_LED_0 + button_number, !hal_led_pin_get(BSP_LED_0 + button_number));
      break;
    default:
      break;
    }

    if (status == NRF_ERROR_INVALID_STATE ||
        status == NRF_ERROR_NO_MEM ||
        status == NRF_ERROR_BUSY) {
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
      hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
    } else {
      ERROR_CHECK(status);
    }
  } else {
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Ignored. Node is not configured.\n&amp;quot;);
  }
}
/*uint32_t send_command_client(simple_on_off_client_t *p_client, uint8_t *msg, uint16_t length) {
  //int i;
  send_command_msg_t command_msg;

  command_msg.length = length;
  strncpy(command_msg.command, msg, length);

  access_message_tx_t message;
  message.opcode.opcode = SEND_COMMAND;
  message.opcode.company_id = ACCESS_COMPANY_ID_NORDIC;
  message.p_buffer = (const uint8_t *)&amp;amp;command_msg;
  message.length = command_msg.length + 2;

  uint32_t status = NRF_SUCCESS;

  status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);

  Method for sending to all nodes!
  for (uint8_t i = 0; i &amp;lt; 3; ++i)
    {
        status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);
        if (status == NRF_SUCCESS) {
            break;
        }
    }
  return status;
}*/

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].status_cb = client_status_cb;
    m_clients[i].timeout_cb = client_publish_timeout_cb;
    ERROR_CHECK(simple_on_off_client_init(&amp;amp;m_clients[i], i + 1));
    ERROR_CHECK(access_model_subscription_list_alloc(m_clients[i].model_handle));
  }
}

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;

  
    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,//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));
}
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);
  //ERROR_CHECK(mesh_stack_start());

  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_CLIENT
};
    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());

//  const uint8_t *p_uuid = nrf_mesh_configure_device_uuid_get();
//  __LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Device UUID &amp;quot;, p_uuid, NRF_MESH_UUID_SIZE);

  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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170905?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 13:50:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e2fecb9-ca34-4f30-9908-78060a769cc0</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;I do have the source file thanks , my problem is Im not sure how to add it to&amp;nbsp;static void mesh_init(void)&lt;/p&gt;
&lt;p&gt;and static void models_init_cb(void) for MESH 3.1. Im either getting compile errors and when it does compile im sitting with mesh error 8.&lt;/p&gt;
&lt;p&gt;the server side is working but the client side is not.&amp;nbsp;&amp;nbsp;When I provision the&amp;nbsp;server &amp;nbsp;the elements come us as vendor model which is correct.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;must I remove the generic_on_off .c and .h files from the solution or keep them there ?&lt;/p&gt;
&lt;p&gt;my latest main.c for client below . Im not getting the uuid in RTT viewer just&amp;nbsp; the following&lt;/p&gt;
&lt;p&gt;&amp;lt;t: 0&amp;gt;, main.c, 300, ----- BLE Mesh Light Switch Client Demo -----&lt;br /&gt;&amp;lt;t: 13072&amp;gt;, main.c, 271, Initializing and adding models&lt;br /&gt;&amp;lt;t: 17971&amp;gt;, app_error_weak.c, 108, Mesh assert at 0x0002ACB2 (:0)&lt;/p&gt;
&lt;p&gt;thanks for the help.&amp;nbsp;&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_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;

/* Provisioning and configuration */
#include &amp;quot;mesh_provisionee.h&amp;quot;
#include &amp;quot;mesh_app_utils.h&amp;quot;

/* Models */

#include &amp;quot;simple_on_off_client.h&amp;quot;
#include &amp;quot;simple_on_off_common.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;

#define APP_STATE_OFF                (0)
#define APP_STATE_ON                 (1)

#define APP_UNACK_MSG_REPEAT_COUNT   (2)

 #define DEV_BOARD_LF_CLK_CFG  { \
        .source = NRF_SDH_CLOCK_LF_SRC, \
        .rc_ctiv = NRF_SDH_CLOCK_LF_RC_CTIV, \
        .rc_temp_ctiv = NRF_SDH_CLOCK_LF_RC_TEMP_CTIV, \
        .accuracy = NRF_SDH_CLOCK_LF_ACCURACY \
    }
#define RTT_INPUT_POLL_PERIOD_MS (100)
#define GROUP_MSG_REPEAT_COUNT (2)

#define LED_BLINK_INTERVAL_MS (200)
#define LED_BLINK_SHORT_INTERVAL_MS (50)
#define LED_BLINK_CNT_START (2)
#define LED_BLINK_CNT_RESET (3)
#define LED_BLINK_CNT_PROV (4)
#define LED_BLINK_CNT_NO_REPLY (6)

static simple_on_off_client_t m_clients[CLIENT_MODEL_INSTANCE_COUNT];
//static const uint8_t m_client_node_uuid[NRF_MESH_UUID_SIZE] = CLIENT_NODE_UUID;
static bool m_device_provisioned;

//static void client_status_cb(const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src);
static bool client_publication_configured(void) {
  dsm_handle_t pub_addr_handle;
  for (uint8_t i = 0; i &amp;lt; CLIENT_MODEL_INSTANCE_COUNT; i++) {
    if (access_model_publish_address_get(m_clients[i].model_handle, &amp;amp;pub_addr_handle) == NRF_SUCCESS) {
      if (pub_addr_handle == DSM_HANDLE_INVALID) {
        return false;
      }
    } else {
      return false;
    }
  }

  return true;
}


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;);

  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_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
  hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
}

static uint32_t server_index_get(const simple_on_off_client_t *p_client) {
  uint32_t index = p_client - &amp;amp;m_clients[0];
  NRF_MESH_ASSERT(index &amp;lt; SERVER_NODE_COUNT);
  return index;
}

static void client_publish_timeout_cb(access_model_handle_t handle, void *p_self) {
  __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;Acknowledged send timedout\n&amp;quot;);
}

static void client_status_cb(const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src) {
  uint32_t server_index = server_index_get(p_self);

  //__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;server status received \n&amp;quot;,p_self);
  switch (status) {
  case SIMPLE_ON_OFF_STATUS_ON:
    hal_led_pin_set(BSP_LED_0 + server_index, true);
    break;

  case SIMPLE_ON_OFF_STATUS_OFF:
    hal_led_pin_set(BSP_LED_0 + server_index, false);
    break;

  case SIMPLE_ON_OFF_STATUS_ERROR_NO_REPLY:
    hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
    break;

  case SIMPLE_ON_OFF_STATUS_CANCELLED:
  default:
    __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, &amp;quot;Unknown status \n&amp;quot;);
    break;
  }
}

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);
  //uint32_t status = config_client_node_reset();
  //__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR,&amp;quot;Node Reset Status:0x%08lX\n&amp;quot;,status); 
  /* 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);

  if (client_publication_configured()) {
    uint32_t status = NRF_SUCCESS;
    switch (button_number) {
    case 0:
    case 1:
      /* send unicast message, with inverted GPIO pin value */
     
      status = simple_on_off_client_set(&amp;amp;m_clients[button_number],
          !hal_led_pin_get(BSP_LED_0 + button_number));

      break;

    case 2:
    case 3:
      
      /* send a group message to the ODD group, with inverted GPIO pin value */
      status = simple_on_off_client_set_unreliable(&amp;amp;m_clients[button_number],
          !hal_led_pin_get(BSP_LED_0 + button_number),
          GROUP_MSG_REPEAT_COUNT);
      hal_led_pin_set(BSP_LED_0 + button_number, !hal_led_pin_get(BSP_LED_0 + button_number));
      break;
    default:
      break;
    }

    if (status == NRF_ERROR_INVALID_STATE ||
        status == NRF_ERROR_NO_MEM ||
        status == NRF_ERROR_BUSY) {
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
      hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
    } else {
      ERROR_CHECK(status);
    }
  } else {
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Ignored. Node is not configured.\n&amp;quot;);
  }
}
/*uint32_t send_command_client(simple_on_off_client_t *p_client, uint8_t *msg, uint16_t length) {
  //int i;
  send_command_msg_t command_msg;

  command_msg.length = length;
  strncpy(command_msg.command, msg, length);

  access_message_tx_t message;
  message.opcode.opcode = SEND_COMMAND;
  message.opcode.company_id = ACCESS_COMPANY_ID_NORDIC;
  message.p_buffer = (const uint8_t *)&amp;amp;command_msg;
  message.length = command_msg.length + 2;

  uint32_t status = NRF_SUCCESS;

  status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);

  Method for sending to all nodes!
  for (uint8_t i = 0; i &amp;lt; 3; ++i)
    {
        status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);
        if (status == NRF_SUCCESS) {
            break;
        }
    }
  return status;
}*/

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].status_cb = client_status_cb;
    m_clients[i].timeout_cb = client_publish_timeout_cb;
    ERROR_CHECK(simple_on_off_client_init(&amp;amp;m_clients[i], i + 1));
    ERROR_CHECK(access_model_subscription_list_alloc(m_clients[i].model_handle));
  }
}

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;

  
    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));
}
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;----- BLE Mesh Light Switch Client 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(rtt_input_handler, RTT_INPUT_POLL_PERIOD_MS);
  ERROR_CHECK(mesh_stack_start());

  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_CLIENT
};
    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());

//  const uint8_t *p_uuid = nrf_mesh_configure_device_uuid_get();
//  __LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Device UUID &amp;quot;, p_uuid, NRF_MESH_UUID_SIZE);

  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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170882?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 12:53:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a990553d-d194-4abf-9356-8cb200369a15</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;The first &lt;strong&gt;models_init_cb()&lt;/strong&gt; has an initialization call inside it for the &lt;strong&gt;simple_on_off&lt;/strong&gt; model, if you look closly.&lt;/p&gt;
&lt;p&gt;Are you looking for the source file for this implementation? You can find it in Mesh SDK 2.0.0 under &lt;strong&gt;models\simple_on_off\src\simple_on_off_client.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here it is:&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;quot;simple_on_off_client.h&amp;quot;
#include &amp;quot;simple_on_off_common.h&amp;quot;

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stddef.h&amp;gt;

#include &amp;quot;access.h&amp;quot;
#include &amp;quot;access_config.h&amp;quot;
#include &amp;quot;access_reliable.h&amp;quot;
#include &amp;quot;device_state_manager.h&amp;quot;
#include &amp;quot;nrf_mesh.h&amp;quot;
#include &amp;quot;nrf_mesh_assert.h&amp;quot;
#include &amp;quot;log.h&amp;quot;

/*****************************************************************************
 * Static variables
 *****************************************************************************/

/** Keeps a single global TID for all transfers. */
static uint8_t m_tid;

/*****************************************************************************
 * Static functions
 *****************************************************************************/

static void reliable_status_cb(access_model_handle_t model_handle,
                               void * p_args,
                               access_reliable_status_t status)
{
    simple_on_off_client_t * p_client = p_args;
    NRF_MESH_ASSERT(p_client-&amp;gt;status_cb != NULL);

    p_client-&amp;gt;state.reliable_transfer_active = false;
    switch (status)
    {
        case ACCESS_RELIABLE_TRANSFER_SUCCESS:
            /* Ignore */
            break;
        case ACCESS_RELIABLE_TRANSFER_TIMEOUT:
            p_client-&amp;gt;status_cb(p_client, SIMPLE_ON_OFF_STATUS_ERROR_NO_REPLY, NRF_MESH_ADDR_UNASSIGNED);
            break;
        case ACCESS_RELIABLE_TRANSFER_CANCELLED:
            p_client-&amp;gt;status_cb(p_client, SIMPLE_ON_OFF_STATUS_CANCELLED, NRF_MESH_ADDR_UNASSIGNED);
            break;
        default:
            /* Should not be possible. */
            NRF_MESH_ASSERT(false);
            break;
    }
}

/** Returns @c true if the message received was from the address corresponding to the clients
 * publish address. */
static bool is_valid_source(const simple_on_off_client_t * p_client,
                            const access_message_rx_t * p_message)
{
    /* Check the originator of the status. */
    dsm_handle_t publish_handle;
    nrf_mesh_address_t publish_address;
    if (access_model_publish_address_get(p_client-&amp;gt;model_handle, &amp;amp;publish_handle) != NRF_SUCCESS ||
        publish_handle == DSM_HANDLE_INVALID ||
        dsm_address_get(publish_handle, &amp;amp;publish_address) != NRF_SUCCESS ||
        publish_address.value != p_message-&amp;gt;meta_data.src.value)
    {
        return false;
    }
    else
    {
        return true;
    }
}

static uint32_t send_reliable_message(const simple_on_off_client_t * p_client,
                                      simple_on_off_opcode_t opcode,
                                      const uint8_t * p_data,
                                      uint16_t length)
{
    access_reliable_t reliable;
    reliable.model_handle = p_client-&amp;gt;model_handle;
    reliable.message.p_buffer = p_data;
    reliable.message.length = length;
    reliable.message.opcode.opcode = opcode;
    reliable.message.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
    reliable.message.force_segmented = false;
    reliable.message.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;
    reliable.reply_opcode.opcode = SIMPLE_ON_OFF_OPCODE_STATUS;
    reliable.reply_opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
    reliable.timeout = ACCESS_RELIABLE_TIMEOUT_MIN;
    reliable.status_cb = reliable_status_cb;

    return access_model_reliable_publish(&amp;amp;reliable);
}

/*****************************************************************************
 * Opcode handler callback(s)
 *****************************************************************************/

static void handle_status_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args)
{
    simple_on_off_client_t * p_client = p_args;
    NRF_MESH_ASSERT(p_client-&amp;gt;status_cb != NULL);

    if (!is_valid_source(p_client, p_message))
    {
        return;
    }

    simple_on_off_msg_status_t * p_status =
        (simple_on_off_msg_status_t *) p_message-&amp;gt;p_data;
    simple_on_off_status_t on_off_status = (p_status-&amp;gt;present_on_off ?
                                              SIMPLE_ON_OFF_STATUS_ON : SIMPLE_ON_OFF_STATUS_OFF);
    p_client-&amp;gt;status_cb(p_client, on_off_status, p_message-&amp;gt;meta_data.src.value);
}

static const access_opcode_handler_t m_opcode_handlers[] =
{
    {{SIMPLE_ON_OFF_OPCODE_STATUS, SIMPLE_ON_OFF_COMPANY_ID}, handle_status_cb}
};

static void handle_publish_timeout(access_model_handle_t handle, void * p_args)
{
    simple_on_off_client_t * p_client = p_args;

    if (p_client-&amp;gt;timeout_cb != NULL)
    {
        p_client-&amp;gt;timeout_cb(handle, p_args);
    }
}
/*****************************************************************************
 * Public API
 *****************************************************************************/

uint32_t simple_on_off_client_init(simple_on_off_client_t * p_client, uint16_t element_index)
{
    if (p_client == NULL ||
        p_client-&amp;gt;status_cb == NULL)
    {
        return NRF_ERROR_NULL;
    }

    access_model_add_params_t init_params;
    init_params.model_id.model_id = SIMPLE_ON_OFF_CLIENT_MODEL_ID;
    init_params.model_id.company_id = SIMPLE_ON_OFF_COMPANY_ID;
    init_params.element_index = element_index;
    init_params.p_opcode_handlers = &amp;amp;m_opcode_handlers[0];
    init_params.opcode_count = sizeof(m_opcode_handlers) / sizeof(m_opcode_handlers[0]);
    init_params.p_args = p_client;
    init_params.publish_timeout_cb = handle_publish_timeout;
    return access_model_add(&amp;amp;init_params, &amp;amp;p_client-&amp;gt;model_handle);
}

uint32_t simple_on_off_client_set(simple_on_off_client_t * p_client, bool on_off)
{
    if (p_client == NULL || p_client-&amp;gt;status_cb == NULL)
    {
        return NRF_ERROR_NULL;
    }
    else if (p_client-&amp;gt;state.reliable_transfer_active)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    p_client-&amp;gt;state.data.on_off = on_off ? 1 : 0;
    p_client-&amp;gt;state.data.tid = m_tid++;

    uint32_t status = send_reliable_message(p_client,
                                            SIMPLE_ON_OFF_OPCODE_SET,
                                            (const uint8_t *)&amp;amp;p_client-&amp;gt;state.data,
                                            sizeof(simple_on_off_msg_set_t));
    if (status == NRF_SUCCESS)
    {
        p_client-&amp;gt;state.reliable_transfer_active = true;
    }
    return status;

}

uint32_t simple_on_off_client_set_unreliable(simple_on_off_client_t * p_client, bool on_off, uint8_t repeats)
{
    simple_on_off_msg_set_unreliable_t set_unreliable;
    set_unreliable.on_off = on_off ? 1 : 0;
    set_unreliable.tid = m_tid++;

    access_message_tx_t message;
    message.opcode.opcode = SIMPLE_ON_OFF_OPCODE_SET_UNRELIABLE;
    message.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
    message.p_buffer = (const uint8_t*) &amp;amp;set_unreliable;
    message.length = sizeof(set_unreliable);
    message.force_segmented = false;
    message.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;

    uint32_t status = NRF_SUCCESS;
    for (uint8_t i = 0; i &amp;lt; repeats; ++i)
    {
        status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);
        if (status != NRF_SUCCESS)
        {
            break;
        }
    }
    return status;
}

uint32_t simple_on_off_client_get(simple_on_off_client_t * p_client)
{
    if (p_client == NULL || p_client-&amp;gt;status_cb == NULL)
    {
        return NRF_ERROR_NULL;
    }
    else if (p_client-&amp;gt;state.reliable_transfer_active)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    uint32_t status = send_reliable_message(p_client,
                                            SIMPLE_ON_OFF_OPCODE_GET,
                                            NULL,
                                            0);
    if (status == NRF_SUCCESS)
    {
        p_client-&amp;gt;state.reliable_transfer_active = true;
    }
    return status;
}

/**
 * Cancel any ongoing reliable message transfer.
 *
 * @param[in] p_client Pointer to the client instance structure.
 */
void simple_on_off_client_pending_msg_cancel(simple_on_off_client_t * p_client)
{
    (void)access_model_reliable_cancel(p_client-&amp;gt;model_handle);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170834?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 11:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd79f1e7-033b-48cb-9f0d-ff339f48c6cd</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thanks Andreas, these are for the Generic model. Im looking for a sample of the functions or sample main.c for simple_on_off model in the vendor directory&lt;/p&gt;
&lt;p&gt;They don&amp;#39;t work together&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170832?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 11:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c7cca19-feb5-43ec-817b-215a85ec7bd7</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m a bit unsure what your question is, are you looking for the implementation of &lt;strong&gt;mesh_init() &lt;/strong&gt;and &lt;strong&gt;models_init_cb()&lt;/strong&gt; where the &lt;strong&gt;simple_on_off&lt;/strong&gt; model were used?&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;simple_on_off &lt;/strong&gt;model was used up to Mesh SDK 2.0.0, after this the&lt;strong&gt; generic_on_off model&lt;/strong&gt; is used, which should be used in real applications using the mesh.&lt;/p&gt;
&lt;p&gt;The implementation of &lt;strong&gt;mesh_init() &lt;/strong&gt;and &lt;strong&gt;models_init_cb()&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;in Mesh SDK 2.0.0 are for example:&lt;/p&gt;
&lt;p&gt;(examples\enocean_switch example)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;mesh_init() :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void mesh_init(void)
{
    uint8_t dev_uuid[NRF_MESH_UUID_SIZE] = CLIENT_NODE_UUID;

    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));

    /* Register event handler to receive NRF_MESH_EVT_FLASH_STABLE. Application functionality will
    be started after this event */
    nrf_mesh_evt_handler_add(&amp;amp;m_mesh_core_event_handler);
}&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;models_init_cb() :&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initializing and adding models\n&amp;quot;);

    /* Model initialization */
    for (uint32_t i = 0; i &amp;lt; LIGHT_SWITCH_CLIENTS; ++i)
    {
        m_clients[i].status_cb = client_status_cb;
        ERROR_CHECK(simple_on_off_client_init(&amp;amp;m_clients[i], i + 1));
        ERROR_CHECK(access_model_subscription_list_alloc(m_clients[i].model_handle));
    }
}&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The implementation of &lt;strong&gt;mesh_init() &lt;/strong&gt;and &lt;strong&gt;models_init_cb()&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;in Mesh SDK 3.1.0 are for example:&lt;/p&gt;
&lt;p&gt;(examples\enocean_switch example)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;mesh_init() :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;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
    };
    ERROR_CHECK(mesh_stack_init(&amp;amp;init_params, &amp;amp;m_device_provisioned));

    /* Register event handler to receive NRF_MESH_EVT_FLASH_STABLE. Application functionality will
    be started after this event */
    nrf_mesh_evt_handler_add(&amp;amp;m_mesh_core_event_handler);
}&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;models_init_cb() :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initializing and adding models\n&amp;quot;);

    /* Model initialization */
    for (uint32_t i = 0; i &amp;lt; LIGHT_SWITCH_CLIENTS; ++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));
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is this what you are looking for?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170657?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 14:05:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88662944-797c-4820-9a99-c965567fa295</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Yip strings. I have read how to create models and&amp;nbsp; go over it almost every day.&amp;nbsp; Can you please share how these functions are structured for the vendor simple_on_off model.&lt;/p&gt;
&lt;p&gt;static void mesh_init(void)&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;static void models_init_cb(void)&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170649?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 13:53:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:664962bd-30a4-4be6-bba9-b66db120cbb2</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Have you read about &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/Mesh_SDK/v3-1-0/md_doc_getting_started_how_to_models#creating_models_publication"&gt;creating new models&lt;/a&gt; for your mesh network?&lt;/p&gt;
[quote user="melt777"]Can this model now send messages?[/quote]
&lt;p&gt;Do you mean packages or string messages?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170588?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 11:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a465c85-bcd5-4212-8004-1766da75fb5a</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;What I am actually trying to do&amp;nbsp;is send a small string on a mesh.&amp;nbsp; the latest example I found is &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35326/mesh-sending-many-messages-in-a-row"&gt;here&amp;nbsp;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I want to use mesh 3.1. Also looking at the on_off_example I see there is now an included generic_on_off_messages.h file. Can this model now send messages?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170567?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 10:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e82df137-6cce-4faf-a384-df7096d58129</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Which Mesh SDK is the code you are trying to integrate from?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170490?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 06:27:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc7d8421-9431-49e7-8275-18ab87dfcad9</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Andreas&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Did&amp;nbsp; what you suggested and still have error 8. Do you perhaps have an example of&amp;nbsp; on_off vendor model on mesh 3.1?&lt;/p&gt;
&lt;p&gt;Then I can compare.&lt;/p&gt;
&lt;p&gt;I know it has something to do with mesh_init and models_init. If I use the default generic_on_off functions of mesh_init and models_init (tegether with generic_onn_off.c and .h files it seems to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: simple_on_off vendor model on Mesh 3.1</title><link>https://devzone.nordicsemi.com/thread/170350?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 12:45:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b11d47cb-84d8-479e-91bf-8fec3d21eb9f</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I think that your order of calling might be wrong. Looking at your code, it seems that you call &lt;strong&gt;mesh_stack_init()&lt;/strong&gt; without having initialized the Mesh state, which throws an error in &lt;strong&gt;nrf_mesh.c&lt;/strong&gt;, line 284.&lt;/p&gt;
&lt;p&gt;Can you call &lt;strong&gt;nrf_mesh_enable()&lt;/strong&gt; before you call&amp;nbsp; &lt;strong&gt;mesh_stack_init()&lt;/strong&gt; and see if this works?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>