Hello_client/blecen Timer Callback Questions

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

cross mob
Anonymous
Not applicable

Hi,

To implement some central role functionality on the BCM20737S I'm trying to find out what hello client does with some of the timer callbacks. My goal was to find out how I can detect whether a scan process has ended and I can start a new scan.

Looking at hello_client_timer_callback() I would guess that BLEAPP_APP_TIMER_SCAN is an event on which the scan type is changed. In the hello_client case it would mean that it stays in LOW_SCAN forever, in other words this seems to be the code I want to keep in my project.

Another thing that puzzles me is whether the call in hello_client to:

bleprofile_regTimerCb(hello_client_app_fine_timer, hello_client_app_timer);

means that from then on only hello_client_app_fine_timer() is called or also the previously registered callbacks in blecen.

I hope you can help.

Regards,

Kilian

0 Likes
1 Solution
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

hello_client_app_fine_timer and hello_client_app_timer are free running timers.  so if your app needs to do something periodically or needs to check when some condition expires, those can be used.

You can register a callback when Scan or Connect event expires.  This is the way how hello client is doing that.

  blecen_usertimerCb = hello_client_timer_callback;

The type of the event is passed to the callback as a parameter.  If you start HIGH_SCAN the callback will be called in 30 seconds.  If you start LOW_SCAN the callback will be called in 300 seconds.  This can be changed by changing

   blecen_cen_cfg.high_scan_duration = 30; // seconds

  /blecen_cen_cfg.low_scan_duration = 300; // seconds 

View solution in original post

3 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I will ask one of the developers to respond.

0 Likes
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

hello_client_app_fine_timer and hello_client_app_timer are free running timers.  so if your app needs to do something periodically or needs to check when some condition expires, those can be used.

You can register a callback when Scan or Connect event expires.  This is the way how hello client is doing that.

  blecen_usertimerCb = hello_client_timer_callback;

The type of the event is passed to the callback as a parameter.  If you start HIGH_SCAN the callback will be called in 30 seconds.  If you start LOW_SCAN the callback will be called in 300 seconds.  This can be changed by changing

   blecen_cen_cfg.high_scan_duration = 30; // seconds

  /blecen_cen_cfg.low_scan_duration = 300; // seconds 

Anonymous
Not applicable

Great, that helps!

I tried to find out whether calling bleprofile_regTimerCb() twice shadows the previous callbacks. I found out that it does. I assume from that that I don't have to worry about implementing anything in blecen_FineTimeout() and blecen_Timeout() apart from maybe calling bleprofile_pollPowersave() in my code.

Regards,

Kilian

0 Likes