本文整理汇总了Java中org.openhab.core.binding.BindingProvider类的典型用法代码示例。如果您正苦于以下问题:Java BindingProvider类的具体用法?Java BindingProvider怎么用?Java BindingProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindingProvider类属于org.openhab.core.binding包,在下文中一共展示了BindingProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
public void bindingChanged(BindingProvider provider, String itemName)
{
boolean added = provider.providesBindingFor(itemName);
logger.info("Binding {} {}", itemName, (added ? "added" : "removed"));
if (added && provider instanceof HdlBindingProvider) {
HdlBindingConfig config = ((HdlBindingProvider)provider).getConfigFor(itemName);
if (config == null || server == null) {
return;
}
if (server.getDevice(config.address) == null) {
HdlDimmer d = new HdlDimmer(config.address, server);
d.addListener(this);
server.addDevice(d);
logger.info("Listening for events from {}", Integer.toHexString(config.address));
}
}
}
示例2: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* Inherited from AbstractActiveBinding.
* This method is called by the framework whenever there are changes to
* a binding configuration.
* @param provider the binding provider where the binding has changed
* @param itemName the item name for which the binding has changed
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
super.bindingChanged(provider, itemName);
m_hasInitialItemConfig = true; // hack around openHAB bug
InsteonPLMBindingConfig c =
((InsteonPLMBindingProvider)provider).getInsteonPLMBindingConfig(itemName);
logger.debug("item {} binding changed: {}", String.format("%-30s", itemName), c);
if (c == null) {
// Item has been removed. This condition is also found when *any*
// change to the items file is made: the items are first removed (c == null),
// and then added anew.
removeFeatureListener(itemName);
} else {
InsteonDevice dev = getDevice(c.getAddress());
if (dev == null) {
dev = makeNewDevice(c);
}
addFeatureListener(dev, itemName, c);
}
}
示例3: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* Called, if a single binding has changed. The given item could have been
* added or removed. We refresh the binding in case it's in the done stage.
*
* @param provider the binding provider where the binding has changed
* @param itemName the item name for which the binding has changed
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.trace("bindingChanged {}", itemName);
ZWaveBindingProvider zProvider = (ZWaveBindingProvider)provider;
if (zProvider != null) {
ZWaveBindingConfig bindingConfig = zProvider.getZwaveBindingConfig(itemName);
if (bindingConfig != null && converterHandler != null) {
converterHandler.executeRefresh(zProvider, itemName, true);
}
}
// Bindings have changed - rebuild the polling table
rebuildPollingTable();
super.bindingChanged(provider, itemName);
}
示例4: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.trace("bindingChanged() for item {} msg received.", itemName);
if (mKNXConnectionEstablished) {
if (provider instanceof KNXBindingProvider) {
KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
if(datapoint.getName().equals(itemName)) {
logger.debug("Initializing read of item {}.", itemName);
if (!mKNXBusReaderScheduler.scheduleRead(datapoint, knxProvider.getAutoRefreshTime(datapoint))) {
logger.warn("Couldn't add to KNX bus reader scheduler (bindingChanged, datapoint='{}')",datapoint);
}
break;
}
}
}
}
}
示例5: allBindingsChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void allBindingsChanged(BindingProvider provider) {
logger.trace("allBindingsChanged() msg received.");
if (mKNXConnectionEstablished) {
logger.debug("Initializing readable DPs.");
if (provider instanceof KNXBindingProvider) {
KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
mKNXBusReaderScheduler.clear();
for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
mKNXBusReaderScheduler.readOnce(datapoint);
int autoRefreshTimeInSecs=knxProvider.getAutoRefreshTime(datapoint);
if (autoRefreshTimeInSecs>0) {
if (!mKNXBusReaderScheduler.scheduleRead(datapoint, knxProvider.getAutoRefreshTime(datapoint))) {
logger.warn("Couldn't add to KNX bus reader scheduler (allBindingsChanged, datapoint='{}')",datapoint);
}
}
}
}
}
}
示例6: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void bindingChanged(BindingProvider prov, String itemName) {
if (prov.getItemNames().contains(itemName)) {
try {
createInternalItem(itemName, prov);
} catch (Ipx800UnknownDeviceException e) {
logger.error("Item {} will be ignored", itemName);
}
} else {
logger.debug("Removing item {}", itemName);
for (String deviceName : devices.keySet()) {
for (Ipx800Port slot : devices.get(deviceName).getAllPorts()) {
slot.destroyItem(itemName);
}
}
}
}
示例7: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* Inherited from AbstractActiveBinding.
* This method is called by the framework whenever there are changes to
* a binding configuration.
*
* @param provider the binding provider where the binding has changed
* @param itemName the item name for which the binding has changed
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
super.bindingChanged(provider, itemName);
m_hasInitialItemConfig = true; // hack around openHAB bug
InsteonPLMBindingConfig c = ((InsteonPLMBindingProvider) provider).getInsteonPLMBindingConfig(itemName);
logger.debug("item {} binding changed: {}", String.format("%-30s", itemName), c);
if (c == null) {
// Item has been removed. This condition is also found when *any*
// change to the items file is made: the items are first removed (c == null),
// and then added anew.
removeFeatureListener(itemName);
} else {
InsteonDevice dev = getDevice(c.getAddress());
if (dev == null) {
dev = makeNewDevice(c);
}
addFeatureListener(dev, itemName, c);
}
}
示例8: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* Called, if a single binding has changed. The given item could have been
* added or removed. We refresh the binding in case it's in the done stage.
*
* @param provider the binding provider where the binding has changed
* @param itemName the item name for which the binding has changed
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.trace("bindingChanged {}", itemName);
ZWaveBindingProvider zProvider = (ZWaveBindingProvider) provider;
if (zProvider != null) {
ZWaveBindingConfig bindingConfig = zProvider.getZwaveBindingConfig(itemName);
if (bindingConfig != null && converterHandler != null) {
converterHandler.executeRefresh(zProvider, itemName, true);
}
}
// Bindings have changed - rebuild the polling table
rebuildPollingTable();
super.bindingChanged(provider, itemName);
}
示例9: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
if (gpio == null) {
// we are not properly initialized
return;
}
if (provider instanceof MCP23017BindingProvider) {
String allItemNames = Arrays.toString(provider.getItemNames().toArray());
if (provider.getItemNames().contains(itemName)) {
bindGpioPin((MCP23017BindingProvider) provider, itemName);
logger.debug("bindingChanged item bound {} - {}", itemName, allItemNames);
} else {
unBindGpioPin((MCP23017BindingProvider) provider, itemName);
logger.debug("bindingChanged item unbound {} - {}", itemName, allItemNames);
}
}
super.bindingChanged(provider, itemName);
}
示例10: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* @{inheritDoc}
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.debug("Denon binding changed for item {}", itemName);
if (provider instanceof DenonBindingProvider) {
DenonBindingConfig config = ((DenonBindingProvider) provider).getConfig(itemName);
if (config != null) {
DenonConnector connector = getConnector(config);
if (connector != null) {
connector.updateStateFromCache(config.getProperty());
} else {
logger.debug("No connector found for item {}", itemName);
}
} else {
logger.debug("No config found for item {}", itemName);
}
}
}
示例11: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
super.bindingChanged(provider, itemName);
for (Map.Entry<String, Socket> entry : socketCache.entrySet()) {
try {
entry.getValue().close();
} catch (IOException e) {
logger.error("Can't close a socket when binding changed.");
}
}
// Cleanup all sockets
socketCache.clear();
outputStreamCache.clear();
bufferedReaderCache.clear();
}
示例12: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
/**
* Restart scheduler if some binding changes.
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
if (!context.getConfig().finishedParsing()) {
return;
}
if (context.getConfig().isValid()) {
if (provider instanceof WeatherBindingProvider) {
context.getJobScheduler().restart();
}
} else {
logger.debug("Binding for item '{}' changed, but unable to restart weather job "
+ " because weather configuration is not valid. Check openhab.cfg.", itemName);
}
super.bindingChanged(provider, itemName);
}
示例13: bindingChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.trace("bindingChanged() for item {} msg received.", itemName);
if (mKNXConnectionEstablished) {
if (provider instanceof KNXBindingProvider) {
KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
if (datapoint.getName().equals(itemName)) {
logger.debug("Initializing read of item {}.", itemName);
if (!mKNXBusReaderScheduler.scheduleRead(datapoint,
knxProvider.getAutoRefreshTime(datapoint))) {
logger.warn("Couldn't add to KNX bus reader scheduler (bindingChanged, datapoint='{}')",
datapoint);
}
break;
}
}
}
}
}
示例14: allBindingsChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void allBindingsChanged(BindingProvider provider) {
logger.trace("allBindingsChanged() msg received.");
if (mKNXConnectionEstablished) {
logger.debug("Initializing readable DPs.");
if (provider instanceof KNXBindingProvider) {
KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
mKNXBusReaderScheduler.clear();
for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
mKNXBusReaderScheduler.readOnce(datapoint);
int autoRefreshTimeInSecs = knxProvider.getAutoRefreshTime(datapoint);
if (autoRefreshTimeInSecs > 0) {
if (!mKNXBusReaderScheduler.scheduleRead(datapoint,
knxProvider.getAutoRefreshTime(datapoint))) {
logger.warn("Couldn't add to KNX bus reader scheduler (allBindingsChanged, datapoint='{}')",
datapoint);
}
}
}
}
}
}
示例15: allBindingsChanged
import org.openhab.core.binding.BindingProvider; //导入依赖的package包/类
@Override
public void allBindingsChanged(BindingProvider provider) {
if (provider instanceof EnoceanBindingProvider) {
EnoceanBindingProvider enoceanBindingProvider = (EnoceanBindingProvider) provider;
initializeAllItemsInProvider(enoceanBindingProvider);
}
}