bt_gatt_read() multiply read #nrf52840 #bluetooth


antonsolonovich@...
 

Hello,
I use nrf52840-dk as central_hr and nrf52833-dk as peripheral_hr, examples from NRF Connect SDK.
I want to read two or more values using bt_gatt_read().
Code:


dis->read_params.func = gatt_read_cb;
dis->read_params.handle_count  = 2;
dis->read_params.handles = dis_handles;
err = bt_gatt_read(dis->conn, &(dis->read_params));


I read two values,

BT_UUID_DIS_MODEL_NUMBER, which is "Model"

and BT_UUID_DIS_SERIAL_NUMBER, with value "serial"

Here you can see part of my log,


gatt read cb // We are in callback
 
data length 11 //One length for two values?
 
data = Modelserial //Don't understand how to split it
 
gatt read cb //Extra callback with zero length? Does it mean that reading finished?
 
data length 0
 
empty data


The problem is that in multiply read I get one callback and one length for all values,
and I don't understand how to split it, and what value for what characteristic is.

Also I've asked it on DevZone 
https://devzone.nordicsemi.com/f/nordic-q-a/77045/discovery-dis
but no success there

Thank you,
Anton