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

How to add a custom GATT service and characteristic to one of the mesh examples?

Dear BLE Experts,
 
I've followed this tutorial to create a custom GATT service and characteristic. The tutorial seems to be based on the BLE SDK, not the MESH sdk, hence the question: What needs to be done to add a custom GATT service/characteristic to one of the mesh expamples?
Can you please briefly outline what needs to be done at the mesh firmware to add a GATT service and characteristic? Thank you,

and all the best for 2021.

Parents
  • Hi,

    Please have a look at the ble_app_uart_coexist example in the NRF5 Mesh SDK v5. 

    The example shows an application that build for mesh but can be used inside nRF5 SDK. And it includes the NUS proprietary service and characteristic. The documentation is here.

  • Hi Hung Bui,

    Thanks for your help. I'll have a look at the ble_app_uart_coexist example.

    One thing I don't quite understand though: Is it necessary to move the firmware from the mesh SDK over to the nRF5 SDK in order to be able to add a custom GATT service/characteristic?

    Since mesh is based on BLE, one would think you can simply use the BLE features from inside the mesh SDK.

  • Hi BlueMike, 

    Sure, it's possible to add extra proprietary service/characteristic to the mesh example in mesh SDK. You just need to do it as in a normal BLE application: declare the UUID base, add the service, add characteristic etc. 
    Note that both the Mesh SDK and the nRF5 SDK running on top of the softdevice so it would use the same softdevice API to add and manage the characteristic, service etc. 

    There is one note though, if you use PB-GATT example, the softdevice is restarted after the device get provisioned (to update the att table) so if you add your service before it provisioned, you would need to add the service again after it's provisioned. If you don't plan to add the service before the device get provisioned, you can just add the service only after it's provisioned and don't have to worry about this. 

Reply
  • Hi BlueMike, 

    Sure, it's possible to add extra proprietary service/characteristic to the mesh example in mesh SDK. You just need to do it as in a normal BLE application: declare the UUID base, add the service, add characteristic etc. 
    Note that both the Mesh SDK and the nRF5 SDK running on top of the softdevice so it would use the same softdevice API to add and manage the characteristic, service etc. 

    There is one note though, if you use PB-GATT example, the softdevice is restarted after the device get provisioned (to update the att table) so if you add your service before it provisioned, you would need to add the service again after it's provisioned. If you don't plan to add the service before the device get provisioned, you can just add the service only after it's provisioned and don't have to worry about this. 

Children
No Data
Related