@Override public void setBoolean(BooleanResource resource, boolean value) throws NoSuchResourceException { final String path = resource.getPath(); if (!m_boolMap.containsKey(path)) { throw new NoSuchResourceException("Can not set a value for resource " + resource.toString() + " in transaction: Resource had not been registered before. Be sure to register the resource to the transaction with addResource(...) before trying to set a value for it"); } final RwPair<Boolean> pair = m_boolMap.get(path); pair.write = value; }
@Override public JSONObject retrieveGETData(OgemaHttpRequest req) { checkboxList.clear(); if (selected != null) { String text; if (this.text != null) text = this.text; else text = selected.getPath(); checkboxList.put(text, selected.getValue()); } return super.retrieveGETData(req); }
@Override public void event(List<HmEvent> events) { for (HmEvent e : events) { if (!address.equals(e.getAddress())) { continue; } switch (e.getValueKey()) { case "PRESS_SHORT" : { shortPressEventResource.activate(false); shortPressEventResource.setValue(true); logger.debug("short press event on {}", shortPressEventResource.getPath()); break; } case "PRESS_LONG" : { longPressEventResource.activate(false); longPressEventResource.setValue(true); logger.debug("long press event on {}", longPressEventResource.getPath()); break; } default : { logger.trace("unsupported KEY event '{}'", e.getValueKey()); } } } }
private void handleUnreach(HmEvent e) { if (!e.getValueBoolean()) { logger.debug("device {} is reachable again, resending state control {}={}", address, sw.stateControl().getPath(), sw.stateControl().getValue()); conn.performSetValue(address, "STATE", sw.stateControl().getValue()); } else { logger.debug("device {} unreachable", address); } }