Animesh Jena
Animesh Jena

Reputation: 1551

What is ENABLE_INDICATION_VALUE and ENABLE_NOTIFICATION_VALUE in Client Characteristic Configuration Descriptor in ble?

I have been working on an app to read and write data from another BLE device. I don't have any issues going on from the app point of view. Just some of the conceptual doubts I need to clarify. So:

  1. Why do we need the cccd for enabling notification?

  2. Once passing the ENABLE_INDICATION_VALUE, does it enables the notification in the peripheral device?

  3. What is the major difference between ENABLE_INDICATION_VALUE and ENABLE_NOTIFICATION_VALUE while both do the same task that is, sending continuous data to the central device?

Upvotes: 4

Views: 5427

Answers (2)

Balu Sangem
Balu Sangem

Reputation: 712

1.Why do we need the CCCD for enabling notification?

firstly setCharacteristicNotification() - enabling/disabling local device to recieve notifications from peripheral device

CCCD - Client Configuration Characteristic Descriptor

"The use of CCCD is for a GATT Client to control what kind of packets the GATT Server can send to it" - which means enabling peripheral to send data.

2.Once passing the ENABLE_INDICATION_VALUE, does it enables the notification in the peripheral device?

NO.For every Indication, you have to send Acknowledgement to say that this is the data I need.

3.What is the difference between ENABLE_INDICATION_VALUE and ENABLE_NOTIFICATION_VALUE?

They both will notify if there is any change in characteristic value.

ENABLE_NOTIFICATION_VALUE -> peripheral will send if there is any change, that means this can be used for regular notificaions

ENABLE_INDICATION_VALUE -> peripheral will send if there is any change, there will be an application level ack(from ble stack) in the next connection interval (only one indication is allowed for one connection interval), then only peripheral can send new values. this is why we cant use ENABLE_INDICATION_VALUE to send regular notifications.

Upvotes: 2

Emil
Emil

Reputation: 18442

  1. The client needs to configure the server if it should enable notifications/indications. Otherwise it won't send anything.

  2. No. The 16-bit descriptor value is a bit field. Currently only two bits are defined: Notification and Indication. You could set both bits and then you should get both a notification and an indication if the server behaves correctly.

  3. A server can send notifications whenever it wants. Possibly even multiple notifications per connection event, which gives high performance. A server can only have one outstanding indication. The client needs to confirm the reception of an indication before the server can send a new one. This gives slow performance compared to notifications. Note that, in my opinion, using indications with Android or iOS as client is kind of useless because the confirmation is sent back by the Bluetooth stack before the app has handled the indication completely. So the confirmation is a "false" confirmation.

Upvotes: 10

Related Questions