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


Java ThingUID类代码示例

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


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

示例1: createResult

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(RemoteDevice device) {

    ThingUID uid = getThingUID(device);
    if (uid != null) {

        Map<String, Object> properties = new HashMap<>(2);
        properties.put(HOST, device.getIdentity().getDescriptorURL().getHost());
        properties.put(NAME, device.getDetails().getModelDetails().getModelName());
        DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
                .withLabel(device.getDetails().getFriendlyName()).withRepresentationProperty(PLAYER_TYPE).build();
        // Debug
        // System.out.println(device.getDetails().getFriendlyName());
        // System.out.println(uid.toString());
        // System.out.println(device.getDetails().getManufacturerDetails().getManufacturer());
        // System.out.println(device.getDetails().getModelDetails().getModelName());
        // System.out.println(device.getIdentity().getDescriptorURL().getHost().toString());
        // System.out.println(device.getIdentity().getUdn().getIdentifierString());
        // System.out.println(device.getType().getType() + "\n");

        logger.info("Found HEOS device with UID: {}", uid.getAsString());
        return result;
    }

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

示例2: getThingUID

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的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

示例3: getThingUID

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
    if (device != null) {
        String manufacturer = device.getDetails().getManufacturerDetails().getManufacturer();
        if (manufacturer != null && manufacturer.toLowerCase().contains("loxone")) {
            String model = device.getDetails().getModelDetails().getModelName();
            if (model != null && model.toLowerCase().contentEquals("loxone miniserver")) {
                String serial = device.getDetails().getSerialNumber();
                if (serial == null) {
                    serial = device.getIdentity().getUdn().getIdentifierString();
                }
                if (serial != null) {
                    return new ThingUID(LoxoneBindingConstants.THING_TYPE_MINISERVER, serial);
                }
            }
        }
    }
    return null;
}
 
开发者ID:ppieczul,项目名称:org.openhab.binding.loxone,代码行数:20,代码来源:LoxoneMiniserverDiscoveryParticipant.java

示例4: detectThing

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
private void detectThing(DatagramPacket packet) throws IOException {
    String data = Util
            .decrypt(new ByteArrayInputStream(Arrays.copyOfRange(packet.getData(), 0, packet.getLength())), true);

    logger.debug("Detecting HS110 by data: {}", data);

    String inetAddress = packet.getAddress().getHostAddress();
    String id = HS110.parseDeviceId(data);
    logger.debug("HS110 with id {} found on {} ", id, inetAddress);
    ThingUID thingUID = new ThingUID(HS110BindingConstants.THING_TYPE_HS110, id);
    String label = "HS110 at " + inetAddress;
    Map<String, Object> properties = new TreeMap<>();
    properties.put(HS110BindingConstants.CONFIG_IP, inetAddress);
    DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withLabel(label)
            .withProperties(properties).build();
    thingDiscovered(discoveryResult);
}
 
开发者ID:computerlyrik,项目名称:openhab2-addon-hs110,代码行数:18,代码来源:HS110DiscoveryService.java

示例5: getChannel

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
    if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
        return null;
    }

    ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
    if (cluster == null) {
        logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
        return null;
    }

    Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
    ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
    if (zoneType != ZoneTypeEnum.MOTION_SENSOR) {
        return null;
    }

    return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_MOTION_INTRUSION,
            ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Motion Intrusion");
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:22,代码来源:ZigBeeConverterIasMotionIntrusion.java

示例6: getChannel

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
    if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
        return null;
    }

    ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
    if (cluster == null) {
        logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
        return null;
    }

    Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
    ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
    if (zoneType != ZoneTypeEnum.CONTACT_SWITCH) {
        return null;
    }

    return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_CONTACT_PORTAL1,
            ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Contact Portal 1");
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:22,代码来源:ZigBeeConverterIasContactPortal1.java

示例7: getChannel

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
    if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
        return null;
    }

    ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
    if (cluster == null) {
        logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
        return null;
    }

    Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
    ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
    if (zoneType != ZoneTypeEnum.MOTION_SENSOR) {
        return null;
    }

    return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_MOTION_PRESENCE,
            ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Motion Presence");
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:22,代码来源:ZigBeeConverterIasMotionPresence.java

示例8: getChannel

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
    clusterColorControl = (ZclColorControlCluster) endpoint.getInputCluster(ZclColorControlCluster.CLUSTER_ID);

    if (clusterColorControl == null) {
        return null;
    }

    try {
        if (!clusterColorControl.discoverAttributes(false).get()) {
            logger.warn(
                    "{}: Cannot determine whether device supports RGB color. Assuming it does by now (checking again later)",
                    endpoint.getIeeeAddress());
        } else if (!clusterColorControl.getSupportedAttributes().contains(ZclColorControlCluster.ATTR_CURRENTHUE)
                && !clusterColorControl.getSupportedAttributes().contains(ZclColorControlCluster.ATTR_CURRENTX)) {
            return null;
        }
    } catch (InterruptedException | ExecutionException e) {
        logger.warn(
                "{}: Exception checking whether device supports RGB color. Assuming it does by now (checking again later)",
                endpoint.getIeeeAddress(), e);
    }

    return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_COLOR_COLOR,
            ZigBeeBindingConstants.ITEM_TYPE_COLOR, "Color");
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:27,代码来源:ZigBeeConverterColorColor.java

示例9: onWMBusMessageReceivedInternal

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
private void onWMBusMessageReceivedInternal(WMBusMessage wmBusDevice) {
    // try to find this device in the list of supported devices
    ThingUID thingUID = getThingUID(wmBusDevice);

    if (thingUID != null) {
        // device known -> create discovery result
        ThingUID bridgeUID = bridgeHandler.getThing().getUID();
        Map<String, Object> properties = new HashMap<>(1);
        properties.put(PROPERTY_HKV_ID, wmBusDevice.getSecondaryAddress().getDeviceId().toString());

        // TODO label according to uid
        DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withProperties(properties)
                .withRepresentationProperty(wmBusDevice.getSecondaryAddress().getDeviceId().toString())
                .withBridge(bridgeUID)
                .withLabel("Techem Heizkostenverteiler #" + wmBusDevice.getSecondaryAddress().getDeviceId())
                .build();
        thingDiscovered(discoveryResult);
    } else {
        // device unknown -> log message
        logger.debug("discovered unsupported WMBus device of type '{}' with id {}", wmBusDevice.getSecondaryAddress().getDeviceType(), wmBusDevice.getSecondaryAddress().getDeviceId());
    }
}
 
开发者ID:pokerazor,项目名称:openhab-binding-wmbus,代码行数:23,代码来源:WMBusHKVDiscoveryService.java

示例10: createThing

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID,
        ThingUID bridgeUID) {
    logger.trace("Create Thing for Type {}", thingUID.toString());
    if (MegaDBindingConstants.THING_TYPE_UID_BRIDGE.equals(thingTypeUID)) {

        logger.trace("Create Bride: {}", thingTypeUID);
        return super.createThing(thingTypeUID, configuration, thingUID, null);
    } else {
        if (supportsThingType(thingTypeUID)) {
            logger.trace("Create Thing: {}", thingTypeUID);
            return super.createThing(thingTypeUID, configuration, thingUID, bridgeUID);
        }
    }

    throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding.");
}
 
开发者ID:Pshatsillo,项目名称:openhab2MegadBinding,代码行数:18,代码来源:MegaDHandlerFactory.java

示例11: onDeviceStateChanged

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public void onDeviceStateChanged(ThingUID bridge, BticinoDevice device) {
	if (deviceWhereAddress.equals(device.getWhereAddress())) {
		updateStatus(ThingStatus.ONLINE);
		if (device.isUpdated() || forceRefresh) {
			forceRefresh = false;
			logger.debug("Updating states of {} ({}) id: {}", device.getType(),
					device.getWhereAddress(), getThing().getUID());
			switch (device.getType()) {				
			case VIDEO_CAMERA_ENTRANCE_PANEL:
			case INDOOR_CAMERA:
			case DOOR_LOCK_ACTUATOR:					
				break;				
			default:
				logger.debug("Unhandled Device {}.", device.getType());
				break;

			}
		} else
			logger.debug("No changes for {} ({}) id: {}", device.getType(), 
					device.getWhereAddress(), getThing().getUID());
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:24,代码来源:OpenWebNetVdesHandler.java

示例12: createThing

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID,
		ThingUID bridgeUID) {

	if (IP_2WIRE_INTERFACE_THING_TYPE.equals(thingTypeUID)) {
		ThingUID bticinoBridgeUID = getBridgeThingUID(thingTypeUID, thingUID, configuration);
		logger.debug("createThing: {}", bticinoBridgeUID);
		return super.createThing(thingTypeUID, configuration, bticinoBridgeUID, null);
	}
	else if (supportsThingType(thingTypeUID)) {
		ThingUID deviceUID = getBtcinoDeviceUID(thingTypeUID, thingUID, configuration, bridgeUID);
		logger.debug("createThing: {}", deviceUID);
		return super.createThing(thingTypeUID, configuration, deviceUID, bridgeUID);
	}
	throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding.");
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:17,代码来源:OpenWebNetVdesHandlerFactory.java

示例13: getThingUID

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
	if (device != null) {
		if(device.getDetails().getManufacturerDetails().getManufacturer() != null) {
			if (device.getDetails().getManufacturerDetails().getManufacturer()
					.toUpperCase().contains("SONOS")) {
				logger.debug(
						"Discovered a Sonos Zone Player thing with UDN '{}'",
						device.getIdentity().getUdn().getIdentifierString());
				return new ThingUID(ZONEPLAYER_THING_TYPE_UID, device
						.getIdentity().getUdn().getIdentifierString());
			} 
		}
	}
	return null;
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:17,代码来源:ZonePlayerDiscoveryParticipant.java

示例14: submitDiscoveryResults

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
/**
 * Submit the discovered Devices to the Smarthome inbox,
 * 
 * @param ip The Device IP
 */
private void submitDiscoveryResults(String ip) {

	// uid must not contains dots
	ThingUID uid = new ThingUID(THING_TYPE_DEVICE, ip.replace('.', '_') ); 	
	
	if(uid!=null) { 
		Map<String, Object> properties = new HashMap<>(1); 
		properties.put(PARAMETER_HOSTNAME ,ip);
		DiscoveryResult result = DiscoveryResultBuilder.create(uid)
				.withProperties(properties)
				.withLabel("Network Device (" + ip +")").build();
		thingDiscovered(result); 
	}
	 
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:21,代码来源:NetworkDiscoveryService.java

示例15: createResult

import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(ServiceInfo service) {
    final ThingUID uid = getThingUID(service);
    if (uid == null) {
        return null;
    }

    final Map<String, Object> properties = new HashMap<>(2);
    String host = service.getHostAddresses()[0];
    properties.put(ChromecastBindingConstants.HOST, host);
    int port = service.getPort();
    properties.put(ChromecastBindingConstants.PORT, port);
    logger.debug("Chromecast Found: {} {}", host, port);
    String friendlyName = service.getPropertyString("fn"); // friendly name;

    final DiscoveryResult result = DiscoveryResultBuilder.create(uid).withThingType(getThingType(service))
            .withProperties(properties).withLabel(friendlyName).build();

    return result;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:ChromecastDiscoveryParticipant.java


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