4 Replies Latest reply on Nov 5, 2015 8:39 PM by userc_8505

    variable length for long characteristic

      Hi, I am trying to use long characteristic (50byte) with variable length.

      I can set value to the characteristic once, but it never change if I try to update to another value.

       

      I defined below LEGATTDB_PERM_READABLE and LEGATTDB_PERM_VARIABLE_LENGTH set characteristic.

      ```

          CHARACTERISTIC_UUID128 (

              HANDLE_MY_CHARACTERISTIC,

              HANDLE_MY_VALUE,

              UUID_MY_CHARACTERISTIC,

              LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY,

              LEGATTDB_PERM_READABLE | LEGATTDB_PERM_AUTH_READABLE | LEGATTDB_PERM_VARIABLE_LENGTH,

              50),

              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

      ```

       

      I set value as below.

      ```

          BLEPROFILE_DB_PDU* my_characterestic = cfa_mm_Alloc(2 + data_len);

          memcpy(my_characterestic->pdu, data, data_len);

          my_characterestic->len = data_len;

          bleprofile_WriteHandleData(HANDLE_MY_VALUE, my_characterestic, 2 + data_len);

          cfa_mm_Free(my_characterestic);

      ```

       

      reproducible procedure.

      1. connect BCM20737S(peripheral) and iPhone(central)

      2. set value with bleprofile_WriteHandleData.

          data is {0x01, 0x02, 0x03, 0x04, 0x05, 0x06} and data_len is 6.

      3. read value from iPhone. {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}  can be read correctly.

      4. set another value like {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17} and data_len is 7.

      5. read value from iPhone. {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}  remains even though another value has been set.

      (if I set shorter byte array like {0x21,0x22,0x23,0x24,0x25} at step4, it can be set correctly..)

       

      Can we use long characteristic with variable length?

       

      Environment is as below.

      ```

      Hardware : BCM20737S as BLE peripheral, and iPhone (iOS9.1) as BLE central

      SDK : 2.2.0

      ```


      Best Regards,