@Override
	public void onWheelMeasurementReceived(@NonNull final BluetoothDevice device, final long wheelRevolutions, final int lastWheelEventTime) {
		if (mLastWheelEventTime == lastWheelEventTime)
			return;

		if (mLastWheelRevolutions >= 0) {
			final float circumference = getWheelCircumference();

			float timeDifference;
			if (lastWheelEventTime < mLastWheelEventTime)
				timeDifference = (65535 + lastWheelEventTime - mLastWheelEventTime) / 1024.0f; // [s]
			else
				timeDifference = (lastWheelEventTime - mLastWheelEventTime) / 1024.0f; // [s]
			final float distanceDifference = (wheelRevolutions - mLastWheelRevolutions) * circumference / 1000.0f; // [m]
			final float totalDistance = (float) wheelRevolutions * circumference / 1000.0f; // [m]
			final float distance = (float) (wheelRevolutions - mInitialWheelRevolutions) * circumference / 1000.0f; // [m]
			final float speed = distanceDifference / timeDifference; // [m/s]
			mWheelCadence = (wheelRevolutions - mLastWheelRevolutions) * 60.0f / timeDifference; // [revolutions/minute]

			// Notify listener about the new measurement
			onDistanceChanged(device, totalDistance, distance, speed);
		}
		mLastWheelRevolutions = wheelRevolutions;
		mLastWheelEventTime = lastWheelEventTime;
	}
@Test
	public void onWheelMeasurementReceived() {
		final DataReceivedCallback callback = new CyclingSpeedAndCadenceMeasurementDataCallback() {
			@Override
			public void onWheelMeasurementReceived(@NonNull final BluetoothDevice device, final long wheelRevolutions, final int lastWheelEventTime) {
				assertEquals("Wheel measurement", 12345, wheelRevolutions);
				assertEquals("Wheel last event time", 1000, lastWheelEventTime);
			}

			@Override
			public void onInvalidDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) {
				assertEquals("Correct CSC reported as invalid", 1, 2);
			}

			@Override
			public void onDistanceChanged(@NonNull final BluetoothDevice device, final float totalDistance, final float distance, final float speed) {
				// ignore
			}

			@Override
			public void onCrankDataChanged(@NonNull final BluetoothDevice device, final float crankCadence, final float gearRatio) {
				// ignore
			}
		};
		final MutableData data = new MutableData(new byte[7]);
		// Flags
		assertTrue(data.setByte(0x01, 0));
		// Wheel revolutions
		assertTrue(data.setValue(12345, Data.FORMAT_UINT32_LE, 1));
		assertTrue(data.setValue(1000, Data.FORMAT_UINT16_LE, 5));

		callback.onDataReceived(null, data);
	}