Skip to content

Commit d35a6b8

Browse files
committed
GenericGap: remove legacy dis/connection callbacks signalling
1 parent 6f701cd commit d35a6b8

File tree

2 files changed

+31
-105
lines changed

2 files changed

+31
-105
lines changed

features/FEATURE_BLE/ble/generic/GenericGap.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -592,28 +592,6 @@ class GenericGap :
592592
*/
593593
ble_error_t reset_(void);
594594

595-
/**
596-
* @copydoc ::Gap::processConnectionEvent
597-
*/
598-
void processConnectionEvent(
599-
Handle_t handle,
600-
Role_t role,
601-
peer_address_type_t peerAddrType,
602-
const BLEProtocol::AddressBytes_t peerAddr,
603-
BLEProtocol::AddressType_t ownAddrType,
604-
const BLEProtocol::AddressBytes_t ownAddr,
605-
const ConnectionParams_t *connectionParams,
606-
const uint8_t *peerResolvableAddr,
607-
const uint8_t *localResolvableAddr
608-
);
609-
610-
/**
611-
* @copydoc ::Gap::processDisconnectionEvent
612-
*/
613-
void processDisconnectionEvent(
614-
Handle_t handle,
615-
DisconnectionReason_t reason
616-
);
617595

618596
private:
619597
ble_error_t setAdvertisingData(

features/FEATURE_BLE/source/generic/GenericGap.tpp

Lines changed: 31 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,72 +1487,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
14871487
return BLE_ERROR_NONE;
14881488
}
14891489

1490-
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
1491-
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::processConnectionEvent(
1492-
Handle_t handle,
1493-
Role_t role,
1494-
peer_address_type_t peerAddrType,
1495-
const BLEProtocol::AddressBytes_t peerAddr,
1496-
BLEProtocol::AddressType_t ownAddrType,
1497-
const BLEProtocol::AddressBytes_t ownAddr,
1498-
const ConnectionParams_t *connectionParams,
1499-
const uint8_t *peerResolvableAddr,
1500-
const uint8_t *localResolvableAddr
1501-
)
1502-
{
1503-
if (_connection_event_handler) {
1504-
_connection_event_handler->on_connected(
1505-
handle,
1506-
role,
1507-
peerAddrType,
1508-
peerAddr,
1509-
ownAddrType,
1510-
ownAddr,
1511-
connectionParams
1512-
);
1513-
}
1514-
1515-
LegacyGap::processConnectionEvent(
1516-
handle,
1517-
role,
1518-
peerAddrType,
1519-
peerAddr,
1520-
ownAddrType,
1521-
ownAddr,
1522-
connectionParams,
1523-
peerResolvableAddr,
1524-
localResolvableAddr
1525-
);
1526-
}
1527-
1528-
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
1529-
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::processDisconnectionEvent(
1530-
Handle_t handle,
1531-
DisconnectionReason_t reason
1532-
)
1533-
{
1534-
if (_connection_event_handler) {
1535-
_connection_event_handler->on_disconnected(
1536-
handle,
1537-
reason
1538-
);
1539-
}
1540-
1541-
if (_eventHandler) {
1542-
_eventHandler->onDisconnectionComplete(
1543-
DisconnectionCompleteEvent(
1544-
handle,
1545-
(disconnection_reason_t::type) reason
1546-
)
1547-
);
1548-
}
1549-
1550-
LegacyGap::processDisconnectionEvent(
1551-
handle,
1552-
reason
1553-
);
1554-
}
1555-
15561490
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
15571491
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_scan_timeout_()
15581492
{
@@ -1825,20 +1759,20 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
18251759
address = _pal_gap.get_random_address();
18261760
}
18271761

1828-
// legacy process event
1829-
processConnectionEvent(
1830-
e.connection_handle,
1831-
e.role.value() == e.role.CENTRAL ? LegacyGap::CENTRAL : LegacyGap::PERIPHERAL,
1832-
e.peer_address_type,
1833-
e.peer_address.data(),
1834-
_address_type,
1835-
address.data(),
1836-
&connection_params,
1837-
e.local_resolvable_private_address.data(),
1838-
e.peer_resolvable_private_address.data()
1839-
);
1762+
// signal internal stack
1763+
if (_connection_event_handler) {
1764+
_connection_event_handler->on_connected(
1765+
e.connection_handle,
1766+
e.role.value() == e.role.CENTRAL ? LegacyGap::CENTRAL : LegacyGap::PERIPHERAL,
1767+
e.peer_address_type,
1768+
e.peer_address.data(),
1769+
_address_type,
1770+
address.data(),
1771+
&connection_params
1772+
);
1773+
}
18401774

1841-
// new process event
1775+
// signal application
18421776
if (_eventHandler) {
18431777
_eventHandler->onConnectionComplete(
18441778
ConnectionCompleteEvent(
@@ -1874,10 +1808,24 @@ template <template<class> class PalGapImpl, class PalSecurityManager, class Conn
18741808
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_disconnection_complete(const pal::GapDisconnectionCompleteEvent &e)
18751809
{
18761810
if (e.status == pal::hci_error_code_t::SUCCESS) {
1877-
processDisconnectionEvent(
1878-
e.connection_handle,
1879-
(DisconnectionReason_t) e.reason
1880-
);
1811+
1812+
// signal internal stack
1813+
if (_connection_event_handler) {
1814+
_connection_event_handler->on_disconnected(
1815+
(Handle_t) e.connection_handle,
1816+
(DisconnectionReason_t) e.reason
1817+
);
1818+
}
1819+
1820+
// signal application
1821+
if (_eventHandler) {
1822+
_eventHandler->onDisconnectionComplete(
1823+
DisconnectionCompleteEvent(
1824+
(connection_handle_t) e.connection_handle,
1825+
(disconnection_reason_t::type) e.reason
1826+
)
1827+
);
1828+
}
18811829
} else {
18821830
// TODO: define what to do in case of failure
18831831
}

0 commit comments

Comments
 (0)