@@ -1487,72 +1487,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
1487
1487
return BLE_ERROR_NONE;
1488
1488
}
1489
1489
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
-
1556
1490
template <template <class > class PalGapImpl , class PalSecurityManager , class ConnectionEventMonitorEventHandler >
1557
1491
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_scan_timeout_ ()
1558
1492
{
@@ -1825,20 +1759,20 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
1825
1759
address = _pal_gap.get_random_address ();
1826
1760
}
1827
1761
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
+ }
1840
1774
1841
- // new process event
1775
+ // signal application
1842
1776
if (_eventHandler) {
1843
1777
_eventHandler->onConnectionComplete (
1844
1778
ConnectionCompleteEvent (
@@ -1874,10 +1808,24 @@ template <template<class> class PalGapImpl, class PalSecurityManager, class Conn
1874
1808
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_disconnection_complete (const pal::GapDisconnectionCompleteEvent &e)
1875
1809
{
1876
1810
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
+ }
1881
1829
} else {
1882
1830
// TODO: define what to do in case of failure
1883
1831
}
0 commit comments