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


Java DeviceDetails类代码示例

本文整理汇总了Java中org.jupnp.model.meta.DeviceDetails的典型用法代码示例。如果您正苦于以下问题:Java DeviceDetails类的具体用法?Java DeviceDetails怎么用?Java DeviceDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeviceDetails类属于org.jupnp.model.meta包,在下文中一共展示了DeviceDetails类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getThingUID

import org.jupnp.model.meta.DeviceDetails; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
    DeviceDetails details = device.getDetails();
    if (details != null) {
        ModelDetails modelDetails = details.getModelDetails();
        ManufacturerDetails modelManufacturerDetails = details.getManufacturerDetails();
        if (modelDetails != null && modelManufacturerDetails != null) {
            String modelName = modelDetails.getModelName();
            String modelManufacturer = modelManufacturerDetails.getManufacturer();
            if (modelName != null && modelManufacturer != null) {
                if (modelManufacturer.equals("Denon")) {
                    if (modelName.startsWith("HEOS") || modelName.endsWith("H")) {
                        if (device.getType().getType().startsWith("ACT")) {
                            return new ThingUID(THING_TYPE_BRIDGE,
                                    device.getIdentity().getUdn().getIdentifierString());
                        }
                    }
                }

            }
        }

    }

    return null;
}
 
开发者ID:Wire82,项目名称:org.openhab.binding.heos,代码行数:27,代码来源:HeosDiscoveryParticipant.java

示例2: createResult

import org.jupnp.model.meta.DeviceDetails; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(RemoteDevice device) {
    ThingUID uid = getThingUID(device);
    if (uid != null) {
        Map<String, Object> properties = new HashMap<>(2);

        // After correct Thing UID is created, we have confidence that all following parameters exist and we don't
        // need to check for null objects here in the device details
        DeviceDetails details = device.getDetails();
        String serial = details.getSerialNumber();
        String host = details.getPresentationURI().getHost();
        String label = details.getFriendlyName() + " @ " + host;
        int port = details.getPresentationURI().getPort();
        String vendor = details.getManufacturerDetails().getManufacturer();
        String model = details.getModelDetails().getModelName();

        logger.debug("Creating discovery result for serial {} label {} port {}", serial, label, port);
        properties.put(LoxoneBindingConstants.MINISERVER_PARAM_HOST, host);
        properties.put(LoxoneBindingConstants.MINISERVER_PARAM_PORT, port);
        properties.put(Thing.PROPERTY_VENDOR, vendor);
        properties.put(Thing.PROPERTY_MODEL_ID, model);
        properties.put(Thing.PROPERTY_SERIAL_NUMBER, serial);

        return DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel(label)
                .withRepresentationProperty(serial).build();
    }
    return null;
}
 
开发者ID:ppieczul,项目名称:org.openhab.binding.loxone,代码行数:29,代码来源:LoxoneMiniserverDiscoveryParticipant.java

示例3: createResult

import org.jupnp.model.meta.DeviceDetails; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(RemoteDevice device) {
    ThingUID uid = getThingUID(device);
    if (uid != null) {
        DeviceDetails details = device.getDetails();
        Map<String, Object> properties = new HashMap<>(3);
        properties.put("gatewayAddress", details.getBaseURL().getHost());

        logger.debug("Discovered a Homegear gateway with serial number '{}'", details.getSerialNumber());
        return DiscoveryResultBuilder.create(uid).withProperties(properties)
                .withLabel(details.getModelDetails().getModelNumber()).build();
    }
    return null;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:15,代码来源:HomegearDiscoveryParticipant.java

示例4: getThingUID

import org.jupnp.model.meta.DeviceDetails; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
    if (device != null) {
        DeviceDetails details = device.getDetails();
        String modelName = details.getModelDetails().getModelName();
        if ("HOMEGEAR".equalsIgnoreCase(modelName)) {
            return new ThingUID(THING_TYPE_BRIDGE, details.getSerialNumber());
        }
    }
    return null;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:HomegearDiscoveryParticipant.java

示例5: getThingUID

import org.jupnp.model.meta.DeviceDetails; //导入依赖的package包/类
/**
 * Compute a FRITZ!Box thind UID.
 */
@Override
public ThingUID getThingUID(RemoteDevice device) {
    DeviceDetails details = device.getDetails();
    if (details != null) {
        ModelDetails modelDetails = details.getModelDetails();
        if (modelDetails != null) {
            String modelName = modelDetails.getModelName();
            if (modelName != null) {
                if (modelName.startsWith(BRIDGE_MODEL_NAME)) {
                    logger.debug("discovered on {}", device.getIdentity().getDiscoveredOnLocalAddress());
                    return new ThingUID(BRIDGE_THING_TYPE,
                            device.getIdentity().getDescriptorURL().getHost()
                                    // It world be better to use udn but in my case FB is discovered twice
                                    // .getIdentity().getUdn().getIdentifierString()
                                    .replaceAll("[^a-zA-Z0-9_]", "_"));
                } else if (modelName.startsWith(PL546E_MODEL_NAME)) {
                    logger.debug("discovered on {}", device.getIdentity().getDiscoveredOnLocalAddress());
                    return new ThingUID(PL546E_STANDALONE_THING_TYPE,
                            device.getIdentity().getDescriptorURL().getHost()
                                    // It world be better to use udn but in my case PL546E is discovered twice
                                    // .getIdentity().getUdn().getIdentifierString()
                                    .replaceAll("[^a-zA-Z0-9_]", "_"));
                }
            }
        } else {
            logger.debug("no model details");
        }
    }
    return null;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:34,代码来源:AVMFritzUpnpDiscoveryParticipant.java


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