Bluetooth characteristic runtime



  • I am trying to create a bluetooth GATT characteristic at runtime using Qt 5.9, is this possible? If so, any clues on how I can do this? I want to be able to dynamically add a characteristic to a peripheal based on a runtime condition and this to be advertised.

    Thanks, Andy


  • Qt Champions 2017

    Hi
    I think its possible
    http://doc.qt.io/qt-5/qtbluetooth-le-overview.html#gatt-profile
    "While it is advisable to use pre-defined UUIDs where available it is entirely possible to use new and not yet used UUIDs for characteristic and service types."



  • @mrjj thanks for the response. I have been able to create a custom service and characteristic with no trouble already. What I want to do is add another characteristic in runtime after a certain event and that the new characteristic is browsable as the original characteristics.


  • Qt Champions 2017

    @Andy-Bell
    Hi
    Im not sure what is preventing you from doing it the same way as the first
    characteristic ?
    Is there something that cannot be created dynamically ?



  • @mrjj if I add another characteristic to the service after it has been running for a period of time and if i browse this service using a central role again I do not see the new characteristic but just the first characteristic. Is this an issue in advertising? In other words if I add a characteristic after starting to advertise do I need to restart the advertising?


  • Qt Champions 2017

    @Andy-Bell
    Hi
    Yes, i think you need to start over but i never tested it.
    Do you connect anything ?
    "Note: Advertising will stop automatically once a client connects to the local device."

    Try with a flipflop stopAdvertising()/start



  • @mrjj ok, thanks for the confirmation. I will check it out.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.