本文整理汇总了Java中org.openhab.binding.homematic.internal.model.HmDevice.isGatewayExtras方法的典型用法代码示例。如果您正苦于以下问题:Java HmDevice.isGatewayExtras方法的具体用法?Java HmDevice.isGatewayExtras怎么用?Java HmDevice.isGatewayExtras使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openhab.binding.homematic.internal.model.HmDevice
的用法示例。
在下文中一共展示了HmDevice.isGatewayExtras方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeviceName
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
/**
* Returns the device name for the given device type.
*/
public static String getDeviceName(HmDevice device) {
if (device.isGatewayExtras()) {
return getDescription(HmDevice.TYPE_GATEWAY_EXTRAS);
}
String deviceDescription = null;
boolean isTeam = device.getType().endsWith("-Team");
String type = isTeam ? StringUtils.remove(device.getType(), "-Team") : device.getType();
deviceDescription = getDescription(type);
if (deviceDescription != null && isTeam) {
deviceDescription += " Team";
}
return deviceDescription == null ? "No Description" : deviceDescription;
}
示例2: reloadDeviceValues
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void reloadDeviceValues(HmDevice device) {
updateThing(device);
if (device.isGatewayExtras()) {
typeGenerator.generate(device);
}
}
示例3: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (!device.isGatewayExtras() && !(device.getHmInterface() == HmInterface.CUXD)) {
HmDatapoint dp = addDatapoint(device, 0, getName(), HmValueType.ENUM, 0, false);
dp.setOptions(new String[] { MODE_LOCKED, MODE_RESET, MODE_FORCE, MODE_DEFER });
dp.setMinValue(0);
dp.setMaxValue(dp.getOptions().length - 1);
}
}
示例4: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (device.isGatewayExtras()) {
HmDatapoint dp = addDatapoint(device, 0, getName(), HmValueType.INTEGER, 60, false);
dp.setMinValue(10);
dp.setMaxValue(300);
}
}
示例5: generateThingTypeUID
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
/**
* Generates the ThingTypeUID for the given device. If it's a Homegear device, add a prefix because a Homegear
* device has more datapoints.
*/
public static ThingTypeUID generateThingTypeUID(HmDevice device) {
if (!device.isGatewayExtras() && device.getGatewayId().equals(HmGatewayInfo.ID_HOMEGEAR)) {
return new ThingTypeUID(BINDING_ID, String.format("HG-%s", device.getType()));
} else {
return new ThingTypeUID(BINDING_ID, device.getType());
}
}
示例6: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (device.isGatewayExtras()) {
addDatapoint(device, 0, getName(), HmValueType.BOOL, Boolean.FALSE, false);
}
}
示例7: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (!device.isGatewayExtras()) {
addDatapoint(device, 0, getName(), HmValueType.STRING, device.getFirmware(), true);
}
}
示例8: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (!device.isGatewayExtras() && !(device.getHmInterface() == HmInterface.CUXD)) {
addDatapoint(device, 0, getName(), HmValueType.BOOL, Boolean.FALSE, false);
}
}
示例9: initialize
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void initialize(HmDevice device) {
if (device.isGatewayExtras()) {
addDatapoint(device, HmChannel.CHANNEL_NUMBER_EXTRAS, getName(), HmValueType.BOOL, Boolean.FALSE, false);
}
}
示例10: loadAllDeviceMetadata
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void loadAllDeviceMetadata() throws IOException {
cancelLoadAllMetadata = false;
// load all device descriptions
List<HmDevice> deviceDescriptions = getDeviceDescriptions();
// loading datapoints for all channels
Set<String> loadedDevices = new HashSet<String>();
Map<String, Collection<HmDatapoint>> datapointsByChannelIdCache = new HashMap<String, Collection<HmDatapoint>>();
for (HmDevice device : deviceDescriptions) {
if (!cancelLoadAllMetadata) {
try {
logger.trace("Loading metadata for device '{}' of type '{}'", device.getAddress(),
device.getType());
if (device.isGatewayExtras()) {
loadChannelValues(device.getChannel(HmChannel.CHANNEL_NUMBER_VARIABLE));
loadChannelValues(device.getChannel(HmChannel.CHANNEL_NUMBER_SCRIPT));
} else {
for (HmChannel channel : device.getChannels()) {
logger.trace(" Loading channel {}", channel);
// speed up metadata generation a little bit for equal channels in the gateway devices
if ((DEVICE_TYPE_VIRTUAL.equals(device.getType())
|| DEVICE_TYPE_VIRTUAL_WIRED.equals(device.getType())) && channel.getNumber() > 1) {
HmChannel previousChannel = device.getChannel(channel.getNumber() - 1);
cloneAllDatapointsIntoChannel(channel, previousChannel.getDatapoints());
} else {
String channelId = String.format("%s:%s:%s", channel.getDevice().getType(),
channel.getDevice().getFirmware(), channel.getNumber());
Collection<HmDatapoint> cachedDatapoints = datapointsByChannelIdCache.get(channelId);
if (cachedDatapoints != null) {
// clone all datapoints
cloneAllDatapointsIntoChannel(channel, cachedDatapoints);
} else {
logger.trace(" Loading datapoints into channel {}", channel);
addChannelDatapoints(channel, HmParamsetType.MASTER);
addChannelDatapoints(channel, HmParamsetType.VALUES);
// Make sure to only cache non-reconfigurable channels. For reconfigurable channels,
// the data point set might change depending on the selected mode.
if (!channel.isReconfigurable()) {
datapointsByChannelIdCache.put(channelId, channel.getDatapoints());
}
}
}
}
}
prepareDevice(device);
loadedDevices.add(device.getAddress());
gatewayAdapter.onDeviceLoaded(device);
} catch (IOException ex) {
logger.warn("Can't load device with address '{}' from gateway '{}': {}", device.getAddress(), id,
ex.getMessage());
}
}
}
if (!cancelLoadAllMetadata) {
devices.keySet().retainAll(loadedDevices);
}
initialized = true;
}
示例11: generate
import org.openhab.binding.homematic.internal.model.HmDevice; //导入方法依赖的package包/类
@Override
public void generate(HmDevice device) {
if (thingTypeProvider != null) {
ThingTypeUID thingTypeUID = UidUtils.generateThingTypeUID(device);
ThingType tt = thingTypeProvider.getThingType(thingTypeUID, Locale.getDefault());
if (tt == null || device.isGatewayExtras()) {
logger.debug("Generating ThingType for device '{}' with {} datapoints", device.getType(),
device.getDatapointCount());
List<ChannelGroupType> groupTypes = new ArrayList<ChannelGroupType>();
for (HmChannel channel : device.getChannels()) {
List<ChannelDefinition> channelDefinitions = new ArrayList<ChannelDefinition>();
// Omit thing channel definitions for reconfigurable channels;
// those will be populated dynamically during thing initialization
if (!channel.isReconfigurable()) {
// generate channel
for (HmDatapoint dp : channel.getDatapoints()) {
if (!isIgnoredDatapoint(dp) && dp.getParamsetType() == HmParamsetType.VALUES) {
ChannelTypeUID channelTypeUID = UidUtils.generateChannelTypeUID(dp);
ChannelType channelType = channelTypeProvider.getChannelType(channelTypeUID,
Locale.getDefault());
if (channelType == null) {
channelType = createChannelType(dp, channelTypeUID);
channelTypeProvider.addChannelType(channelType);
}
ChannelDefinition channelDef = new ChannelDefinition(dp.getName(),
channelType.getUID());
channelDefinitions.add(channelDef);
}
}
}
// generate group
ChannelGroupTypeUID groupTypeUID = UidUtils.generateChannelGroupTypeUID(channel);
ChannelGroupType groupType = channelTypeProvider.getChannelGroupType(groupTypeUID,
Locale.getDefault());
if (groupType == null || device.isGatewayExtras()) {
String groupLabel = String.format("%s",
WordUtils.capitalizeFully(StringUtils.replace(channel.getType(), "_", " ")));
groupType = new ChannelGroupType(groupTypeUID, false, groupLabel, null, null,
channelDefinitions);
channelTypeProvider.addChannelGroupType(groupType);
groupTypes.add(groupType);
}
}
tt = createThingType(device, groupTypes);
thingTypeProvider.addThingType(tt);
}
addFirmware(device);
}
}