Package org.openhab.binding.zwave.internal.protocol

Examples of org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint


   
    ZWaveCommandClass zwaveCommandClass = null;
   
    // first get command class from endpoint, if supported
    if (this.getVersion() >= 2) {
      ZWaveEndpoint endpoint = this.endpoints.get(instance);
      if (endpoint != null) {
        zwaveCommandClass = endpoint.getCommandClass(commandClass);
        if (zwaveCommandClass == null) {
          logger.warn(String.format("NODE %d: CommandClass %s (0x%02x) not implemented by endpoint %d, fallback to main node.", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode, instance));
        }
      }
    }
View Full Code Here


    // TODO: handle dynamically added endpoints. Have never seen such a device.
    if (changingNumberOfEndpoints)
      logger.warn("NODE {}: Changing number of endpoints, expect some weird behavior during multi channel handling.", this.getNode().getNodeId());
   
    for (int i=1; i <= endpoints; i++) {
      ZWaveEndpoint endpoint = new ZWaveEndpoint(i);
      this.endpoints.put(i, endpoint);
      if (!endpointsAreTheSameDeviceClass || i == 1)
        this.getController().sendData(this.getMultiChannelCapabilityGetMessage(endpoint));
    }
  }
View Full Code Here

    int endId = this.endpointsAreTheSameDeviceClass ? this.endpoints.size() : receivedEndpointId;
   
    boolean supportsBasicCommandClass = this.getNode().supportsCommandClass(CommandClass.BASIC);
   
    for (int endpointId = startId; endpointId <= endId; endpointId++) {
      ZWaveEndpoint endpoint = this.endpoints.get(endpointId);
     
      if (endpoint == null){
        logger.error("Endpoint {} not found on node {}. Cannot set command classes.", endpointId, this.getNode().getNodeId());
        continue;
      }
 
      Basic basic = this.getNode().getDeviceClass().getBasicDeviceClass();
      Generic generic = Generic.getGeneric(genericDeviceClass);
      if (generic == null) {
        logger.error(String.format("NODE %d: Endpoint %d has invalid device class. generic = 0x%02x, specific = 0x%02x.",
            this.getNode().getNodeId(), endpoint, genericDeviceClass, specificDeviceClass));
        continue;
      }
      Specific specific = Specific.getSpecific(generic, specificDeviceClass);
      if (specific == null) {
        logger.error(String.format("NODE %d: Endpoint %d has invalid device class. generic = 0x%02x, specific = 0x%02x.",
            this.getNode().getNodeId(), endpoint, genericDeviceClass, specificDeviceClass));
        continue;
      }
     
      logger.debug("NODE {}: Endpoint Id = {}", this.getNode().getNodeId(), endpointId);
      logger.debug("NODE {}: Endpoints is dynamic = {}", this.getNode().getNodeId(), dynamic ? "true" : false);
      logger.debug(String.format("NODE %d: Basic = %s 0x%02x", this.getNode().getNodeId(), basic.getLabel(), basic.getKey()));
      logger.debug(String.format("NODE %d: Generic = %s 0x%02x", this.getNode().getNodeId(), generic.getLabel(), generic.getKey()));
      logger.debug(String.format("NODE %d: Specific = %s 0x%02x", this.getNode().getNodeId(), specific.getLabel(), specific.getKey()));
     
      ZWaveDeviceClass deviceClass = endpoint.getDeviceClass();
      deviceClass.setBasicDeviceClass(basic);
      deviceClass.setGenericDeviceClass(generic);
      deviceClass.setSpecificDeviceClass(specific);
     
      // add basic command class, if it's also supported by the parent node.
      if (supportsBasicCommandClass) {
        ZWaveCommandClass commandClass = new ZWaveBasicCommandClass(this.getNode(), this.getController(), endpoint);
        endpoint.addCommandClass(commandClass);
      }
     
      for (int i = 0; i < serialMessage.getMessagePayload().length - offset - 3; i++) {
        int data = serialMessage.getMessagePayloadByte(offset + 3 + i);
        if(data == 0xef )  {
          // TODO: Implement control command classes
          break;
        }
        logger.debug(String.format("NODE %d: Adding command class 0x%02X to the list of supported command classes.", this.getNode().getNodeId(), data));
        ZWaveCommandClass commandClass = ZWaveCommandClass.getInstance(data, this.getNode(), this.getController(), endpoint);
       
        if (commandClass == null)
          continue;
       
        endpoint.addCommandClass(commandClass);
       
        ZWaveCommandClass parentClass = this.getNode().getCommandClass(commandClass.getCommandClass());
       
        // copy version info to endpoint classes.
        if (parentClass != null)
View Full Code Here

      logger.error(String.format("NODE %d: Unsupported command class 0x%02x", this.getNode().getNodeId(), commandClassCode));
      return;
    }
   
    logger.debug(String.format("NODE %d: Requested Command Class = %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode));
    ZWaveEndpoint endpoint = this.endpoints.get(endpointId);
   
    if (endpoint == null){
      logger.error("NODE {}: Endpoint {} not found. Cannot set command classes.", this.getNode().getNodeId(), endpointId);
      return;
    }
   
    zwaveCommandClass = endpoint.getCommandClass(commandClass);
   
    if (zwaveCommandClass == null) {
      logger.warn(String.format("NODE %d: CommandClass %s (0x%02x) not implemented by endpoint %d, fallback to main node.", this.getNode().getNodeId(), commandClass.getLabel(), commandClassCode, endpointId));
      zwaveCommandClass = this.getNode().getCommandClass(commandClass);
    }
View Full Code Here

TOP

Related Classes of org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint

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.