use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveManufacturerSpecificCommandClass method getManufacturerSpecificMessage.
/**
* Gets a SerialMessage with the ManufacturerSpecific GET command
*
* @return the serial message
*/
public SerialMessage getManufacturerSpecificMessage() {
logger.debug("NODE {}: Creating new message for command MANUFACTURER_SPECIFIC_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) MANUFACTURER_SPECIFIC_GET };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveMultiLevelSwitchCommandClass method stopLevelChangeMessage.
/**
* Gets a SerialMessage with the SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE command
*
* @return the serial message
*/
public SerialMessage stopLevelChangeMessage() {
logger.debug("NODE {}: Creating new message for command SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE", 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;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveMultiLevelSwitchCommandClass method getValueMessage.
/**
* Gets a SerialMessage with the SWITCH_MULTILEVEL_GET command
*
* @return the serial message
*/
@Override
public SerialMessage getValueMessage() {
if (isGetSupported == false) {
logger.debug("NODE {}: Node doesn't support get requests", this.getNode().getNodeId());
return null;
}
logger.debug("NODE {}: Creating new message for command SWITCH_MULTILEVEL_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) SWITCH_MULTILEVEL_GET };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveNodeNamingCommandClass method setValueMessage.
/**
* Gets a SerialMessage with the Name or Location SET command
*
* @param the level to set.
* @return the serial message
*/
private SerialMessage setValueMessage(String str, int command) {
byte[] nameBuffer = null;
try {
nameBuffer = str.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
int len = nameBuffer.length;
if (len > 16) {
len = 16;
}
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);
byte[] newPayload = { (byte) this.getNode().getNodeId(), (byte) ((byte) len + 3), (byte) getCommandClass().getKey(), (byte) command, (byte) ENCODING_UTF16 };
byte[] msg = new byte[newPayload.length + len];
System.arraycopy(newPayload, 0, msg, 0, newPayload.length);
System.arraycopy(nameBuffer, 0, msg, newPayload.length, len);
result.setMessagePayload(msg);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveNodeNamingCommandClass method getNameMessage.
/**
* Gets a SerialMessage with the NAME GET command
*
* @return the serial message
*/
public SerialMessage getNameMessage() {
logger.debug("NODE {}: Creating new message for application command NAME_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) NAME_GET };
result.setMessagePayload(newPayload);
return result;
}
Aggregations