<?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>AN36 modifications</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1057/an36-modifications</link><description>I want to add to lbs service battery service(bas) as well. One of the changes is in the advertising_init() function: 
 
static void advertising_init(void)
{
 uint32_t err_code;
 ble_advdata_t advdata;
 uint8_t flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Dec 2013 19:32:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1057/an36-modifications" /><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5005?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 19:32:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:148715cb-81eb-4959-9a08-a2442270ec9c</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;I need more time to read books/specs, examples of actual implementation and personal experience to digest what you&amp;#39;ve been saying...
In any rate AN36 is a pretty good starting point and of course it could be and should be better but so far this is the best tutorial already.
Hope that our discussion will help it to become even better.&lt;/p&gt;
&lt;p&gt;My regards,
Boris.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5004?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 14:30:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77eecce0-46bb-46f4-b0ef-2aceb310462b</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Each field in the advertisement and scan response packets have a type, and when you use the complete UUID list as type, I&amp;#39;d say that you are required to actually have all services in this exact field. If you have one field in the advertisement packet which have the complete type, and one field in the scan response with the complete type, neither of them are actually complete, and I&amp;#39;d hence say that you don&amp;#39;t fulfill the specification.&lt;/p&gt;
&lt;p&gt;This is exactly why you have the more available type, and are also not required to have all services in the advertisement packet. I&amp;#39;d normally recommend you to have the primary service of the device in the advertisement, and leave out all others. In some cases you may have multiple equally important services, and if so, you may need/want to split them between the advertisement and scan response, but then by using the more available type for both fields.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5003?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 14:24:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7e91e33-2ded-463b-95bf-37a2756981ac</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;Dear Ole,&lt;/p&gt;
&lt;p&gt;Thank you very much for your help, support and patience.
Could you please add more details and extend this paragraph:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Based on my understanding of the spec however, I don&amp;#39;t think it would normally be legal to have uuids_complete split between advertisement data and scan response. The reason is that each packet should be valid in itself, but if you have only some services in a field marked as uuid_complete, your field doesn&amp;#39;t actually contain what the type implies. If you want to share the list between the packets, I&amp;#39;d therefore recommend you to use more_available.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What confuses me is if I do have a proprietary device with some unique service(s) but also want to have same defined services like the battery, temperature, proximity. The list can become lengthy and may not fit, so how to do it the right way?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5002?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 09:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa976011-0078-4bfc-878f-fad8247d3e15</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;You can get any kind of advertisement and scan response data you want, by just using sd_ble_gap_adv_data_set() directly if ble_advdata doesn&amp;#39;t allow you to do what you want. In that case, you must however do the parsing and data setup yourself.&lt;/p&gt;
&lt;p&gt;Based on my understanding of the spec however, I don&amp;#39;t think it would normally be legal to have uuids_complete split between advertisement data and scan response. The reason is that each packet should be valid in itself, but if you have only some services in a field marked as uuid_complete, your field doesn&amp;#39;t actually contain what the type implies. If you want to share the list between the packets, I&amp;#39;d therefore recommend you to use more_available.&lt;/p&gt;
&lt;p&gt;(In your case this is somewhat different, since you have one 128-bit UUID and one 16-bit UUID, so you could probably achieve what you want and be compliant by having the type of fields be different (see Core specification, Volume 3, Part C, table 18.2), but this seems to be a corner case.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5001?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 19:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da496a96-4e29-4caf-a55b-c126bd845521</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;This is what I ended up with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
static void advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata, scanrsp;
    uint8_t       flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
    
    // YOUR_JOB: Use UUIDs for service(s) used in your application.
    ble_uuid_t adv_uuids[] = 
    {
        {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE},
        {LBS_UUID_SERVICE, m_lbs.uuid_type}
    };

    // Build and set advertising data
    memset(&amp;amp;advdata, 0, sizeof(advdata));
    
    advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance      = true;
    advdata.flags.size              = sizeof(flags);
    advdata.flags.p_data            = &amp;amp;flags;

    memset(&amp;amp;scanrsp, 0, sizeof(scanrsp));
    scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    scanrsp.uuids_complete.p_uuids  = adv_uuids;
    
    err_code = ble_advdata_set(&amp;amp;advdata, &amp;amp;scanrsp);
    APP_ERROR_CHECK(err_code);
}

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Does this mean that because of implementation of SD110 x.uuids_complete can not be splitted between advdata and scanrsp?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/5000?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 11:08:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f05a8f3a-8a2a-4651-9a6b-faaebc59c7db</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Sorry, the method name was a typo from my part, it is sd_ble_gap_adv_data_set(), which as you can see is the final call of ble_advdata_set().&lt;/p&gt;
&lt;p&gt;It seems that current softdevices will initialize the appearance to 0x1234, but this will most likely be changed in future versions to just 0. If you want to, you can set appearance to one of the values from this list: &lt;a target="_blank" href="https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml" rel="nofollow"&gt;https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As for the latter part of your question, I&amp;#39;m not sure I understand it. With the S110, you can change the advertising data at any time, by either calling sd_ble_gap_adv_data_set() or ble_advdata_set(). You can however not advertise more than 31 bytes in the advertisement packet and 31 bytes in the scan response, and all data must be part of some advertising type as defined in the specification.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/4999?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 04:58:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55a7c2e4-42a1-4a19-a43e-9bbf8b3b0d43</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;I&amp;#39;m assuming that &amp;gt; the source code for ble_advdata
you mean file ble_advdata.c but in any case I do not see sd_ble_advdata_set(): not in this file nor anywhere else.
Also there is a function sd_ble_gap_appearance_get(). Should it not return what sd_ble_gap_appearance_set() sets? Template uses&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    /* YOUR_JOB: Use an appearance value matching the application&amp;#39;s use case.
    err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_);
    APP_ERROR_CHECK(err_code); */

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;AN36 doesn&amp;#39;t have this snippet or I missed it but somehow appearance gets initialized to 0x1234 and the code is not for debugging...
I&amp;#39;m sorry for the next question because I&amp;#39;m sure BLE Core v.4 has the answer but having advertisement package and the scan response limits is limiting to less than 62 bytes. What am I missing?  Or if it is necessary one can modify ads by changing my advertisement data?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/4998?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2013 16:43:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab2c930f-577c-4595-8eac-021c5484e83b</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I assume the user who wrote that means that he removed some of the services and then shortened his name.&lt;/p&gt;
&lt;p&gt;There isn&amp;#39;t any magic way to know how large the packet is, but if you look at the source code for ble_advdata, you can see the raw packet as passed to sd_ble_advdata_set(). This is the size of advertising data as seen on air. You can also take a look at the Core Specification, Volume 3, Part C, chapter 11, which details the different fields available.&lt;/p&gt;
&lt;p&gt;There isn&amp;#39;t any right or wrong way to separate data between the advertisement packet and scan response, you are more or less free to choose as you see fit. The only exception I&amp;#39;m aware of is that you are allowed to have the name only one place, and that the Flags field shall be in the advertisement. You may also want to consider Apple&amp;#39;s recommendations in section 3.4 of their Bluetooth Accessory Design Guidelines, if that is a target platform of yours:
&lt;a target="_blank" href="https://developer.apple.com/hardwaredrivers/bluetoothdesignguidelines.pdf" rel="nofollow"&gt;https://developer.apple.com/hardwaredrivers/bluetoothdesignguidelines.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/4997?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2013 13:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b3996f5-650e-4609-ae66-d7f1a63931a6</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;Thank you for the reply.
I do not understand what this exactly means:&amp;gt;  I dropped the other services and pared the name down.&lt;/p&gt;
&lt;p&gt;Also, I&amp;#39;m aware of size limitations but how does ble_advdata_t is converted into the message, so I can count it&amp;#39;s size? Sorry I didn&amp;#39;t find this in ble_advdata.h. How to split correctly long message between the advertisement package and the scan response. Could you please point me to an example.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 modifications</title><link>https://devzone.nordicsemi.com/thread/4996?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2013 12:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ed4be09-86f5-4e65-a5a7-de0fc9729fb5</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;If you want to advertise a regular Bluetooth SIG service like the battery service, you should use BLE_UUID_TYPE_BLE and not m_lbs.uuid_type. Using the latter will set the Battery Service&amp;#39;s 16-bit UUID on top of the Led Button service&amp;#39;s base UUID, which is not what you want.&lt;/p&gt;
&lt;p&gt;The error 0x0C shows that your advertisement packet is too big. For details, take a look at &lt;a href="https://devzone.nordicsemi.com/index.php/i-m-having-trouble-advertising-a-vs-service"&gt;this&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/index.php/what-s-the-maximum-size-for-an-advertisement-package"&gt;this&lt;/a&gt; question, and also section 4.4.6 of the application note.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>