本文整理汇总了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);
}
}
}
示例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");
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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) {
}
}
}
示例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);
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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;
}
示例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());
}
}
}
示例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);
}
}
}
示例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();
}