Skip to content

Commit 5e04938

Browse files
committed
Fix the crash issuse and Jira 752
1. Jira 752 BLE Central. Cannot detect local Name that is more than 8 characters 2. The construct function make program crash
1 parent 4373506 commit 5e04938

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libraries/BLE/src/BLECharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ BLECharacteristic::BLECharacteristic(const BLECharacteristic& rhs):
5757
_chrc_local_imp = NULL; // Not copy
5858
_value_size = rhs._value_size;
5959
_internal = rhs._internal;
60-
_bledev = BLEDevice(&rhs._bledev);
60+
_bledev.setAddress(*rhs._bledev.bt_le_address());
6161
memcpy(_uuid_cstr, rhs._uuid_cstr, sizeof(_uuid_cstr));
6262
_properties = rhs._properties;
6363

libraries/BLE/src/internal/BLEDeviceManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ void BLEDeviceManager::handleDeviceFound(const bt_addr_le_t *addr,
11851185
uint8_t data_len)
11861186
{
11871187
const uint8_t *data = ad;
1188+
uint8_t real_adv_len = data_len;
11881189

11891190
/* We're only interested in connectable events */
11901191
if (type == BT_LE_ADV_IND || type == BT_LE_ADV_DIRECT_IND)
@@ -1221,7 +1222,7 @@ void BLEDeviceManager::handleDeviceFound(const bt_addr_le_t *addr,
12211222
{
12221223
// The critical is accepted
12231224
// Find the oldest and expired buffer
1224-
if(false == setAdvertiseBuffer(addr, ad, data_len, rssi))
1225+
if(false == setAdvertiseBuffer(addr, ad, real_adv_len, rssi))
12251226
{
12261227
pr_info(LOG_MODULE_BLE, "No buffer to store the ADV\n");
12271228
}

0 commit comments

Comments
 (0)