Skip to content

Commit cbba6dd

Browse files
committed
BLE PAL: Update connection event to support enhanced connection events.
1 parent 57ffa14 commit cbba6dd

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

features/FEATURE_BLE/ble/pal/GapEvents.h

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ struct GapConnectionCompleteEvent : public GapEvent {
140140
* @param supervision_timeout Supervision timeout of the connection. It
141141
* shall be in the range [0x000A : 0x0C80] where a unit represent 10ms.
142142
*
143-
* @note: See Bluetooth 5 Vol 2 PartE: 7.7.65.1 LE Connection Complete Event
144143
* @note: See Bluetooth 5 Vol 2 PartE: 7.7.65.10 LE Enhanced Connection
145144
* Complete Event
146145
*/
@@ -153,6 +152,69 @@ struct GapConnectionCompleteEvent : public GapEvent {
153152
uint16_t connection_interval,
154153
uint16_t connection_latency,
155154
uint16_t supervision_timeout
155+
) :
156+
GapEvent(GapEventType::CONNECTION_COMPLETE),
157+
status(status),
158+
connection_handle(connection_handle),
159+
role(role),
160+
peer_address_type(
161+
peer_address_type == advertising_peer_address_type_t::PUBLIC_ADDRESS ?
162+
peer_address_type_t::PUBLIC :
163+
peer_address_type_t::RANDOM
164+
),
165+
peer_address(peer_address),
166+
connection_interval(connection_interval),
167+
connection_latency(connection_latency),
168+
supervision_timeout(supervision_timeout),
169+
local_resolvable_private_address(),
170+
peer_resolvable_private_address() {
171+
}
172+
173+
/**
174+
* Construct a new GapConnectionCompleteEvent.
175+
*
176+
* @param status Status of the operation: 0x00 in case of success otherwise
177+
* the error code associated with the failure.
178+
*
179+
* @param connection_handle handle of the connection created. This handle
180+
* will be used to address the connection in any connection oriented
181+
* operation.
182+
*
183+
* @param role Role of the LE subsystem in the connection.
184+
*
185+
* @param address_type Type of address used by the peer for this connection.
186+
*
187+
* @param address Address of the peer used to establish the connection.
188+
*
189+
* @param connection_interval Connection interval used on this connection.
190+
* It shall be in a range [0x0006 : 0x0C80]. A unit is equal to 1.25ms.
191+
*
192+
* @param connection_latency Number of connection events the slave can
193+
* drop.
194+
*
195+
* @param supervision_timeout Supervision timeout of the connection. It
196+
* shall be in the range [0x000A : 0x0C80] where a unit represent 10ms.
197+
*
198+
* @param local_resolvable_private_address Resolvable private address used
199+
* by the local device to establish the connection.
200+
*
201+
* @param peer_resolvable_private_address Resolvable private address used
202+
* by the peer to establish the connection.
203+
*
204+
* @note: See Bluetooth 5 Vol 2 PartE: 7.7.65.10 LE Enhanced Connection
205+
* Complete Event
206+
*/
207+
GapConnectionCompleteEvent(
208+
uint8_t status,
209+
connection_handle_t connection_handle,
210+
connection_role_t role,
211+
peer_address_type_t peer_address_type,
212+
const address_t& peer_address,
213+
uint16_t connection_interval,
214+
uint16_t connection_latency,
215+
uint16_t supervision_timeout,
216+
const address_t& local_resolvable_private_address,
217+
const address_t& peer_resolvable_private_address
156218
) :
157219
GapEvent(GapEventType::CONNECTION_COMPLETE),
158220
status(status),
@@ -162,9 +224,12 @@ struct GapConnectionCompleteEvent : public GapEvent {
162224
peer_address(peer_address),
163225
connection_interval(connection_interval),
164226
connection_latency(connection_latency),
165-
supervision_timeout(supervision_timeout) {
227+
supervision_timeout(supervision_timeout),
228+
local_resolvable_private_address(local_resolvable_private_address),
229+
peer_resolvable_private_address(peer_resolvable_private_address) {
166230
}
167231

232+
168233
/*
169234
* @param status Indicate if the connection succesfully completed or not:
170235
* - 0: Connection successfuly completed
@@ -188,7 +253,7 @@ struct GapConnectionCompleteEvent : public GapEvent {
188253
/**
189254
* Peer address type.
190255
*/
191-
const advertising_peer_address_type_t peer_address_type;
256+
const peer_address_type_t peer_address_type;
192257

193258
/**
194259
* Peer address.
@@ -211,6 +276,18 @@ struct GapConnectionCompleteEvent : public GapEvent {
211276
* It shall be in the range [0x000A : 0x0C80] where a unit represent 10ms.
212277
*/
213278
const uint16_t supervision_timeout;
279+
280+
/**
281+
* Resolvable private address of the local device.
282+
* Set to all 0 if not available.
283+
*/
284+
const address_t local_resolvable_private_address;
285+
286+
/**
287+
* Resolvable private address of the peer.
288+
* Set to all 0 if not available. *
289+
*/
290+
const address_t peer_resolvable_private_address;
214291
};
215292

216293

0 commit comments

Comments
 (0)