2 posts / 0 new
Last post
wisilica
Offline
Last seen:10 months 3 weeks ago
加入:2015-03-17 08:16
扫描突然终止

Hi dialog,

I am trying to scan for ble packets in the GAP_OBSERVER_SCA mode. I am receiving ble packets(ie, control goes to adv_report_ind callback) only for a short duration of time, around 5-6 seconds. Afterwards, the device execution stops abruptly. In the user_scanning_complete( ) I am again calling the scan_start( ) function. But the program control doesnt reach the scanning_complete( ). Is it beacuse the BLE packets which the device is scanning for is not being received within a particular time period ?Please suggest the measures we can adopt to continue scanning until we can explicitely stop scanning by sending a cancel message.
Thanks in advance,

Wisilica

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi wicilica,

Hi wicilica,

When you send a scan command you define a scan mode (the .mode member that you set in the gapm_start_scan_cmd structure), if the mode of the scanning is GAP_GEN_DISCOVERY there is a timeout at this command, so you should get the scanning complete after about 8 seconds (you can also find that kind of info in the RW-BLE-GAP-IS.pdf). So when the scanning procedure times out you can invoke the scanning function in order to continue scanning for another 8 seconds. Regarding the fact that the second time the device doens't reach the scan complete callback i suppose that there is something wrong and the scanning never executes (unless the second time, the mode that you are scanning is in GAP_OBSERVER_MODE - the scanning continues until you cancel it explicitly). In case that you call the same scan function and something goes wrong you should get the scan complete callback instantly with an error code (indicating invalid parameters or any kind of error during the execution of the scanning). So check the .pdf i ve mentioned and check what kind of scanning you would like. Also you can check the scanning procedure in the DSPS host example which implements a scanning procedure with a GAP_GEN_DISCOVERY mode and re-initiates the scanning procedure after scan ends.

Thanks MT_dialog