Multiple services in GATT profile with Zephyr OS

I was able to follow the tutorials from academy.nordicsemi.com on bluetooth fundamentals but unfortunately, I could not find an example where more than one custom service is advertised to the client.

I understand that the maximum advertising packet is 31 bytes, but the UUID is 16 bytes so two or more won't fit in the advertising packet - but this could be exposed later. How?

Parents
  • Hi, 

    I recommend looking into this sample for multiple service advertising 

    Regards

    Runar

  • I figured this out by myself.

    If you want to add multiple services to the GATT Profile you don't necessarily need to advertise them. This was unclear to me and it did not make sense.

    You can add any number of services and characteristics and they will be discovered after connection. The advertisement of the UUID for service has the purpose of filtering the scanned devices. Again, very unclear to me from the wording in the BLE Course - or my English is lacking - who knows?

    The answer for coding multiple services without advertising them can be found in ncs/v2.x/zephyr/samples/bluetooth/peripheral

    Here's a screenshot of the peripheral app to which I added the Nordic LBS service

Reply
  • I figured this out by myself.

    If you want to add multiple services to the GATT Profile you don't necessarily need to advertise them. This was unclear to me and it did not make sense.

    You can add any number of services and characteristics and they will be discovered after connection. The advertisement of the UUID for service has the purpose of filtering the scanned devices. Again, very unclear to me from the wording in the BLE Course - or my English is lacking - who knows?

    The answer for coding multiple services without advertising them can be found in ncs/v2.x/zephyr/samples/bluetooth/peripheral

    Here's a screenshot of the peripheral app to which I added the Nordic LBS service

Children
No Data
Related