本文整理汇总了Java中org.eclipse.smarthome.core.thing.ThingTypeUID类的典型用法代码示例。如果您正苦于以下问题:Java ThingTypeUID类的具体用法?Java ThingTypeUID怎么用?Java ThingTypeUID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThingTypeUID类属于org.eclipse.smarthome.core.thing包,在下文中一共展示了ThingTypeUID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(THING_TYPE_HOME)) {
TadoHomeHandler tadoHomeHandler = new TadoHomeHandler((Bridge) thing);
TadoDiscoveryService discoveryService = new TadoDiscoveryService(tadoHomeHandler);
bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
new Hashtable<String, Object>());
return tadoHomeHandler;
} else if (thingTypeUID.equals(THING_TYPE_ZONE)) {
return new TadoZoneHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_MOBILE_DEVICE)) {
return new TadoMobileDeviceHandler(thing);
}
return null;
}
示例2: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(WMBusBindingConstants.THING_TYPE_BRIDGE)) {
// create handler for WMBus bridge
logger.debug("Creating (handler for) WMBus bridge.");
if (thing instanceof Bridge) {
WMBusBridgeHandler handler = new WMBusBridgeHandler((Bridge) thing);
registerDiscoveryService(handler);
return handler;
} else {
return null;
}
} else if (thingTypeUID.equals(WMBusBindingConstants.THING_TYPE_TECHEM_HKV)) {
// create handler for Techem HKV device
logger.debug("Creating (handler for) TechemHKV device.");
return new WMBusTechemHKVHandler(thing);
} else {
return null;
}
}
示例3: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(MegaDBindingConstants.THING_TYPE_UID_BRIDGE)) {
MegaDBridgeHandler handler = new MegaDBridgeHandler((Bridge) thing);
return handler;
}
if (supportsThingType(thingTypeUID)) {
return new MegaDHandler(thing);
}
return null;
}
示例4: createThing
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的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.");
}
示例5: createThing
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的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.");
}
示例6: getSensorType
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
public static ThingTypeUID getSensorType(Sensor sensor) {
ThingTypeUID thingTypeUID = null;
SensorType type = SensorType.valueOf(sensor.getType());
switch (type) {
case DOOR:
thingTypeUID = ElementsBindingConstants.THING_TYPE_DOOR;
break;
case WINDOW:
thingTypeUID = ElementsBindingConstants.THING_TYPE_WINDOW;
break;
case MOTION:
thingTypeUID = ElementsBindingConstants.THING_TYPE_MOTION;
break;
case SIREN:
thingTypeUID = ElementsBindingConstants.THING_TYPE_SIREN;
break;
default:
thingTypeUID = null;
break;
}
return thingTypeUID;
}
示例7: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
logger.debug("MeteoStick thing factory: createHandler {} of type {}", thing.getThingTypeUID(), thing.getUID());
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (MeteostickBridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
return new MeteostickBridgeHandler((Bridge) thing);
}
if (MeteostickSensorHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
return new MeteostickSensorHandler(thing);
}
return null;
}
示例8: onNestDeviceAdded
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
private void onNestDeviceAdded(BaseNestDevice device, ThingTypeUID typeUID) {
ThingUID bridgeUID = bridge.getThing().getUID();
ThingUID deviceUID = new ThingUID(typeUID, bridgeUID, device.getDeviceId());
Map<String, Object> properties = new HashMap<>();
properties.put(NestDeviceConfiguration.DEVICE_ID, device.getDeviceId());
properties.put(PROPERTY_FIRMWARE_VERSION, device.getSoftwareVersion());
// @formatter:off
thingDiscovered(DiscoveryResultBuilder.create(deviceUID)
.withThingType(typeUID)
.withLabel(device.getNameLong())
.withBridge(bridgeUID)
.withProperties(properties)
.withRepresentationProperty(NestDeviceConfiguration.DEVICE_ID)
.build()
);
// @formatter:on
}
示例9: testCorrectClass
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Test
public void testCorrectClass()
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
when(thing.getThingTypeUID()).thenReturn(new ThingTypeUID(TPLinkSmartHomeBindingConstants.BINDING_ID, name));
SmartHomeHandler handler = (SmartHomeHandler) factory.createHandler(thing);
if (clazz == null) {
assertNull(name + " should not return any handler but null", handler);
} else {
assertNotNull(name + " should no return null handler", handler);
Field smartHomeDeviceField = SmartHomeHandler.class.getDeclaredField(SMART_HOME_DEVICE_FIELD);
smartHomeDeviceField.setAccessible(true);
assertSame(name + " should return expected device class", clazz,
smartHomeDeviceField.get(handler).getClass());
}
}
示例10: onItemUpdate
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
public void onItemUpdate(String sid, String command, JsonObject data) {
if (command.equals("read_ack") || command.equals("report") || command.equals("heartbeat")) {
String model = data.get("model").getAsString();
ThingTypeUID thingType = getThingTypeForModel(model);
if (thingType == null) {
logger.debug("Unknown discovered model: {}", model);
return;
}
Map<String, Object> properties = new HashMap<>(1);
properties.put(ITEM_ID, sid);
ThingUID thingUID = new ThingUID(thingType, sid);
if (discoveryServiceCallback.getExistingThing(thingUID) == null) {
logger.debug("Detected Xiaomi smart device - sid: {} model: {}", sid, model);
thingDiscovered(
DiscoveryResultBuilder.create(thingUID).withThingType(thingType).withProperties(properties)
.withRepresentationProperty(ITEM_ID).withLabel(getLabelForModel(model))
.withBridge(xiaomiBridgeHandler.getThing().getUID()).build());
}
}
}
示例11: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) {
String callbackUrl = createCallbackUrl();
OnkyoHandler handler = new OnkyoHandler(thing, upnpIOService, audioHTTPServer, callbackUrl);
if (callbackUrl != null) {
@SuppressWarnings("unchecked")
ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) bundleContext
.registerService(AudioSink.class.getName(), handler, new Hashtable<String, Object>());
audioSinkRegistrations.put(thing.getUID().toString(), reg);
}
return handler;
}
return null;
}
示例12: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(THING_TYPE_KODI)) {
KodiHandler handler = new KodiHandler(thing);
// register the Kodi as an audio sink
KodiAudioSink audioSink = new KodiAudioSink(handler, audioHTTPServer, createCallbackUrl());
@SuppressWarnings("unchecked")
ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) bundleContext
.registerService(AudioSink.class.getName(), audioSink, new Hashtable<String, Object>());
audioSinkRegistrations.put(thing.getUID().toString(), reg);
return handler;
}
return null;
}
示例13: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_RIO)) {
final RioSystemHandler sysHandler = new RioSystemHandler((Bridge) thing);
registerThingDiscovery(sysHandler);
return sysHandler;
} else if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_CONTROLLER)) {
return new RioControllerHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_SOURCE)) {
return new RioSourceHandler(thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_ZONE)) {
return new RioZoneHandler(thing);
}
return null;
}
示例14: startScan
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected void startScan() {
logger.debug("Starting system information discovery !");
String hostname;
try {
hostname = getHostName();
if (hostname.isEmpty()) {
throw new UnknownHostException();
}
if (!hostname.matches("[" + THING_UID_VALID_CHARS + "]*")) {
hostname = hostname.replaceAll("[^" + THING_UID_VALID_CHARS + "]", HOST_NAME_SEPERATOR);
}
} catch (UnknownHostException ex) {
hostname = DEFAULT_THING_ID;
logger.info("Hostname can not be resolved. Computer name will be set to the default one: {}",
DEFAULT_THING_ID);
}
ThingTypeUID computerType = SysteminfoBindingConstants.THING_TYPE_COMPUTER;
ThingUID computer = new ThingUID(computerType, hostname);
thingDiscovered(DiscoveryResultBuilder.create(computer).withLabel(DEFAULT_THING_LABEL).build());
}
示例15: createHandler
import org.eclipse.smarthome.core.thing.ThingTypeUID; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(final Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (SleepIQCloudHandler.SUPPORTED_THING_TYPE_UIDS.contains(thingTypeUID)) {
logger.debug("Creating SleepIQ cloud thing handler");
SleepIQCloudHandler cloudHandler = new SleepIQCloudHandler((Bridge) thing);
registerBedDiscoveryService(cloudHandler);
return cloudHandler;
} else if (SleepIQDualBedHandler.SUPPORTED_THING_TYPE_UIDS.contains(thingTypeUID)) {
logger.debug("Creating SleepIQ dual bed thing handler");
return new SleepIQDualBedHandler(thing);
}
return null;
}