2 months ago.

Is offset for BLE read long values in use?

Hi there,

I'm trying to read from a GATT client a characteristic with 29 bytes, this is, a long characteristic value. It only reads the first 22 bytes, this is, the first chunk of data sent by the GATT server. I know the server can send the full 29 bytes since I have tested using a phone app to access the server just to see in which side of the communication was the problem.

I have tracked backwards the DiscoveredCharacteristic::read(...) function all the way up to BlueNRGGattClient::read function where I've found that the offset argument sent to this function is fully ignored in its implementation, as can be seen below...

include the mbed library with this snippet

ble_error_t BlueNRGGattClient::read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const
  /* avoid compiler warnings about unused variables */

  tBleStatus ret;

  BlueNRGGattClient *gattc = const_cast<BlueNRGGattClient*>(this);

  // Save the attribute_handle not provided by evt_att_read_resp
  gattc->readCBParams.handle = attributeHandle;

  // FIXME: We need to wait for a while before starting a read
  // due to BlueNRG process queue handling

  ret = aci_gatt_read_charac_val(connHandle, attributeHandle);

  if(ret == BLE_STATUS_SUCCESS) {
    gattc->_currentState = GATT_READ_CHAR;
    return BLE_ERROR_NONE;
  switch (ret) {
    return BLE_STACK_BUSY;

As you can see, the code calls aci_gatt_read_charac_val(connHandle, attributeHandle) and do not pass along the offset value. But what is more strange to me is that there is another function aci_gatt_read_long_charac_val(...) which does use a third argument with the offset, but this function is not being used.

Why ? Is the read of long value characteristics possible with this library or not (maybe I'm looking the wrong functions) ?


Does anyone at mbed look at these posts? Is it worthy to keep a forum like this if nobody answer to critical questions?

posted by Jorge Monagas 19 Feb 2019
Comment on this question

1 Answer

1 month, 3 weeks ago.

Hi Jorge,

Since Mbed OS has introduced Cordio BLE stack, would you mind port your project to use Cordio BLE stack?

What board are you using?If the board is listed in Mbed supported platform, then it's very easy to use Cordio BLE stack.

You can refer to this mbed_app.json

Take NUCLEO_F401RE for an example, you just need add below configuration to your mbed_app.json, then your project will use Cordio BLE Stack, that is more powerful and well-supported.


"target_overrides": {
        "NUCLEO_F401RE": {
            "target.features_add": ["BLE"],
            "target.extra_labels_add": ["CORDIO", "CORDIO_BLUENRG"]

Let me know if you have any questions.

Desmond, team Mbed

To post an answer, please log in.