Disable service with preprocessor definition or at runtime?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
euggersh
Level 5
Level 5
5 sign-ins First solution authored 50 replies posted

I have a BLE service that's used for debug and I don't want it to show up in release builds.  Is there a way of either disabling it for debug builds or for programmatically getting rid of it before I start advertising?

I can't find anything like that in the documentation, but I'm hoping I'm just missing something.

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

Can you have a look at the function CyBle_GattsDisableAttribute().

This function disables the attribute entry for service or characteristic logical group in the GATT database registered

in the BLE Stack.

Thanks,

Hima

View solution in original post

0 Likes
3 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

Can you have a look at the function CyBle_GattsDisableAttribute().

This function disables the attribute entry for service or characteristic logical group in the GATT database registered

in the BLE Stack.

Thanks,

Hima

0 Likes

HimaM_31

This works almost perfectly.  I'm calling CyBle_GattsDisableAttribute() with the handle of the secondary service I want to disable.  When I discover services, the characteristics from the secondary service are gone, but the service is still there.  I can work with that, but it would be even better if the service itself was no longer visible.  Is there any way to accomplish that?

Thanks.

0 Likes
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

There is a GATT "Service Changed" indication which can be sent. Can you please try using the same.

Thanks,

Hima

0 Likes