This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do I create my own service on the BLE stack?

I've sifted through the examples given to me, and none of them seem to explain how to create your own service and add it to the stack. All of the services that are registered in the ble examples (nRF51 nordic pca10001) have their own header and c files.

Does anyone know how to create your own service, or at least know of any documentation that could point me in the right direction?

Thanks in advance!

Parents
  • Hi Alex

    A good place to start would be the ble_app_template example. I created one generic working service from there and used it to build multiple of my own services.

    Unfortunately you will not be able to move away from using .c and .h files to configure your services. If you look at figure 2 on page 7 of the softdevice specification, you will see that the setup of services and attributes is the responsibility of your app. Even though the Softdevice hosts the GAPP server, the configuration is up to the you. As far as adding your own service to the stack: This is not possible since the stack is a pre-compiled .hex file supplied by Nordic. You can simply send your setup and configuration at runtime to the stack to configure the GATT server.

    Hope this helps a bit

  • I've looked at the example, and it helps a lot, thanks! But the one part that I really needed help on it just tells me to fill in myself. The function, static void services_init(void) { // YOUR_JOB: Add code to initialize the services used by the application. }

    is the one that I have no idea how to do! This is where the other ble examples dive into their 20 file infrastructure that I can't quite follow. I just need to create one simple bare-bones service to get my foot in the door.

    Carles was nice enough to provide me with these functions:

    sd_ble_gatts_service_add sd_ble_gatts_include_add sd_ble_gatts_characteristic_add sd_ble_gatts_descriptor_add

    but I'm not sure how to use them.

    Do you know how to implement these?

    Thanks again!

Reply
  • I've looked at the example, and it helps a lot, thanks! But the one part that I really needed help on it just tells me to fill in myself. The function, static void services_init(void) { // YOUR_JOB: Add code to initialize the services used by the application. }

    is the one that I have no idea how to do! This is where the other ble examples dive into their 20 file infrastructure that I can't quite follow. I just need to create one simple bare-bones service to get my foot in the door.

    Carles was nice enough to provide me with these functions:

    sd_ble_gatts_service_add sd_ble_gatts_include_add sd_ble_gatts_characteristic_add sd_ble_gatts_descriptor_add

    but I'm not sure how to use them.

    Do you know how to implement these?

    Thanks again!

Children
No Data
Related