ArduinoBLE - valueLength()

Query the length, in bytes, of the descriptor current value.

Syntax

bleDescriptor.valueLength()

Parameters

None

Returns

Length of descriptor value in bytes.

Example


  // read the descriptor value
  descriptor.read();

  // print out the value of the descriptor
  Serial.print(", value 0x");
  printData(descriptor.value(), descriptor.valueLength());

  // ...

  void printData(const unsigned char data[], int length) {
    for (int i = 0; i < length; i++) {
      unsigned char b = data[i];

      if (b < 16) {
        Serial.print("0");
      }

      Serial.print(b, HEX);
    }
  }