result.application().requestAccessMode(AccessMode.EXCLUSIVE, AccessPriority.PRIO_HIGHEST); result.application().setValue(appId); return (T) result;
private void addMandatoryChannels() { HM_hlConfig attributeConfig = new HM_hlConfig(); attributeConfig.driverId = hm_hlConfig.driverId; attributeConfig.interfaceId = hm_hlConfig.interfaceId; attributeConfig.deviceAddress = hm_hlConfig.deviceAddress; attributeConfig.channelAddress = "ATTRIBUTE:0001"; attributeConfig.timeout = -1; attributeConfig.resourceName = hm_hlConfig.resourceName + "_HighWater"; attributeConfig.chLocator = addChannel(attributeConfig); attributeConfig = new HM_hlConfig(); attributeConfig.driverId = hm_hlConfig.driverId; attributeConfig.interfaceId = hm_hlConfig.interfaceId; attributeConfig.deviceAddress = hm_hlConfig.deviceAddress; attributeConfig.channelAddress = "ATTRIBUTE:0002"; attributeConfig.timeout = -1; attributeConfig.resourceName = hm_hlConfig.resourceName + "_BatteryStatus"; attributeConfig.chLocator = addChannel(attributeConfig); WaterDetector threeStateDevice = resourceManager.createResource(hm_hlConfig.resourceName, WaterDetector.class); highWater = threeStateDevice.reading().create(); // highWater.activate(true); // highWater.setValue("dry"); highWater.requestAccessMode(AccessMode.EXCLUSIVE, AccessPriority.PRIO_HIGHEST); StateOfChargeSensor eSens = threeStateDevice.battery().chargeSensor().create(); batteryStatus = eSens.reading().create(); // batteryStatus.activate(true); // batteryStatus.setValue(95); batteryStatus.requestAccessMode(AccessMode.EXCLUSIVE, AccessPriority.PRIO_HIGHEST); // do not activate value resources, since they do not contain sensible values yet ResourceUtils.activateComplexResources(threeStateDevice, true, appManager.getResourceAccess()); }