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

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


  public SerialMessage doRequestStart(boolean highPower) {
    logger.debug("Setting controller into INCLUSION mode.");

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessage.SerialMessageClass.AddNodeToNetwork, SerialMessage.SerialMessageType.Request,
        SerialMessage.SerialMessageClass.AddNodeToNetwork, SerialMessage.SerialMessagePriority.High);
    byte[] newPayload = { (byte) ADD_NODE_ANY, (byte)255 };
    if(highPower == true)
      newPayload[0] |= OPTION_HIGH_POWER;

      newMessage.setMessagePayload(newPayload);
      return newMessage;
    }
View Full Code Here


   * @return the serial message
   */
  public SerialMessage getConfigMessage(int parameter) {
    logger.debug("NODE {}: Creating new message for application command CONFIGURATIONCMD_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(), 3, (byte) getCommandClass().getKey(),
        (byte) CONFIGURATIONCMD_GET, (byte) (parameter & 0xff) };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

  public SerialMessage doRequestStop() {
    logger.debug("Ending INCLUSION mode.");

    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessage.SerialMessageClass.AddNodeToNetwork, SerialMessage.SerialMessageType.Request,
        SerialMessage.SerialMessageClass.AddNodeToNetwork, SerialMessage.SerialMessagePriority.High);
    byte[] newPayload = { (byte) ADD_NODE_STOP };

      newMessage.setMessagePayload(newPayload);
      return newMessage;
    }
View Full Code Here

   * @return the serial message
   */
  public SerialMessage setConfigMessage(ConfigurationParameter parameter) {
    logger.debug("NODE {}: Creating new message for application command CONFIGURATIONCMD_SET", this.getNode()
        .getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData,
        SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);
    byte[] newPayload = new byte[parameter.getSize() + 6];
    newPayload[0] = (byte) this.getNode().getNodeId();
    newPayload[1] = (byte) (4 + parameter.getSize());
    newPayload[2] = (byte) getCommandClass().getKey();
    newPayload[3] = (byte) CONFIGURATIONCMD_SET;
    newPayload[4] = (byte) (parameter.getIndex() & 0xFF);
    newPayload[5] = (byte) (parameter.getSize() & 0xFF);

    for (int i=0; i < parameter.getSize(); i++) {
      newPayload[6 + i] = (byte) (parameter.getValue() >> ((parameter.getSize() - i - 1) * 8) & 0xFF);
    }

    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

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

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

   * Gets a SerialMessage with the VERSION GET command
   * @return the serial message
   */
  public SerialMessage getVersionMessage() {
    logger.debug("NODE {}: Creating new message for application command VERSION_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) VERSION_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * @param commandClass The command class to get the version for.
   * @return the serial message
   */
  public SerialMessage getCommandClassVersionMessage(CommandClass commandClass) {
  logger.debug("NODE {}: Creating new message for application command VERSION_COMMAND_CLASS_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) VERSION_COMMAND_CLASS_GET,
                (byte) commandClass.getKey()
                };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

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

    if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0600) {
      logger.warn("Detected Fibaro FGWPE Wall Plug - this device fails to respond to SENSOR_ALARM_GET and SENSOR_ALARM_SUPPORTED_GET.");
      return null;
    }
   
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.High);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  2,
                (byte) getCommandClass().getKey(),
                (byte) SENSOR_ALARM_SUPPORTED_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
View Full Code Here

   * Gets a SerialMessage with the BATTERY_GET command
   * @return the serial message
   */
  public SerialMessage getValueMessage() {
    logger.debug("Node {}: Creating new message for application command BATTERY_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) BATTERY_GET };
      result.setMessagePayload(newPayload);
      return result;   
  }
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.