<?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>Warnings on Compilation - excess elements in struct initializer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71754/warnings-on-compilation---excess-elements-in-struct-initializer</link><description>Hello, 
 I am working on the ble_app_template example, nrf52840, SDK 17.0.2 and Segger Embedded Studio version 5.34. I have added multiple custom services to my code, however when I build and compile my program I get some warnings which I am not sure</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Feb 2021 12:29:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71754/warnings-on-compilation---excess-elements-in-struct-initializer" /><item><title>RE: Warnings on Compilation - excess elements in struct initializer</title><link>https://devzone.nordicsemi.com/thread/295332?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 12:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c23fb25-48d0-44f5-a87d-1f9e61a403bb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ananye,&lt;/p&gt;
[quote user="Ananye"]Also, thanks for pointing out about the memory aspect. Yeah for the application we are working, we would need these 3 different services.[/quote]
&lt;p&gt;&amp;nbsp;Just to be clear, this limit does not apply to how many services/characteristics you may include in your app. There is nothing in the specification mandating that all services must be included in the advertisement. &lt;/p&gt;
[quote user="Ananye"]Is there any other way?[/quote]
&lt;p&gt;&amp;nbsp;Yes, you could enable advertisement extensions, a feature introduced in Bluetooth 5. This allows a payload of up to 255 bytes. A potential problem with this is that you would need to always have a BT 5 compatible observer that supports adv. extensions to receive it.&lt;/p&gt;
[quote user="Ananye"]Also, I have defined a 128 bit base UUID and then created 16 bit custom UUIDs under that base UUID. So does that mean all 3 still use 128 bits in memory? My understanding was that after having one base UUID, any new UUIDs we create under that only use 16 bits in memory, not 128 bits.[/quote]
&lt;p&gt;&amp;nbsp;The base UUID is stored once through the &lt;span&gt;&lt;a title="sd_ble_uuid_vs_add" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html?cp=4_7_3_1_2_0_2_2_8#ga265b4251110a15120d0aa97e5152163b"&gt;sd_ble_uuid_vs_add&lt;/a&gt;&lt;/span&gt;(), and is later referenced through the uuid -&amp;gt; type value returned by &lt;span&gt;&lt;a title="sd_ble_uuid_vs_add" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html?cp=4_7_3_1_2_0_2_2_8#ga265b4251110a15120d0aa97e5152163b"&gt;sd_ble_uuid_vs_add&lt;/a&gt;&lt;/span&gt;(). But this is related to the internal memory handling. The adv. packet must contain the whole 128-bit byte string for each custom service that is included.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Warnings on Compilation - excess elements in struct initializer</title><link>https://devzone.nordicsemi.com/thread/295235?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 22:34:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a931c25-137c-4ffa-8d3f-e716283a1946</guid><dc:creator>Ananye</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your response. Adding the brackets helped resolve the warnings.&lt;/p&gt;
&lt;p&gt;Also, thanks for pointing out about the memory aspect. Yeah for the application we are working, we would need these 3 different services. I did add one of the services to the scan response packet but even then I would not be able to have all 3 at once. Is there any other way?&lt;/p&gt;
&lt;p&gt;Also, I have defined a 128 bit base UUID and then created 16 bit custom UUIDs under that base UUID. So does that mean all 3 still use 128 bits in memory? My understanding was that after having one base UUID, any new UUIDs we create under that only use 16 bits in memory, not 128 bits.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Ananye&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Warnings on Compilation - excess elements in struct initializer</title><link>https://devzone.nordicsemi.com/thread/295086?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 12:38:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b17976d4-7a60-4a84-8619-bb27bca6eb5c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Each &amp;quot;uuid-type&amp;quot; pair must be enclosed with curly brackets as shown in the snippet below. Another problem is that you probably will not be able to fit all 3 128-bit service UUIDs in your advertising payload (payload per packet is 31 bytes if you use legacy advertising). Are you sure you need to include all 3 in your advertisment?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define BLE_UUID_OUR_SERVICE_UUID                0x5763 
#define BLE_UUID_OUR_SERVICE_2_UUID              0x8964 
#define BLE_UUID_NUS_SERVICE 0x0001

static ble_uuid_t m_adv_uuids[]          =                                          /**&amp;lt; Universally unique service identifier. */
{
    {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}, 
    {BLE_UUID_OUR_SERVICE_2_UUID, BLE_UUID_TYPE_VENDOR_BEGIN},
    {BLE_UUID_OUR_SERVICE_UUID,BLE_UUID_TYPE_VENDOR_BEGIN}
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>