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

Where is the function which sets the cccd?

Hello, I'm using an android device to set cccd, it worked when I was running the project on nrf514xx @s110, it no longer does on nrf52840 S140, so now I wanna make sure the program actually dont skip the part that sets the cccd.

So where in the library API can I find it? Which switch case? Which API function? I imagine it is a part of a gatt call back somewhere, but I can't quite tell where.

I hope it's not deeply hidden in the SD and it's impossible to locate.

Also, the other question I asked here can provide some more background:

devzone.nordicsemi.com/.../

  • However now SD ignores Write CMD to CCCD and doesn't (logically) notify application, only Write Request will cause that.

    Thank you again for your reply endnode, you seem to be hell bent on me switching from some sort of "write" to some sort of "request" yea I can do that, but first allow me to ask you this question so as to clear things up a bit, how do I do it?

    By modifying code the MCU side or android side? Because at this point I'm not aware there are any newer, updated official API which sets the cccd with the value 0x0001 in android. This is the code I'm currently using:

  • if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) { BluetoothGattDescriptor descriptor = characteristic.getDescriptor( UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG)); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor);

    is the "write" in the "mBluetoothGatt.writeDescriptor(descriptor);" problematic, and should be changed to "request"? Don't worry, just give a guesswork. If that's the case then I don't know how to do it, because sadly there is no "request" function looks promising.

    On the other hand, I do hope everything can be solved MCU side.

  • I'm not Android guru but I would say it should be managed by Android underneath and your code is fine. Also it's absolutely unsure this is your problem. Seeing what really goes over the radio would give you more clues. Then you can dig into why Android doesn't follow the spec or why Nordic things BT SIG spec insists on using GATT Write Request (or sometimes called Write with Response) and doesn't allow Write Command (or Write without Response if you want). Unfortunately my only sources on this topic are these links from this forum, I have neither time nor resources to test all this on nRF5x and phones any time soon...

  • So I take that as an "yes", I have to use a different function in android to switch from "write" to "request"?

    Well crap.

    Alright, so by " Seeing what really goes over the radio would give you more clues.", you mean I use some sort of software sniffer, hooked up to a bluetooth dongle? Can you recommend one? Please..?

    Also, I'm suppose to sniff at what my anroid device send out, right?

    What if there is no function, like ever to send those "requests", but instead only "writes"? What am I going to do then? Is there a way to make nordic change their SD back? :( I miss the good old days...

  • I would expect you are not the first one looking into GATT Client API and Write functions on Android so search here or elsewhere should help. To the sniffer: I've thought you are familiar with Nordic sniffer, sorry, wrong assumption. It works out of the box on nRF51 DK and nRF51 Dongle (I recommend DK) but if you only have nRF52 DK then search this forum for unofficial port, it works too. Use strictly (outdated) Wireshark 1.x, newer versions are incompatible. I'm afraid it works on Windows so if you are MAC or Linux guy you might need to look for some help here on the forum... There are similar tools from TI and other vendors, also some more expensive (and better) analyzers are on the market (e.g. Frontline BPA, if you get it discounted from 4k USD to 1k then go for it, it's real help for PROs in BLE field...)

Related