<?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 does one get an internal firmware notification when an external device reads a characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65015/how-does-one-get-an-internal-firmware-notification-when-an-external-device-reads-a-characteristic</link><description>I have a firmware build that uses the nRF52832 (SoftDevice S132) to return a variety of read characteristics to an external device. So far so good. I can verify that the values are read properly when using nRF connect or a mobile app. 
 How can I get</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Aug 2020 05:51:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65015/how-does-one-get-an-internal-firmware-notification-when-an-external-device-reads-a-characteristic" /><item><title>RE: How does one get an internal firmware notification when an external device reads a characteristic?</title><link>https://devzone.nordicsemi.com/thread/266354?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 05:51:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2742fb70-de46-4fa6-9618-cf3da4b03eef</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Good to hear the success. You can verify his answer to thank him.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does one get an internal firmware notification when an external device reads a characteristic?</title><link>https://devzone.nordicsemi.com/thread/266332?ContentTypeID=1</link><pubDate>Tue, 25 Aug 2020 20:21:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85239cd6-2ca8-4c2f-9fef-8ef7e64edb09</guid><dc:creator>TCdeveloper</dc:creator><description>&lt;p&gt;I think Richard D.&amp;#39;s response was on the right track, although one doesn&amp;#39;t have to provide any value.&lt;/p&gt;
&lt;p&gt;I also think this link was helpful too:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/9505/how-do-i-add-authorization-on-read-write-on-a-service-s-characteristics/35090#35090"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/9505/how-do-i-add-authorization-on-read-write-on-a-service-s-characteristics/35090#35090&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Code that worked for me was:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;ble_gatts_rw_authorize_reply_params_t auth_reply;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;memset(&amp;amp;auth_reply, 0, sizeof(auth_reply));&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;auth_reply.type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = BLE_GATTS_AUTHORIZE_TYPE_READ;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;And then in the BLE event handler, add a case that looks like:&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sd_ble_gatts_rw_authorize_reply(m_conn_handle, &amp;amp;auth_reply);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Generic reply to allow read.&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Do anything else you want here. Strobe an LED etc...&lt;/p&gt;
&lt;p style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does one get an internal firmware notification when an external device reads a characteristic?</title><link>https://devzone.nordicsemi.com/thread/265426?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 23:54:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae9c8fd6-af1b-42c2-abe8-4dbe9a4d15e5</guid><dc:creator>Richard D.</dc:creator><description>&lt;p&gt;One of the parameters to sd_ble_gatts_characteristic_add() is the attribute metadata, ble_gatts_attr_md_t.&amp;nbsp; Set the element .rd_auth = 1.&lt;/p&gt;
&lt;p&gt;Then in your ble event handler (depends on sdk version), add a case for BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST.&amp;nbsp; In that case, check the request for BLE_GATTS_AUTHORIZE_TYPE_READ.&amp;nbsp; If so, you&amp;#39;ve got a read request for the indicated characteristic.&lt;/p&gt;
&lt;p&gt;Note that this is not just a notification, you will need to provide the value that is being read rather than the gatts subsystem managing that for you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t find an example that shows it clearly, but the above should get you started.&lt;/p&gt;
&lt;p&gt;Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>