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

Problem with nRF Connect for Android

Hello,

I'm working on a custom GATT service which has only one characteristic that support notification. The code has started from the ble_hrm service and it runs on a thingy (in parallel with all the other services the original thingy firmware has). With respect to the standard thingy firmware, in my application it is the thingy that connects as Central and the smartphone that acts as Peripheral.

When I enable the notification, the device start sending data, sd_ble_gatts_hvx returns NRF_SUCCESS and I get BLE_GATTS_EVT_HVN_TX_COMPLETE anyway on nRF Connect for Android (v 4.19.1) I cannot see the notification arriving. The strange thing is that, with an older version of nRF Connect for Android it worked and also with the desktop version it works. Moreover by porting the code to run on a PCA10040 again it works.

I have the impression that the nRF Connect somehow have problem when an unknown custom service is added to the Thingy GATT server.

Is this an expected behavior?

Thank you Davide.

Parents
  • Hi,

    In some of the latest releases of nRF Connect for Android I decided to call `setCharacteristicNotification(..., true)` just after connecting to a device, so that if a notification is received from a device I would display the received value and marked the CCCD as enabled for this characteristic. This is because, when you debug your connection in background, while having another app open, you'd like to see the incoming notifications without need to  enable notifications (as they are already enabled by the other app). The intentions were amazing Slight smile

    However, as I found later, there is a limit of 15 characteristics per BluetoothGatt object that may have notifications enabled: Max 15 notifications . They are enabled from top to bottom, so if Thingy has already 15 characteristics with notify/indicate properties, calling this `setCharacteristicNotification` for 16th time does not work. That's may be the reason that you don't receive notifications.

    And actually, I made it so smart, that you can't disable them. You may send value to CCCD, but this does not disable the local listener. so.. there is no way to receive notifications from 16th+ characteristic. I'll fix it in the next release. For devices having less than 15 characteristics it will work like in 4.19.1, but for devices with higher number it will not enable them by default.

    I hope that's the reason. Otherwise I have no clue Slight smile

Reply
  • Hi,

    In some of the latest releases of nRF Connect for Android I decided to call `setCharacteristicNotification(..., true)` just after connecting to a device, so that if a notification is received from a device I would display the received value and marked the CCCD as enabled for this characteristic. This is because, when you debug your connection in background, while having another app open, you'd like to see the incoming notifications without need to  enable notifications (as they are already enabled by the other app). The intentions were amazing Slight smile

    However, as I found later, there is a limit of 15 characteristics per BluetoothGatt object that may have notifications enabled: Max 15 notifications . They are enabled from top to bottom, so if Thingy has already 15 characteristics with notify/indicate properties, calling this `setCharacteristicNotification` for 16th time does not work. That's may be the reason that you don't receive notifications.

    And actually, I made it so smart, that you can't disable them. You may send value to CCCD, but this does not disable the local listener. so.. there is no way to receive notifications from 16th+ characteristic. I'll fix it in the next release. For devices having less than 15 characteristics it will work like in 4.19.1, but for devices with higher number it will not enable them by default.

    I hope that's the reason. Otherwise I have no clue Slight smile

Children
Related