Skip to content

Commit e3d7f2b

Browse files
committed
BLE: Add address type in AdvertisementCallbackParams_t.
1 parent 24a3acd commit e3d7f2b

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

features/FEATURE_BLE/ble/Gap.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class GapAdvertisingData;
237237
* // Initiate the connection procedure
238238
* gap.connect(
239239
* packet->peerAddr,
240-
* BLEProtocol::RANDOM_STATIC,
240+
* packet->addressType,
241241
* &connection_parameters,
242242
* &scanning_params
243243
* );
@@ -608,6 +608,11 @@ class Gap {
608608
* Pointer to the advertisement packet's data.
609609
*/
610610
const uint8_t *advertisingData;
611+
612+
/**
613+
* Type of the address received
614+
*/
615+
AddressType_t addressType;
611616
};
612617

613618
/**
@@ -2349,7 +2354,8 @@ class Gap {
23492354
bool isScanResponse,
23502355
GapAdvertisingParams::AdvertisingType_t type,
23512356
uint8_t advertisingDataLen,
2352-
const uint8_t *advertisingData
2357+
const uint8_t *advertisingData,
2358+
BLEProtocol::AddressType_t addressType
23532359
) {
23542360
AdvertisementCallbackParams_t params;
23552361
memcpy(params.peerAddr, peerAddr, ADDR_LEN);
@@ -2358,6 +2364,7 @@ class Gap {
23582364
params.type = type;
23592365
params.advertisingDataLen = advertisingDataLen;
23602366
params.advertisingData = advertisingData;
2367+
params.addressType = addressType;
23612368
onAdvertisementReport.call(&params);
23622369
}
23632370

features/FEATURE_BLE/source/generic/GenericGap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,8 @@ void GenericGap::on_advertising_report(const pal::GapAdvertisingReportEvent& e)
972972
advertising.type == pal::received_advertising_type_t::SCAN_RESPONSE,
973973
(GapAdvertisingParams::AdvertisingType_t) advertising.type.value(),
974974
advertising.data.size(),
975-
advertising.data.data()
975+
advertising.data.data(),
976+
(BLEProtocol::AddressType_t) advertising.address_type.value()
976977
);
977978
}
978979
}

features/FEATURE_BLE/targets/TARGET_ARM_SSG/TARGET_BEETLE/source/ArmBLE.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ static void armHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
332332
(scan->scanReport.eventType == DM_ADV_SCAN_RESPONSE) ? true : false,
333333
(GapAdvertisingParams::AdvertisingType_t)scan->scanReport.eventType,
334334
scan->scanReport.len,
335-
scan->scanReport.pData);
335+
scan->scanReport.pData,
336+
(BLEProtocol::AddressType_t) scan->scanReport.addrType);
336337
}
337338
break;
338339
case DM_CONN_OPEN_IND:

features/FEATURE_BLE/targets/TARGET_Maxim/MaximBLE.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ static void maximHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
168168
(scanReport->eventType == DM_ADV_SCAN_RESPONSE) ? true : false,
169169
(GapAdvertisingParams::AdvertisingType_t)scanReport->eventType,
170170
scanReport->len,
171-
scanReport->pData);
171+
scanReport->pData,
172+
(BLEProtocol::AddressType_t) scan->scanReport.addrType);
172173
}
173174
break;
174175
case DM_CONN_OPEN_IND:
@@ -281,7 +282,7 @@ ble_error_t MaximBLE::init(BLE::InstanceID_t instanceID, FunctionPointerWithCont
281282
DmRegister(DmCback);
282283
DmConnRegister(DM_CLIENT_ID_APP, DmCback);
283284
AttConnRegister(AppServerConnCback);
284-
285+
285286
/* Reset the device */
286287
reset_complete = 0;
287288
DmDevReset();

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ static void btle_handler(ble_evt_t *p_ble_evt)
220220
advReport->scan_rsp,
221221
static_cast<GapAdvertisingParams::AdvertisingType_t>(advReport->type),
222222
advReport->dlen,
223-
advReport->data);
223+
advReport->data,
224+
static_cast<BLEProtocol::AddressType_t>(advReport->peer_addr.addr_type));
224225
break;
225226
}
226227

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ static void btle_handler(ble_evt_t *p_ble_evt)
287287
advReport->scan_rsp,
288288
static_cast<GapAdvertisingParams::AdvertisingType_t>(advReport->type),
289289
advReport->dlen,
290-
advReport->data);
290+
advReport->data,
291+
static_cast<BLEProtocol::AddressType_t>(advReport->peer_addr.addr_type));
291292
break;
292293
}
293294

0 commit comments

Comments
 (0)