From 8e96e3b7fd7a041aad799b62e2e1eac6946d701e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sat, 10 Oct 2015 14:53:02 +0200 Subject: [PATCH] add gatt_client_pts_suppress_mtu_exchange for testing sm --- ble/gatt_client.c | 10 ++++++++++ ble/gatt_client.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/ble/gatt_client.c b/ble/gatt_client.c index 14eb43038..b8acfb245 100644 --- a/ble/gatt_client.c +++ b/ble/gatt_client.c @@ -62,6 +62,7 @@ static linked_list_t gatt_client_connections = NULL; static linked_list_t gatt_subclients = NULL; static uint16_t gatt_client_id = 0; +static uint8_t pts_suppress_mtu_exchange; static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *packet, uint16_t size); static void gatt_client_report_error_if_pending(gatt_client_t *peripheral, uint8_t error_code); @@ -128,6 +129,7 @@ void gatt_client_unregister_packet_handler(uint16_t gatt_client_id){ void gatt_client_init(void){ gatt_client_connections = NULL; + pts_suppress_mtu_exchange = 0; att_dispatch_register_client(gatt_client_att_packet_handler); } @@ -190,6 +192,11 @@ static gatt_client_t * provide_context_for_conn_handle(uint16_t con_handle){ context->mtu_state = SEND_MTU_EXCHANGE; context->gatt_client_state = P_READY; linked_list_add(&gatt_client_connections, (linked_item_t*)context); + + // skip mtu exchange for testing sm with pts + if (pts_suppress_mtu_exchange){ + context->mtu_state = MTU_EXCHANGED; + } return context; } @@ -1749,4 +1756,7 @@ le_command_status_t gatt_client_write_long_characteristic_descriptor(uint16_t ga return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle, length, value); } +void gatt_client_pts_suppress_mtu_exchange(void){ + pts_suppress_mtu_exchange = 1; +} diff --git a/ble/gatt_client.h b/ble/gatt_client.h index 0bc985e5a..ccdf0a786 100644 --- a/ble/gatt_client.h +++ b/ble/gatt_client.h @@ -379,6 +379,9 @@ le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descr le_command_status_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration); /* API_END */ +// only used for testing +void gatt_client_pts_suppress_mtu_exchange(); + #if defined __cplusplus } #endif