Examples of ZWaveNoOperationCommandClass


Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveNoOperationCommandClass

        logger.error("NODE {}: Got error {}, while identifying node", this.node.getNodeId(), e.getLocalizedMessage());
      }
      break;
    case PROTOINFO:
      if (this.node.getNodeId() != this.controller.getOwnNodeId()) {
        ZWaveNoOperationCommandClass zwaveCommandClass = (ZWaveNoOperationCommandClass) this.node
            .getCommandClass(CommandClass.NO_OPERATION);
        if (zwaveCommandClass == null)
          break;

        this.node.setNodeStage(NodeStage.PING);
        this.controller.sendData(zwaveCommandClass.getNoOperationMessage());
      } else {
        logger.debug("NODE {}: Initialisation complete.", this.node.getNodeId());
        initializationComplete = true;
        this.node.setNodeStage(NodeStage.DONE); // nothing
                            // more
                            // to
                            // do
                            // for
                            // this
                            // node.
      }
      break;
    case PING:
    case WAKEUP:
      // if restored from a config file, redo from the dynamic
      // node stage.
      if (this.isRestoredFromConfigfile()) {
        this.node.setNodeStage(NodeStage.DYNAMIC);       
        advanceNodeStage(NodeStage.DONE);
        break;
      }
      this.node.setNodeStage(NodeStage.DETAILS);
      this.controller.requestNodeInfo(this.node.getNodeId());
      break;
    case DETAILS:
      // try and get the manufacturerSpecific command class.
      ZWaveManufacturerSpecificCommandClass manufacturerSpecific = (ZWaveManufacturerSpecificCommandClass) this.node
          .getCommandClass(CommandClass.MANUFACTURER_SPECIFIC);

      if (manufacturerSpecific != null) {
        // if this node implements the Manufacturer Specific command
        // class, we use it to get manufacturer info.
        this.node.setNodeStage(NodeStage.MANSPEC01);
        this.controller.sendData(manufacturerSpecific.getManufacturerSpecificMessage());
        break;
      }

      logger.warn("NODE {}: does not support MANUFACTURER_SPECIFIC, proceeding to version node stage.",
          this.node.getNodeId());
    case MANSPEC01:
      this.node.setNodeStage(NodeStage.VERSION);
      // try and get the version command class.
      ZWaveVersionCommandClass version = (ZWaveVersionCommandClass) this.node
          .getCommandClass(CommandClass.VERSION);

      boolean checkVersionCalled = false;
      for (ZWaveCommandClass zwaveCommandClass : this.node.getCommandClasses()) {
        if (version != null && zwaveCommandClass.getMaxVersion() > 1) {
          version.checkVersion(zwaveCommandClass); // check version
                                // for this
                                // command
                                // class.
          checkVersionCalled = true;
        } else
          zwaveCommandClass.setVersion(1);
      }

      if (checkVersionCalled) // wait for another call of advanceNodeStage
                  // before continuing.
        break;
    case VERSION:
      this.node.setNodeStage(NodeStage.INSTANCES_ENDPOINTS);
      // try and get the multi instance / channel command class.
      ZWaveMultiInstanceCommandClass multiInstance = (ZWaveMultiInstanceCommandClass) this.node
          .getCommandClass(CommandClass.MULTI_INSTANCE);

      if (multiInstance != null) {
        multiInstance.initEndpoints();
        break;
      }

      logger.trace("NODE {}: does not support MULTI_INSTANCE, proceeding to static node stage.",
          this.node.getNodeId());
    case INSTANCES_ENDPOINTS:
      this.node.setNodeStage(NodeStage.STATIC_VALUES);
    case STATIC_VALUES:
      if (queriesPending == -1) {
        queriesPending = 0;
        for (ZWaveCommandClass zwaveCommandClass : this.node.getCommandClasses()) {
          logger.trace("NODE {}: Inspecting command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass().getLabel());
          if (zwaveCommandClass instanceof ZWaveCommandClassInitialization) {
            logger.debug("NODE {}: Found initializable command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass()
                .getLabel());
            ZWaveCommandClassInitialization zcci = (ZWaveCommandClassInitialization) zwaveCommandClass;
            int instances = zwaveCommandClass.getInstances();
            if (instances == 0) {
              Collection<SerialMessage> initqueries = zcci.initialize();
              for (SerialMessage serialMessage : initqueries) {
                this.controller.sendData(serialMessage);
                queriesPending++;
              }
            } else {
              for (int i = 1; i <= instances; i++) {
                Collection<SerialMessage> initqueries = zcci.initialize();
                for (SerialMessage serialMessage : initqueries) {
                  this.controller
                      .sendData(this.node.encapsulate(serialMessage, zwaveCommandClass, i));
                  queriesPending++;
                }
              }
            }
          } else if (zwaveCommandClass instanceof ZWaveMultiInstanceCommandClass) {
            ZWaveMultiInstanceCommandClass multiInstanceCommandClass = (ZWaveMultiInstanceCommandClass) zwaveCommandClass;
            for (ZWaveEndpoint endpoint : multiInstanceCommandClass.getEndpoints()) {
              for (ZWaveCommandClass endpointCommandClass : endpoint.getCommandClasses()) {
                logger.trace(String.format("NODE %d: Inspecting command class %s for endpoint %d", this.node.getNodeId(), endpointCommandClass
                    .getCommandClass().getLabel(), endpoint.getEndpointId()));
                if (endpointCommandClass instanceof ZWaveCommandClassInitialization) {
                  logger.debug("NODE {}: Found initializable command class {}", this.node.getNodeId(), endpointCommandClass
                      .getCommandClass().getLabel());
                  ZWaveCommandClassInitialization zcci2 = (ZWaveCommandClassInitialization) endpointCommandClass;
                  Collection<SerialMessage> initqueries = zcci2.initialize();
                  for (SerialMessage serialMessage : initqueries) {
                    this.controller.sendData(this.node.encapsulate(serialMessage,
                        endpointCommandClass, endpoint.getEndpointId()));
                    queriesPending++;
                  }
                }
              }
            }
          }
        }
      }
      if (queriesPending-- > 0) // there is still something to be
                    // initialized.
        break;

      logger.trace("NODE {}: Done getting static values, proceeding to dynamic node stage.", this.node.getNodeId());
      queriesPending = -1;
      this.node.setNodeStage(NodeStage.DYNAMIC);
    case DYNAMIC:
      if (queriesPending == -1) {
        queriesPending = 0;
        for (ZWaveCommandClass zwaveCommandClass : this.node.getCommandClasses()) {
          logger.trace("NODE {}: Inspecting command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass().getLabel());
          if (zwaveCommandClass instanceof ZWaveCommandClassDynamicState) {
            logger.debug("NODE {}: Found dynamic state command class {}", this.node.getNodeId(), zwaveCommandClass.getCommandClass()
                .getLabel());
            ZWaveCommandClassDynamicState zdds = (ZWaveCommandClassDynamicState) zwaveCommandClass;
            int instances = zwaveCommandClass.getInstances();
            if (instances == 0) {
              Collection<SerialMessage> dynamicQueries = zdds.getDynamicValues();
              for (SerialMessage serialMessage : dynamicQueries) {
                this.controller.sendData(serialMessage);
                queriesPending++;
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveNoOperationCommandClass

        logger.debug("NODE {}: Sending periodic PING.", oldestNode.getNodeId());

        // Reset the resend count - also resets the lastUpdate timer
        oldestNode.resetResendCount();

        ZWaveNoOperationCommandClass zwaveCommandClass = (ZWaveNoOperationCommandClass) oldestNode
            .getCommandClass(CommandClass.NO_OPERATION);
        if (zwaveCommandClass != null)
          zController.sendData(zwaveCommandClass.getNoOperationMessage());
      }

      // To reduce congestion, we don't do anything else during this
      // period
      return;
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveNoOperationCommandClass

      healing.node.resetResendCount();

    case PING:
      if (healing.nodeId != zController.getOwnNodeId()) {
        healing.state = HealState.PING;
        ZWaveNoOperationCommandClass zwaveCommandClass = (ZWaveNoOperationCommandClass) healing.node
            .getCommandClass(CommandClass.NO_OPERATION);
        if (zwaveCommandClass != null) {
          zController.sendData(zwaveCommandClass.getNoOperationMessage());
          healing.stateNext = HealState.SETSUCROUTE;
          break;
        }
      }
      healing.state = HealState.SETSUCROUTE;
    case SETSUCROUTE:
      // Only set the route if this is not the controller and there is an SUC in the network
      if (healing.nodeId != zController.getOwnNodeId() && zController.getSucId() != 0) {
        // Update the route to the controller
        logger.debug("NODE {}: Heal is setting SUC route.", healing.nodeId);
        healing.event = ZWaveNetworkEvent.Type.AssignSucReturnRoute;
        healing.stateNext = HealState.UPDATENEIGHBORS;
        zController.requestAssignSucReturnRoute(healing.nodeId);
        break;
      }
      healing.state = HealState.UPDATENEIGHBORS;
    case UPDATENEIGHBORS:
      logger.debug("NODE {}: Heal is updating node neighbors.", healing.nodeId);
      healing.event = ZWaveNetworkEvent.Type.NodeNeighborUpdate;
      healing.stateNext = HealState.GETASSOCIATIONS;
      zController.requestNodeNeighborUpdate(healing.nodeId);
      break;
    case GETASSOCIATIONS:
      // Check if this node supports associations
      ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) healing.node
          .getCommandClass(CommandClass.ASSOCIATION);
      if (associationCommandClass != null) {
        logger.debug("NODE {}: Heal is requesting device associations.", healing.nodeId);
        healing.stateNext = HealState.UPDATEROUTES;
        healing.event = ZWaveNetworkEvent.Type.AssociationUpdate;
        associationCommandClass.getAllAssociations();
        break;
      }
    case UPDATEROUTES:
      // Get the list of routes for this node
      healing.routeList = healing.node.getRoutingList();
      if (healing.routeList != null && healing.routeList.size() != 0) {
        // Delete all the return routes for the node
        logger.debug("NODE {}: Heal is deleting routes.", healing.nodeId);
        healing.event = ZWaveNetworkEvent.Type.DeleteReturnRoute;
        healing.stateNext = HealState.UPDATEROUTESNEXT;
        zController.requestDeleteAllReturnRoutes(healing.nodeId);
        break;
      }
    case UPDATEROUTESNEXT:
      if (healing.routeList != null && healing.routeList.size() != 0) {
        // Loop through all the nodes and set the return route
        logger.debug("NODE {}: Adding return route to {}", healing.nodeId, healing.routeList.get(0));
        healing.stateNext = HealState.GETNEIGHBORS;
        healing.event = ZWaveNetworkEvent.Type.AssignReturnRoute;
        zController.requestAssignReturnRoute(healing.nodeId, healing.routeList.get(0));
        break;
      }
    case GETNEIGHBORS:
      healing.event = ZWaveNetworkEvent.Type.NodeRoutingInfo;
      healing.stateNext = HealState.PINGEND;

      logger.debug("NODE {}: Heal is requesting node neighbor info.", healing.nodeId);
      zController.requestNodeRoutingInfo(healing.nodeId);
      break;
    case PINGEND:
      if (healing.nodeId != zController.getOwnNodeId()) {
        ZWaveNoOperationCommandClass zwaveCommandClass = (ZWaveNoOperationCommandClass) healing.node
            .getCommandClass(CommandClass.NO_OPERATION);
        if (zwaveCommandClass == null)
          break;
        zController.sendData(zwaveCommandClass.getNoOperationMessage());
        healing.stateNext = HealState.SAVE;
        break;
      }
    case SAVE:
      logger.debug("NODE {}: Heal is complete - saving XML.", healing.nodeId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.