@Test public void readHumidity() throws IOException { Bmx280 bmx280 = new Bmx280(mI2c); bmx280.setHasHumiditySensor(true); bmx280.setTemperatureOversampling(Bmx280.OVERSAMPLING_1X); bmx280.setPressureOversampling(Bmx280.OVERSAMPLING_1X); bmx280.setHumidityOversampling(Bmx280.OVERSAMPLING_1X); bmx280.readHumidity(); Mockito.verify(mI2c).readRegBuffer(eq(0xFA), any(byte[].class), eq(3)); Mockito.verify(mI2c).readRegBuffer(eq(0xFD), any(byte[].class), eq(2)); }
public float readHumidity() throws IOException, IllegalStateException { if (!hasHumiditySensor()) { throw new UnsupportedOperationException("This chip " + mChipId + " doesn't have humidity sensor"); } if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mHumidityOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("Humidity oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawHum = readSample16(BME280_REG_HUM); return compensateHumidity(rawHum, temperatures[1], mHumCalibrationData); }
Bmx280 implements AutoCloseable { public float readHumidity() throws IOException, IllegalStateException { if (!hasHumiditySensor()) { throw new UnsupportedOperationException("This chip " + mChipId + " doesn't have humidity sensor"); } if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mHumidityOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("Humidity oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawHum = readSample16(BME280_REG_HUM); return compensateHumidity(rawHum, temperatures[1], mHumCalibrationData); } }
Bmx280 implements AutoCloseable { public float readHumidity() throws IOException, IllegalStateException { if (!hasHumiditySensor()) { throw new UnsupportedOperationException("This chip " + mChipId + " doesn't have humidity sensor"); } if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mHumidityOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("Humidity oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawHum = readSample16(BME280_REG_HUM); return compensateHumidity(rawHum, temperatures[1], mHumCalibrationData); } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); }
Bmx280 implements AutoCloseable { public float readHumidity() throws IOException, IllegalStateException { if (!hasHumiditySensor()) { throw new UnsupportedOperationException("This chip " + mChipId + " doesn't have humidity sensor"); } if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mHumidityOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("Humidity oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawHum = readSample16(BME280_REG_HUM); return compensateHumidity(rawHum, temperatures[1], mHumCalibrationData); } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); }
Bmx280 implements AutoCloseable { public float readHumidity() throws IOException, IllegalStateException { if (!hasHumiditySensor()) { throw new UnsupportedOperationException("This chip " + mChipId + " doesn't have humidity sensor"); } if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mHumidityOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("Humidity oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawHum = readSample16(BME280_REG_HUM); return compensateHumidity(rawHum, temperatures[1], mHumCalibrationData); } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); static final int CHIP_ID_BMP280; static final int CHIP_ID_BME280; static final int DEFAULT_I2C_ADDRESS; @Deprecated
    static final int I2C_ADDRESS; static final float MIN_TEMP_C; static final float MAX_TEMP_C; static final float MIN_PRESSURE_HPA; static final float MAX_PRESSURE_HPA; static final float MIN_HUM_RH; static final float MAX_HUM_RH; static final float MAX_POWER_CONSUMPTION_TEMP_UA; static final float MAX_POWER_CONSUMPTION_PRESSURE_UA; static final float MAX_POWER_CONSUMPTION_HUMIDITY_UA; static final float MAX_FREQ_HZ; static final float MIN_FREQ_HZ; static final int MODE_SLEEP; static final int MODE_FORCED; static final int MODE_NORMAL; static final int OVERSAMPLING_SKIPPED; static final int OVERSAMPLING_1X; }