This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Variable length not working?

/**@brief Attribute metadata. */
typedef struct
{
  ble_gap_conn_sec_mode_t read_perm;       /**< Read permissions. */
  ble_gap_conn_sec_mode_t write_perm;      /**< Write permissions. */
  uint8_t                 vlen       :1;   /**< Variable length attribute. */
  uint8_t                 vloc       :2;   /**< Value location, see @ref BLE_GATTS_VLOCS.*/
  uint8_t                 rd_auth    :1;   /**< Read Authorization and value will be requested from the application on every read operation. */ 
  uint8_t                 wr_auth    :1;   /**< Write Authorization will be requested from the application on every Write Request operation (but not Write Command). */
} ble_gatts_attr_md_t;

Whenever I set .vlen to true the softdevice fails with error 7 on the call to: sd_ble_gatts_characteristic_add

Is this functionality implemented, and are there any examples using it?

Parents
  • Hi there,

    I am not sure I understand the memory dump you pasted, but here's a possible cause:

    If your p_user_desc_md is != NULL and your p_user_desc_md->write_perm allows the user description descriptor to be written to, then you need to set your wr_aux bit in extended properties.

    Carles

Reply
  • Hi there,

    I am not sure I understand the memory dump you pasted, but here's a possible cause:

    If your p_user_desc_md is != NULL and your p_user_desc_md->write_perm allows the user description descriptor to be written to, then you need to set your wr_aux bit in extended properties.

    Carles

Children
  • I greatly appreciate that you can tell exactly what the cause is, but I also tend to think that it's quite difficult to look up this kind of information. Is it just me not doing my homework, or is everybody else completely aware that you have to set this bit, in order to use a user descriptor.

    I hope at least it's a combination of the two :-)

  • Since we provide a GAP/GATT level API we do rely on API users having an understanding of the specification at those levels.

    In GATT 3.3.3.2: "If the Writable Auxiliary bit of the Characteristic Properties is set then this characteristic descriptor can be written".

    I agree that we could be a bit more explicit regarding these sort of pitfalls, but we don't want to replicate the whole specification in our documentation either, so it's a tough balance to strike.