[FL-2053] BLE MTU processing #830

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-11-21 17:47:54 +03:00
committed by GitHub
parent 013ed64cbb
commit a5052a0375
8 changed files with 34 additions and 5 deletions

View File

@@ -155,6 +155,16 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification( void *pckt )
}
break;
case EVT_BLUE_ATT_EXCHANGE_MTU_RESP:
{
aci_att_exchange_mtu_resp_event_rp0 *pr = (void*)blue_evt->data;
FURI_LOG_I(TAG, "Rx MTU size: %d", pr->Server_RX_MTU);
// Set maximum packet size given header size is 3 bytes
BleEvent event = {.type = BleEventTypeUpdateMTU, .data.max_packet_size = pr->Server_RX_MTU - 3};
gap->on_event_cb(event, gap->context);
}
break;
case EVT_BLUE_GAP_AUTHORIZATION_REQUEST:
FURI_LOG_I(TAG, "Authorization request event");
break;

View File

@@ -13,10 +13,12 @@ typedef enum {
BleEventTypeStartAdvertising,
BleEventTypeStopAdvertising,
BleEventTypePinCodeShow,
BleEventTypeUpdateMTU,
} BleEventType;
typedef union {
uint32_t pin_code;
uint16_t max_packet_size;
} BleEventData;
typedef struct {

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
#include <stdbool.h>
#define SERIAL_SVC_DATA_LEN_MAX (245)
#define SERIAL_SVC_DATA_LEN_MAX (248)
#ifdef __cplusplus
extern "C" {