TinkerforgeBinding.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:openhab-hdl 作者:
/**
 * Adds a listener {@link EContentAdapter} to the {@link Ecosystem}. The listener handles updated
 * sensor values and posts them to the openhab eventbus by
 * {@link #processTFDeviceValues(Notification) processTFDeviceValues}. Furthermore the addition
 * and removal of devices is handled by {@link #initializeTFDevices(Notification)
 * initializeTFDevices}.
 * 
 * @param tinkerforgeEcosystem The EMF Ecosystem object.
 */
private void listen2Model(Ecosystem tinkerforgeEcosystem) {
  EContentAdapter modelAdapter = new EContentAdapter() {
    @Override
    public void notifyChanged(Notification notification) {
      super.notifyChanged(notification);
      logger.debug("TinkerforgeNotifier was notified");
      if (notification.getEventType() == Notification.ADD
          || notification.getEventType() == Notification.ADD_MANY
          || notification.getEventType() == Notification.REMOVE
          || notification.getEventType() == Notification.REMOVE_MANY) {
        initializeTFDevices(notification);
      } else {
        processTFDeviceValues(notification);
      }
    }

  };
  tinkerforgeEcosystem.eAdapters().add(modelAdapter);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号