From 6263b3d77dc716cb446e4aaac0a586ad631288c7 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 28 Mar 2016 15:19:31 +0200 Subject: [PATCH] att_server: directly process ATT Write Commands --- ble/att_server.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ble/att_server.c b/ble/att_server.c index 968fe436d..7b0f87347 100644 --- a/ble/att_server.c +++ b/ble/att_server.c @@ -340,11 +340,24 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa return; } + // directly process commands + // note: signed write cannot be handled directly as authentication needs to be verified + if (packet[0] == ATT_WRITE_COMMAND){ + att_handle_request(&att_connection, packet, size, 0); + return; + } + // check size - if (size > sizeof(att_request_buffer)) return; + if (size > sizeof(att_request_buffer)) { + log_info("att_packet_handler: dropping att pdu 0x%02x as size %u > att_request_buffer %u", packet[0], size, (int) sizeof(att_request_buffer)); + return; + } // last request still in processing? - if (att_server_state != ATT_SERVER_IDLE) return; + if (att_server_state != ATT_SERVER_IDLE){ + log_info("att_packet_handler: skipping att pdu 0x%02x as server not idle (state %u)", packet[0], att_server_state); + return; + } // store request att_server_state = ATT_SERVER_REQUEST_RECEIVED;