本文整理汇总了Java中org.openhab.core.binding.BindingConfig类的典型用法代码示例。如果您正苦于以下问题:Java BindingConfig类的具体用法?Java BindingConfig怎么用?Java BindingConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindingConfig类属于org.openhab.core.binding包,在下文中一共展示了BindingConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTellstickBindingConfig
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public TellstickBindingConfig getTellstickBindingConfig(int id, TellstickValueSelector valueSel, String protocol) {
TellstickBindingConfig name = null;
for (Entry<String, BindingConfig> entry : bindingConfigs.entrySet()) {
TellstickBindingConfig bv = (TellstickBindingConfig) entry.getValue();
if (bv.getId() == id) {
if (valueSel == null || valueSel.equals(bv.getValueSelector())) {
if (protocol == null || bv.getProtocol() == null || protocol.equals(bv.getProtocol())) {
name = bv;
break;
}
}
}
}
return name;
}
示例2: getItemNamesForProperty
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<String> getItemNamesForProperty(String property) {
ArrayList<String> result = new ArrayList<String>();
// TODO: Make a reverse map somewhere, and keep it around as this is
// going to get a lot of calls, and a lot of garbage along the way!!
for (Entry<String, BindingConfig> bindingConfigEntry : bindingConfigs.entrySet()) {
if (bindingConfigEntry.getValue() instanceof MiosBindingConfig) {
String p = ((MiosBindingConfig) bindingConfigEntry.getValue()).toProperty();
if (p.equals(property)) {
logger.trace("getItemNamesForProperty: MATCH property '{}' against BindingConfig.toProperty '{}'",
property, p);
String itemName = bindingConfigEntry.getKey();
result.add(itemName);
}
}
}
return result;
}
示例3: getConfigsForSerialNumber
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public List<MaxCulBindingConfig> getConfigsForSerialNumber(String serial) {
List<MaxCulBindingConfig> configs = new ArrayList<MaxCulBindingConfig>();
for (BindingConfig c : super.bindingConfigs.values()) {
MaxCulBindingConfig config = (MaxCulBindingConfig) c;
if (config.getSerialNumber() != null) /*
* could be PairMode/ListenMode
* device which has no serial
*/
{
if (config.getSerialNumber().compareToIgnoreCase(serial) == 0)
configs.add(config);
}
}
if (configs.isEmpty())
return null;
else
return configs;
}
示例4: getConfigsForRadioAddr
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public List<MaxCulBindingConfig> getConfigsForRadioAddr(String addr) {
List<MaxCulBindingConfig> configs = new ArrayList<MaxCulBindingConfig>();
for (BindingConfig c : super.bindingConfigs.values()) {
MaxCulBindingConfig config = (MaxCulBindingConfig) c;
if (config.getSerialNumber() != null) /*
* could be PairMode/ListenMode
* device which has no serial
*/
{
if (config.getDevAddr().equalsIgnoreCase(addr))
configs.add(config);
}
}
return configs;
}
示例5: processBindingConfiguration
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
super.processBindingConfiguration(context, item, bindingConfig);
try {
if (bindingConfig != null) {
String[] configParts = bindingConfig.split(";");
if (configParts.length < 2 || configParts.length >2) {
throw new BindingConfigParseException ("energenie binding configuration must have two parts");
}
BindingConfig energenieBindingConfig = (BindingConfig) new EnergenieBindingConfig(configParts[0], configParts[1]);
addBindingConfig(item,energenieBindingConfig);
} else {
logger.warn("bindingConfig is NULL (item=" + item
+ ") -> processing bindingConfig aborted!");
}
} catch (ArrayIndexOutOfBoundsException e) {
logger.warn("bindingConfig is invalid (item=" + item
+ ") -> processing bindingConfig aborted!");
}
}
示例6: isCommandGA
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public boolean isCommandGA(final GroupAddress groupAddress) {
synchronized(bindingConfigs) {
for (BindingConfig config : bindingConfigs.values()) {
KNXBindingConfig knxConfig = (KNXBindingConfig) config;
for (KNXBindingConfigItem configItem : knxConfig) {
if (configItem.allDataPoints.contains(groupAddress)) {
if(configItem.mainDataPoint instanceof CommandDP) {
if(configItem.mainDataPoint.getMainAddress().equals(groupAddress)) {
// the first GA in a CommandDP is always a command GA
return true;
} else {
return false;
}
} else {
// it is a StateDP, so the GA cannot be a command GA
return false;
}
}
}
}
}
return false;
}
示例7: autoUpdate
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public Boolean autoUpdate(String itemName) {
BindingConfig config = bindingConfigs.get(itemName);
if(config instanceof KNXBindingConfig) {
KNXBindingConfig knxConfig = (KNXBindingConfig) config;
Iterator<KNXBindingConfigItem> it = knxConfig.iterator();
while(it.hasNext()) {
KNXBindingConfigItem item = it.next();
if(item.allDataPoints.getDatapoints().size()>1) {
// If the datapoint is a CommandDP, the first GA is the command GA, all other are listening GAs.
// If the datapoint is a StateDP, all GAs are listening GAs.
// If we have a single DPT configured with a command GA and at least one listening GA,
// we deactivate the auto-update as we assume that status updates after a command
// will come from KNX.
return false;
}
}
}
return null;
}
示例8: getTellstickBindingConfig
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public TellstickBindingConfig getTellstickBindingConfig(int id, TellstickValueSelector valueSel, String protocol) {
TellstickBindingConfig name = null;
for (Entry<String, BindingConfig> entry : bindingConfigs.entrySet()) {
TellstickBindingConfig bv = (TellstickBindingConfig) entry.getValue();
if (bv.getId() == id) {
if (valueSel == null || valueSel.equals(bv.getValueSelector())) {
if (protocol == null || bv.getProtocol() == null || protocol.equals(bv.getProtocol())) {
name = bv;
break;
}
}
}
}
return name;
}
示例9: getBindingItemName
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public String getBindingItemName(String vdrId, VDRCommandType vdrCommand) {
String itemName = null;
logger.debug("Searching for a binding config that matches the id '{}' and command '{}'", vdrId, vdrCommand);
for (BindingConfig config : this.bindingConfigs.values()) {
VDRBindingConfig vdrConfig = (VDRBindingConfig) config;
if (vdrConfig.vDRId.equals(vdrId) && vdrConfig.command.equals(vdrCommand.getVDRCommand())) {
itemName = vdrConfig.item.getName();
logger.debug("Match found: '{}'", itemName);
break;
} else {
logger.debug("Not a match: '{}':'{}'", vdrConfig.vDRId, vdrConfig.command);
}
}
return itemName;
}
示例10: getItemNamesForProperty
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<String> getItemNamesForProperty(String property) {
ArrayList<String> result = new ArrayList<String>();
// TODO: Make a reverse map somewhere, and keep it around as this is
// going to get a lot of calls, and a lot of garbage along the way!!
for (Entry<String, BindingConfig> bindingConfigEntry : bindingConfigs.entrySet()) {
if (bindingConfigEntry.getValue() instanceof MiosBindingConfig) {
String p = ((MiosBindingConfig) bindingConfigEntry.getValue()).toProperty();
if (p.equals(property)) {
logger.trace("getItemNamesForProperty: MATCH property '{}' against BindingConfig.toProperty '{}'",
property, p);
String itemName = bindingConfigEntry.getKey();
result.add(itemName);
}
}
}
return result;
}
示例11: getConfigsForSerialNumber
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public List<MaxCulBindingConfig> getConfigsForSerialNumber(String serial) {
List<MaxCulBindingConfig> configs = new ArrayList<MaxCulBindingConfig>();
for (BindingConfig c : super.bindingConfigs.values()) {
MaxCulBindingConfig config = (MaxCulBindingConfig) c;
if (config.getSerialNumber() != null) /*
* could be PairMode/ListenMode
* device which has no serial
*/
{
if (config.getSerialNumber().compareToIgnoreCase(serial) == 0) {
configs.add(config);
}
}
}
if (configs.isEmpty()) {
return null;
} else {
return configs;
}
}
示例12: getConfigsForRadioAddr
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public List<MaxCulBindingConfig> getConfigsForRadioAddr(String addr) {
List<MaxCulBindingConfig> configs = new ArrayList<MaxCulBindingConfig>();
for (BindingConfig c : super.bindingConfigs.values()) {
MaxCulBindingConfig config = (MaxCulBindingConfig) c;
if (config.getSerialNumber() != null) /*
* could be PairMode/ListenMode
* device which has no serial
*/
{
if (config.getDevAddr().equalsIgnoreCase(addr)) {
configs.add(config);
}
}
}
return configs;
}
示例13: getMatchBindingConfigs
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
public Map<String, BindingConfig> getMatchBindingConfigs(
Cardio2eTransaction transaction) { // Returns a Map that
// contains only the
// BindingConfigs with
// Cardio2eTransaction like
// "transaction" and their
// IntemNames
Map<String, BindingConfig> matchBindingConfigs = new HashMap<String, BindingConfig>();
if (!(bindingConfigs.isEmpty())) {
for (String itemName : bindingConfigs.keySet()) {
Cardio2eBindingConfig storedBindingConfig = getConfig(itemName);
Cardio2eBindingConfig matchBindingConfig = new Cardio2eBindingConfig();
for (Cardio2eBindingConfigItem configItem : storedBindingConfig) {
if (configItem.transaction.isLike(transaction)) {
matchBindingConfig.add(configItem);
}
}
if (!matchBindingConfig.isEmpty()) {
matchBindingConfigs.put(itemName, matchBindingConfig);
}
}
}
return matchBindingConfigs;
}
示例14: isCommandGA
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public boolean isCommandGA(final GroupAddress groupAddress) {
synchronized (bindingConfigs) {
for (BindingConfig config : bindingConfigs.values()) {
KNXBindingConfig knxConfig = (KNXBindingConfig) config;
for (KNXBindingConfigItem configItem : knxConfig) {
if (configItem.allDataPoints.contains(groupAddress)) {
if (configItem.mainDataPoint instanceof CommandDP) {
if (configItem.mainDataPoint.getMainAddress().equals(groupAddress)) {
// the first GA in a CommandDP is always a command GA
return true;
} else {
return false;
}
} else {
// it is a StateDP, so the GA cannot be a command GA
return false;
}
}
}
}
}
return false;
}
示例15: autoUpdate
import org.openhab.core.binding.BindingConfig; //导入依赖的package包/类
@Override
public Boolean autoUpdate(String itemName) {
BindingConfig config = bindingConfigs.get(itemName);
if (config instanceof KNXBindingConfig) {
KNXBindingConfig knxConfig = (KNXBindingConfig) config;
Iterator<KNXBindingConfigItem> it = knxConfig.iterator();
while (it.hasNext()) {
KNXBindingConfigItem item = it.next();
if (item.allDataPoints.getDatapoints().size() > 1) {
// If the datapoint is a CommandDP, the first GA is the command GA, all other are listening GAs.
// If the datapoint is a StateDP, all GAs are listening GAs.
// If we have a single DPT configured with a command GA and at least one listening GA,
// we deactivate the auto-update as we assume that status updates after a command
// will come from KNX.
return false;
}
}
}
return null;
}