Skip to content

Commit c452d8f

Browse files
add mtu events
1 parent 1492dc1 commit c452d8f

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

features/FEATURE_BLE/ble/gap/Gap.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,37 @@ class Gap {
492492
{
493493
}
494494

495+
/**
496+
* Function invoked when the connections changes the ATT_MTU which controls
497+
* the maximum size of an attribute that can be read in a single L2CAP packet
498+
* which might be fragmented across multiple packets.
499+
*
500+
* @param connectionHandle The handle of the connection that changed the size.
501+
* @param attMtuSize
502+
*/
503+
virtual void onAttMtuChanged(
504+
connection_handle_t connectionHandle,
505+
uint16_t attMtuSize
506+
)
507+
{
508+
}
509+
510+
/**
511+
* Function invoked when the connections changes the maximum number of octets
512+
* that can be sent or received by the controller in a single packet.
513+
*
514+
* @param connectionHandle The handle of the connection that changed the size.
515+
* @param txSize Number of octets we can send on this connection in a single packet.
516+
* @param rxSize Number of octets we can receive on this connection in a single packet.
517+
*/
518+
virtual void onPacketPaylodSizeChanged(
519+
connection_handle_t connectionHandle,
520+
uint16_t txSize,
521+
uint16_t rxSize
522+
)
523+
{
524+
}
525+
495526
protected:
496527
/**
497528
* Prevent polymorphic deletion and avoid unnecessary virtual destructor

features/FEATURE_BLE/ble/generic/GenericGap.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,17 @@ class GenericGap :
627627
phy_t rx_phy
628628
);
629629

630+
virtual void on_att_mtu_changed(
631+
Handle_t connection_handle,
632+
uint16_t att_mtu_size
633+
);
634+
635+
virtual void on_packet_paylod_size_changed(
636+
Handle_t connection_handle,
637+
uint16_t tx_size,
638+
uint16_t rx_size
639+
);
640+
630641
virtual void on_phy_update_complete(
631642
pal::hci_error_code_t hci_status,
632643
Handle_t connection_handle,

features/FEATURE_BLE/ble/pal/PalGap.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ struct Gap {
4444
ble::phy_t rx_phy
4545
) = 0;
4646

47+
/**
48+
* @copydoc Gap::EventHandler::onAttMtuChanged
49+
*/
50+
virtual void on_att_mtu_changed(
51+
Handle_t connection_handle,
52+
uint16_t att_mtu_size
53+
) = 0;
54+
55+
/**
56+
* @copydoc Gap::EventHandler::onPacketPaylodSizeChanged
57+
*/
58+
virtual void on_packet_paylod_size_changed(
59+
Handle_t connection_handle,
60+
uint16_t tx_size,
61+
uint16_t rx_size
62+
) = 0;
63+
4764
/**
4865
* @copydoc Gap::EventHandler::onPhyUpdateComplete
4966
*/

features/FEATURE_BLE/source/generic/GenericGap.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,23 @@ void GenericGap::on_read_phy(
860860
}
861861
}
862862

863+
void GenericGap::on_att_mtu_changed(
864+
Handle_t connection_handle,
865+
uint16_t att_mtu_size
866+
)
867+
{
868+
onAttMtuChanged(connectionHandle, attMtuSize);
869+
}
870+
871+
void GenericGap::on_packet_paylod_size_changed(
872+
Handle_t connection_handle,
873+
uint16_t tx_size,
874+
uint16_t rx_size
875+
)
876+
{
877+
onPacketPaylodSizeChanged(connectionHandle, txSize, rxSize);
878+
}
879+
863880
void GenericGap::on_phy_update_complete(
864881
pal::hci_error_code_t hci_status,
865882
Handle_t connection_handle,

0 commit comments

Comments
 (0)