Hi
I tested BLE Central with different values in .scanInterval and .scanWindow params of gapConnectionRequestParameters_t structure. And this change value affected connection establishment time.
But this structure is only used after we found a device in Device Discovery Procedure and try to connect to it.
/* Connect with the previously scanned peer device */
if (mFoundDeviceToConnect)
{
(void)App_Connect(&gConnReqParams, BleApp_ConnectionCallback);
}
The actual scan window and interval are in gapScanningParameters_t structure. And this is used for scanning.
Then how the .scanInterval and .scanWindow params of gapConnectionRequestParameters_t structure affect scanning?
Thanks in Advance
Nidhin
已解决! 转到解答。
Hi @nidhintomy ,
We discover devices via scanning, but when the device is found, we need to initiate the connection.
The connection procedure also needs to scan the advertising package first, then initiate the connection request, so gap connection request need the parameters scanInterval and .scanWindow .
Best regards,
Gavin
Hi @nidhintomy ,
Hope you are doing well!
In your case, you found that changing the values of the scan interval and scan window parameters affects the connection establishment time. This is because the connection establishment time is determined by the time it takes for the central device to find the peripheral device and connect to it. Since the scan interval and scan window parameters affect how often the central device scans for advertisement packets, connection establishment time is also somewhat affected.
Best regards,
Gavin
Hi @Gavin_Jia
I am fine. Thanks for reply.
Here my question was about importance of setting scan interval and scan window parameters in connection request parameter. We already set scan interval and scan window parameters in scan request parameters. Then why we need to set it again in connection request parameter.
E.g., In frdmkw38_adv_ext_central_bm project/source/app_config.c line no.54&55 set scan interval and scan window parameters in scan request parameters. In line no.64&65 set scan interval and scan window parameters in connection request parameters.
Best Regards,
Nidhin
Hi @nidhintomy ,
We discover devices via scanning, but when the device is found, we need to initiate the connection.
The connection procedure also needs to scan the advertising package first, then initiate the connection request, so gap connection request need the parameters scanInterval and .scanWindow .
Best regards,
Gavin
Hi @Gavin_Jia
That means if i set .scanInterval and .scanWindow in scan req params as 500ms and set .scanInterval and .scanWindow in connection req params as 1000ms, then the device will scan at 500ms until peripheral device found. After it will scan at 1000ms until device get connected.
So what if the connection failed, is device going to scan at 1000ms ?
Best Regards,
Nidhin