Context
I followed these tutorials (which are great btw) and adapted them to have 2 custom services:
- Nordic UART Service (as provided in examples, no modification)
- My custom service
In my custom service I added 4 characteristics. All these characteristics share the same ble_uuid128_t base_uuid, which is different from the service they belong to.
- Service UUID: 0000FFFD-0000-1000-8000-00805F9B34FB
- Char1: CAFE0001-1234-1234-1234-123456789000
- Char2: CAFE0002-1234-1234-1234-123456789000
- Char3: CAFE0003-1234-1234-1234-123456789000
- Char4: CAFE0004-1234-1234-1234-123456789000
I use nRF Connect mobile app for Android to test my program.
Problem
When I try to interact (Read/Write/Enable notifications, ...) with my characteristic, the applications hangs forever.
In the logs, the last DEBUG frame is gatt.writeCharacteristic(CHAR_UUID, VALUE)
I tried to change the Service UUID so it matches the one from characteristics(CAFEFFFD-1234-1234-1234-123456789000)
And then that worked ! I was able to successfully Write/Read/etc.
I understand that I register my service UUID with sd_ble_gatts_service_add(), so the SoftDevice indexes the Service UUID.
However it seems that despite attaching my characteristic to the service handle with sd_ble_chracteristics_add(), it seems that some link is missing.
Like... the characteristic base UUID is not registered/indexed/?, only listed (because it appears OK in the Service/Char list after connection and discovery).
I am confused.
Notes:
- I have set
vs_uuid_countto 3 (NUS UUID, Custom service UUID, Custom characteristic UUID). I also tried with 2 with no effect. - The RAM is adapted correctly so I have no warning with
soft_device_enable() - I only advertise my custom service, (not the NUS) but when I connect I see all my services and characteristics with the correct UUIDs
- The NUS service is working as expected, no matter the configuration used for the custom service