From 5aed585b775dc39e6156750766f06ea5e851a5e5 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 15 Jun 2017 11:34:14 +0200 Subject: [PATCH] spp_streamer: disable page/inquiry scan during test --- example/spp_and_le_streamer.c | 16 ++++++++++++++++ example/spp_streamer.c | 8 ++++++++ example/spp_streamer_client.c | 9 +++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/example/spp_and_le_streamer.c b/example/spp_and_le_streamer.c index 2a9b264d9..e5a15677e 100644 --- a/example/spp_and_le_streamer.c +++ b/example/spp_and_le_streamer.c @@ -213,6 +213,11 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack break; case HCI_EVENT_DISCONNECTION_COMPLETE: + // re-enable page/inquiry scan again + gap_discoverable_control(1); + gap_connectable_control(1); + // re-enable advertisements + gap_advertisements_enable(1); le_notification_enabled = 0; break; @@ -261,6 +266,12 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack spp_test_data_len = sizeof(test_data); } + // disable page/inquiry scan to get max performance + gap_discoverable_control(0); + gap_connectable_control(0); + // disable advertisements + gap_advertisements_enable(0); + test_reset(); rfcomm_request_can_send_now_event(rfcomm_cid); } @@ -324,6 +335,11 @@ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, if (le_notification_enabled){ att_server_request_can_send_now_event(le_connection_handle); } + + // disable page/inquiry scan to get max performance + gap_discoverable_control(0); + gap_connectable_control(0); + test_reset(); break; default: diff --git a/example/spp_streamer.c b/example/spp_streamer.c index 100c8e946..5cd9a46aa 100644 --- a/example/spp_streamer.c +++ b/example/spp_streamer.c @@ -185,6 +185,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack spp_test_data_len = sizeof(test_data); } + // disable page/inquiry scan to get max performance + gap_discoverable_control(0); + gap_connectable_control(0); + test_reset(); rfcomm_request_can_send_now_event(rfcomm_cid); } @@ -197,6 +201,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack case RFCOMM_EVENT_CHANNEL_CLOSED: printf("RFCOMM channel closed\n"); rfcomm_cid = 0; + + // re-enable page/inquiry scan again + gap_discoverable_control(1); + gap_connectable_control(1); break; default: diff --git a/example/spp_streamer_client.c b/example/spp_streamer_client.c index cbf4341aa..72d7bd7bd 100644 --- a/example/spp_streamer_client.c +++ b/example/spp_streamer_client.c @@ -172,14 +172,19 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet); printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_cid, rfcomm_mtu); test_reset(); - // disable page and inquiry scan + + // disable page/inquiry scan to get max performance + gap_discoverable_control(0); gap_connectable_control(0); } break; case RFCOMM_EVENT_CHANNEL_CLOSED: printf("RFCOMM channel closed\n"); - rfcomm_cid = 0; // re-enable page scan + rfcomm_cid = 0; + + // re-enable page/inquiry scan again + gap_discoverable_control(1); gap_connectable_control(1); break;