Package org.openhab.binding.insteonplm.internal.device

Examples of org.openhab.binding.insteonplm.internal.device.InsteonDevice


      // Item has been removed. This condition is also found when *any*
      // change to the items file is made: the items are first removed (c == null),
      // and then added anew.
      removeFeatureListener(itemName);
    } else {
      InsteonDevice dev = getDevice(c.getAddress());
      if (dev == null) {
        dev = makeNewDevice(c);
      }
      addFeatureListener(dev, itemName, c);
    }
View Full Code Here


   * Send command to insteon device
   * @param c item binding configuration
   * @param command The command to be sent
   */
  private void sendCommand(InsteonPLMBindingConfig c, Command command) {
    InsteonDevice dev = getDevice(c.getAddress());
    if (dev == null) {
      logger.warn("no device found with insteon address {}", c.getAddress());
      return;
    }
    dev.processCommand(m_driver, c, command);
  }
View Full Code Here

   */
  private void removeFeatureListener(String aItem) {
    synchronized (m_devices) {
      for (Iterator<Entry<InsteonAddress, InsteonDevice>> it = m_devices.entrySet().iterator();
          it.hasNext(); ) {
        InsteonDevice dev = it.next().getValue();
        boolean removedListener = dev.removeFeatureListener(aItem);
        if (removedListener) {
          logger.trace("removed feature listener {} from dev {}", aItem, dev);
        }
        if (!dev.hasAnyListeners()) {
          Poller.s_instance().stopPolling(dev);
          it.remove();
          logger.trace("removing unreferenced {}", dev);
          if (m_devices.isEmpty()) {
            logger.debug("all devices removed!", dev);
View Full Code Here

    if (dt == null) {
      logger.error("unknown product key: {} for config: {}." +
          " Add definition to xml file and try again", prodKey, aConfig);
      return null;
    }
    InsteonDevice dev =  InsteonDevice.s_makeDevice(dt);
    dev.setAddress(aConfig.getAddress());
    dev.setDriver(m_driver);
    dev.addPort(m_driver.getDefaultPort());
    if (!dev.hasValidPollingInterval()) {
      dev.setPollInterval(m_devicePollInterval);
    }
    if (m_driver.isModemDBComplete() && dev.getStatus() != DeviceStatus.POLLING) {
      int ndev = checkIfInModemDatabase(dev);
      if (dev.hasModemDBEntry()) {
        dev.setStatus(DeviceStatus.POLLING);
        Poller.s_instance().startPolling(dev, ndev);
      }
    }
    synchronized (m_devices) {
      m_devices.put(aConfig.getAddress(), dev);
View Full Code Here

      if (fromAddr == null) {
        logger.debug("invalid fromAddress, ignoring msg {}", msg);
        return;
      }
      synchronized (m_devices) {
        InsteonDevice  dev = getDevice(fromAddr);
        if (dev == null) {
          logger.debug("dropping message from unknown device with address {}", fromAddr);
        } else {
          dev.handleMessage(fromPort, msg);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.openhab.binding.insteonplm.internal.device.InsteonDevice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.