當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。