spp_streamer: disable page/inquiry scan during test

This commit is contained in:
Matthias Ringwald 2017-06-15 11:34:14 +02:00
parent e2b367a767
commit 5aed585b77
3 changed files with 31 additions and 2 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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;