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

Differentiating BLE connection types

Hi, I am trying to implement an example that support multiple peripherals (HRS & UART). When I get a connection (from either) I get the BLE_GAP_EVT_CONNECTED. How can I differentiate who I am getting connected to ? (HRS or UART). I can see the address but address is not a valid differentiator in my scenario. Thanks

  • I have experimented with all kinds of discovery with the connection handle using Gatt Client functions. They all "work" but I am still not figuring what to use to differentiate connections.

  • Hi

    The HRS and UART are services that can be implemented to be in the same connection. Do you really want to make your peripheral device connect to a central with only one of the services enabled at a time, or do you want the HRS and UART to be enabled in the same connection? 

    Please take a look at our BLE service tutorial to see how to implement services in your application, as I assume that you want to use the UART to print the values from HRS to a GUI (graphical user interface) to be able to see the HRS values.

    Best regards,

    Simon

  • Thanks Simon.

    I will not be doing UART and HRS on the same connection. Machine A will make a connection to my peripheral using UART and send/receive data in both directions. Machine B will make a connection to my peripheral and receive HR measurements. So my app can't tell what connections to send HR measurements and which is used for UART communications.

  • Hi

    Okay, thank you for clarifying. It is possible to have multiple services like you're describing. Either to have both services available all the time, but in that case, both central devices will have access to both services.

    Alternatively, if you only want Machine A to be able to use UART and Machine B only should be able to use the HRS service, you can change the service UUIDs that you put into the advertising packet between disconnections.

    Best regards,

    Simon

Related