use of org.openhab.binding.onewire.internal.deviceproperties.OneWireDevicePropertySwitchBindingConfig in project openhab1-addons by openhab.
the class OneWireBindingConfigFactory method createOneWireDeviceProperty.
/**
* @param pvItem
* @param pvBindingConfig
* @return a new BindingConfig, corresponding to the given
* <code><pvItem/code> and <code><pvBindingConfig/code>
* @throws BindingConfigParseException
*/
public static OneWireBindingConfig createOneWireDeviceProperty(Item pvItem, String pvBindingConfig) throws BindingConfigParseException {
logger.debug("createOneWireDeviceProperty: {} - bindingConfig:{}", pvItem.getName(), pvBindingConfig);
OneWireBindingConfig lvNewBindingConfig = null;
if (OneWireClearCacheControlBindingConfig.isBindingConfigToCreate(pvItem, pvBindingConfig)) {
lvNewBindingConfig = new OneWireClearCacheControlBindingConfig(pvBindingConfig);
} else if (OneWireDevicePropertyPushButtonBindingConfig.isBindingConfigToCreate(pvItem, pvBindingConfig)) {
lvNewBindingConfig = new OneWireDevicePropertyPushButtonBindingConfig(pvBindingConfig);
} else if (OneWireDevicePropertySwitchMinMaxNumberWarningBindingConfig.isBindingConfigToCreate(pvItem, pvBindingConfig)) {
lvNewBindingConfig = new OneWireDevicePropertySwitchMinMaxNumberWarningBindingConfig(pvBindingConfig);
} else if (pvItem instanceof NumberItem) {
lvNewBindingConfig = new OneWireDevicePropertyNumberBindingConfig(pvBindingConfig);
} else if (pvItem instanceof ContactItem) {
lvNewBindingConfig = new OneWireDevicePropertyContactBindingConfig(pvBindingConfig);
} else if (pvItem instanceof SwitchItem) {
lvNewBindingConfig = new OneWireDevicePropertySwitchBindingConfig(pvBindingConfig);
} else if (pvItem instanceof StringItem) {
lvNewBindingConfig = new OneWireDevicePropertyStringBindingConfig(pvBindingConfig);
} else {
throw new UnsupportedOperationException("the item-type " + pvItem.getClass() + " cannot be a onewire device");
}
logger.debug("created newBindingConfig: {}", lvNewBindingConfig.toString());
return lvNewBindingConfig;
}
Aggregations