本文整理汇总了Java中org.eclipse.smarthome.core.thing.Thing.getChannels方法的典型用法代码示例。如果您正苦于以下问题:Java Thing.getChannels方法的具体用法?Java Thing.getChannels怎么用?Java Thing.getChannels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.smarthome.core.thing.Thing
的用法示例。
在下文中一共展示了Thing.getChannels方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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) {
}
}
}
示例2: 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());
}
}
}
示例3: thingUpdated
import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
@Override
public void thingUpdated(Thing thing) {
logger.trace("About to update thing.");
boolean isChannelConfigChanged = false;
List<Channel> channels = thing.getChannels();
for (Channel channel : channels) {
ChannelUID channelUID = channel.getUID();
Configuration newChannelConfig = channel.getConfiguration();
Channel oldChannel = this.thing.getChannel(channelUID.getId());
if (oldChannel == null) {
logger.warn("Channel with UID : {} can not be updated, as it can not be found !",
channelUID.getAsString());
continue;
}
Configuration currentChannelConfig = oldChannel.getConfiguration();
if (isConfigurationKeyChanged(currentChannelConfig, newChannelConfig, PRIOIRITY_PARAM)) {
isChannelConfigChanged = true;
handleChannelConfigurationChange(oldChannel, newChannelConfig, PRIOIRITY_PARAM);
String newPriority = (String) newChannelConfig.get(PRIOIRITY_PARAM);
changeChannelPriority(channelUID, newPriority);
}
if (isConfigurationKeyChanged(currentChannelConfig, newChannelConfig, PID_PARAM)) {
isChannelConfigChanged = true;
handleChannelConfigurationChange(oldChannel, newChannelConfig, PID_PARAM);
}
}
if (!(isInitialized() && isChannelConfigChanged)) {
super.thingUpdated(thing);
}
}
示例4: refreshThing
import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
* Method to Refresh Thing Handler.
*/
public final synchronized void refreshThing(IZoneMinderSession session, DataRefreshPriorityEnum refreshPriority) {
if ((refreshPriority != getRefreshPriority()) && (!isConnected())) {
return;
}
if (refreshPriority == DataRefreshPriorityEnum.HIGH_PRIORITY) {
logger.debug("{}: Performing HIGH PRIORITY refresh", getLogIdentifier());
} else {
logger.debug("{}: Performing refresh", getLogIdentifier());
}
if (getZoneMinderBridgeHandler() != null) {
if (isConnected()) {
logger.debug("{}: refreshThing(): Bridge '{}' Found for Thing '{}'!", getLogIdentifier(),
getThing().getUID(), this.getThing().getUID());
onFetchData();
}
}
Thing thing = getThing();
List<Channel> channels = thing.getChannels();
logger.debug("{}: refreshThing(): Refreshing Thing - {}", getLogIdentifier(), thing.getUID());
for (Channel channel : channels) {
updateChannel(channel.getUID());
}
this.setThingRefreshed(true);
logger.debug("[{}: refreshThing(): Thing Refreshed - {}", getLogIdentifier(), thing.getUID());
}
示例5: initializeThingHandler
import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
* Method to Initialize Thing Handler.
*/
public void initializeThingHandler() {
if (getDSCAlarmBridgeHandler() != null) {
if (getThing().getStatus().equals(ThingStatus.ONLINE)) {
Thing thing = getThing();
List<Channel> channels = thing.getChannels();
logger.debug("initializeThingHandler(): Initialize Thing Handler - {}", thing.getUID());
for (Channel channel : channels) {
if (channel.getAcceptedItemType().equals("DateTime")) {
updateChannel(channel.getUID(), 0, "0000010100");
} else {
updateChannel(channel.getUID(), 0, "");
}
}
if (dscAlarmThingType.equals(DSCAlarmThingType.PANEL)) {
dscAlarmBridgeHandler.setUserCode(getUserCode());
}
this.setThingHandlerInitialized(true);
logger.debug("initializeThingHandler(): Thing Handler Initialized - {}", thing.getUID());
} else {
logger.debug("initializeThingHandler(): Thing '{}' Unable To Initialize Thing Handler!: Status - {}",
thing.getUID(), thing.getStatus());
}
}
}