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

Java DiscoveryService类代码示例

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

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



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

示例1: createHandler

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的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.config.discovery.DiscoveryService; //导入依赖的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


示例3: initialize

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void initialize() {
    this.config = getThing().getConfiguration().as(IPBridgeConfig.class);

    if (validConfiguration(this.config)) {
        LutronDeviceDiscoveryService discovery = new LutronDeviceDiscoveryService(this);

        this.discoveryServiceRegistration = this.bundleContext.registerService(DiscoveryService.class, discovery,
                null);

        this.scheduler.schedule(new Runnable() {
            @Override
            public void run() {
                connect();
            }
        }, 0, TimeUnit.SECONDS);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:IPBridgeHandler.java


示例4: thingDiscovered

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * If a thing is discovered, the method checks if the thing is already known
 * and the state is only temporary set to OFFLINE. If so initialize() of the
 * thing is called.
 */

@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
    if (handlerList.containsKey(result.getThingUID())) {
        if (thingOnlineState.containsKey(result.getThingUID())) {
            if (thingOnlineState.get(result.getThingUID()).equals(ThingStatus.OFFLINE)) {
                handlerList.get(result.getThingUID()).initialize();
            }
        }

    }

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


示例5: createHandler

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

    logger.debug("Creating coordinator handler for {}", thing);

    ZigBeeCoordinatorHandler coordinator = null;

    // Handle coordinators here
    if (thingTypeUID.equals(ZigBeeBindingConstants.COORDINATOR_TYPE_CC2531)) {
        coordinator = new ZigBeeCoordinatorCC2531Handler((Bridge) thing, translationProvider);
    }
    // if (thingTypeUID.equals(ZigBeeBindingConstants.COORDINATOR_TYPE_CONBEE)) {
    // coordinator = new ZigBeeCoordinatorConBeeHandler((Bridge) thing, translationProvider);
    // }
    if (thingTypeUID.equals(ZigBeeBindingConstants.COORDINATOR_TYPE_EMBER)) {
        coordinator = new ZigBeeCoordinatorEmberHandler((Bridge) thing, translationProvider);
    }
    if (thingTypeUID.equals(ZigBeeBindingConstants.COORDINATOR_TYPE_TELEGESIS)) {
        coordinator = new ZigBeeCoordinatorTelegesisHandler((Bridge) thing, translationProvider);
    }

    if (coordinator != null) {
        ZigBeeDiscoveryService discoveryService = new ZigBeeDiscoveryService(coordinator);
        discoveryService.activate();

        discoveryServiceRegs.put(coordinator.getThing().getUID(), bundleContext.registerService(
                DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));

        return coordinator;
    }

    // Everything else gets handled in a single handler
    ZigBeeThingHandler handler = new ZigBeeThingHandler(thing, translationProvider);

    bundleContext.registerService(ConfigDescriptionProvider.class.getName(), handler,
            new Hashtable<String, Object>());

    return handler;
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:41,代码来源:ZigBeeHandlerFactory.java


示例6: start

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void start(BundleContext bundleContext) {
    if (reg != null) {
        return;
    }
    reg = bundleContext.registerService(DiscoveryService.class.getName(), this, new Hashtable<String, Object>());
}
 
开发者ID:pfink,项目名称:openhab2-flicbutton,代码行数:8,代码来源:FlicButtonPassiveDiscoveryService.java


示例7: thingDiscovered

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
	if(result.getThingUID().equals(this.getThing().getUID())) {
		if (getThing().getConfiguration().get(UDN)
				.equals(result.getProperties().get(UDN))) {
			logger.debug("Discovered UDN '{}' for thing '{}'", result
					.getProperties().get(UDN), getThing().getUID());
			getThing().setStatus(ThingStatus.ONLINE);
			onSubscription();
			onUpdate();
		}
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:14,代码来源:ZonePlayerHandler.java


示例8: thingRemoved

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
	if(thingUID.equals(this.getThing().getUID())) {
		logger.debug("Setting status for thing '{}' to OFFLINE", getThing()
				.getUID());
		getThing().setStatus(ThingStatus.OFFLINE);
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:9,代码来源:ZonePlayerHandler.java


示例9: registerDeviceDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
private void registerDeviceDiscoveryService(TelldusBridgeHandler tellstickBridgeHandler) {
    if (discoveryService == null) {
        discoveryService = new TellstickDiscoveryService(tellstickBridgeHandler);
        discoveryService.activate();
        bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
                new Hashtable<String, Object>());
    } else {
        discoveryService.addBridgeHandler(tellstickBridgeHandler);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:11,代码来源:TellstickHandlerFactory.java


示例10: registerSqueezeBoxPlayerDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Adds SqueezeBoxServerHandlers to the discovery service to find SqueezeBox
 * Players
 *
 * @param squeezeBoxServerHandler
 */
private synchronized void registerSqueezeBoxPlayerDiscoveryService(
        SqueezeBoxServerHandler squeezeBoxServerHandler) {
    logger.trace("registering player discovery service");

    SqueezeBoxPlayerDiscoveryParticipant discoveryService = new SqueezeBoxPlayerDiscoveryParticipant(
            squeezeBoxServerHandler);

    // Register the PlayerListener with the SqueezeBoxServerHandler
    squeezeBoxServerHandler.registerSqueezeBoxPlayerListener(discoveryService);

    // Register the service, then add the service to the ServiceRegistration map
    discoveryServiceRegs.put(squeezeBoxServerHandler.getThing().getUID(), bundleContext
            .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:SqueezeBoxHandlerFactory.java


示例11: createHandler

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Creates a handler for the specific thing. THis also creates the discovery service
 * when the bridge is created.
 */
@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (THING_TYPE_THERMOSTAT.equals(thingTypeUID)) {
        return new NestThermostatHandler(thing);
    }

    if (THING_TYPE_CAMERA.equals(thingTypeUID)) {
        return new NestCameraHandler(thing);
    }

    if (THING_TYPE_STRUCTURE.equals(thingTypeUID)) {
        return new NestStructureHandler(thing);
    }

    if (THING_TYPE_SMOKE_DETECTOR.equals(thingTypeUID)) {
        return new NestSmokeDetectorHandler(thing);
    }

    if (THING_TYPE_BRIDGE.equals(thingTypeUID)) {
        NestBridgeHandler handler = new NestBridgeHandler((Bridge) thing);
        NestDiscoveryService service = new NestDiscoveryService(handler);
        service.activate();
        // Register the discovery service.
        discoveryService.put(handler.getThing().getUID(),
                bundleContext.registerService(DiscoveryService.class.getName(), service, new Hashtable<>()));
        return handler;
    }

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


示例12: registerDeviceDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Registers the DeviceDiscoveryService.
 */
private void registerDeviceDiscoveryService() {
    if (bundleContext != null) {
        logger.trace("Registering HomematicDeviceDiscoveryService for bridge '{}'", getThing().getUID().getId());
        discoveryService = new HomematicDeviceDiscoveryService(this);
        discoveryServiceRegistration = bundleContext.registerService(DiscoveryService.class.getName(),
                discoveryService, new Hashtable<String, Object>());
        discoveryService.activate();
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:13,代码来源:HomematicBridgeHandler.java


示例13: registerThingDiscovery

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Registers a {@link RioSystemDeviceDiscoveryService} from the passed {@link RioSystemHandler} and activates it.
 *
 * @param bridgeHandler the {@link RioSystemHandler} for discovery services
 */
private synchronized void registerThingDiscovery(RioSystemHandler bridgeHandler) {
    RioSystemDeviceDiscoveryService discoveryService = new RioSystemDeviceDiscoveryService(bridgeHandler);
    logger.trace("Try to register Discovery service on BundleID: {} Service: {}",
            bundleContext.getBundle().getBundleId(), DiscoveryService.class.getName());

    final Hashtable<String, String> prop = new Hashtable<String, String>();

    bundleContext.registerService(DiscoveryService.class.getName(), discoveryService, prop);
    discoveryService.activate();
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:16,代码来源:RussoundHandlerFactory.java


示例14: registerDeviceDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
private void registerDeviceDiscoveryService(MaxCubeBridgeHandler maxCubeBridgeHandler) {
    MaxDeviceDiscoveryService discoveryService = new MaxDeviceDiscoveryService(maxCubeBridgeHandler);
    discoveryService.activate();

    this.discoveryServiceRegs.put(maxCubeBridgeHandler.getThing().getUID(), bundleContext
            .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:8,代码来源:MaxCubeHandlerFactory.java


示例15: scanForDevices

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
private void scanForDevices() {
    try {
        DiscoveryService service = this.bundleContext.getService(this.discoveryServiceRegistration.getReference());

        if (service != null) {
            service.startScan(null);
        }
    } catch (Exception e) {
        logger.error("Error scanning for paired devices", e);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:IPBridgeHandler.java


示例16: registerDSCAlarmDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Register the Thing Discovery Service for a bridge.
 *
 * @param dscAlarmBridgeHandler
 */
private void registerDSCAlarmDiscoveryService(DSCAlarmBaseBridgeHandler dscAlarmBridgeHandler) {
    DSCAlarmDiscoveryService discoveryService = new DSCAlarmDiscoveryService(dscAlarmBridgeHandler);
    discoveryService.activate();

    ServiceRegistration<?> discoveryServiceRegistration = bundleContext
            .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>());
    discoveryServiceRegistrations.put(dscAlarmBridgeHandler.getThing().getUID(), discoveryServiceRegistration);

    logger.debug("registerDSCAlarmDiscoveryService(): Bridge Handler - {}, Class Name - {}, Discovery Service - {}",
            dscAlarmBridgeHandler, DiscoveryService.class.getName(), discoveryService);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:17,代码来源:DSCAlarmHandlerFactory.java


示例17: registerBedDiscoveryService

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
/**
 * Register the given cloud handler to participate in discovery of new beds.
 *
 * @param cloudHandler the cloud handler to register (must not be <code>null</code>)
 */
private synchronized void registerBedDiscoveryService(final SleepIQCloudHandler cloudHandler) {
    logger.debug("Registering bed discovery service");
    SleepIQBedDiscoveryService discoveryService = new SleepIQBedDiscoveryService(cloudHandler);
    discoveryServiceReg.put(cloudHandler.getThing().getUID(), bundleContext
            .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>()));
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:SleepIQHandlerFactory.java


示例18: registerThingDiscovery

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
private synchronized void registerThingDiscovery(VitotronicBridgeHandler bridgeHandler) {
    VitotronicDiscoveryService discoveryService = new VitotronicDiscoveryService(bridgeHandler);
    logger.trace("Try to register Discovery service on BundleID: {} Service: {}",
            bundleContext.getBundle().getBundleId(), DiscoveryService.class.getName());

    Hashtable<String, String> prop = new Hashtable<String, String>();

    bundleContext.registerService(DiscoveryService.class.getName(), discoveryService, prop);
    discoveryService.activate();
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:11,代码来源:VitotronicHandlerFactory.java


示例19: thingDiscovered

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
    logger.debug("thingDiscovered: {}", result);

    if (configuration.hostName.equals(result.getProperties().get(HOST_NAME))) {
        /*
         * SamsungTV discovery services creates thing UID from UPnP UDN.
         * When thing is generated manually, thing UID may not match UPnP UDN, so store it for later use (e.g.
         * thingRemoved).
         */
        upnpThingUID = result.getThingUID();
        logger.debug("thingDiscovered, thingUID={}, discoveredUID={}", this.getThing().getUID(), upnpThingUID);
        upnpPollingJob = scheduler.schedule(this::checkAndCreateServices, 0, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:16,代码来源:SamsungTvHandler.java


示例20: thingRemoved

import org.eclipse.smarthome.config.discovery.DiscoveryService; //导入依赖的package包/类
@Override
public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
    logger.debug("thingRemoved: {}", thingUID);

    if (thingUID.equals(upnpThingUID)) {
        shutdown();
        putOffline();
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:SamsungTvHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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