<?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>How to get data from different characteristics</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8145/how-to-get-data-from-different-characteristics</link><description>Hello, 
 i have a BLE device running with a service with three writable characteristics. At the moment I have one data handler function.
If there is any characteristic written, the software will jump to this data handler. My question is, how can I differ</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Jul 2015 07:53:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8145/how-to-get-data-from-different-characteristics" /><item><title>RE: How to get data from different characteristics</title><link>https://devzone.nordicsemi.com/thread/29276?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 07:53:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1b8513a-b0f3-4376-9cb0-fb9e8691801f</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hello RK,&lt;/p&gt;
&lt;p&gt;thanks for your reply. Now I added three different data handlers. And call each specific data_handler function in the on_write function. I think this is the right way for my application. And it is just the way I suspected...&lt;/p&gt;
&lt;p&gt;Thanks and regards,
BTprogrammer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get data from different characteristics</title><link>https://devzone.nordicsemi.com/thread/29275?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2015 07:33:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a4296a2-eed6-4e29-b691-0b6a7dafbe6c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;All the information is in the p_ble_evt, if you follow that down you&amp;#39;ll find the characteristic being written (and a whole load of other information). So yes you need to do something in the on_write handler to either call one of three functions or pull the information out of the structure and pass it as another argument to one function or any combination of those.&lt;/p&gt;
&lt;p&gt;The current signature of your memory_data_handler() has already lost the information about which characteristic was written.&lt;/p&gt;
&lt;p&gt;If your three writable characteristics are basically very similar and handled in similar ways, then use one handler and just pass it the characteristic pulled from the event, if your three characteristics are quite different and would benefit from each having its own handler code, then switch inside the on_write() and call one of three pieces of code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>