<?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>Differentiation of Events in BLE Libraries</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8969/differentiation-of-events-in-ble-libraries</link><description>I&amp;#39;m looking at the ble_app_hrs example and I&amp;#39;m confused about how the drivers are able to differentiate between events originating from various services/characteristics. For example, in main.c under the ble_evt_dispatch we have: 
 void ble_evt_dispatch</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 30 Aug 2015 01:39:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8969/differentiation-of-events-in-ble-libraries" /><item><title>RE: Differentiation of Events in BLE Libraries</title><link>https://devzone.nordicsemi.com/thread/33019?ContentTypeID=1</link><pubDate>Sun, 30 Aug 2015 01:39:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:973ff05f-3820-4d95-a0e0-959626ff0042</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;It doesn&amp;#39;t have to differentiate the source for a connection event, a connection event is global to the peripheral, not restricted to a given service, so in this case each service which cares about whether or not it&amp;#39;s connected stores the connection handle in its own data structure.&lt;/p&gt;
&lt;p&gt;If you look at other events, like handling reads and writes, you&amp;#39;ll see that those are differentiated by checking the handle of the characteristic being read/written which is available for those events. For an example of that, look at the ble_rscs code, there are many other examples too.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (p_evt_write-&amp;gt;handle == p_rscs-&amp;gt;meas_handles.cccd_handle)
{
    on_meas_cccd_write(p_rscs, p_evt_write);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>