Datatype/Size of Data in BTH_LE_GATT_CHARACTERISTIC_VALUE Structure RRS feed

  • Question

  • I'm currently working on a BLE application, and I'm having trouble with the size of the Data in the BTH_LE_GATT_CHARACTERISTIC_VALUE structure.

    The sample here: points out that the Data is a pointer, but while coding, I tried the sample and it did not work, because VS sees the Data as an array instead of a pointer.

    I want to send more than 4 Bytes of data or more than 4 in length, but I cannot resize the Data, I tried the malloc() and realloc(), and both did not work. I also tried assigning a larger value in DataSize, and that did not work too.

    Is there a way to resize the size of Data?

    Wednesday, May 15, 2013 3:22 AM


  • BTH_LE_GATT_CHARACTERISTIC_VALUE is an open ended structure. You have to compute the sizeof(BTH_LE_GATT_CHARACTERISTIC_VALUE)+size o your data as the size you pass to malloc/HeapAlloc/etc. Note that operator new() by default won't work with a structure like this. So your call to malloc would look like this for a 4 byte valu



    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, May 15, 2013 4:28 PM