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

why do not have 'BLE_GATTS_EVT_READ' ?

HI,ALL

in the nRF5_SDK_11.0.0-2.alpha_bc3f6a0 , GATT Server Event IDs.

i do not find the read event.

All i found is the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST .

Now i need a read event without authorization, which event can i use?

Then i download the ble_app_bps in the nrf52382.

And when iphone connect the board with lightblue and read the battery characteristic, the project do not enter the function static void ble_evt_dispatch(ble_evt_t * p_ble_evt);

BR Bernerd

  • What? If you don't set the read characteristic to require authorisation then the stack doesn't call you back, it just returns the data in the characteristic. This is the default case, because in most cases you just want to set the data and have the stack handle it automatically. This is all in the message sequence charts, the chart for GATTS Read Request without Authorization shows there are no callbacks.

    If you want to know the characteristic was read, authorise it, change the data before it goes out or in any other way intercept the read, you use BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST and set the characteristic to require read auth.

    If you don't need to know, authorise it, change the data before it goes out then you just let the stack handle it for you. Simple.

Related