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

When is a custom GATT profile recommended?

I am currently developing an IoT device using nRF8001 which needs to report gas concentration obtained from a sensor. I have looked through the standard GATT profiles, and I don't see anything I can use directly. I was curious if it's common practice for products to create their own custom GATT profiles.

  • Hey I have worked on nRF51822, and yes you can easily create your own GATT profile. You can start by using code from existing standard GATT characteristic code. I have used mbed's APIs mbed-src,BLE_API, (there is one more for nrf51822, but you gotta find compatibility for your chip and board). A simple way to get idea would be reading this simple code.

    github.com/.../BatteryService.h

    I will put my sample code to use it on github and will update here asap if you want.

  • Thanks, @dhruvagga. My question was more on best practices - whether it is better to define your own, or try to use existing profiles. I don't see anything existing for measuring ppm of a gas for example. Such scenarios must be common for industrial applications?

  • Yes, the existing GATT profiles are some standard which can be used right away to production or to have some idea about how it's working. To build something not made before, you can always build on the top of it ( or by taking the idea on how it can be made). And yes it is quite common in industrial applications to have custom GATT services. which can be used by your application (mobile, or other devices).

  • Hi electronut,

    I believe then it's more question of interoperability. If you want to rely on different (central) apps connecting to your device and reading/showing the data then you are interested into standard GATT Services defined by BT SIG (e.g. if you implement Battery Service then many existing central apps can display it even they do not understand the main purpose of your peripheral device). If your main architecture is based on peripheral and specific matching central app then you do not care and then you can freely start designing custom services because all BT Smart APIs on mobiles (Android, iOS) and PCs (Win 8.1/10) support search and use of custom GATT Services/Characteristics.

    Main rules for such custom design might be:

    • Create simple services per "interface" or "feature" you offer on server (peripheral) side.
    • Remember that every new service and characteristic/descriptor make generic Service Discovery procedure slower (which might be an issue if you are connecting for every transaction).
    • Also remember that even GATT handle space is usually not an issue (65k slots) implementation of BLE stack in embedded systems might have limitations and overloading stack just increases probability of issues in the field.

    There are some rules explained at the slides 321-395 of the original BLE training delivered by BT SIG in 2010 here (member login required): www.bluetooth.org/.../DownloadDoc.ashx

    Cheers Jan

  • Thanks Jan. Unfortunately the slides require a member login.

Related