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

What is a 'system attribute'

I see this in the documentation for this method

uint32_t sd_ble_gatts_value_set ( uint16_t  conn_handle,
uint16_t  handle,
ble_gatts_value_t  p_value 
)

with this note:

Values other than system attributes can be set at any time, regardless of whether any active connections exist.

But what is a system attribute? Why is one attribute have preference over another? They are, after all, attributes. Is a system attribute any attribute that has no characteristic value, for example, a characteristic declaration? How about a descriptor?

Parents
  • Hi,

    By "system attributes" we primarily mean the Client Characteristic Configuration Descriptors (CCCD), i.e. attributes that are handled by the SoftDevice and have special requirements. It is mandated by Bluetooth specification that CCCD values are altered only by the peer, so you cannot change them from the application. Since CCCD values for a bonded peer should be stored between connections, an API exist for the application to store the values after disconnection, and to restore them on connection.

    Regards,
    Terje

  • Why would I get this 

      BLE_ERROR_GATTS_SYS_ATTR_MISSING

    when trying to invoke a service changed sd_ble_gatts_service_changed() method?

    It is clear that the peer has enabled the characteristic for indications.

    Then the docs say to use these functions

    uint8_t* p_sys_attr_data;
    uint16_t p_len = 0;
    sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, NULL, &p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
    p_sys_attr_data = calloc(1, p_len);
    sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, p_sys_attr_data, &p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
    sd_ble_gatts_sys_attr_set(m_adapter, m_connection_handle, p_sys_attr_data, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);

    to set them to a known value??? Then I look at the table in p_sys_attr_data and it is 8 bytes. I have no idea which attribute it is talking about. There is no UUID. I get handle 13, two bytes length, value 0, and a checksum.

    • What am I supposed to do with that and how does it pertain to the 'set' function?
    • Do I pick what I want out of thin air?
    • What's wrong with the value already there?
    • How is that even related to the service table that I am changing? (In this case the DIS is being removed).
  • Hi,

    Let's continue the discussion in the thread Why don't I get a BLE_GATTS_EVT_SYS_ATTR_MISSING event? I am currently looking into the matter.

    Regards,
    Terje

  • All for it!

    I went ahead and did the 'set()' call in the connection event since the 'MISSING' event was not getting signaled. I got no error but I still could not invoke a service changed event. I get the same results:

    Starting at handle zero and incrementing I got 14 invalid handle errors and then when it hit 14 (value 0x0d) I got the BLE_ERROR_GATTS_SYS_ATTR_MISSING error. Same value as in the attribute table returned by the get() method.

Reply Children
No Data
Related