Skip to content

Commit c10fc2e

Browse files
add API to trigger MTU negotiation
1 parent 02d5391 commit c10fc2e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

features/FEATURE_BLE/ble/GattClient.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,27 @@ class GattClient {
635635
(void) characteristic;
636636
}
637637

638+
/**
639+
* Trigger MTU negotiation. This might result in a Gap event onAttMtuChange
640+
* being called if MTU changes.
641+
*
642+
* @note This does not guarantee a change in MTU size. If size remains
643+
* unchanged no event will be generated.
644+
*
645+
* @param connection Connection on which the MTU is to be negotiated.
646+
*
647+
* @return BLE_ERROR_NONE if the procedure has been launched successfully
648+
* otherwise an appropriate error.
649+
*/
650+
virtual ble_error_t negotiateAttMtu(
651+
Gap::Handle_t connection
652+
) {
653+
/* Requesting action from porter(s): override this API if this
654+
capability is supported. */
655+
(void) connection;
656+
return BLE_ERROR_NOT_IMPLEMENTED;
657+
}
658+
638659
/**
639660
* Register an handler for Handle Value Notification/Indication events.
640661
*

features/FEATURE_BLE/ble/generic/GenericGattClient.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ class GenericGattClient : public GattClient,
111111
const DiscoveredCharacteristic& characteristic
112112
);
113113

114+
/**
115+
* @see GattClient::negotiateAttMtu
116+
*/
117+
virtual ble_error_t negotiateAttMtu(
118+
connection_handle_t connection
119+
);
120+
114121
/**
115122
* @see GattClient::reset
116123
*/

features/FEATURE_BLE/source/generic/GenericGattClient.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,12 @@ void GenericGattClient::terminateCharacteristicDescriptorDiscovery(
12591259

12601260
}
12611261

1262+
ble_error_t GenericGattClient::negotiateAttMtu(
1263+
connection_handle_t connection
1264+
) {
1265+
return _pal_client->exchange_mtu(connection);
1266+
}
1267+
12621268
ble_error_t GenericGattClient::reset(void) {
12631269

12641270
// _is_reseting prevent executions of new procedure while the instance resets.

0 commit comments

Comments
 (0)