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

Creating multiple vendor services - nRF52840 SDK16

Hi everyone,

I have created a vendor service that works fine. Now I want to create a second one. What is the most efficient approach for doing this?

For the first service, the steps I followed are:

On the .c and .h files:

1.  Define the base and service UUIDs

2.  Define a function to initialize the service

3.  Define an event handler

4.  Define a macro to instantiate the service and register the event handler (BLE observer) that will get all BLE events. I'm using the NRF_SDH_BLE_OBSERVER to register the event handler

On the main.c file

5. Instantiate the service 

6. Initialize the service in services_init() function

7. Include the service in ble_uuid_t m_adv_uuids[] array in order to be advertised by the ble_advertising_init() function

Further actions:

I have configured the RAM_START  and RAM_SIZE as well as the NRF_SDH_BLE_VS_UUID_COUNT (for one vendor UUID at the moment but I will re-configure for more)

Also, I am advertising vendor services using scan response format

In order to add a new vendor service, I have to repeat steps 1-7? I mean, I have to declare separate functions for initialization and event handling and separate macros for instantiation and event handling registration?

Thanks in advance

Nick

Related