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

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


  private int manufactureId = 0;
  private int deviceType = 0;
  private int deviceId = 0;

  public SerialMessage doRequest() {
    return new SerialMessage(SerialMessageClass.SerialApiGetCapabilities, SerialMessageType.Request, SerialMessageClass.SerialApiGetCapabilities, SerialMessagePriority.High);
  }
View Full Code Here


  public SerialMessage doRequest(int nodeId, SUCType type) {
    logger.debug("NODE {}: SetSucNodeID node as {}", nodeId, type.toString());

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessageClass.SetSucNodeID, SerialMessageType.Request,
        SerialMessageClass.SetSucNodeID, SerialMessagePriority.High);
    byte[] newPayload = new byte[5];
    newPayload[0] = (byte)nodeId;
    switch(type) {
      case NONE:
        newPayload[1] = 0;
        newPayload[3] = 0;
        break;
      case BASIC:
        newPayload[1] = 1;
        newPayload[3] = 0;
        break;
      case SERVER:
        newPayload[1] = 1;
        newPayload[3] = 1;
        break;
    }

    newPayload[2] = 0;        // Low power option = false
    newPayload[4] = 1;        // Callback!!!
    newMessage.setMessagePayload(newPayload);
      return newMessage;
  }
View Full Code Here

   * Gets a SerialMessage with the SWITCH_BINARY_GET command
   * @return the serial message
   */
  public SerialMessage getValueMessage() {
    logger.debug("Creating new message for application command SWITCH_BINARY_GET for node {}", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  2,
                (byte) getCommandClass().getKey(),
                (byte) SWITCH_BINARY_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * @param the level to set. 0 is mapped to off, > 0 is mapped to on.
   * @return the serial message
   */
  public SerialMessage setValueMessage(int level) {
    logger.debug("Creating new message for application command SWITCH_BINARY_SET for node {}", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  3,
                (byte) getCommandClass().getKey(),
                (byte) SWITCH_BINARY_SET,
                (byte) (level > 0 ? 0xFF : 0x00)
                };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * @param the command class to return the number of instances for.
   * @return the serial message.
   */
  public SerialMessage getMultiInstanceGetMessage(CommandClass commandClass) {
    logger.debug("NODE {}: Creating new message for application command MULTI_INSTANCE_GET command class {}", this.getNode().getNodeId(), commandClass.getLabel());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  3,
                (byte) getCommandClass().getKey(),
                (byte) MULTI_INSTANCE_GET,
                (byte) commandClass.getKey()
                };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * Returns the endpoints for this node.
   * @return the serial message.
   */
  public SerialMessage getMultiChannelEndpointGetMessage() {
    logger.debug("NODE {}: Creating new message for application command MULTI_CHANNEL_ENDPOINT_GET", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  2,
                (byte) getCommandClass().getKey(),
                (byte) MULTI_CHANNEL_ENDPOINT_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * @param the number of the endpoint to get the
   * @return the serial message.
   */
  public SerialMessage getMultiChannelCapabilityGetMessage(ZWaveEndpoint endpoint) {
    logger.debug("NODE {}: Creating new message for application command MULTI_CHANNEL_CAPABILITY_GET endpoint {}", this.getNode().getNodeId(), endpoint.getEndpointId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  3,
                (byte) getCommandClass().getKey(),
                (byte) MULTI_CHANNEL_CAPABILITY_GET,
                (byte) endpoint.getEndpointId() };
      result.setMessagePayload(newPayload);
      return result;
  }
View Full Code Here

        node.routeList.remove(0);

      // Continue....
      nextHealStage(node);
    } else if (event instanceof ZWaveTransactionCompletedEvent) {
      SerialMessage serialMessage = ((ZWaveTransactionCompletedEvent) event).getCompletedMessage();

      if (serialMessage.getMessageClass() != SerialMessageClass.SendData
          && serialMessage.getMessageType() != SerialMessageType.Request)
        return;

      byte[] payload = serialMessage.getMessagePayload();
      if (payload.length < 3)
        return;

      HealNode node = healNodes.get(payload[0] & 0xFF);
      if (node == null)
View Full Code Here

   */
  @Override
  public void executeRefresh(ZWaveNode node,
      ZWaveAlarmCommandClass commandClass, int endpointId, Map<String,String> arguments) {
    logger.debug("NODE {}: Generating poll message for {}, endpoint {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId);
    SerialMessage serialMessage;
    String alarmType = arguments.get("alarm_type");
   
    if (alarmType != null) {
      serialMessage = node.encapsulate(commandClass.getMessage(AlarmType.getAlarmType(Integer.parseInt(alarmType))), commandClass, endpointId);
    } else {
View Full Code Here

  @Override
  void executeRefresh(ZWaveNode node,
      ZWaveThermostatFanModeCommandClass commandClass, int endpointId,
      Map<String, String> arguments) {
    logger.debug("NODE {}: Generating poll message for {}  endpoint {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId);
    SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId);
   
    if (serialMessage == null) {
      logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId);
      return;
    }
View Full Code Here

TOP

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

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.