Hi Rohit,
Thank you for your reply. But I am still having a few problems. I don't want to send scanRequest right at the beginning but only if a certain value is received from the initial advertisement packet.
Here is the scenario.....
In my code say device A sends a certain value (that increments every second) to device B as part of an Advertising structure with type TRICKLE_TYPE (Here TRICKLE_TYPE is custom type that I have added in the GapAdvertisingData.h ). Device B should then send a scan request to device A only if a certain value is received, after which the device A should send a scan Response. In my code, I have put the following statement so that data in array scanResponse is sent only when the scan request is received:
ble_device.accumulateScanResponse(GapAdvertisingData::TRICKLE_TYPE,(uint8_t *)scanResponse, sizeof(scanResponse));
However, when I check on Master Control Panel, right at the beginning I can see data in array ScanResponse being advertised. Is it wrong to put the accumulateScanResponse() function along with statements calling accumulateAdvertisingPayload() to populate the initial advertisement packet? I don't want the Scan Response advertising structure to appear till the scan request has been received.
Also, in the code in Device B, I am checking for the value received in the advertisement callback and only if it is a required value I use ble.gap().setActiveScanning(true); to send scan request. Is it possible to dynamically change the scan parameters like this or I need to stopScan then setActiveScanning and then startScan again.
Kind Regards
Swati Sehgal
Hi,
We're on our way to extending the BLE_API to allow the programming of devices to take on the role of a BLE Central. As a step in this direction, we'd like to propose APIs to support scanning:
extensions to top-level APIs to support scanning
extensions to Gap.h
Please comment. Thanks.