Search in sources :

Example 56 with SerialMessage

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

the class RemoveNodeMessageClass method doRequestStop.

public SerialMessage doRequestStop() {
    logger.debug("Ending EXCLUSION mode.");
    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessage.SerialMessageClass.RemoveNodeFromNetwork, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.RemoveNodeFromNetwork, SerialMessage.SerialMessagePriority.High);
    byte[] newPayload = { (byte) REMOVE_NODE_STOP };
    newMessage.setMessagePayload(newPayload);
    return newMessage;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 57 with SerialMessage

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

the class RemoveNodeMessageClass method doRequestStart.

public SerialMessage doRequestStart(boolean highPower) {
    logger.debug("Setting controller into EXCLUSION mode.");
    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessage.SerialMessageClass.RemoveNodeFromNetwork, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.RemoveNodeFromNetwork, SerialMessage.SerialMessagePriority.High);
    byte[] newPayload = { (byte) REMOVE_NODE_ANY, (byte) 255 };
    newMessage.setMessagePayload(newPayload);
    return newMessage;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 58 with SerialMessage

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

the class RequestNodeInfoMessageClass method doRequest.

public SerialMessage doRequest(int nodeId) {
    SerialMessage newMessage = new SerialMessage(SerialMessageClass.RequestNodeInfo, SerialMessageType.Request, SerialMessageClass.ApplicationUpdate, SerialMessagePriority.High);
    byte[] newPayload = { (byte) nodeId };
    newMessage.setMessagePayload(newPayload);
    return newMessage;
}
Also used : SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 59 with SerialMessage

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

the class SerialApiGetCapabilitiesMessageClass method handleResponse.

@Override
public boolean handleResponse(ZWaveController zController, SerialMessage lastSentMessage, SerialMessage incomingMessage) {
    logger.trace("Handle Message Serial API Get Capabilities - Length {}", incomingMessage.getMessagePayload().length);
    serialAPIVersion = String.format("%d.%d", incomingMessage.getMessagePayloadByte(0), incomingMessage.getMessagePayloadByte(1));
    manufactureId = ((incomingMessage.getMessagePayloadByte(2)) << 8) | (incomingMessage.getMessagePayloadByte(3));
    deviceType = ((incomingMessage.getMessagePayloadByte(4)) << 8) | (incomingMessage.getMessagePayloadByte(5));
    deviceId = (((incomingMessage.getMessagePayloadByte(6)) << 8) | (incomingMessage.getMessagePayloadByte(7)));
    logger.debug(String.format("API Version = %s", serialAPIVersion));
    logger.debug(String.format("Manufacture ID = 0x%x", manufactureId));
    logger.debug(String.format("Device Type = 0x%x", deviceType));
    logger.debug(String.format("Device ID = 0x%x", deviceId));
    // Print the list of messages supported by this controller
    for (int by = 8; by < incomingMessage.getMessagePayload().length; by++) {
        for (int bi = 0; bi < 8; bi++) {
            if ((incomingMessage.getMessagePayloadByte(by) & (0x01 << bi)) != 0) {
                SerialMessage.SerialMessageClass msgClass = SerialMessage.SerialMessageClass.getMessageClass(((by - 8) << 3) + bi + 1);
                if (msgClass == null) {
                    logger.debug(String.format("Supports: Unknown Class 0x%02x", ((by - 8) << 3) + bi + 1));
                } else {
                    logger.debug("Supports: {}", msgClass.getLabel());
                }
            }
        }
    }
    checkTransactionComplete(lastSentMessage, incomingMessage);
    return true;
}
Also used : SerialMessageClass(org.openhab.binding.zwave.internal.protocol.SerialMessage.SerialMessageClass) SerialMessage(org.openhab.binding.zwave.internal.protocol.SerialMessage)

Example 60 with SerialMessage

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

the class AssignSucReturnRouteMessageClass method doRequest.

public SerialMessage doRequest(int nodeId, int callbackId) {
    logger.debug("NODE {}: Assigning SUC return route", nodeId);
    // Queue the request
    SerialMessage newMessage = new SerialMessage(SerialMessageClass.AssignSucReturnRoute, SerialMessageType.Request, SerialMessageClass.AssignSucReturnRoute, SerialMessagePriority.High);
    byte[] newPayload = { (byte) nodeId, (byte) callbackId };
    newMessage.setMessagePayload(newPayload);
    return newMessage;
}
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