예제 #1
0
  /* (non-Javadoc)
   * @see org.openhab.binding.knx.internal.connection.KNXConnectionListener#connectionEstablished()
   */
  @Override
  public void connectionEstablished() {
    logger.trace("connectionEstablished() msg received. Initializing readable DPs.");
    mKNXConnectionEstablished = true;
    for (KNXBindingProvider knxProvider : providers) {
      for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
        mKNXBusReaderScheduler.readOnce(datapoint);

        int autoRefreshTimeInSecs = knxProvider.getAutoRefreshTime(datapoint);
        if (autoRefreshTimeInSecs > 0) {
          if (!mKNXBusReaderScheduler.scheduleRead(datapoint, autoRefreshTimeInSecs)) {
            logger.warn(
                "Couldn't add to KNX bus reader scheduler (connectionEstablished, datapoint='{}')",
                datapoint);
          }
        }
      }
    }
  }
예제 #2
0
  /* (non-Javadoc)
   * @see org.openhab.core.binding.AbstractBinding#allBindingsChanged(org.openhab.core.binding.BindingProvider)
   */
  @Override
  public void allBindingsChanged(BindingProvider provider) {
    logger.trace("allBindingsChanged() msg received.");
    if (mKNXConnectionEstablished) {
      logger.debug("Initializing readable DPs.");
      if (provider instanceof KNXBindingProvider) {
        KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
        mKNXBusReaderScheduler.clear();
        for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
          mKNXBusReaderScheduler.readOnce(datapoint);

          int autoRefreshTimeInSecs = knxProvider.getAutoRefreshTime(datapoint);
          if (autoRefreshTimeInSecs > 0) {
            if (!mKNXBusReaderScheduler.scheduleRead(
                datapoint, knxProvider.getAutoRefreshTime(datapoint))) {
              logger.warn(
                  "Couldn't add to KNX bus reader scheduler (allBindingsChanged, datapoint='{}')",
                  datapoint);
            }
          }
        }
      }
    }
  }