Esempio n. 1
0
 private Buffer getAnalogValueCallbackThresholdDefault() {
   Buffer buffer = Buffer.buffer();
   buffer.appendBytes(Utils.getCharRandomValue(1));
   buffer.appendBytes(Utils.get2ByteURandomValue(1));
   buffer.appendBytes(Utils.get2ByteURandomValue(1));
   return buffer;
 }
Esempio n. 2
0
 @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;
 }
Esempio n. 3
0
  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;
  }
Esempio n. 4
0
 private Buffer getVoltageCallbackPeriodDefault() {
   Buffer buffer = Buffer.buffer();
   buffer.appendBytes(Utils.get4ByteURandomValue(1));
   return buffer;
 }
Esempio n. 5
0
 private Buffer getDebouncePeriodDefault() {
   Buffer buffer = Buffer.buffer();
   buffer.appendBytes(Utils.get4ByteURandomValue(1));
   return buffer;
 }
Esempio n. 6
0
 @Override
 public void encodeToWire(Buffer buffer, MyPOJO myPOJO) {
   byte[] bytes = myPOJO.getStr().getBytes(CharsetUtil.UTF_8);
   buffer.appendInt(bytes.length);
   buffer.appendBytes(bytes);
 }
Esempio n. 7
0
 private void writeString(Buffer buff, String str) {
   byte[] strBytes = str.getBytes(CharsetUtil.UTF_8);
   buff.appendInt(strBytes.length);
   buff.appendBytes(strBytes);
 }