@XmlElement public boolean getValue() { return ((BooleanResource) res).getValue(); }
@Override public void resourceChanged(BooleanResource resource) { // Here the on/off command channel should be written // Currently only 1 channel for everything ChannelConfiguration locator = this.commandChannel.get("COMMAND:01"); BooleanValue onOff = new BooleanValue(resource.getValue()); if (isOn.getValue() != resource.getValue()) { // Toggle writeToChannel(locator, onOff); } }
@Override public void resourceChanged(BooleanResource resource) { // Here the on/off command channel should be written // Currently only 1 channel for everything ChannelConfiguration locator = this.commandChannel.get("COMMAND:01"); BooleanValue onOff = new BooleanValue(resource.getValue()); if (isOn.getValue() != resource.getValue()) { // Toggle writeToChannel(locator, onOff); } }
@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); }
private static void printChannelMapping(final ChannelController cc) { System.out.println(" Configuration " + cc.pattern.model.getLocation()); System.out.println(" Resource: " + cc.pattern.target.getLocationResource()); System.out.println(" Channel: " + cc.channelLocator); System.out.println(" Initialisation successful: " + (cc.pattern.registrationSuccessful.isActive() && cc.pattern.registrationSuccessful.getValue())); }
@Override public void resourceChanged(FloatResource resource) { final boolean alarmState = areLimitsViolated(m_device); final boolean currentState = m_device.trigger.getValue(); if (currentState != alarmState) m_device.trigger.setValue(alarmState); }
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); } }
/** * Creates an instance of the configuration object from an existing configuration. */ public ScheduleSumImpl(ResourceManipulatorImpl base, ScheduleSumModel configResource) { m_base = base; m_inputs = new ArrayList<>(configResource.inputs().getAllElements()); m_output = configResource.resultBase().program(); m_delay = configResource.delay().getValue(); m_deactivateEmtpySum = configResource.deactivateEmptySum().getValue(); m_activationControl = configResource.activationControl().getValue(); m_incrementalUpdate = configResource.incrementalUpdate().getValue(); m_ignoreGaps = configResource.ignoreGaps().getValue(); m_writeImmediately = configResource.writeImmediately().getValue(); m_config = configResource; }
/** * Update the rules how the threshold shall be calculated, including the * question if the target resource should be set active or inactive. */ private void updateAndEnforceRules() { m_active = m_config.source().isActive(); m_threshold = m_config.threshold().getValue(); m_invert = m_config.invert().getValue(); m_equalityExceeds = m_config.equalityExceeds().getValue(); enforceRules(); }
/** * Creates an instance of the configuration object from an existing configuration. */ public ThresholdConfigurationImpl(ResourceManipulatorImpl base, ThresholdModel configResource) { m_base = base; m_appMan = base.getApplicationManager(); m_source = configResource.source(); m_threshold = configResource.threshold().getValue(); m_target = configResource.target(); m_equalityExceeds = configResource.equalityExceeds().getValue(); m_invert = configResource.invert().getValue(); m_config = configResource; }
@Override public void resourceChanged(BooleanResource t) { if (t.equals(baseResource.installationMode().stateControl())) { try { boolean onOff = t.getValue(); client.setInstallMode(onOff, 900, 1); int secondsRemaining = client.getInstallMode(); baseResource.installationMode().stateFeedback().setValue(secondsRemaining > 0); } catch (XmlRpcException ex) { logger.error("could not activate install mode", ex); } } else if (t.equals(baseResource.installationMode().stateFeedback())) { boolean installModeOn = baseResource.installationMode().stateFeedback().getValue(); logger.info("installation mode {}", installModeOn ? "on" : "off"); } }
/** * Creates an instance of the configuration object from an existing configuration. */ public SumImpl(ResourceManipulatorImpl base, SumModel configResource) { m_base = base; m_inputs = new ArrayList<>(configResource.inputs().getAllElements()); m_output = configResource.resultBase(); m_delay = configResource.delay().getValue(); m_deactivateEmtpySum = configResource.deactivateEmptySum().getValue(); m_config = configResource; }
protected static boolean needsIndividualPushOnInit(RestPullConfig pull) { return pull.isActive() && pull.pushOnInit().isActive() && pull.pushOnInit().getValue(); }
final void resourceChanged(final long t, final SingleValueResource resource) { final Value v; if (resource instanceof FloatResource) v = new FloatValue(((FloatResource) resource).getValue()); else if (resource instanceof IntegerResource) v = new IntegerValue(((IntegerResource) resource).getValue()); else if (resource instanceof BooleanResource) v = new BooleanValue(((BooleanResource) resource).getValue()); else if (resource instanceof TimeResource) v = new LongValue(((TimeResource) resource).getValue()); else throw new IllegalArgumentException(); values.add(new SampledValue(v, t, Quality.GOOD)); }
public static Value getValue(SingleValueResource resource) { if (resource instanceof FloatResource) { return new FloatValue(((FloatResource) resource).getValue()); } else if (resource instanceof IntegerResource) { return new IntegerValue(((IntegerResource) resource).getValue()); } else if (resource instanceof BooleanResource) { return new BooleanValue(((BooleanResource) resource).getValue()); } else if (resource instanceof TimeResource) { return new LongValue(((TimeResource) resource).getValue()); } else throw new RuntimeException(); }
/** * Creates an instance of the configuration object from an existing * configuration. */ public ProgramEnforcerImpl(ResourceManipulatorImpl base, ProgramEnforcerModel configResource) { m_base = base; m_targetResource = configResource.targetResource(); m_updateInterval = configResource.updateInterval().getValue(); m_priority = AccessPriority.valueOf(configResource.priority().getValue()); m_exclusiveAccessRequired = configResource.exclusiveAccessRequired().getValue(); m_config = configResource; m_deactivate = m_config.deactivateIfValueMissing().getValue(); m_scheduleName = m_config.scheduleResourceName().isActive() ? m_config.scheduleResourceName().getValue() : null; }
@Override public void resourceChanged(Resource resource) { if (resource.equalsLocation(pushTask.con.triggerPush())) { if (!pushTask.con.triggerPush().getValue()) return; else pushTask.con.triggerPush().setValue(false); } pushTask.triggerImmediately(); trigger.reschedule(pushTask); }
public boolean isRecursivePushTrigger() { if (con.pushConfig().isActive()) return con.pushConfig().pushOnSubresourceChanged().isActive() && con.pushConfig().pushOnSubresourceChanged().getValue(); if (con.individualPushConfigs().isActive()) { for (RestPushConfig config: con.individualPushConfigs().getAllElements()) { if (config.pushOnSubresourceChanged().isActive() && config.pushOnSubresourceChanged().getValue()) return true; } } return false; }
@Override public void resourceChanged(Resource resource) { if (resource.equalsLocation(pullTask.con.triggerPull())) { if (!pullTask.con.triggerPull().getValue()) return; else pullTask.con.triggerPull().setValue(false); } pullTask.triggerImmediately(); trigger.reschedule(pullTask); }
@Override public void start() { boolean callOnEveryUpdate = true; if (m_config.callOnEveryUpdate().isActive()) { callOnEveryUpdate = m_config.callOnEveryUpdate().getValue(); } for (SingleValueResource input : m_config.inputs().getAllElements()) { input.addStructureListener(this); input.addValueListener(this, callOnEveryUpdate); } active = true; evaluate(); }