• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Thing类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createHandler

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

    if (thingTypeUID.equals(THING_TYPE_SAMPLE)) {
        return new EventBusHandler(thing);
    }

    return null;
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:11,代码来源:EventBusHandlerFactory.java


示例17: createHandler

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

    if (thingTypeUID.equals(THING_TYPE_SIMPLE_MOTION_SENSOR)) {
        return new SimpleMotionSensorHandler(thing);
    }

    return null;
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:11,代码来源:SimpleMotionSensorHandlerFactory.java


示例18: HeosPlayerHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
public HeosPlayerHandler(Thing thing, HeosSystem heos, HeosAPI api) {
    super(thing);
    this.heos = heos;
    this.api = api;
    pid = thing.getConfiguration().get(PID).toString();

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


示例19: HeosGroupHandler

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
public HeosGroupHandler(Thing thing, HeosSystem heos, HeosAPI api) {
    super(thing);
    this.heos = heos;
    this.api = api;
    gid = thing.getConfiguration().get(GID).toString();

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


示例20: childHandlerInitialized

import org.eclipse.smarthome.core.thing.Thing; //导入依赖的package包/类
/**
 * Manages the adding of the childHandler to the handlerList and sets the Status
 * of the thing to ThingStatus.ONLINE.
 * Add also the player or group channel to the bridge.
 */

@Override
public synchronized void childHandlerInitialized(ThingHandler childHandler, Thing childThing) {
    handlerList.put(childThing.getUID(), childHandler);
    thingOnlineState.put(childThing.getUID(), ThingStatus.ONLINE);
    this.addPlayerChannel(childThing);

    logger.info("Inizialize child handler for: {}.", childThing.getUID().getId());

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PropertyNotWritableException类代码示例发布时间:2022-05-21
下一篇:
Java ConnectResponse类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap