This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

AndroidOS seems to treat Gatt Status as an 8 bit number, rather than 16

I'm returning an error code on a rw_authorized characteristic using uint32_t sd_ble_gatts_rw_authorize_reply(uin16_t conn_handle, ble_gatts_rw_authorize_reply_params_t * auth_reply);

auth_reply contains a 16 bit gatt status field

On a read that my device determines to be invalid, I was returning a custom error code of 0x180 which corresponds to BLE_GATT_STATUS_ATTERR_APP_BEGIN and noticed that the androidOS was giving the error code as 0x80 which corresponds to GATT_NO_RESOURCES on both nrfConnect for android and my custom app.

After playing around a bit, I found that using lower value error codes, e.g. 0x2, resulted in correct error codes while higher values such as 0x187 resulted in the top byte being lost.

Nrf Connect for desktop shows the correct gatt status

Has anyone else noticed this behaviour?

Im using a samsung galaxy a3 (2017) running android 8.0.0 and a nexus 5x running android 8.1

Parents Reply Children
Related