<?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>Publish custom message using access layer mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111426/publish-custom-message-using-access-layer-mesh</link><description>Hi! I am taking reference to following issue : 
 
 I have implemented same method as discussed in above link. I am getting message on client side successfully only when code for custom message transmission is in button event handler. 
 
 
 But when I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 25 May 2024 05:42:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111426/publish-custom-message-using-access-layer-mesh" /><item><title>RE: Publish custom message using access layer mesh</title><link>https://devzone.nordicsemi.com/thread/485902?ContentTypeID=1</link><pubDate>Sat, 25 May 2024 05:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b2126d3-626c-43f6-bb52-d0dacb59da49</guid><dc:creator>Danish_Riaz</dc:creator><description>&lt;p&gt;Hi!&amp;nbsp;To avoid&amp;nbsp;&lt;span&gt;NRF_ERROR_FORBIDDEN we can use application timer and can do access layer publication in timer callback.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards: Danish Riaz&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Publish custom message using access layer mesh</title><link>https://devzone.nordicsemi.com/thread/485658?ContentTypeID=1</link><pubDate>Thu, 23 May 2024 13:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1593b17-0f4b-40f2-8a25-ac873e9d1d14</guid><dc:creator>Danish_Riaz</dc:creator><description>&lt;p&gt;Hi! I have also try this implementation &amp;quot; Running application and mesh event handling in main loop&amp;quot; in nrf documentation following is link .&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v4.2.0%2Fmd_doc_user_guide_mesh_interrupt_priorities.html&amp;amp;cp=7_2_2_5"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v4.2.0%2Fmd_doc_user_guide_mesh_interrupt_priorities.html&amp;amp;cp=7_2_2_5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is my code detail.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void publish_message(void)
{
    access_message_tx_t msg;

    msg.opcode.opcode = SENSOR_OPCODE_STATUS;
    msg.opcode.company_id = 0xFFFF;
    msg.force_segmented = m_sensor_server_0.server.settings.force_segmented;
    msg.transmic_size =  m_sensor_server_0.server.settings.transmic_size;

    char *message = &amp;quot;Enable Reciever\n&amp;quot;;
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Message from Initiator =  %s\n&amp;quot;,  message);
    msg.p_buffer = (const uint8_t *)message;
    msg.length   = strlen(message);
    int status = access_model_publish(m_sensor_server_0.server.model_handle, &amp;amp;msg);   

     if (status == NRF_ERROR_INVALID_STATE ||
      status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
       {
         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
       }
       else
       {
             ERROR_CHECK(status);
       }
}


int main(void)
{
    nrf_power_dcdcen_set(1);

    //Initialize schedular to handle events from mesh
    APP_SCHED_INIT(APP_SCHED_EVENT_SIZE, APP_SCHED_QUEUE_SIZE);

    initialize();
    start();

    for (;;)
    {

      app_sched_execute();
      bool done = nrf_mesh_process();

      //Publish message to address assigned by static provisioner
      publish_message();

       if (done)
       {
          sd_app_evt_wait();
       }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have got reference from following issue. But now getting &amp;quot;NRF_ERROR_FORBIDDEN&amp;quot;&amp;nbsp; &amp;quot;&amp;nbsp;app_error_weak.c,&amp;nbsp; 115, Mesh error 15&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/63800/app_error_weak-c-105-mesh-assert-at-0x0002bcaa-0"&gt;app_error_weak.c,  105, Mesh assert at 0x0002BCAA (:0)&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best Regards : Danish Riaz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>