@Test public void testUpdateHumidity() throws Exception { EepA50401 eep = (EepA50401)EepType.lookup("A5-04-01").createEep( deviceID, Constants.HUMIDITY_STATUS_COMMAND, null ); Assert.assertNull(eep.getHumidity()); int rawHumidityValue = 0; boolean isTemperatureAvailable = true; boolean isTeachIn = false; EspRadioTelegram telegram = createRadioTelegramESP3( deviceID, 0, rawHumidityValue, isTemperatureAvailable, isTeachIn ); Boolean isUpdate = eep.update(telegram); Assert.assertTrue(isUpdate); Assert.assertEquals(Double.valueOf(0), eep.getHumidity()); rawHumidityValue = 0; telegram = createRadioTelegramESP3( deviceID, 0, rawHumidityValue, isTemperatureAvailable, isTeachIn ); isUpdate = eep.update(telegram); Assert.assertFalse(isUpdate); Assert.assertEquals(Double.valueOf(0), eep.getHumidity()); rawHumidityValue = 250; telegram = createRadioTelegramESP2( deviceID, 0, rawHumidityValue, isTemperatureAvailable, isTeachIn ); isUpdate = eep.update(telegram); Assert.assertTrue(isUpdate); Assert.assertEquals(Double.valueOf(100), eep.getHumidity()); isTemperatureAvailable = false; rawHumidityValue = 0; telegram = createRadioTelegramESP2( deviceID, 0, rawHumidityValue, isTemperatureAvailable, isTeachIn ); isUpdate = eep.update(telegram); Assert.assertTrue(isUpdate); Assert.assertEquals(Double.valueOf(0), eep.getHumidity()); rawHumidityValue = 251; telegram = createRadioTelegramESP2( deviceID, 0, rawHumidityValue, isTemperatureAvailable, isTeachIn ); isUpdate = eep.update(telegram); Assert.assertFalse(isUpdate); Assert.assertEquals(Double.valueOf(0), eep.getHumidity()); }
private boolean updateHumidity(EspRadioTelegram telegram) { boolean isUpdate = false; Double oldHumValue = humidity.rangeValue(); this.sensorData.update(telegram.getPayload()); Double newHumValue = humidity.rangeValue(); isUpdate = ((oldHumValue == null && newHumValue != null) || (oldHumValue != null && newHumValue != null && newHumValue.doubleValue() != oldHumValue.doubleValue())); return isUpdate; }
EepA50401 implements EepReceive { private boolean updateHumidity(EspRadioTelegram telegram) { boolean isUpdate = false; Double oldHumValue = humidity.rangeValue(); this.sensorData.update(telegram.getPayload()); Double newHumValue = humidity.rangeValue(); isUpdate = ((oldHumValue == null && newHumValue != null) || (oldHumValue != null && newHumValue != null && newHumValue.doubleValue() != oldHumValue.doubleValue())); return isUpdate; } }
EepA50401 implements EepReceive { private boolean updateHumidity(EspRadioTelegram telegram) { boolean isUpdate = false; Double oldHumValue = humidity.rangeValue(); this.sensorData.update(telegram.getPayload()); Double newHumValue = humidity.rangeValue(); isUpdate = ((oldHumValue == null && newHumValue != null) || (oldHumValue != null && newHumValue != null && newHumValue.doubleValue() != oldHumValue.doubleValue())); return isUpdate; } EepA50401(DeviceID deviceID, String commandString); }
EepA50401 implements EepReceive { private boolean updateHumidity(EspRadioTelegram telegram) { boolean isUpdate = false; Double oldHumValue = humidity.rangeValue(); this.sensorData.update(telegram.getPayload()); Double newHumValue = humidity.rangeValue(); isUpdate = ((oldHumValue == null && newHumValue != null) || (oldHumValue != null && newHumValue != null && newHumValue.doubleValue() != oldHumValue.doubleValue())); return isUpdate; } EepA50401(DeviceID deviceID, String commandString); @Override String toString(); @Override EepType getType(); @Override boolean update(EspRadioTelegram telegram); @Override void updateSensor(Sensor sensor); }
EepA50401 implements EepReceive { private boolean updateHumidity(EspRadioTelegram telegram) { boolean isUpdate = false; Double oldHumValue = humidity.rangeValue(); this.sensorData.update(telegram.getPayload()); Double newHumValue = humidity.rangeValue(); isUpdate = ((oldHumValue == null && newHumValue != null) || (oldHumValue != null && newHumValue != null && newHumValue.doubleValue() != oldHumValue.doubleValue())); return isUpdate; } EepA50401(DeviceID deviceID, String commandString); @Override String toString(); @Override EepType getType(); @Override boolean update(EspRadioTelegram telegram); @Override void updateSensor(Sensor sensor); static final int EEP_A50401_TSN_OFFSET; static final int EEP_A50401_TSN_SIZE; static final String EEP_A50401_TSN_AVAILABLE_DESC; static final int EEP_A50401_TSN_AVAILABLE_VALUE; static final String EEP_A50401_TSN_NOT_AVAILABLE_DESC; static final int EEP_A50401_TSN_NOT_AVAILABLE_VALUE; static final int EEP_A50401_FRACTIONAL_DIGITS; }