Bluetooth: inline BluetoothUtils into Handler classes.

This commit is contained in:
Dennis Guse
2023-11-05 15:13:40 +01:00
parent 4d54472c93
commit f2594371d3
13 changed files with 391 additions and 314 deletions
@@ -0,0 +1,25 @@
package de.dennisguse.opentracks.sensors;
import static org.junit.Assert.assertEquals;
import android.bluetooth.BluetoothGattCharacteristic;
import org.junit.Test;
import de.dennisguse.opentracks.data.models.AtmosphericPressure;
public class BluetoothHandlerBarometricPressureTest {
@Test
public void parseEnvironmentalSensing_Pa() {
// given
BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(BluetoothHandlerBarometricPressure.BAROMETRIC_PRESSURE.serviceUUID(), 0, 0);
characteristic.setValue(new byte[]{(byte) 0xB2, (byte) 0x48, (byte) 0x0F, (byte) 0x00});
// when
AtmosphericPressure pressure = BluetoothHandlerBarometricPressure.parseEnvironmentalSensing(characteristic);
// then
assertEquals(AtmosphericPressure.ofPA(100165), pressure);
}
}