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

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


   * {@inheritDoc}
   */
  @Override
  public void receiveCommand(Item item, Command command, ZWaveNode node,
      ZWaveMultiLevelSwitchCommandClass commandClass, int endpointId, Map<String,String> arguments) {
    SerialMessage serialMessage = null;
    String restoreLastValue = null;
    if (command instanceof StopMoveType && (StopMoveType)command == StopMoveType.STOP) {
      // special handling for the STOP command
      serialMessage = commandClass.stopLevelChangeMessage();
    } else {
View Full Code Here


    }
   
    logger.debug(
        "NODE {}: Creating new message for application command SENSOR_MULTI_LEVEL_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) SENSOR_MULTI_LEVEL_GET };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

   */
  public SerialMessage getSupportedValueMessage() {
    logger.debug(
        "NODE {}: Creating new message for application command SENSOR_MULTI_LEVEL_SUPPORTED_GET",
        this.getNode().getNodeId());
    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_MULTI_LEVEL_SUPPORTED_GET };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

   */
  public SerialMessage getMessage(SensorType sensorType) {
    logger.debug(
        "NODE {}: Creating new message for application command SENSOR_MULTI_LEVEL_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) SENSOR_MULTI_LEVEL_GET,
        (byte) sensorType.getKey()
        };
    result.setMessagePayload(newPayload);
    return result;
 
View Full Code Here

   *
   * @return the serial message
   */
  public SerialMessage getValueMessage() {
    logger.debug("NODE {}: Creating new message for application command METER_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) METER_GET };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

   *
   * @return the serial message
   */
  public SerialMessage getMessage(MeterScale meterScale) {
    logger.debug("NODE {}: Creating new message for application command METER_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) METER_GET, (byte) (meterScale.getScale() << 3) };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

   *         supported.
   */
  public SerialMessage getSupportedMessage() {
    logger.debug("NODE {}: Creating new message for application command METER_SUPPORTED_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) METER_SUPPORTED_GET };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

    // resetable
    if (this.getVersion() == 1 || !this.canReset)
      return null;

    logger.debug("NODE {}: Creating new message for application command METER_RESET", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData,
        SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Set);
    byte[] newPayload = { (byte) this.getNode().getNodeId(), 2, (byte) getCommandClass().getKey(),
        (byte) METER_RESET };
    result.setMessagePayload(newPayload);
    return result;
  }
View Full Code Here

      SerialMessage incomingMessage) {
    logger.trace("Handle Message Send Data Request");

    int callbackId = incomingMessage.getMessagePayloadByte(0);
    TransmissionState status = TransmissionState.getTransmissionState(incomingMessage.getMessagePayloadByte(1));
    SerialMessage originalMessage = lastSentMessage;

    if (status == null) {
      logger.warn("Transmission state not found, ignoring.");
      return false;
    }

    logger.debug("CallBack ID = {}", callbackId);
    logger.debug(String.format("Status = %s (0x%02x)", status.getLabel(), status.getKey()));

    if (originalMessage == null || originalMessage.getCallbackId() != callbackId) {
      logger.warn("Already processed another send data request for this callback Id, ignoring.");
      return false;
    }

    switch (status) {
    case COMPLETE_OK:
      ZWaveNode node = zController.getNode(originalMessage.getMessageNode());
      if(node == null)
        break;
     
      // Consider this as a received frame since the controller did receive an ACK from the device.
      node.incrementReceiveCount();
View Full Code Here

   * Gets a SerialMessage with the WAKE_UP_NO_MORE_INFORMATION command.
   * @return the serial message
   */
  public SerialMessage getNoMoreInformationMessage() {
    logger.debug("NODE {}: Creating new message for application command WAKE_UP_NO_MORE_INFORMATION", this.getNode().getNodeId());
    SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Low);
      byte[] newPayload = {   (byte) this.getNode().getNodeId(),
                  2,
                (byte) getCommandClass().getKey(),
                (byte) WAKE_UP_NO_MORE_INFORMATION };
      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.