client side example of LBS using NCS

Back in SDK 17 or so there were code samples for both the client and server side of the LED button service.

What happened to the client/central example when you migrated to NCS?  Is it still available under a different name?

I'm trying to run an nrf5340 as the central (in a dual role setup).  I'd like to call LBS specific discovery functions (i.e. bt_lbs_client_handles_assign() and bt_lbs_client_subscribe_button()) but they don't appear to exist..

Searching the internet, I see examples (likely from old SDK versions) that want me to include <client_LBS.h>  but this file does not exist in the ncs\v3.2.1 directory structure anywhere.

I'm running NCS v3.2.1 in VScode 

Note: your AI assistant directed me the the NUS central example, but it calls bt_nus_handles_assign and bt_nus_subscribe_receive which are exactly the analogous calls I'd like to make for LBS

  • Hello,

    Unfortunately, it looks like the central sample for the LBS didn't make the cut into NCS.

    You can find the equivalent peripheral sample here:

    v3.2.1\nrf\samples\bluetooth\peripheral_lbs

    As for the central sample, this doesn't exist. If you need it, I would look into how the central_uart sample (same location) is built up. You can use this to see how to do service discovery, and since both of these are vendor specific services (NUS and LBS) the setup should be pretty much the same. The difference is that you would have to write the files lbs_client.c/h yourself, similar to how nus_client.c/h is built up.

    Best regards,

    Edvin

  • I did not find the LBS peripheral example helpful for making a central  implementation.

    So the answer is to write my own LBS_Client.  Since my end goal is to migrate from a (working) example of LBS client to a custom service, can I expect to be able to write an entirely custom service client based off NUS_Client or are there assumptions about how a service is organized that I must comply with?

    Also, note, this central is actually a dual role nrf5340 that serves as a peripheral to an upstream host.  Does that change which example I should work with?

  • Dan in Colorado said:
    LBS peripheral example helpful for making a central  implementation

    What I tried to say was to use the central_uart example to make a central implementation of the LBS client (or your custom service client).

    Dan in Colorado said:
    Also, note, this central is actually a dual role nrf5340 that serves as a peripheral to an upstream host.  Does that change which example I should work with?

    That shouldn't affect things much. I would start with one of the roles, such as a custom_service_client application, and then add the peripheral when you get that working.

    Best regards,

    Edvin

  • Hi Dan

    I used Vibe coding (copilot github chat on vs code) to get LBS Central. For some reasons, I named it blinky (as it reminds the nrf Blinky app from nordic, which also implements a central LBS). 

    I tested on NCS 3.2.4 and with two nRF54L15DK. button works in both directions (pushing Button 0 on either DK will trigger an LED on the other DK). 

    The zip includes the code for central. For peripheral LBS, use the one in the SDK. 
    I cannot guarantee it builds on nRF53, and given this is done by AI, take it with a grain of salt.

    I hope it helps. Please also see our DevAcademy Bluetooth course where we show how to build custom service.

    BR
    Lorenzo 

     blinky_central.zip

  • Thank you,  
    This application seems to do what a central_lbs sample would do. It scans for a device advertising with the LBS UUID, connects to it, enables notifications, and it can send data back to the peripheral_lbs.

    Best regards,

    Edvin

Related