/* * The connection interval is 30ms, the masters clock accuracy is 50ppm and the slave is configured with * the default of 500ppm (in sum 550ppm). * So the maximum derivation is 16µs */ BOOST_FIXTURE_TEST_CASE( smaller_window_after_connected, only_one_pdu_from_master ) { BOOST_REQUIRE_GE( connection_events().size(), 1 ); auto event = connection_events()[ 1 ]; BOOST_CHECK_EQUAL( event.start_receive, bluetoe::link_layer::delta_time::usec( 30000 - 16 ) ); BOOST_CHECK_EQUAL( event.end_receive, bluetoe::link_layer::delta_time::usec( 30000 + 16 ) ); }
/* * For the second connection event, the derivation from the 2*30ms is 33µs */ BOOST_FIXTURE_TEST_CASE( window_size_is_increasing_with_connection_event_timeouts, only_one_pdu_from_master ) { BOOST_REQUIRE_GE( connection_events().size(), 2 ); auto event = connection_events()[ 2 ]; BOOST_CHECK_EQUAL( event.start_receive, bluetoe::link_layer::delta_time::usec( 60000 - 33 ) ); BOOST_CHECK_EQUAL( event.end_receive, bluetoe::link_layer::delta_time::usec( 60000 + 33 ) ); }
void receive_and_consume( std::initializer_list< std::uint8_t > pdu ) { BOOST_REQUIRE_GE( buffer.size, pdu.size() ); std::copy( pdu.begin(), pdu.end(), buffer.buffer ); received( buffer ); buffer = allocate_receive_buffer(); BOOST_REQUIRE_GE( buffer.size, 29u ); if ( pdu.size() == 2 ) { BOOST_CHECK( !next_received().size ); } else { BOOST_CHECK( next_received().size ); free_received(); } BOOST_CHECK( !next_received().size ); }