@Test public void testInvalidDeviceID() throws Exception { EepA50701 eep = (EepA50701)EepType.lookup("A5-07-01").createEep( deviceID, Constants.PIR_STATUS_COMMAND, null ); int rawPirStatusValue = 0; boolean isTeachIn = false; DeviceID invalidDeviceID = DeviceID.fromString("0xFF800002"); EspRadioTelegram telegram = createRadioTelegramESP3( invalidDeviceID, rawPirStatusValue, isTeachIn ); Boolean isUpdate = eep.update(telegram); Assert.assertFalse(isUpdate); telegram = createRadioTelegramESP2( invalidDeviceID, rawPirStatusValue, isTeachIn ); isUpdate = eep.update(telegram); Assert.assertFalse(isUpdate); }
@Override public boolean update(EspRadioTelegram telegram) { if(!deviceID.equals(telegram.getSenderID())) { return false; } if(!eepType.isValidRadioTelegramRORG(telegram)) { log.warn( "Discarded received radio telegram from device " + "with ID {0} because of a configuration error: " + "Command for device with ID {0} has been configured " + "with an invalid EEP {1} for this device.", deviceID, getType() ); return false; } this.controlData.update(telegram.getPayload()); if(isTeachInTelegram()) { return false; } return updatePirStatus(telegram); }
EepA50701 implements EepReceive { @Override public boolean update(EspRadioTelegram telegram) { if(!deviceID.equals(telegram.getSenderID())) { return false; } if(!eepType.isValidRadioTelegramRORG(telegram)) { log.warn( "Discarded received radio telegram from device " + "with ID {0} because of a configuration error: " + "Command for device with ID {0} has been configured " + "with an invalid EEP {1} for this device.", deviceID, getType() ); return false; } this.controlData.update(telegram.getPayload()); if(isTeachInTelegram()) { return false; } return updatePirStatus(telegram); } }
EepA50701 implements EepReceive { @Override public boolean update(EspRadioTelegram telegram) { if(!deviceID.equals(telegram.getSenderID())) { return false; } if(!eepType.isValidRadioTelegramRORG(telegram)) { log.warn( "Discarded received radio telegram from device " + "with ID {0} because of a configuration error: " + "Command for device with ID {0} has been configured " + "with an invalid EEP {1} for this device.", deviceID, getType() ); return false; } this.controlData.update(telegram.getPayload()); if(isTeachInTelegram()) { return false; } return updatePirStatus(telegram); } EepA50701(DeviceID deviceID, String commandString); }
EepA50701 implements EepReceive { @Override public boolean update(EspRadioTelegram telegram) { if(!deviceID.equals(telegram.getSenderID())) { return false; } if(!eepType.isValidRadioTelegramRORG(telegram)) { log.warn( "Discarded received radio telegram from device " + "with ID {0} because of a configuration error: " + "Command for device with ID {0} has been configured " + "with an invalid EEP {1} for this device.", deviceID, getType() ); return false; } this.controlData.update(telegram.getPayload()); if(isTeachInTelegram()) { return false; } return updatePirStatus(telegram); } EepA50701(DeviceID deviceID, String commandString); @Override EepType getType(); @Override boolean update(EspRadioTelegram telegram); @Override void updateSensor(Sensor sensor); }
EepA50701 implements EepReceive { @Override public boolean update(EspRadioTelegram telegram) { if(!deviceID.equals(telegram.getSenderID())) { return false; } if(!eepType.isValidRadioTelegramRORG(telegram)) { log.warn( "Discarded received radio telegram from device " + "with ID {0} because of a configuration error: " + "Command for device with ID {0} has been configured " + "with an invalid EEP {1} for this device.", deviceID, getType() ); return false; } this.controlData.update(telegram.getPayload()); if(isTeachInTelegram()) { return false; } return updatePirStatus(telegram); } EepA50701(DeviceID deviceID, String commandString); @Override EepType getType(); @Override boolean update(EspRadioTelegram telegram); @Override void updateSensor(Sensor sensor); static final String EEP_A50701_PIRS_DATA_FIELD_NAME; static final int EEP_A50701_PIRS_OFFSET; static final int EEP_A50701_PIRS_SIZE; static final String EEP_A50701_PIRS_OFF_DESC; static final int EEP_A50701_PIRS_OFF_DATA_RANGE_MIN; static final int EEP_A50701_PIRS_OFF_DATA_RANGE_MAX; static final String EEP_A50701_PIRS_ON_DESC; static final int EEP_A50701_PIRS_ON_DATA_RANGE_MIN; static final int EEP_A50701_PIRS_ON_DATA_RANGE_MAX; }