当前位置: 首页>>代码示例>>Java>>正文


Java HmDevice.isGatewayExtras方法代码示例

本文整理汇总了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;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:20,代码来源:MetadataUtils.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:8,代码来源:HomematicBridgeHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:DeleteDeviceModeVirtualDatapointHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:9,代码来源:InstallModeDurationVirtualDatapoint.java

示例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());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:UidUtils.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:7,代码来源:ReloadRssiVirtualDatapointHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:7,代码来源:FirmwareVirtualDatapointHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:7,代码来源:DeleteDeviceVirtualDatapointHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:7,代码来源:ReloadAllFromGatewayVirtualDatapointHandler.java

示例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;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:61,代码来源:AbstractHomematicGateway.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:54,代码来源:HomematicTypeGeneratorImpl.java


注:本文中的org.openhab.binding.homematic.internal.model.HmDevice.isGatewayExtras方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。