<?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>What does this particular &amp;quot;flag&amp;quot; do in the mesh example?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27600/what-does-this-particular-flag-do-in-the-mesh-example</link><description>Hi, I&amp;#39;ve searched and googled through this site and made sure no one asked this question before. 
 In core\Bearer_event.c, there is this function: 
 bearer_event_flag_t bearer_event_flag_add(bearer_event_flag_callback_t callback)
{
NRF_MESH_ASSERT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Nov 2017 14:55:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27600/what-does-this-particular-flag-do-in-the-mesh-example" /><item><title>RE: What does this particular "flag" do in the mesh example?</title><link>https://devzone.nordicsemi.com/thread/109005?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 14:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:239e9d9f-682d-4ba5-b1bc-1ea3b2fd308e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You are correct. Mainly, when we don&amp;#39;t want to execute a function immediately, for example if we are in high priority context (handler of high priority interrupt) we don&amp;#39;t want to do time consuming operation (flash operation for example) or if it that operation should be executed in lower priority context, we will just set the flag on. And it will be executed later when handle_events() is called, in lower priority context.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What does this particular "flag" do in the mesh example?</title><link>https://devzone.nordicsemi.com/thread/109004?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 01:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55ce6bc3-f684-4db4-a150-83e5b29a94e9</guid><dc:creator>Mitch996</dc:creator><description>&lt;p&gt;Thanks Hung. Although not 100%, I think I know what it does.&lt;/p&gt;
&lt;p&gt;You have a series of events that comes with 2 critical components (among other components): one of them is callbacks (of course), which will perform specific tasks based on the nature of the event.&lt;/p&gt;
&lt;p&gt;Another critical component is flag. This flag will be set to a specific value to decide whether its corresponding event will be executed or when and how etc. it will be executed.&lt;/p&gt;
&lt;p&gt;In other words, sometimes an event has been added, but we do not want to respond to it immediately, we look at its flag to decide what to do with it.&lt;/p&gt;
&lt;p&gt;Is that how it works?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not planning on doing anything about it hehe, I just want to know exactly how it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What does this particular "flag" do in the mesh example?</title><link>https://devzone.nordicsemi.com/thread/109003?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2017 13:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c38ad7b-d7c4-49b8-acba-646a6496d3a1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mitch,&lt;/p&gt;
&lt;p&gt;What exactly do you plan do to with the flags ?&lt;/p&gt;
&lt;p&gt;The flags used in our stack is kind of event flags. So a module can register an event handler and set a flag to trygger the event handler asynchronously. Something similar to &lt;a href="https://www.freertos.org/FreeRTOS-Event-Groups.html"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We use it in several modules: scanner.c , flash_manager.c&lt;/p&gt;
&lt;p&gt;The flags have been set will be executed inside handle_events() in bearer_event.c one by one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>