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

How to retrieve information from Soft Device

Hi all,

I am currently working on the nRF51422 with the S110 version of the Softdevice. The SDK version is 8.1.0.

I tried to get some information back from the Softdevice itself without using a BLE connection in my application. I have done some manipulation (especially using the handle number of my serv/char) with the S130 but it seems that the S110 is a bit different. My problems and also my questioning are:

  1. Using the ble_gatts.h library in S130 I used the function "sd_ble_gatts_attr_get" to get a correlation between uuid and handle number. The function is not available in the S110? Why?

  2. Is there any other way, except from the function used in 1. to retrieve information from the SD using S110? (Handle and uuid associated)

  3. Also in an application server, when we initialize each service/char/descr, is every handle attributed by the SD always incremented by 1?

Thanks a lot for your answers, Thomas

Parents
  • Hi Thomas,

    before Nordic will comment on details of S110/S130 APIs: you should get (and store) GATTS handle at the time you provision (create) given service/characteristic/include/descriptor handle through functions such as sd_ble_gatts_service_add, sd_ble_gatts_characteristic_add, sd_ble_gatts_descriptor_add and sd_ble_gatts_descriptor_add, or not?

    Cheers Jan

Reply
  • Hi Thomas,

    before Nordic will comment on details of S110/S130 APIs: you should get (and store) GATTS handle at the time you provision (create) given service/characteristic/include/descriptor handle through functions such as sd_ble_gatts_service_add, sd_ble_gatts_characteristic_add, sd_ble_gatts_descriptor_add and sd_ble_gatts_descriptor_add, or not?

    Cheers Jan

Children
  • Hi Jan,

    Thanks for your quick answer. I know those handles is stored into the data structure of my services but I would like to know if there is another way to have a correlation between handle/uuid independently of my services structure.

    Also if you check this services structure, there is no handle for the main characteristic where the permission (read/write/notify) is stored. The permission is only known during the initialization of my service. and again I would like to be able to retrieve this information after all the service initialization.

    I hope to be clear enough.

  • I'm not sure I follow your remark. E.g. sd_ble_gatts_characteristic_add function (which is the most interesting for you I guess) has ble_gatts_char_handles_t *p_handles parameter which populates given structure with all handles created. And if you are interested into handle of Characteristic's permissions (even you cannot do anything with it on GATT server side I believe) then it is from BT SIG specification mandatory "value_handle - 1", isn't it?

  • Ok about ble_gatts_char_handles_t, this data structure is stored into my service structure for each characteristic. For the "value_handle - 1", I guess you are right, I noticed it every time I discover my services and their characteristics. The point is I work with customs services which implement several characteristics so it's difficult to know which handle will give you the main characteristic handle by substracting 1... For the permission, I just need to read the value of the main characteristic handle (that's not a problem).

    What I am trying to do is to retrieve information without having to change anything in the initalization of my characteristics or services.

  • Well "normally" the work with GATT server in Nordic SoftDevice looks like this:

    1. Initialize all necessary objects and store in your app handle references to all of them which you need for further communication (it typically are only Characteristic's Value handles and CCCD handles but could be more).
    2. Once you get any GATTS related event in your main SoftDevice event hadler then you simply first check over which GATTS handle this event comes and acting accordingly.

    It looks very simple and straight forward to me. No need to interrogate SoftDevice (even more crazy to do it each time and during interrupt/scheduled event) what this handle means. Sure, it brings necessity of storing all active handles in your app as kind of state variables but you will anyway need to do something like that if you list your application's features by UUIDs... I find this pretty effective. Cheers

Related