1 of 1 people found this helpful
You probably don't want be using blecm_startScan unless you absolutely have to.
blecm_startScan is called inside blecen_Scan function.
In blecen_Scan, these things happen sequentially:
- it turns off the callback timer
- it turns off the scan
- resets the scan mode
- start the callback timer and scan if appropriate with the right scan_type
To answer your questions:
1. calling blecm_Scan will start the scan with the given parameters. However, the scanner callback will not be called.
2. calling blecen_Scan will always stop the callback timer and the scan first. If the function is called with NO_SCAN argument, the callback will not be called again.
3. calling blecm_setScanEnable will only stop the scan. It will not stop the callback timer. So the callback function will be called again.
I suggest sticking to using blecen_Scan function as it gives you control over the callback timer.
Please refer to hello_client application for example on how to use blecen_Scan.
userc_19497 Thanks for replying.
1. Will it be ok to set scan_duration less than scan_window? For example:
scan_duration = 9 seconds
scan_window = 10 seconds
If so, will the scan stops at 9th second and call the callback function?
2. Does blecen_Scan(HIGH_SCAN) have callback?
3. Can I change scan parameters such as blecen_cen_cfg.low_scan_interval on the fly?
I'm sorry I haven't replied back earlier. I didn't have time to look at the source code.
Here are answers to your question:
1. Yes, it would be okay to set it like that (not sure why you would want to do that though).
scan_duration is only used for the scan timer, which enables the scan callback. So changing the scan_duration will effect when the scan callback is called. Also notice that scan_window has units of slots where as in scan_duration is in seconds. Don't mix the numbers.
I'm not sure if the scan is stopped when the callback is called...
2. Whenever you start a scan, the timer will call whatever callback defined at variable blecen_usertimerCb. The default is NULL.
3. Yes, you can change the intervals by setting a new value to blece_cen_cfg, but you must restart the scan by calling blecen_Scan function.
Again, I'm sorry if this reply is really late.
But I thought if I put the info, someone else might be able to benefit from it.
Hope this info helps.