* Build a request from a user command This one is mostly used with a
* CONTROL function
*/
public Buffer buildRequestMsg(byte FC, byte group, byte variation,
int[] values, boolean withData) {
Buffer requestFrame = new Buffer(S);
requestFrame.writeBytes(buildHeader(FC, group, variation));
if (values[values.length - 1] < 256) {
requestFrame.writeByte(INDEXES_8);
requestFrame.writeByte((byte) values.length);
if (withData) {
// requestFrame.writeBytes(appRcv.getDataMap().get(group,
// variation, values, (byte) 0x17));
} else {
byte[] byteValues = new byte[values.length];
System.arraycopy(values, 0, byteValues, 0, values.length);
requestFrame.writeBytes(byteValues);
}
} else {
requestFrame.writeByte(INDEXES_16);
requestFrame.writeBytes(values.length);
if (withData) {
// requestFrame.writeBytes(appRcv.getDataMap().get(group,
// variation, values, (byte) 0x28));
} else {
requestFrame.writeBytes(values);
}
}
return requestFrame;
}