* @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;
}