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


Java Thing类代码示例

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


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

示例1: unregisterHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Override
public void unregisterHandler(Thing thing) {
    if (thing.getThingTypeUID().equals(THING_TYPE_BRIDGE)) {
        super.unregisterHandler(thing);
        ServiceRegistration<?> serviceRegistration = this.discoveryServiceRegs.get(thing.getUID());
        if (serviceRegistration != null) {
            serviceRegistration.unregister();
            discoveryServiceRegs.remove(thing.getUID());
            logger.info("Unregister discovery service for HEOS player and HEOS groups by bridge '{}'",
                    thing.getUID().getId());
        }
    }
    if (thing.getThingTypeUID().equals(THING_TYPE_PLAYER) || thing.getThingTypeUID().equals(THING_TYPE_GROUP)) {
        super.unregisterHandler(thing);
        ServiceRegistration<AudioSink> reg = audioSinkRegistrations.get(thing.getUID().toString());
        if (reg != null) {
            reg.unregister();
        }
    }

}
 
开发者ID:Wire82,项目名称:org.openhab.binding.heos,代码行数:22,代码来源:HeosHandlerFactory.java

示例2: createHandler

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

示例3: createHandler

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

示例4: createHandler

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

示例5: createThing

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

示例6: createThing

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

示例7: ZonePlayerHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
public ZonePlayerHandler(Thing thing, UpnpIOService upnpIOService,
		DiscoveryServiceRegistry discoveryServiceRegistry, String opmlPartnerID) {
	super(thing);
	this.opmlPartnerID = opmlPartnerID;

	logger.debug("Creating a ZonePlayerHandler for thing '{}'", getThing()
			.getUID());
	if (upnpIOService != null) {
		this.service = upnpIOService;
	}
	if (discoveryServiceRegistry != null) {
		this.discoveryServiceRegistry = discoveryServiceRegistry;
		this.discoveryServiceRegistry.addDiscoveryListener(this);
	}

}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:17,代码来源:ZonePlayerHandler.java

示例8: createHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
    ElementsDiscoveryService discoveryService = null;
    if (ElementsBindingConstants.THING_TYPE_BASE.equals(thing.getThingTypeUID())) {
        logger.debug("discovery service register");

        ElementsBridgeHandler bridgetHandler = new ElementsBridgeHandler(thing, discoveryService);

        discoveryService = new ElementsDiscoveryService((Bridge) thing, 15);
        this.discoveryServiceReg = bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
                new Hashtable<String, Object>());
        logger.debug("done ElementsDiscoveryService");
        return bridgetHandler;
    }
    return new ElementsThingHandler(thing);
}
 
开发者ID:hkuhn42,项目名称:openhab2.elements,代码行数:17,代码来源:ElementsHandlerFactory.java

示例9: createHandler

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

示例10: createThing

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

    String adapterID = (String) configuration.get(VitotronicBindingConstants.ADAPTER_ID);

    if (VitotronicBindingConstants.THING_TYPE_UID_BRIDGE.equals(thingTypeUID)) {

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

    throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding.");
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:VitotronicHandlerFactory.java

示例11: createHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {
    logger.debug("createHandler for {} {}", thing, thing.getThingTypeUID());
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    if (thingTypeUID.equals(APIBRIDGE_THING_TYPE)) {
        ToonBridgeHandler bridgeHandler = new ToonBridgeHandler((Bridge) thing);
        registerDeviceDiscoveryService(bridgeHandler);
        return bridgeHandler;
    } else if (thingTypeUID.equals(PLUG_THING_TYPE)) {
        return new ToonPlugHandler(thing);
    } else if (thingTypeUID.equals(MAIN_THING_TYPE)) {
        return new ToonDisplayHandler(thing);
    } else {
        logger.warn("ThingHandler not found for {}", thing.getThingTypeUID());
        return null;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:18,代码来源:ToonHandlerFactory.java

示例12: createHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Override
protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(THING_TYPE_IP_REGO6XX)) {
        return new IpRego6xxHeatPumpHandler(thing);
    }

    if (thingTypeUID.equals(THING_TYPE_SERIAL_REGO6XX)) {
        return new SerialRego6xxHeatPumpHandler(thing);
    }

    if (thingTypeUID.equals(THING_TYPE_IP_HUSDATA)) {
        return new IpHusdataHandler(thing);
    }

    if (thingTypeUID.equals(THING_TYPE_SERIAL_HUSDATA)) {
        return new SerialHusdataHandler(thing);
    }

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

示例13: updateProperties

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
/**
 * Update the given properties with attributes of the given bed. If no properties are given, a new map will be
 * created.
 *
 * @param bed the source of data
 * @param properties the properties to update (this may be <code>null</code>)
 * @return the given map (or a new map if no map was given) with updated/set properties from the supplied bed
 */
public Map<String, String> updateProperties(final Bed bed, Map<String, String> properties) {
    if (bed != null) {
        properties.put(Thing.PROPERTY_MODEL_ID, bed.getModel());
        properties.put(SleepIQBindingConstants.PROPERTY_BASE, bed.getBase());
        if (bed.isKidsBed() != null) {
            properties.put(SleepIQBindingConstants.PROPERTY_KIDS_BED, bed.isKidsBed().toString());
        }
        properties.put(SleepIQBindingConstants.PROPERTY_MAC_ADDRESS, bed.getMacAddress());
        properties.put(SleepIQBindingConstants.PROPERTY_NAME, bed.getName());
        if (bed.getPurchaseDate() != null) {
            properties.put(SleepIQBindingConstants.PROPERTY_PURCHASE_DATE, bed.getPurchaseDate().toString());
        }
        properties.put(SleepIQBindingConstants.PROPERTY_SIZE, bed.getSize());
        properties.put(SleepIQBindingConstants.PROPERTY_SKU, bed.getSku());
    }

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

示例14: onDeviceUpdated

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Override
public void onDeviceUpdated(Device device) {
    for (ThingUID thingUID : UidUtils.getThingUIDs(device, getThing())) {
        Thing gardenaThing = getThingByUID(thingUID);
        try {
            GardenaThingHandler gardenaThingHandler = (GardenaThingHandler) gardenaThing.getHandler();
            gardenaThingHandler.updateProperties(device);
            for (Channel channel : gardenaThing.getChannels()) {
                gardenaThingHandler.updateChannel(channel.getUID());
            }
            gardenaThingHandler.updateSettings(device);
            gardenaThingHandler.updateStatus(device);
        } catch (GardenaException ex) {
            logger.error("There is something wrong with your thing '{}', please check or recreate it: {}",
                    gardenaThing.getUID(), ex.getMessage());
            logger.debug("Gardena exception caught on device update.", ex);
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, ex.getMessage());
        } catch (AccountHandlerNotAvailableException ignore) {
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:GardenaAccountHandler.java

示例15: createHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
@Nullable
@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    SmartHomeDevice device;

    if (HS110.is(thingTypeUID)) {
        device = new EnergySwitchDevice();
    } else if (LB130.is(thingTypeUID) || LB230.is(thingTypeUID)) {
        device = new BulbDevice(thingTypeUID, COLOR_TEMPERATURE_LB130_MIN, COLOR_TEMPERATURE_LB130_MAX);
    } else if (LB120.is(thingTypeUID)) {
        device = new BulbDevice(thingTypeUID, COLOR_TEMPERATURE_LB120_MIN, COLOR_TEMPERATURE_LB120_MAX);
    } else if (TPLinkSmartHomeThingType.isSwitchingDevice(thingTypeUID)) {
        device = new SwitchDevice();
    } else if (TPLinkSmartHomeThingType.isBulbDevice(thingTypeUID)) {
        device = new BulbDevice(thingTypeUID);
    } else {
        return null;
    }
    return new SmartHomeHandler(thing, device);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:TPLinkSmartHomeHandlerFactory.java


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