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

Handling a BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST

I have configured the settings of a Blood Pressure Feature characteristic to have RW authorized request. When the client reads the feature, the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event is signaled. However, I have already set the value of the feature and I do not want to set it here. So I set the response as follows:

            ble_gatts_rw_authorize_reply_params_t p_rw_authorize_reply_params;
            p_rw_authorize_reply_params.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
            p_rw_authorize_reply_params.params.read.update = 0;
            p_rw_authorize_reply_params.params.read.offset = 0;
            p_rw_authorize_reply_params.params.read.gatt_status = NRF_SUCCESS;

Note that the update is set to 0, which as I understand it is supposed to IGNORE any attempt to update the characteristic but just return what is already there.

However, I get the error that soft device is unable to encode the packet.  That is pretty obvious because I have given no packet information. If I DO give the proper packet info, the method succeeds. Why is that happening? It makes no difference if I set the 'update' parameter to 0 or 1. I specifically do NOT want to update the value. Is there missing information in the documentation.

Please note that I am using the ble_pc_driver so I am using only sd_* calls.

Parents Reply Children
  • ok. What did the sd_call return, then?

    Just as a warning, I can report it to the pc-ble-driver team, but if there is a quick fix, you would need to update the files in the library, so building the library may not be a bad idea. 

    Where in building this library did you get stuck?

    BR,

    Edvin

  • I don't recall entirely.One part was all this third party software one had to install which I didn't want. I would also have to learn how to use it. In the end I think I tried to construct a VS project from scratch based upon the git repo distribution but I did not succeed. 

    If I included the value in the response, the sd call always succeeded regardless of the 'update' setting. If not, it failed with the encoding error regardless of the 'update' setting. As a work a round I always set the value.even if it is the same one in the data base.

  • Ok. Is it possible for me to reproduce this? Can you send the pc-ble-driver project that you are using, and the peripheral project that you are using for the nRF?

  • Yes I can. I have an IHE meeting that I am going to in a few hours but I will try and get this to you. You will need a peer collector to communicate with. There is one available free on the Android Play Store. The peripheral project consists of six Health Device Profiles (Blood Pressure, Glucose Monitor, Heart Rate, Pulse Oximeter, Thermometer, and Weight Scale. They are configurable. A JSON string with config info is sent via MQTT which is then used to run the given peripheral. I am going to try and figure out a way to pre-load a config so you don't have to mess with MQTT (there is a downloadable free MQTT broker that you can install locally on your system and I have a project that uses that. I could zip up the broker.

    You will need Visual Studio 2019 Community Edition (which is supposedly free).

Related