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


Java ThingTypeUID类代码示例

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

示例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;
    }
}
 
开发者ID:pokerazor,项目名称:openhab-binding-wmbus,代码行数:23,代码来源:WMBusHandlerFactory.java

示例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;
}
 
开发者ID:Pshatsillo,项目名称:openhab2MegadBinding,代码行数:17,代码来源:MegaDHandlerFactory.java

示例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.");
}
 
开发者ID:Pshatsillo,项目名称:openhab2MegadBinding,代码行数:18,代码来源:MegaDHandlerFactory.java

示例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.");
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:17,代码来源:OpenWebNetVdesHandlerFactory.java

示例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;
}
 
开发者ID:hkuhn42,项目名称:openhab2.elements,代码行数:24,代码来源:ElementsHandlerFactory.java

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

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

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

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

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

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

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

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

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


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