<?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>Unable to read packets from custom BLE Characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67062/unable-to-read-packets-from-custom-ble-characteristic</link><description>Hello guys! 
 We are workng with nRF52840 SoC and SDK v17.0.2. 
 Custom BLE Services and Characteristics are needed to implement in our device. Before starting that implementation, I passed through your beginner&amp;#39;s tutorials on Services and Characteristics</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Oct 2020 12:28:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67062/unable-to-read-packets-from-custom-ble-characteristic" /><item><title>RE: Unable to read packets from custom BLE Characteristic</title><link>https://devzone.nordicsemi.com/thread/274636?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 12:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d96dfb1f-d6ef-4a61-8e4d-a541f9841311</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;I think I resolved the issue. It might be useful for someone in the future so here is what I do when &lt;strong&gt;BLE_GATTS_EVT_WRITE&lt;/strong&gt; event happens:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BLE_GATTS_EVT_WRITE:

    if(p_ble_evt-&amp;gt;evt.gatts_evt.params.write.handle == p_mercury_service-&amp;gt;timestamp_handshake_char_handles.value_handle){
        NRF_LOG_WARNING(&amp;quot;Data received over desired custom BLE Characteristic!&amp;quot;);
        NRF_LOG_WARNING(&amp;quot;BLE Data length: %d&amp;quot;, p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len);    
        NRF_LOG_HEXDUMP_INFO(p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data, p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len)
    } else {
        NRF_LOG_WARNING(&amp;quot;Data received over some other cusotm BLE Charecteristic!&amp;quot;);
    }

    break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;with&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;if(p_ble_evt-&amp;gt;evt.gatts_evt.params.write.handle == p_mercury_service-&amp;gt;timestamp_handshake_char_handles.value_handle)&lt;/pre&gt;&amp;nbsp;condition, I basically check if received data coming from desired custom BLE Characteristic. If affirmative, we can access the data through&amp;nbsp;&lt;em&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data &lt;/strong&gt;&lt;/em&gt;pointer. The length of received data can be read from &lt;em&gt;&lt;strong&gt;p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len &lt;/strong&gt;&lt;/em&gt;!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>