Skip to content

Commit

Permalink
Correct EIR length calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed May 12, 2017
1 parent 74d496f commit 7fa8a3d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libraries/CurieBLE/src/internal/BLEDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,16 @@ BLEDeviceManager::setAdvertiseData(uint8_t type, const uint8_t* data, uint8_t le

for (uint8_t i = 0; i < _scan_rsp_data_idx; i++)
{
lengthOfAdv += _scan_rsp_data[i].data_len + 2;
}

lengthOfScanRsp += _scan_rsp_data[i].data_len + 2;
}

if (((length + lengthOfAdv) < BLE_MAX_ADV_SIZE) &&
if (((length + 2 + lengthOfAdv) <= BLE_MAX_ADV_SIZE) &&
(_adv_data_idx < ARRAY_SIZE(_adv_data)))
{
fill_area = &_adv_data[_adv_data_idx];
_adv_data_idx++;
}
else if ((length + lengthOfScanRsp) < BLE_MAX_ADV_SIZE &&
else if ((length + 2 + lengthOfScanRsp) <= BLE_MAX_ADV_SIZE &&
(_scan_rsp_data_idx < ARRAY_SIZE(_scan_rsp_data)))
{
fill_area = &_scan_rsp_data[_scan_rsp_data_idx];
Expand Down

0 comments on commit 7fa8a3d

Please sign in to comment.