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

How to interact with connected devices through the device manger

Hello, I started implementing a project with the device manager. I am using the S120 as central. I am able to connect to 3 peripherals at the same time (also nordic nrf51822). So in general, the device manger does its work. But now, I can not find the information how to interact (write a characteristic) with one specific peripheral/peer. I believe, writing a characteristic will be done with sd_ble_gattc_write(...). But where to get the right handle?

Also I don`t know, how to disconnect from a specific peer. Must these tasks be done by the client handling? Or can that be done directly with the device manager.

Is there an existing example?

I also had a look to the device manager tutorial and it helped a lot when setting up the device manager. But the tasks I mentioned are not described.

Thanks for any help/hint/link.

Regards, BTprogrammer

  • Why are you mixing device manager into this? Device manager handles pairing and bond information, it is not used for writing to a characteristic value. You are correct about sd_ble_gattc_write(). What handle do you mean? The connection handle or the attribute handle?

  • Hi Petter, thanks for your reply. Yes, in my understanding, the device manager handles multiple connections to more than one peripheral at the same time. Right!? I had a deeper look into the S120 multilink example. There I found, that the interaction is done by the client_handling.c file/functions. Yes, I mean the connection handle. I found out that it seems to work with sd_ble_gap_disconnect(m_client[systemID].srv_db.conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);. So the connection handle is part of the m_client array. Right!? Regards

  • Well, yes, it handles multiple connections, but only the pairing and bond information aspect. You get the connection handle with the BLE_GAP_EVT_CONNECTED event. Then you can use the handle do identify events on that connection, and do operations, like write, on that connection. In ble_app_multilink_central you can see that connection handle is assigned with ble_lbs_c_handles_assign() when you get the BLE_GAP_EVT_CONNECTED in on_ble_evt().

  • Ok, after looking into the multilink example, I am pretty sure that I have to discover all the services and characteristics that are available on the connected peer. Right!? Normally I would say this doubles the work. Because I know with what kind of device I am connected. So I should know which, services and characteristics are available. For example, I know, that the device I want to interact with, has two services, one with 20 characteristics, and one with 4 characteristics. Which data fields do I have to adjust when looking at the multilink example? Or will all these information be stored in the m_client[].srv_db data field when doing a discover? Is there an example, how to set up a propper communication to a peripheral on the central side?

    Regards, BTprogrammer

  • I don't know what you have to do. I don't know what your application is. For a client to be able to access a characteristic value, descriptor++ on a server it needs to have the attribute handles of these. These are normally obtained by doing a service discovery. If you know the attribute handles, you could also hack it and hard code the them. Yes, there are several examples, in \examples\ble_central

Related