title: Read Data Structure value binded to Bluetooth LE Descriptor in Android
body: <p>I am writing an android app which reads the data sent from an arm processor over BLE (with characteristics and descriptors). in the hardware part I am using the function below :</p>
  
  <pre><code>tBleStatus aci_gatt_add_char_desc   (   uint16_t    serviceHandle,
  uint16_t    charHandle,
  uint8_t     descUuidType, //16 or 128 bit
  const uint8_t *     uuid, //descriptor uuid
  uint8_t     descValueMaxLen,
  uint8_t     descValueLen,
  const void *    descValue, //actual data
  uint8_t     secPermissions,
  uint8_t     accPermissions,
  uint8_t     gattEvtMask,
  uint8_t     encryKeySize,
  uint8_t     isVariable,
  uint16_t *  descHandle 
  )   
  </code></pre>
  
  <p>And if we pass <code>descValue</code> as string or well-known type value we can easily extract the value in the android side like below :</p>
  
  <pre><code>byte[] descValue = Descriptor.getValue();
  String DescString = new String(descValue, "ISO_8859_1");  
  </code></pre>
  
  <p>or for float I use:</p>
  
  <pre><code>float wrapped = ByteBuffer.wrap(descValue).order(ByteOrder.LITTLE_ENDIAN).getFloat();
  </code></pre>
  
  <p>However, instead of string or any single data type I want to send a struct in C (for example Characteristic Presentation Format (0x2904 UUID):</p>
  
  <pre><code>typedef __packed struct _charactFormat {
  uint8_t format;
  int8_t exp;
  uint16_t unit;
  uint8_t name_space;
  uint16_t desc;
  } PACKED charactFormat;
  </code></pre>
  
  <p>But the problem is when we call <code>getValue()</code> function in Android it returns a byte array and I don't know how to interpret this byte array and extract the data out of it </p>
  
  <p>I am looking for a way to send <code>struct</code> and not strictly looking for Char Pres. form. (This is possible since nRF connect app can read the data structure but the source code is not available (even in their nRF Toolbox)</p>
  
  <p>Any help would be appreciated</p>