Skip to content

Commit 51daa6f

Browse files
sgbihuSidLeung
authored andcommitted
GIT#370 Add scan response support for central role
Resolved conflicts: libraries/CurieBLE/src/internal/BLEDeviceManager.cpp
1 parent 2e749d5 commit 51daa6f

File tree

2 files changed

+21
-32
lines changed

2 files changed

+21
-32
lines changed

libraries/CurieBLE/src/internal/BLEDeviceManager.cpp

+11-32
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ bool BLEDeviceManager::getDataFromAdvertiseByType(const BLEDevice* device,
698698
return retval;
699699
}
700700

701+
701702
bool BLEDeviceManager::hasLocalName(const BLEDevice* device) const
702703
{
703704
if (BLEUtils::isLocalBLE(*device) == true)
@@ -707,40 +708,18 @@ bool BLEDeviceManager::hasLocalName(const BLEDevice* device) const
707708

708709
const uint8_t* local_name = NULL;
709710
uint8_t local_name_len = 0;
710-
return getDataFromAdvertiseByType(device,
711-
BT_DATA_NAME_COMPLETE,
712-
local_name,
713-
local_name_len);
714-
/*
715-
getDeviceAdvertiseBuffer(device->bt_le_address(),
716-
adv_data,
717-
adv_data_len);
718-
if (NULL == adv_data)
719-
{
720-
return false;
721-
}
722-
723-
while (adv_data_len > 1)
711+
bool retval = getDataFromAdvertiseByType(device,
712+
BT_DATA_NAME_COMPLETE,
713+
local_name,
714+
local_name_len);
715+
if (false == retval)
724716
{
725-
uint8_t len = adv_data[0];
726-
uint8_t type = adv_data[1];
727-
728-
// Check for early termination
729-
if (len == 0 || ((len + 1) > adv_data_len))
730-
{
731-
return false;
732-
}
733-
734-
if (type == BT_DATA_NAME_COMPLETE)
735-
{
736-
return true;
737-
}
738-
739-
adv_data_len -= len + 1;
740-
adv_data += len + 1;
717+
retval = getDataFromAdvertiseByType(device,
718+
BT_DATA_NAME_SHORTENED,
719+
local_name,
720+
local_name_len);
741721
}
742-
return false;
743-
*/
722+
return retval;
744723
}
745724

746725
bool BLEDeviceManager::hasAdvertisedServiceUuid(const BLEDevice* device) const

libraries/CurieBLE/src/internal/BLEDeviceManager.h

+10
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ class BLEDeviceManager
376376

377377
void updateDuplicateFilter(const bt_addr_le_t* addr);
378378
bool deviceInDuplicateFilterBuffer(const bt_addr_le_t* addr);
379+
void advertiseAcceptHandler(const bt_addr_le_t *addr,
380+
int8_t rssi,
381+
uint8_t type,
382+
const uint8_t *ad,
383+
uint8_t data_len);
384+
void setTempAdvertiseBuffer(const bt_addr_le_t* bt_addr,
385+
int8_t rssi,
386+
const uint8_t *ad,
387+
uint8_t data_len);
388+
uint8_t getTempAdvertiseIndexFromBuffer(const bt_addr_le_t* bt_addr);
379389

380390
void advertiseAcceptHandler(const bt_addr_le_t *addr,
381391
int8_t rssi,

0 commit comments

Comments
 (0)