<?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>related to app</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2856/related-to-app</link><description>Hi All,
I am novice in this nordic nrf 51822 programming. I wanted to know the best way to do the
following. 
 
 I have two different functionalities to be run on eval board. at a time, only one functionality
is run [mutually exlusive functionalities</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Jun 2014 12:28:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2856/related-to-app" /><item><title>RE: related to app</title><link>https://devzone.nordicsemi.com/thread/10887?ContentTypeID=1</link><pubDate>Thu, 19 Jun 2014 12:28:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45265de6-13a7-4fa4-9bb2-15d2ad4d1d26</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;If I understand correctly, you want the central (phone) to be able to send data to the peripheral (nRF51822) and explicitly set it to run one out of two operations. Similar to setting a boolean flag. Please correct me if my understanding is incorrect.&lt;/p&gt;
&lt;p&gt;I would recommend looking at this application note: &lt;a href="https://www.nordicsemi.com/eng/nordic/download_resource/24020/5/30114525"&gt;www.nordicsemi.com/.../30114525&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When sending this from the central to the peripheral, you will get a BLE_GATTS_EVT_WRITE event in on_ble_evt() function. You can then read out the data by adding another case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;case BLE_GATTS_EVT_WRITE:
{            
    ble_gatts_evt_write_t * p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;
    uint8_t buffer[MAX_RECEIVED_SIZE];
    if (p_evt_write-&amp;gt;len == MY_DESIRED_LEN)
        /* do something with data, is located in p_evt_write-&amp;gt;data*/
        
} 
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>