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

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


  public SerialMessage doRequest(SUCType type) {
    logger.debug("Assigning Controller SUC functionality to {}", type.toString());

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessageClass.EnableSuc, SerialMessageType.Request,
        SerialMessageClass.EnableSuc, SerialMessagePriority.High);
   
    byte[] newPayload = new byte[2];
    switch(type) {
    case NONE:
      newPayload[0] = 0;
      newPayload[1] = 0;
      break;
    case BASIC:
      newPayload[0] = 1;
      newPayload[1] = 0;
      break;
    case SERVER:
      newPayload[0] = 1;
      newPayload[1] = 1;
      break;
    }
    newMessage.setMessagePayload(newPayload);
      return newMessage;
  }
View Full Code Here


   * Gets a SerialMessage with the No Operation command
   * @return the serial message
   */
  public SerialMessage getNoOperationMessage() {
    logger.debug("NODE {}: Creating new message for application command No Operation", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Low);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  1,
                (byte) getCommandClass().getKey() };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * Gets a SerialMessage with the SWITCH_MULTILEVEL_GET command
   * @return the serial message
   */
  public SerialMessage getValueMessage() {
    logger.debug("Creating new message for application command SWITCH_MULTILEVEL_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_MULTILEVEL_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

  public SerialMessage doRequest(int nodeId) {
    logger.debug("NODE {}: Request routing info", nodeId);

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessage.SerialMessageClass.GetRoutingInfo, SerialMessage.SerialMessageType.Request,
        SerialMessage.SerialMessageClass.GetRoutingInfo, SerialMessage.SerialMessagePriority.High);
    byte[] newPayload = { (byte) nodeId,
        (byte) 0,    // Don't remove bad nodes
        (byte) 0,    // Don't remove non-repeaters
        (byte) 3    // Function ID
    };
      newMessage.setMessagePayload(newPayload);
      return newMessage;
  }
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_MULTILEVEL_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_MULTILEVEL_SET,
                (byte) level
                };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * Gets a SerialMessage with the SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE command
   * @return the serial message
   */
  public SerialMessage stopLevelChangeMessage() {
    logger.debug("Creating new message for application command SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE 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(),
                  2,
                (byte) getCommandClass().getKey(),
                (byte) SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

*/
public class RequestNodeInfoMessageClass  extends ZWaveCommandProcessor {
  private static final Logger logger = LoggerFactory.getLogger(RequestNodeInfoMessageClass.class);

  public SerialMessage doRequest(int nodeId) {
    SerialMessage newMessage = new SerialMessage(nodeId, SerialMessageClass.RequestNodeInfo, SerialMessageType.Request, SerialMessageClass.ApplicationUpdate, SerialMessagePriority.High);
      byte[] newPayload = { (byte) nodeId };
      newMessage.setMessagePayload(newPayload);
      return newMessage;
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public SerialMessage getValueMessage() {
    logger.debug("NODE {}: Creating new message for application command THERMOSTAT_OPERATING_STATE_GET", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Get);
    byte[] payload = {
        (byte) this.getNode().getNodeId(),
        2,
        (byte) getCommandClass().getKey(),
        THERMOSTAT_OPERATING_STATE_GET
    };
    result.setMessagePayload(payload);
    return result;
  }
View Full Code Here

  public SerialMessage doRequest(int nodeId) {
    logger.debug("NODE {}: Request neighbor update", nodeId);

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessageClass.RequestNodeNeighborUpdate, SerialMessageType.Request,
        SerialMessageClass.RequestNodeNeighborUpdate, SerialMessagePriority.High);
    byte[] newPayload = { (byte) nodeId };
      newMessage.setMessagePayload(newPayload);
      return newMessage;
  }
View Full Code Here

      }
      break;
    case NODE_INFO_REQ_FAILED:
      logger.debug("NODE {}: Application update request, Node Info Request Failed, re-request node info.", nodeId);
     
      SerialMessage requestInfoMessage = lastSentMessage;
     
      if (requestInfoMessage.getMessageClass() != SerialMessageClass.RequestNodeInfo) {
        logger.warn("NODE {}: Got application update request without node info request, ignoring.", nodeId);
        return false;
      }
       
      if (--requestInfoMessage.attempts >= 0) {
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.