<?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>Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50759/apple-notification-center-service---hard-coded-max-attribute-length-of-32</link><description>nrf_ble_ancs_c.h has hardcoded max attribute length of 32 (BLE_ANCS_ATTR_DATA_MAX). 
 1) BLE_ANCS_ATTR_DATA_MAX mainly seems to be used to allocate the size of the app_id in ble_ancs_c_evt_t. So maybe is misnamed? 
 2) BLE_ANCS_ATTR_DATA_MAX is also used</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 21 Mar 2021 15:18:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50759/apple-notification-center-service---hard-coded-max-attribute-length-of-32" /><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/301083?ContentTypeID=1</link><pubDate>Sun, 21 Mar 2021 15:18:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc47582c-b33d-4b0f-bc3c-bfebb9d9cfd8</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;I&amp;#39;m not using the SDK version any longer. &amp;nbsp;Moving to the NCS version now. &amp;nbsp;So closing this issue...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/297969?ContentTypeID=1</link><pubDate>Fri, 05 Mar 2021 08:33:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:154bdd8f-86f2-488d-8e16-c7c1d87bafdf</guid><dc:creator>ThierryC</dc:creator><description>&lt;p&gt;No, but I did&amp;#39;t tried on latest SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/297140?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 11:07:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6863819-b132-4c30-a50b-5aad8d23aeef</guid><dc:creator>thomas oggier</dc:creator><description>&lt;p&gt;Has this problem found a solution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/297139?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 11:07:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a29e6a8c-e117-4de6-8f4b-50ff8fd953c4</guid><dc:creator>thomas oggier</dc:creator><description>&lt;p&gt;Has this problem found a solution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/203407?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 19:30:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d929af8-c8ca-4eea-891e-3c32ba919f6e</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;You are correct, it would be safer to explicitly set values to 0 first. Here the example assumes that the variables are initialized to 0 by the compiler, and then replaced by the nrf_ble_ancs_c_attr_add() funcitons.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/203405?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 19:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d0131ef-8460-4c65-aa20-00fc85121963</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Looking at this snippet and the code&amp;nbsp;around it in the c file, I think it terminates after the attribute if there is enough buffer to do so.&lt;/p&gt;
&lt;p&gt;If the allocated buffer is 32 bytes, and a 20 byte attribute is received, a nul-terminator is placed on byte 21. If the allocated buffer is 10 bytes, and the message received is 10 bytes, the nul-terminator is placed on byte 10, thereby truncating the data, but at least turning it into a printable string. (replacing the last character to fit into the buffer with a &amp;#39;\0&amp;#39; and then ignoring the rest of the attribute because there is no buffer to store it in.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/203393?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 16:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8659681f-e3ca-421d-ac44-cce1c28a3c73</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;My point is that&amp;nbsp;&lt;span&gt;nrf_ble_ancs_c_app_attr_add should not check the length against&amp;nbsp;BLE_ANCS_ATTR_DATA_MAX, since there doesn&amp;#39;t appear to be such a limitation and the buffer passed in can be of any size.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/203390?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 16:19:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:348d6856-39bd-4a9e-80f1-863c1e8f26d9</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define BLE_ANCS_ATTR_DATA_MAX              32  //!&amp;lt; Maximum data length of an iOS notification attribute.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;1. The comment for the definition could be more clear. The define is also used for application attributes in addition to notification attributes. The App ID is an attribute, so I think the naming of the&amp;nbsp;definition itself is ok. But that is subjective of course.&lt;/p&gt;
&lt;p&gt;2. This define is safe to increase so that you can receive more of the attribute. It should have been placed in sdk_config.h.&lt;/p&gt;
&lt;p&gt;nrf_ble_ancs_c_app_attr_add() will return NRF_ERROR_INVALID_LENGTH if you supply a &amp;quot;len&amp;quot; param larger than&amp;nbsp;BLE_ANCS_ATTR_DATA_MAX. This could have been mentioned directly in the API documentation.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/203086?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 13:12:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9f611f1-cba2-44ef-823f-d4d97849fe0f</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;One other note: &amp;nbsp;It looks like in the example&amp;nbsp;nrf_ble_ancs_c_attr_add is called before ble_ancs_c_init. &amp;nbsp;Seems like it would be safer for&amp;nbsp;&lt;span&gt;ble_ancs_c_init to initialize all the&amp;nbsp;&lt;/span&gt;ancs_notif_attr_list values to get = false and then call&amp;nbsp;&lt;span&gt;nrf_ble_ancs_c_attr_add only on the attributes that you want to retrieve. &amp;nbsp;(As it is now if you comment out any of the&amp;nbsp;nrf_ble_ancs_c_attr_add then you have undefined values, which leads to undefined behavior.)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Apple Notification Center Service - hard coded max attribute length of 32?</title><link>https://devzone.nordicsemi.com/thread/202927?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 20:22:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dd0eba7-d2e7-4753-a7ae-cd26296380ee</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;It also looks like the null termination on an attribute writes 1 past the buffer end in ancs_attr_parser.c:&lt;/p&gt;
&lt;pre&gt;    // We have reached the end of the attribute, or our max allocated internal size.
    // Stop copying data over to our buffer. NUL-terminate at the current index.
    if ( (p_ancs-&amp;gt;parse_info.current_attr_index == p_ancs-&amp;gt;evt.attr.attr_len) ||
         (p_ancs-&amp;gt;parse_info.current_attr_index == p_ancs-&amp;gt;parse_info.p_attr_list[p_ancs-&amp;gt;evt.attr.attr_id].attr_len - 1))
    {
        if (attr_is_requested(p_ancs, p_ancs-&amp;gt;evt.attr))
        {
            p_ancs-&amp;gt;evt.attr.p_attr_data[p_ancs-&amp;gt;parse_info.current_attr_index] = &amp;#39;\0&amp;#39;;
        }
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>