Tool/software: TI C/C++ Compiler
I am using SDK 4.10, ble5 stack but legacy LE advertising, peripheral mode. (simple (ble5) peripheral)
According to my understanding, active-scan-response is required for connectable advertising with the legacy LE advertising.
I tried to disable it virtually by giving the GAP_ADV_DATA_TYPE_SCAN_RSP size 0, so the peripheral was still connectable even without an active scan response.
That seemed working.
However, when I tried to enable it by loading another content, the stack crashed. What is the proper way to disable and re-enable it?
My intention is to save power by not let the central scan it unless it is needed. By giving size 0, does that really help with power saving?
Here is the sample... It works fine when "not-disable" to "disable", but it crashes when it goes back from "disable" to "not-disable"!
// disable the advertising and release the buffer
bStatus_t status = GapAdv_prepareLoadByHandle(advHandleSet1, GAP_ADV_FREE_OPTION_SCAN_RESP_DATA);
// reload with the newly created active scan response data
uint8_t *tmpScanRspData = ICall_malloc(sizeof(scanRspData));
uint32_t useSize;
if(disable)
{
useSize = 0;
}
else
{
useSize = sizeof(scanRspData);
}
memcpy(tmpScanRspData, scanRspData, sizeof(scanRspData));
status = GapAdv_loadByHandle(advHandleSet1, GAP_ADV_DATA_TYPE_SCAN_RSP,
useSize, tmpScanRspData);
Samson