Dynamically define characteristics for a service

Hi -

Is there a simple way to dynamically enable characteristics within a given service profile for a GATT server?  For example, we are using the Fitness Machine Service (FTM). If our product knows at runtime that's it's configured as a rower, we want to only allow the Rower Data characteristic to be discoverable.  If it's configured as a bike, we want to only allow the Indoor Bike Data characteristic to be discoverable.

I realize this can be accomplished by defining two different ftm_services (i.e. ftm_service_rower and ftm_service_bike) then using the bt_gatt_service_register() to select the appropriate implementation, however, this would quickly get resource intensive if there were numerous combinations which could occur at runtime.

Could all possible characteristics be defined then selectively disabled, preventing them from being discovered by a client?

Thanks,

Parents
  • Hi Kurt

    I'm afraid characteristics and services are defined during compile time, and can't be dynamically changed during run time. The option would be on the central side to only use the services/characteristics that the central device needs. The central will be able to discover both characteristics but it should be able to choose which one to use.

    Best regards,

    Simon

Reply
  • Hi Kurt

    I'm afraid characteristics and services are defined during compile time, and can't be dynamically changed during run time. The option would be on the central side to only use the services/characteristics that the central device needs. The central will be able to discover both characteristics but it should be able to choose which one to use.

    Best regards,

    Simon

Children
No Data
Related