<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>What is a &amp;#39;system attribute&amp;#39;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53548/what-is-a-system-attribute</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Nov 2019 10:02:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53548/what-is-a-system-attribute" /><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/219858?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 10:02:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abc2737a-d629-45ce-aac8-067c1a1ef562</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I sort of went forward on that assumption. I save the CCCD tables on shutdown with that &amp;#39;get&amp;#39; and restore them on connection with that &amp;#39;set&amp;#39;. I save the table to a file in between. Still can get service-changed to work. Still get BLE_ERROR_GATTS_SYS_ATTR_MISSING.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/219850?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 09:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05ee1807-87d5-4a4b-a49b-5c244edc5431</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;After a chat with the SoftDevice team, I can confirm that:&lt;/p&gt;
&lt;p&gt;System attributes are the parts of the GATT database that should be kept for bonded peers, that is, they should be restored after reconnecting. CCCDs are among the things that needs to be kept for bonded peers.&lt;/p&gt;
&lt;p&gt;System services are default services, such as the GAP service with characteristics such as Peripheral Preferred Connection Parameters (PPCP), Service Changed, etc., that are controlled by the SoftDevice, e.g. either through SoftDevice configuration or because they are mandatory.&lt;/p&gt;
&lt;p&gt;User services are the services added by the application. That can be either SIG defined services such as the Heart Rate Service, or it can be vendor specific services such as the Nordic UART Service (NUS).&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/218665?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 17:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b926aed-1e6b-4cd3-bb84-7642d645962e</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;All for it!&lt;/p&gt;
&lt;p&gt;I went ahead and did the &amp;#39;set()&amp;#39; call in the connection event since the &amp;#39;MISSING&amp;#39; event was not getting signaled. I got no error but I still could not invoke a service changed event. I get the same results:&lt;/p&gt;
&lt;p&gt;Starting at handle zero and incrementing I got 14 invalid handle errors and then when it hit 14 (value 0x0d) I got the&amp;nbsp;&lt;a class="el" href="https://devzone.nordicsemi.com/f/nordic-q-a/53548/what-is-a-system-attribute/group___b_l_e___e_r_r_o_r_s___g_a_t_t_s.html#ga1d0833ac31d0c319e5286623b6301d0a"&gt;BLE_ERROR_GATTS_SYS_ATTR_MISSING&lt;/a&gt;&amp;nbsp;error. Same value as in the attribute table returned by the get() method.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/218664?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 17:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b11c4d29-01b9-4a65-8174-905e06ca197d</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s continue the discussion in the thread &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/54039/why-don-t-i-get-a-ble_gatts_evt_sys_attr_missing-event"&gt;Why don&amp;#39;t I get a BLE_GATTS_EVT_SYS_ATTR_MISSING event?&lt;/a&gt; I am currently looking into the matter.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/218492?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 10:08:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad63ef8e-0d8b-4f29-8047-7ab72791e131</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I do as you say. But I have one major issue. On the bonded re-connect, the&amp;nbsp;&lt;span&gt;&amp;nbsp;BLE_GATTS_EVT_SYS_ATTR_MISSING is never signaled. Why?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I suppose that is causing the headaches I am having with invoking a service-changed indication?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Since the central re-writes the CCCDs I still get the measurements but the central should not have to do that. It does because there are too many bad devices out there that don&amp;#39;t bond correctly when it comes to CCCDs.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/218469?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 09:34:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d834d13-0cfa-49a4-acb4-25084a9f4e9c</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Why would I get this&amp;nbsp;&lt;/p&gt;
&lt;table class="memberdecls"&gt;
&lt;tbody&gt;
&lt;tr class="memitem:ga1d0833ac31d0c319e5286623b6301d0a"&gt;
&lt;td class="memItemLeft" align="right" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td class="memItemRight" valign="bottom"&gt;&lt;a class="el" href="https://devzone.nordicsemi.com/f/nordic-q-a/53548/what-is-a-system-attribute/group___b_l_e___e_r_r_o_r_s___g_a_t_t_s.html#ga1d0833ac31d0c319e5286623b6301d0a"&gt;BLE_ERROR_GATTS_SYS_ATTR_MISSING&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;when trying to invoke a service changed&amp;nbsp;sd_ble_gatts_service_changed() method?&lt;/p&gt;
&lt;p&gt;It is clear that the peer has enabled the characteristic for indications.&lt;/p&gt;
&lt;p&gt;Then the docs say to use these functions&lt;/p&gt;
&lt;p&gt;uint8_t* p_sys_attr_data;&lt;br /&gt; uint16_t p_len = 0;&lt;br /&gt; sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, NULL, &amp;amp;p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;br /&gt; p_sys_attr_data = calloc(1, p_len);&lt;br /&gt; sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, p_sys_attr_data, &amp;amp;p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;br /&gt; sd_ble_gatts_sys_attr_set(m_adapter, m_connection_handle, p_sys_attr_data, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;/p&gt;
&lt;p&gt;to set them to a known value??? Then I look at the table in&amp;nbsp;&lt;span&gt;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. &lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;What am I supposed to do with that and how does it pertain to the &amp;#39;set&amp;#39; function?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; Do I pick what I want out of thin air?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; What&amp;#39;s wrong with the value already there?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; How is that even related to the service table that I am changing? (In this case the DIS is being removed).&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/217920?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2019 11:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e623816-3d75-4fcf-88bf-e50473fe6d93</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Now that I am trying to use these methods there are two flags&lt;/p&gt;
&lt;p&gt;#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 &amp;lt;&amp;lt; 0) /**&amp;lt; Restrict system attributes to system services only. */&lt;br /&gt;#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 &amp;lt;&amp;lt; 1) /**&amp;lt; Restrict system attributes to user services only. */&lt;/p&gt;
&lt;p&gt;I think I now understand the system services. But what is a user service?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I do this procedure, will I get the&lt;/p&gt;
&lt;p&gt;BLE_GAP_EVT_SEC_INFO_REQUEST&lt;/p&gt;
&lt;p&gt;any more?&lt;/p&gt;
&lt;p&gt;Right now I save the security keys myself and restore them on that event. The documentation for the &lt;span&gt;sd_ble_gatts_sys_attr_set()&amp;nbsp;&lt;/span&gt;method does not specifically mention security keys and I get the idea that it is only CCCDs and the like, and no security keys.&lt;/p&gt;
&lt;p&gt;To add to the problem, @ref BLE_GATTS_SYS_ATTRS_FORMAT described in the call to the *_get() method does not exist. I need to know what state the collector left the CCCDs in on a reconnect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/217385?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 16:36:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3efa33c3-677d-4f74-9db0-13164aeb0569</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;While you are in a connection, the SoftDevice will handle the CCCD as appropriate. When the peer writes to CCCD, that will be handled by SoftDevice.&lt;/p&gt;
&lt;p&gt;The only thing related to the CCCD that you have to do from the application, is to store the data you get from sd_ble_gatts_sys_attr_get() on disconnection, and provide it back to the SoftDevice with sd_ble_gatts_sys_attr_set() on the BLE_GATTS_EVT_SYS_ATTR_MISSING event. You should treat the data as a blob of data of unknown format, i.e. you should store it as is and provide it back as is, without changing it. You should not try to write to the CCCD directly from the application.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/217380?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 15:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de733de6-aaa1-44a9-b2fc-ebc57865be50</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;So the bottom line is this: I do save the stuff myself. But when I read in that the measurement descriptor has been enabled, can I set the descriptor to the appropriate notify/indicate setting using the write method as when the client does it?&amp;nbsp; And do it before I start advertising?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/217379?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 15:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f170afa0-507e-4055-ad3b-481152810567</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The SoftDevice uses a fixed amount of RAM for a given configuration, and only stores the data needed for the current connections. It does not use any permanent storage. Hence anything not related to the current connections, that should be saved for later, must be handled by the application.&lt;/p&gt;
&lt;p&gt;When using the SD API directly you must do the work storing keys yourself. See e.g. the p_sec_keyset in/out parameter for &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v7.0.1%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga7b23027c97b3df21f6cbc23170e55663"&gt;sd_ble_gap_sec_params_reply()&lt;/a&gt;. You can also have a look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v7.0.1%2Fgroup___b_l_e___g_a_p___m_s_c.html"&gt;GAP Message Sequence Charts&lt;/a&gt;, in particular the (Central / Peripheral) Security&amp;nbsp; Procedures.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/216894?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2019 14:16:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e9f1b43-05b7-4c80-9f23-3cf55eedaa71</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I am using the pc-ble-driver so I need to work with the sd_* methods and events directly. I prefer that in some sense because I am doing testing which means sometimes I have to do things which are considered bad and the SDK would not do.&lt;/p&gt;
&lt;p&gt;Do those methods also save the various keys? I am wondering because now I have to handle an keys request event from the client where I give the keys to the client. If I use the above sd call to restore the state, will I still get signaled the key request event or will the SoftDevice handle it automatically?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/216878?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2019 13:44:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b058341-b5a1-46b3-b0bc-64402f71c269</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I would rather describe it as a SoftDevice API that lets you, or an SDK library, do the work. From the application you must, somehow, call sd_ble_gatts_sys_attr_get() to store the state, and sd_ble_gatts_sys_attr_set() to restore it. See &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.0.1/group___b_l_e___g_a_t_t_s___s_y_s___a_t_t_r_s___b_o_n_d_e_d___p_e_e_r___m_s_c.html"&gt;GATTS System Attributes Handling: Bonded Peer&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.0.1/group___b_l_e___g_a_t_t_s___s_y_s___a_t_t_r_s___u_n_k___p_e_e_r___m_s_c.html"&gt;... Unknown Peer&lt;/a&gt; for message sequence charts.&lt;/p&gt;
&lt;p&gt;If you use our SDK this would be automatically handled through the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_peer_manager.html"&gt;Peer Manager&lt;/a&gt; library. So in that case you do not need to worry about the system attributes at all.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/216681?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2019 15:45:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:372e9d98-a2cd-4d37-a5d1-f11b4ed6ab6b</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Okay, I figured it might be something like that but I needed to be sure.&lt;/p&gt;
&lt;p&gt;On your second remark I have been storing the keys and the CCCD state myself. I give the keys to the peer on a reconnect when asked, and when encryption is done I just assumed the CCCD state was remembered. I just used the CCCD state to say I can start sending data as soon as encryption is finished. Since the peer re-writes the CCCDs every time to handle those bad devices that say they bond but don&amp;#39;t save the CCCD state I was never sure that it was set before the peer set it.&lt;/p&gt;
&lt;p&gt;So there are APIs that do this work for me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is a 'system attribute'</title><link>https://devzone.nordicsemi.com/thread/216677?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2019 15:29:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4873d613-7b20-4d07-8699-46ebbb0e5a86</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;By &amp;quot;system attributes&amp;quot; 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.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>