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

how to create custom service?

image descriptionhow to create custom service in order to send dummy message, not from the console, I have to make one char arr[]="hello" this is a fixed string, then where i have add this string as data and what are the parameters are required to create simple custom service? please tell me the stepwise procedure to do this.

I don't want to send the data by this type of window as a shown in the below picture and also by mobile app.

I am following below programs:

ble_ap_uart_s132_pca10040(periphral) ble_app_uart_c_s132_pca10040(central)

  • Steps:

    1. Learn how BLE works (see all Tutorials in "Bluetooth low energy" here).
    2. Try to make Nordic BLE UART Service examples work (you need two dev kits obviously but it works on all nRF51/52/52840 variants, just pick right nRF5 SDK version). GAP Peripheral part is in examples\ble_peripheral\ble_app_uart path while GAP Central example is in examples\ble_central\ble_app_uart_c path.
    3. Send whatever strings you need.
    4. Profit.

    If you fail in any step, please first go back to step 1) and if not resolved then search carefully through all 23k+ Q&S on this forum. If still not resolved then you are most then welcome to paste new question (please give us then detailed description what HW+SW set-up you have, what is your goal, what steps you've done, what is the result what was your expectation instead).

  • In addition to endnode's answer you can take a look at this tutorial on GitHub. This tutorial covers creating a custom service with a custom value characteristic for one of the latest SDK's (SDK v13.0.0). Like endnode said, you should take a look at the information provided and post another question here on DevZone if you run into any specific problems. Good luck.

  • Ble_app_uart is working fine but I don't want to send through the console, it should be programmatically I want to create one char array and directly I want to add this string to the data.

  • @Joakim Jakobsen

    Thanks. I didn't realise there was a nice clean custom service example.

    Is there an example of a custom 16 bit service as well ?

    Currently I'm going through the process of converting the hrs into a custom 16 bit service, so that I can them implement various 16 bit services e.g. the Temperature service, which Nordic does not have an example of.

    From what I have seen the API calls to setup a 16 bit service are different from a 128 bit service, hence why I have been using the HRS as a starting point.

  • Hi Roger, remember that in Nordic stack (and actually even in BT SIG spec) all UUIDs are 128bit;) It's just the base which is different so if you want to add any "standard" BT SIG 16-bit UUID (or simply some UUID derived from BT SIG 128-bit base) then simply use BLE_UUID_TYPE_BLE instead of your custom type base index.

Related