Example #1
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);
            }
          }
        }
      }
    }
  }
Example #2
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);
          }
        }
      }
    }
  }
Example #3
0
 /* (non-Javadoc)
  * @see org.openhab.core.binding.AbstractBinding#bindingChanged(org.openhab.core.binding.BindingProvider, java.lang.String)
  */
 @Override
 public void bindingChanged(BindingProvider provider, String itemName) {
   logger.trace("bindingChanged() for item {} msg received.", itemName);
   if (mKNXConnectionEstablished) {
     if (provider instanceof KNXBindingProvider) {
       KNXBindingProvider knxProvider = (KNXBindingProvider) provider;
       for (Datapoint datapoint : knxProvider.getReadableDatapoints()) {
         if (datapoint.getName().equals(itemName)) {
           logger.debug("Initializing read of item {}.", itemName);
           if (!mKNXBusReaderScheduler.scheduleRead(
               datapoint, knxProvider.getAutoRefreshTime(datapoint))) {
             logger.warn(
                 "Couldn't add to KNX bus reader scheduler (bindingChanged, datapoint='{}')",
                 datapoint);
           }
           break;
         }
       }
     }
   }
 }