private Buffer getAnalogValueCallbackThresholdDefault() { Buffer buffer = Buffer.buffer(); buffer.appendBytes(Utils.getCharRandomValue(1)); buffer.appendBytes(Utils.get2ByteURandomValue(1)); buffer.appendBytes(Utils.get2ByteURandomValue(1)); return buffer; }
@Override public Buffer writeToBuffer() { String encoded = encode(); byte[] bytes = encoded.getBytes(); Buffer buffer = Buffer.buffer(bytes.length + 4); buffer.appendInt(bytes.length); buffer.appendBytes(bytes); return buffer; }
private Buffer getVoltage(Packet packet) { logger.debug("function getVoltage"); if (packet.getResponseExpected()) { byte length = (byte) 8 + 2; byte functionId = FUNCTION_GET_VOLTAGE; byte flags = (byte) 0; Buffer header = Utils.createHeader(uidBytes, length, functionId, packet.getOptions(), flags); Buffer buffer = Buffer.buffer(); buffer.appendBuffer(header); buffer.appendBytes(Utils.get2ByteURandomValue(1)); return buffer; } return null; }
private Buffer getVoltageCallbackPeriodDefault() { Buffer buffer = Buffer.buffer(); buffer.appendBytes(Utils.get4ByteURandomValue(1)); return buffer; }
private Buffer getDebouncePeriodDefault() { Buffer buffer = Buffer.buffer(); buffer.appendBytes(Utils.get4ByteURandomValue(1)); return buffer; }
@Override public void encodeToWire(Buffer buffer, MyPOJO myPOJO) { byte[] bytes = myPOJO.getStr().getBytes(CharsetUtil.UTF_8); buffer.appendInt(bytes.length); buffer.appendBytes(bytes); }
private void writeString(Buffer buff, String str) { byte[] strBytes = str.getBytes(CharsetUtil.UTF_8); buff.appendInt(strBytes.length); buff.appendBytes(strBytes); }