Hello,
I have a question related to the Nordic Thingy 52 FW source code that's been posted at https://github.com/NordicSemiconductor/Nordic-Thingy52-FW/blob/master/source/ble_services/ble_tms.c
I was just wondering if I could be pointed to the file that contains the definition of the sd_ble_gatts_hvx() function that is called at line 1164.
For a bit of context, what I'm trying to achieve is to track the flow of the 9-axis points that are assigned in the file https://github.com/NordicSemiconductor/Nordic-Thingy52-FW/blob/master/source/modules/m_motion.c from lines 351-361. The end of that function results in a call to the ble_tms_raw_set function in ble_tms.c (see first link). Additionally, I tried tracking down the chain of #include files to find out where the definition of the function resides, but for some reason I'm unable to find certain header files in the github repo. I'm thinking that the definition of the function I'm looking for could be in those files that I'm unable to access, but I'm unsure as to what the case actually is.
Any help with this matter would be much appreciated! Thank you.
The sd_ble_gatts_hvx is in the softdevice, so as you have already guessed, you wont have access to its implementation. Instead you'll have to look at the documentation for your softdevice. For example this is the doc for S140 v6.0 GATTS functions.
How are you testing, and how is your behaviour different than expected? Have you enabled notification in the CCC descriptor?
Take a look at the documentation above for your notify call and see if that clears things up.
Thank you for your response.
To obtain the points, I was originally testing by printing out the raw data characteristic values to console (in the android app source code). But there was nothing being printed to the console as the raw data characteristic was never changing (source https://github.com/NordicSemiconductor/Android-Nordic-Thingy/blob/master/thingylib/src/main/java/no/nordicsemi/android/thingylib/ThingyConnection.java, line #466, never enters the if-block).
As for enabling the CCCD for the specific characteristic, I'm not entirely sure how to go about it. I've been looking at these previous posts - https://devzone.nordicsemi.com/f/nordic-q-a/55028/how-to-enable-notification and https://devzone.nordicsemi.com/f/nordic-q-a/17753/sd_ble_gatts_value_set-for-setting-directly-cccd-value but I've not been able to identify how to incorporate this in the existing source code.
Additionally, I also came across https://github.com/NordicSemiconductor/Android-Nordic-Thingy/blob/master/app/src/main/java/no/nordicsemi/android/nrfthingy/MotionServiceFragment.java. In lines 257-270, they have blank functions for onAccelerometerValueChangedEvent(), onGyroscopeValueChangedEvent(), and onCompassValueChangedEvent(). I tried printing values to the console in those functions to but there wasn't anything being printed to the console, so I'm assuming those functions aren't called in the way I'm supposing they are.
Edit : I forgot to add that I also looked into the documentation you mentioned for the s132.0 (not the 140) https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.1.0%2Fgroup___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html. I think I should be using the uint32_t sd_ble_gatts_sys_attr_set function to set the CCCD to 0x0001 as required to enable notification, but again, I don't know how I should I go about doing this.
So as per your suggestion, I'm assuming I first have to enable notifications on the FW code and then the Android side of things too. I'd appreciate if you could let me know how to go about doing so.