Search in sources :

Example 81 with SerialMessage

use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.

the class ZWaveMeterCommandClass method getSupportedMessage.

/**
     * Gets a SerialMessage with the METER_SUPPORTED_GET command
     *
     * @return the serial message, or null if the supported command is not
     *         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.Config);
    byte[] newPayload = { (byte) this.getNode().getNodeId(), 2, (byte) getCommandClass().getKey(), (byte) METER_SUPPORTED_GET };
    result.setMessagePayload(newPayload);
    return result;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 82 with SerialMessage

use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.

the class ZWaveMeterCommandClass method getMessage.

/**
     * Gets a SerialMessage with the METER_GET command
     *
     * @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;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 83 with SerialMessage

use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.

the class ZWaveMultiInstanceCommandClass method getMultiChannelCapabilityGetMessage.

/**
     * Gets a SerialMessage with the MULTI_CHANNEL_CAPABILITY_GET command.
     * Gets the capabilities for a specific endpoint.
     *
     * @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 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.Config);
    byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), (byte) MULTI_CHANNEL_CAPABILITY_GET, (byte) endpoint.getEndpointId() };
    result.setMessagePayload(newPayload);
    return result;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 84 with SerialMessage

use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.

the class ZWaveMultiInstanceCommandClass method getMultiInstanceGetMessage.

/**
     * Gets a SerialMessage with the MULTI_INSTANCE_GET command.
     * Returns the number of instances for this command class.
     *
     * @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 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;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 85 with SerialMessage

use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.

the class ZWaveBarrierOperatorCommandClass method getValueMessage.

@Override
public SerialMessage getValueMessage() {
    logger.debug("NODE {}: Creating new message for command BARRIER_OPERATOR_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) BARRIER_OPERATOR_GET };
    result.setMessagePayload(newPayload);
    return result;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Aggregations

SerialMessage (org.openhab.binding.zwave.internal.protocol.SerialMessage)125 State (org.openhab.core.types.State)12 ZWaveEndpoint (org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 HashMap (java.util.HashMap)5 ZWaveNode (org.openhab.binding.zwave.internal.protocol.ZWaveNode)5 ZWaveWakeUpCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveWakeUpCommandClass)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 ConfigurationParameter (org.openhab.binding.zwave.internal.protocol.ConfigurationParameter)3 SecurityEncapsulatedSerialMessage (org.openhab.binding.zwave.internal.protocol.SecurityEncapsulatedSerialMessage)3 ZWaveCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ZWaveDbConfigurationParameter (org.openhab.binding.zwave.internal.config.ZWaveDbConfigurationParameter)2 ZWaveProductDatabase (org.openhab.binding.zwave.internal.config.ZWaveProductDatabase)2 MultiLevelPercentCommandConverter (org.openhab.binding.zwave.internal.converter.command.MultiLevelPercentCommandConverter)2 ZWaveAssociationCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass)2 ZWaveConfigurationCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveConfigurationCommandClass)2 ZWaveNetworkEvent (org.openhab.binding.zwave.internal.protocol.event.ZWaveNetworkEvent)2