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


Java Thing.getChannels方法代码示例

本文整理汇总了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) {
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:GardenaAccountHandler.java

示例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());
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:14,代码来源:HomematicBridgeHandler.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:38,代码来源:SysteminfoHandler.java

示例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());

}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:38,代码来源:ZoneMinderBaseThingHandler.java

示例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());
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:35,代码来源:DSCAlarmBaseThingHandler.java


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