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


Java DiscoveryService类代码示例

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


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


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