docs: public SerialMessage encapsulate(SerialMessage serialMessage, 
  			ZWaveCommandClass commandClass, int endpointId) {
  		ZWaveMultiInstanceCommandClass multiInstanceCommandClass;
  		
  		if (serialMessage == null)
  			return null;
  		
  		// no encapsulation necessary.
  		if (endpointId == 1 && commandClass.getInstances() == 1 && commandClass.getEndpoint() == null)
  			return serialMessage;
  		
  		multiInstanceCommandClass = (ZWaveMultiInstanceCommandClass)this.getCommandClass(ZWaveCommandClass.CommandClass.MULTI_INSTANCE);
  		
  		if (multiInstanceCommandClass != null) {
  			logger.debug("Encapsulating message for node {}, instance / endpoint {}", this.getNodeId(), endpointId);
  			switch (multiInstanceCommandClass.getVersion()) {
  				case 2:
  					if (commandClass.getEndpoint() != null) {
  						serialMessage = multiInstanceCommandClass.getMultiChannelEncapMessage(serialMessage, commandClass.getEndpoint());
  						return serialMessage;
  					}
  					break;
  				case 1:
  				default:
  					if (commandClass.getInstances() >= endpointId) {
  						serialMessage = multiInstanceCommandClass.getMultiInstanceEncapMessage(serialMessage, endpointId);
  						return serialMessage;
  					}
  					break;
  			}
  		}
  
  		if (endpointId != 1) {
  			logger.warn("Encapsulating message for node {}, instance / endpoint {} failed, will discard message.", this.getNodeId(), endpointId);
  			return null;
  		}
  		
  		return serialMessage;
  	}