Report
4 days, 16 hours 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 */
  (void)offset;

  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
  Clock_Wait(100);

  ret = aci_gatt_read_charac_val(connHandle, attributeHandle);

  if(ret == BLE_STATUS_SUCCESS) {
    gattc->_currentState = GATT_READ_CHAR;
    return BLE_ERROR_NONE;
  }
  switch (ret) {
  case BLE_STATUS_BUSY:
    return BLE_STACK_BUSY;
  default:
    return BLE_ERROR_INVALID_STATE;
  }
}

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) ?

Thanks.

Comment on this question
Be the first to answer this question.

To post an answer, please log in.