public static void setZeroIfActive(IntegerResource res) { if (res.isActive()) res.setValue(0); }
public static void increaseIfActive(IntegerResource res) { if (res.isActive()) res.setValue(res.getValue()+1); } public static void setZeroIfActive(IntegerResource res) {
private void setupHmParameterValues(Thermostat thermos, String address) { //XXX address mangling (parameters are set on device, not channel) if (address.lastIndexOf(":") != -1) { address = address.substring(0, address.lastIndexOf(":")); } @SuppressWarnings("unchecked") ResourceList<SingleValueResource> masterParameters = thermos.addDecorator("HmParametersMaster", ResourceList.class); if (!masterParameters.exists()) { masterParameters.setElementType(SingleValueResource.class); masterParameters.create(); } IntegerResource tf_modus = masterParameters.getSubResource(PARAM_TEMPERATUREFALL_MODUS, IntegerResource.class); ParameterListener l = new ParameterListener(address); if (tf_modus.isActive()) { //send active parameter on startup l.resourceChanged(tf_modus); } tf_modus.addValueListener(l, true); }
public void onGET(OgemaHttpRequest req) { IntegerResource source = getResource(sva, req, null); if ((source == null)||(!source.isActive())) { myLabel.setText("n.a.", req); return; } String val; switch(mode) { default: val = ""+source.getValue(); } myLabel.setText(val, req); }; };
private void setupHmParameterValues(Thermostat thermos, String address) { //XXX address mangling (parameters are set on device, not channel) if (address.lastIndexOf(":") != -1) { address = address.substring(0, address.lastIndexOf(":")); } @SuppressWarnings("unchecked") ResourceList<SingleValueResource> masterParameters = thermos.addDecorator("HmParametersMaster", ResourceList.class); if (!masterParameters.exists()) { masterParameters.setElementType(SingleValueResource.class); masterParameters.create(); } IntegerResource tf_modus = masterParameters.getSubResource(PARAM_TEMPERATUREFALL_MODUS, IntegerResource.class); ParameterListener l = new ParameterListener(address); if (tf_modus.isActive()) { //send active parameter on startup l.resourceChanged(tf_modus); } tf_modus.addValueListener(l, true); }
/** * returns true iff value of target resource remains to be set */ @SuppressWarnings("fallthrough") private boolean handleFilter(float targetValue, Filter filter) { if (filterSatisfied(targetValue, filter)) { return true; } int mode = 0; if (filter.mode().isActive()) mode = filter.mode().getValue(); switch (mode) { case 0: target.deactivate(false); default: // includes case 1 return false; } }
if (pullConfig.depth().isActive()) url = url + "?depth=" + pullConfig.depth().getValue(); url = appendUserInfo(url);
boolean schedules = false; boolean references = false; if (pullConfig.depth().isActive()) depth = pullConfig.depth().getValue(); if (pullConfig.schedules().isActive())
final int depth = (pushConfig.depth().isActive() ? Math.max(0, pushConfig.depth().getValue()) : 0); final boolean schedules = (pushConfig.schedules().isActive() ? pushConfig.schedules().getValue() : false); final boolean references = (pushConfig.resolveReferences().isActive() ? pushConfig.resolveReferences().getValue() : false);
location = ResourceUtils.getDeviceLocationRoom(pattern.target); } catch (SecurityException ignore) {} final boolean outside = location != null && location.type().isActive() && location.type().getValue() == 0; return new Type(Type.PRIMARY_TEMPERATURE, outside ? Type.SECONDARY_TEMP_OUTSIDE : Type.SECONDARY_TEMP_INSIDE);
private final static void checkForRoom(final Resource p, final Map<String, List<String>> result) { Room room = null; if (p instanceof Room) { room = (Room) p; } else if (p instanceof PhysicalElement && (!(p instanceof Building))) { if (((PhysicalElement) p).location().room().isActive()) { room = ((PhysicalElement) p).location().room(); } } if (room != null) { addProperty(result, LogDataTaggingConstants.ROOM_PATH, room.getLocation()); if (room.name().isActive()) addProperty(result, LogDataTaggingConstants.ROOM_NAME, room.name().getValue()); if (room.type().isActive()) addProperty(result, LogDataTaggingConstants.ROOM_TYPE, room.type().getValue() + ""); } }