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


Java Thing.getHandler方法代码示例

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


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

示例1: updatePlayer

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
 * Update Listeners and child Squeeze Player Things
 *
 * @param event
 */
private void updatePlayer(PlayerUpdateEvent event) {
    // update listeners like disco services
    for (SqueezeBoxPlayerEventListener listener : squeezeBoxPlayerListeners) {
        event.updateListener(listener);
    }
    // update our children
    Bridge bridge = getThing();

    if (bridge == null) {
        return;
    }

    List<Thing> things = bridge.getThings();
    for (Thing thing : things) {
        ThingHandler handler = thing.getHandler();
        if (handler instanceof SqueezeBoxPlayerEventListener && !squeezeBoxPlayerListeners.contains(handler)) {
            event.updateListener((SqueezeBoxPlayerEventListener) handler);
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:26,代码来源:SqueezeBoxServerHandler.java

示例2: pollShades

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
private void pollShades() throws IOException {
    Shades shades = webTargets.getShades();
    updateStatus(ThingStatus.ONLINE);
    if (shades != null) {
        Map<String, Thing> things = getThingsByShadeId();
        logger.debug("Found {} shades", things.size());
        for (Shade shade : shades.shadeData) {
            Thing thing = things.get(shade.id);
            if (thing != null) {
                HDPowerViewShadeHandler handler = ((HDPowerViewShadeHandler) thing.getHandler());
                if (handler != null) {
                    logger.debug("Handling update for shade {}", shade.id);
                    handler.onReceiveUpdate(shade);
                } else {
                    logger.debug("Skipping shade with no handler {}", shade.id);
                }
            } else {
                logger.debug("Skipping non-bound shade {}", shade.id);
            }
        }
    } else {
        logger.warn("No response to shade poll");
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:25,代码来源:HDPowerViewHubHandler.java

示例3: addDeviceList

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
@Override
public void addDeviceList(DeviceModel device) {
    try {
        logger.debug("set device model: {}", device);
        ThingUID thingUID = getThingUID(device);
        Thing thing = getThingByUID(thingUID);
        if (thing != null) {
            logger.debug("update thing {} with device model: {}", thingUID, device);
            DeviceHandler handler = (DeviceHandler) thing.getHandler();
            if (handler != null) {
                handler.setState(device);
            }
            updateThingFromDevice(thing, device);
        }
    } catch (Exception e) {
        logger.error("{}", e.getLocalizedMessage(), e);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:BoxHandler.java

示例4: getZoneMinderThingHandlerFromZoneMinderId

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
*
*/
public ZoneMinderBaseThingHandler getZoneMinderThingHandlerFromZoneMinderId(ThingTypeUID thingTypeUID,
        String zoneMinderId) {

    // Inform thing handlers of connection
    List<Thing> things = getThing().getThings();

    for (Thing thing : things) {
        ZoneMinderBaseThingHandler thingHandler = (ZoneMinderBaseThingHandler) thing.getHandler();
        if ((thingHandler.getZoneMinderId().equals(zoneMinderId))
                && (thing.getThingTypeUID().equals(thingTypeUID))) {
            return thingHandler;
        }
    }
    return null;
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:ZoneMinderServerBridgeHandler.java

示例5: onConnected

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
 * Runs when connection established.
 *
 * @throws ZoneMinderUrlNotFoundException
 * @throws IOException
 * @throws GeneralSecurityException
 * @throws IllegalArgumentException
 */
public void onConnected() {
    logger.debug("BRIDGE [{}]: onConnected(): Bridge Connected!", getThingId());
    setConnected(true);
    onBridgeConnected(this, zoneMinderConnection);

    // Inform thing handlers of connection
    List<Thing> things = getThing().getThings();

    for (Thing thing : things) {
        ZoneMinderBaseThingHandler thingHandler = (ZoneMinderBaseThingHandler) thing.getHandler();

        if (thingHandler != null) {
            try {
                thingHandler.onBridgeConnected(this, zoneMinderConnection);
            } catch (IllegalArgumentException | GeneralSecurityException | IOException
                    | ZoneMinderUrlNotFoundException e) {
                logger.error("{}: onConnected() failed - Exceprion: {}", getLogIdentifier(), e.getMessage());
            }
            logger.debug("{}: onConnected(): Bridge - {}, Thing - {}, Thing Handler - {}", getLogIdentifier(),
                    thing.getBridgeUID(), thing.getUID(), thingHandler);
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:32,代码来源:ZoneMinderServerBridgeHandler.java

示例6: onDisconnected

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
 * Runs when disconnected.
 */
private void onDisconnected() {
    logger.debug("{}: onDisconnected(): Bridge Disconnected!", getLogIdentifier());
    setConnected(false);
    onBridgeDisconnected(this);

    // Inform thing handlers of disconnection
    List<Thing> things = getThing().getThings();

    for (Thing thing : things) {
        ZoneMinderBaseThingHandler thingHandler = (ZoneMinderBaseThingHandler) thing.getHandler();

        if (thingHandler != null) {
            thingHandler.onBridgeDisconnected(this);
            logger.debug("{}: onDisconnected(): Bridge - {}, Thing - {}, Thing Handler - {}", getLogIdentifier(),
                    thing.getBridgeUID(), thing.getUID(), thingHandler);
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:ZoneMinderServerBridgeHandler.java

示例7: 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

示例8: TadoHvacChange

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
public TadoHvacChange(Thing zoneThing) {
    if (!(zoneThing.getHandler() instanceof TadoZoneHandler)) {
        throw new IllegalArgumentException("TadoZoneThing expected, but instead got " + zoneThing);
    }

    this.zoneHandler = (TadoZoneHandler) zoneThing.getHandler();
    this.terminationConditionBuilder = TerminationConditionBuilder.of(zoneHandler);
    this.settingsBuilder = ZoneSettingsBuilder.of(zoneHandler);
}
 
开发者ID:dfrommi,项目名称:openhab-tado,代码行数:10,代码来源:TadoHvacChange.java

示例9: getFlicButtonHandler

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
private Optional<FlicButtonHandler> getFlicButtonHandler(Bdaddr bdaddr) {
    Thing flicButtonThing = bridgeHandler.getFlicButtonThing(bdaddr);

    if (flicButtonThing != null) {
        FlicButtonHandler thingHandler = (FlicButtonHandler) flicButtonThing.getHandler();
        return Optional.of(thingHandler);
    } else {
        return Optional.empty();
    }
}
 
开发者ID:pfink,项目名称:openhab2-flicbutton,代码行数:11,代码来源:FlicDaemonBridgeEventListener.java

示例10: restoreAllPlayerState

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
private void restoreAllPlayerState() {
	Collection<Thing> allThings = thingRegistry.getAll();
	for (Thing aThing : allThings) {
		if (aThing.getThingTypeUID().equals(
				this.getThing().getThingTypeUID())) {
			ZonePlayerHandler handler = (ZonePlayerHandler) aThing.getHandler();
			handler.restoreState();
		}
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:11,代码来源:ZonePlayerHandler.java

示例11: saveAllPlayerState

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
private void saveAllPlayerState() {
	Collection<Thing> allThings = thingRegistry.getAll();
	for (Thing aThing : allThings) {
		if (aThing.getThingTypeUID().equals(
				this.getThing().getThingTypeUID())) {
			ZonePlayerHandler handler = (ZonePlayerHandler) aThing.getHandler();
			handler.saveState();
		}
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:11,代码来源:ZonePlayerHandler.java

示例12: getHandlerByName

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
protected ZonePlayerHandler getHandlerByName(String remotePlayerName) {

		if(thingRegistry!=null) {
			Thing thing = thingRegistry.get(new ThingUID(
					ZONEPLAYER_THING_TYPE_UID, remotePlayerName));

			if (thing == null) {
				Collection<Thing> allThings = thingRegistry.getAll();
				for (Thing aThing : allThings) {
					if (aThing.getThingTypeUID().equals(
							this.getThing().getThingTypeUID())) {
						if (aThing.getConfiguration().get(UDN)
								.equals(remotePlayerName)) {
							thing = aThing;
							break;
						}
					}
				}
			}

			if(thing != null) { 
				return (ZonePlayerHandler) thing.getHandler();
			}
		}
		return null;

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

示例13: updateThing

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
 * Updates the thing for the given Homematic device.
 */
private void updateThing(HmDevice device) {
    Thing hmThing = getThingByUID(UidUtils.generateThingUID(device, getThing()));
    if (hmThing != null && hmThing.getHandler() != null) {
        HomematicThingHandler thingHandler = (HomematicThingHandler) hmThing.getHandler();
        thingHandler.thingUpdated(hmThing);
        for (Channel channel : hmThing.getChannels()) {
            thingHandler.handleRefresh(channel.getUID());
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:14,代码来源:HomematicBridgeHandler.java

示例14: onStateUpdated

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
@Override
public void onStateUpdated(HmDatapoint dp) {
    Thing hmThing = getThingByUID(UidUtils.generateThingUID(dp.getChannel().getDevice(), getThing()));
    if (hmThing != null && hmThing.getHandler() != null) {
        final ThingStatus status = hmThing.getStatus();
        if (status == ThingStatus.ONLINE || status == ThingStatus.OFFLINE) {
            HomematicThingHandler thingHandler = (HomematicThingHandler) hmThing.getHandler();
            thingHandler.updateDatapointState(dp);
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:HomematicBridgeHandler.java

示例15: getDatapointConfig

import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
@Override
public HmDatapointConfig getDatapointConfig(HmDatapoint dp) {
    Thing hmThing = getThingByUID(UidUtils.generateThingUID(dp.getChannel().getDevice(), getThing()));
    if (hmThing != null && hmThing.getHandler() != null) {
        HomematicThingHandler thingHandler = (HomematicThingHandler) hmThing.getHandler();
        return thingHandler.getChannelConfig(dp);
    }
    return new HmDatapointConfig();
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:HomematicBridgeHandler.java


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