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

Example code for S120 custom central service

Hello!

I successfully followed nAN-36 and loaded the code into a NRF51 DK (PCA10028). The next step I intend to take is to prepare a custom central service that matches the custom peripheral service of nAN-36. I have 2 nRF51 DK, so my plan is to load custom peripheral service to one and to load custom central service to another.

My doubts is: Where to find S120 custom central service examples? Or even: How should I start to create the custom central service compatible to nAN-36?

Thanks!

  • So you want a peripheral device with a server with a custom service which the central device can access as a client, additionally you want a server with a custom service on the central device that the peripheral device can access as a client?

  • Hello, Petter. Thanks for commenting.

    So you want a peripheral device with a server with a custom service which the central device can access as a client additionally you want a server with a custom service on the central device -- YES!! that the peripheral device can access as a client -- NO! there's no need peripheral to access my central. The peripheral will only notify the updated characteristic value of the peripheral custom service.

    In simplier words: I want my central do be capable of constantly reading a peripheral's button state change.

    Thanks!

  • We have two at least to relevant examples on GitHub for central devices that are clients that want to access servers with custom services.

    One is ble_app_uart_c and the other is S130_LBS_client_server_central_peripheral

    Please have a look and get back to me if anything is unclear.

  • Hello, Peter

    I've been working on my code to make my custom S120 service talk to my custom S110 service, but up to now, without any further success.

    Could you please give me some advice on the following questions?

    1. What are, and how HVX notifications works? I ask this because my S110 device is configured to send a hvx notification everytime a button is pressed. In my S120, when I configure the service notification, I just can't fetch S110 hvx button notifications (the code never enters on "on_hvx" function).

    2. I reused the configuration functions of the standard BA Service as a template to my S120 custom service. This means: my S120 custom service has the same init/config functions as standard BAS (I just changed some parts of the code to fit to my LB Service). I actually can find my custom service (log message returns me: [LBS] Discovery of service with UUID 0x1523 completed with success for connection handle 0, [LBS] LBS discovered at peer) - So I believe the problem I'm facing is just a notification issue. I can debug my code and verify my code never enters in "on_hvx" function for my custom service - which should happen, based on BAS.

    Any advices?

    Thanks

Related