<?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>obtain GATT response code in Android application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41943/obtain-gatt-response-code-in-android-application</link><description>Hi All 
 On my NRF52 device I want to return my own error code after a mobile application (android) has written some data to my custom characteristic. For that I consider to use sd_ble_gatts_rw_authorize_reply() with codes range defined as BLE_GATT_STATUS_ATTERR_APP_BEGIN</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 May 2019 01:46:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41943/obtain-gatt-response-code-in-android-application" /><item><title>RE: obtain GATT response code in Android application</title><link>https://devzone.nordicsemi.com/thread/188669?ContentTypeID=1</link><pubDate>Thu, 23 May 2019 01:46:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a761d528-fa89-42be-b618-0e9979ec5937</guid><dc:creator>goldwake</dc:creator><description>&lt;p&gt;I&amp;#39;ve noticed that the gatt status code is truncated too. I made a&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47646/androidos-seems-to-treat-gatt-status-as-an-8-bit-number-rather-than-16" rel="noopener noreferrer" target="_blank"&gt; post about it on the devzone forum&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: obtain GATT response code in Android application</title><link>https://devzone.nordicsemi.com/thread/164656?ContentTypeID=1</link><pubDate>Wed, 09 Jan 2019 09:44:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71bd2510-386d-4e75-96d7-221adffe7e84</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see that&amp;nbsp;you have the following in your code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static final int BLE_GATT_STATUS_ATTERR_APP_BEGIN = 0x80;
static final int BLE_GATT_STATUS_ATTERR_APP_END = 0x9f;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;These values does not correspond to how they are defined in&amp;nbsp;ble_gatt.h, the correct values are:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define BLE_GATT_STATUS_ATTERR_APP_BEGIN                  0x0180  /**&amp;lt; ATT Error: Application range begin. */
#define BLE_GATT_STATUS_ATTERR_APP_END                    0x019F  /**&amp;lt; ATT Error: Application range end. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But you are saying that the &amp;#39;1&amp;#39; /MSB is&amp;nbsp;truncated on the android side?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;How about adding back the MSB in the callback? (add a test if the callback is for your custom&amp;nbsp;characteristic?)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Another option could maybe be to use e.g.&amp;nbsp;BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN/END instead.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>