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

PDU error codes

Hi,

How can I control the PDU error code when reading an attribute. E.g. Attribbute not found 0x0A. For more info see 3.4.1 Error Handling Bluetooth spec 4.1 Volume 3. I use this with another BLE solutions but it seems that I have no control about this with Nordic. Is there actually a attribute read event?

Regards, Marcel

  • The service discovery by a GATT client is an example where the the "Attribute not found" 0x0A is returned to the application. As can be seen in the message sequence chart for the service discovery, the service discovery ends when the client application receives BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP event with value ATTRIBUTE_NOT_FOUND value (0x0A). This however happens internally in the S110 peripheral softdevice, i.e. to send 0x0A. It is not sent for characteristics that do not have a value.

    What you can do is to add only the characteristics to your service that do have a value. Then whenever a value is provided to a characteristic, you add that characteristic dynamically with call to sd_ble_gatts_characteristic_add and then send a sd_ble_gatts_service_changed indication to the IOS to notify it of the service change. That should make the IOS discover attributes that correspond to the attribute handles provided to the sd_ble_gatts_service_changed function.

    There is however no function available at this point to remove a characteristic dynamically from a service, for that purpose you would need to disable the softdevice, initialize your services and then enable the softdevice again.

  • For those who want to use the proposed solution above, it does not work. Adding characteristics dynamically will only work when reconnecting. I also tried it with an iPhone and it does not work well.

Related