File tree Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,15 @@ struct Gap {
48
48
* @copydoc Gap::EventHandler::onAttMtuChanged
49
49
*/
50
50
virtual void on_att_mtu_changed (
51
- Handle_t connection_handle,
51
+ connection_handle_t connection_handle,
52
52
uint16_t att_mtu_size
53
53
) = 0;
54
54
55
55
/* *
56
56
* @copydoc Gap::EventHandler::onPacketPaylodSizeChanged
57
57
*/
58
58
virtual void on_packet_paylod_size_changed (
59
- Handle_t connection_handle,
59
+ connection_handle_t connection_handle,
60
60
uint16_t tx_size,
61
61
uint16_t rx_size
62
62
) = 0;
Original file line number Diff line number Diff line change @@ -865,7 +865,9 @@ void GenericGap::on_att_mtu_changed(
865
865
uint16_t att_mtu_size
866
866
)
867
867
{
868
- onAttMtuChanged (connectionHandle, attMtuSize);
868
+ if (_eventHandler) {
869
+ _eventHandler->onAttMtuChanged (connection_handle, att_mtu_size);
870
+ }
869
871
}
870
872
871
873
void GenericGap::on_packet_paylod_size_changed (
@@ -874,7 +876,9 @@ void GenericGap::on_packet_paylod_size_changed(
874
876
uint16_t rx_size
875
877
)
876
878
{
877
- onPacketPaylodSizeChanged (connectionHandle, txSize, rxSize);
879
+ if (_eventHandler) {
880
+ _eventHandler->onPacketPaylodSizeChanged (connection_handle, tx_size, rx_size);
881
+ }
878
882
}
879
883
880
884
void GenericGap::on_phy_update_complete (
Original file line number Diff line number Diff line change 22
22
#include " ble/pal/SimpleAttServerMessage.h"
23
23
#include " att_api.h"
24
24
#include " att_defs.h"
25
+ #include " ble/pal/PalGap.h"
26
+ #include " CordioPalGap.h"
25
27
26
28
namespace ble {
27
29
namespace pal {
@@ -318,11 +320,20 @@ class CordioAttClient : public ::ble::pal::AttClient {
318
320
*/
319
321
static void att_client_handler (const attEvt_t* event)
320
322
{
323
+ if (event->hdr .status == ATT_SUCCESS && event->hdr .event == ATT_MTU_UPDATE_IND) {
324
+ ble::pal::Gap::EventHandler *handler;
325
+ handler = ble::pal::vendor::cordio::Gap::get_gap ().get_event_handler ();
326
+ if (handler) {
327
+ handler->on_att_mtu_changed (event->hdr .param , event->mtu );
328
+ }
329
+ return ;
330
+ }
331
+
321
332
// all handlers are stored in a static array
322
333
static const event_handler_t handlers[] = {
323
334
&timeout_event_handler,
324
335
&event_handler<ErrorResponseConverter>,
325
- &event_handler<ExchangeMtuResponseConverter>,
336
+ // &event_handler<ExchangeMtuResponseConverter>,
326
337
&event_handler<FindInformationResponseConverter>,
327
338
&event_handler<FindByTypeValueResponseConverter>,
328
339
&event_handler<ReadByTypeResponseConverter>,
Original file line number Diff line number Diff line change @@ -286,6 +286,20 @@ void BLE::processEvents()
286
286
287
287
void BLE::device_manager_cb (dmEvt_t* dm_event)
288
288
{
289
+ if (dm_event->hdr .status == HCI_SUCCESS && dm_event->hdr .event == DM_CONN_DATA_LEN_CHANGE_IND) {
290
+ // this event can only happen after a connection has been established therefore gap is present
291
+ ble::pal::Gap::EventHandler *handler;
292
+ handler = ble::pal::vendor::cordio::Gap::get_gap ().get_event_handler ();
293
+ if (handler) {
294
+ handler->on_packet_paylod_size_changed (
295
+ dm_event->hdr .param ,
296
+ dm_event->dataLenChange .maxTxOctets ,
297
+ dm_event->dataLenChange .maxRxOctets
298
+ );
299
+ }
300
+ return ;
301
+ }
302
+
289
303
BLE::deviceInstance ().stack_handler (0 , &dm_event->hdr );
290
304
}
291
305
You can’t perform that action at this time.
0 commit comments