att mtu is per default ATT MTU MIN. During MTU exchange is set to a max l2cap le mtu

This commit is contained in:
mila@ringwald.ch 2014-10-09 10:09:04 +00:00
parent 4ff786cfeb
commit 2d27d5e979
2 changed files with 7 additions and 4 deletions

View File

@ -290,10 +290,13 @@ static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, u
uint8_t * response_buffer){
uint16_t client_rx_mtu = READ_BT_16(request_buffer, 1);
if (client_rx_mtu < att_connection->mtu){
att_connection->mtu = client_rx_mtu;
}
if (client_rx_mtu < l2cap_le_max_mtu()){
att_connection->mtu = client_rx_mtu;
} else {
att_connection->mtu = l2cap_le_max_mtu();
}
response_buffer[0] = ATT_EXCHANGE_MTU_RESPONSE;
bt_store_16(response_buffer, 1, att_connection->mtu);
return 3;

View File

@ -126,7 +126,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
bt_flip_addr(att_client_address, &packet[8]);
// reset connection properties
att_connection.con_handle = READ_BT_16(packet, 4);
att_connection.mtu = l2cap_max_le_mtu();
att_connection.mtu = ATT_DEFAULT_MTU;
att_connection.encryption_key_size = 0;
att_connection.authenticated = 0;
att_connection.authorized = 0;