<?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>error: invalid length in advertising init</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4136/error-invalid-length-in-advertising-init</link><description>hii... 
 i hv maufature_array of size 7 to advertise.... am facing a problem while advertising battery level service with dat... my code is lyk dis 
 uint32_t err_code;
 uint8_t flags =BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
 ble_advdata_t advdata1;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Oct 2014 14:10:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4136/error-invalid-length-in-advertising-init" /><item><title>RE: error: invalid length in advertising init</title><link>https://devzone.nordicsemi.com/thread/14797?ContentTypeID=1</link><pubDate>Fri, 24 Oct 2014 14:10:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebee2667-90e8-4b03-b202-4a99a4ee06cc</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;As @scytulip says, you cannot have more than 31 bytes of data in the advertising packets. He has given you a solution, to use scan request and scan response to obtain additional data.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/17884/add-device-name-to-ble_app_beacon-example/"&gt;This&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/question/17555/custom-128-uuid-and-service-data-unknown-error/"&gt;this&lt;/a&gt; may also be helpful to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: invalid length in advertising init</title><link>https://devzone.nordicsemi.com/thread/14796?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2014 08:39:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e74414de-a365-4c30-b8f4-a64e7a7d28b1</guid><dc:creator>sruthiraj koodathil</dc:creator><description>&lt;p&gt;but i want to advertise battery level as a service....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: invalid length in advertising init</title><link>https://devzone.nordicsemi.com/thread/14795?ContentTypeID=1</link><pubDate>Fri, 17 Oct 2014 15:42:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ba94b23-9aab-41fd-80e6-b2eb28833233</guid><dc:creator>scytulip</dc:creator><description>&lt;p&gt;A BLE advertising packet contains at most 31 bytes data. You can try putting some data into the scan response, another 31bytes packet. For instance,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t      err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;

uint8_t       flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

ble_uuid_t adv_uuids[] =
{
    {BLE_UUID_BATTERY_SERVICE,                  BLE_UUID_TYPE_BLE},
    {BLE_UUID_HEART_RATE_SERVICE,               BLE_UUID_TYPE_BLE},
    {BLE_UUID_DEVICE_INFORMATION_SERVICE,       BLE_UUID_TYPE_BLE},
    {BLE_UUID_NUS_SERVICE,                      m_nus.uuid_type}
}; // Too long to fit all in advdata

// Build and set advertising data
memset(&amp;amp;advdata, 0, sizeof(advdata));
memset(&amp;amp;scanrsp, 0, sizeof(scanrsp));

advdata.name_type               = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance      = true;
advdata.flags.size              = sizeof(flags);
advdata.flags.p_data            = &amp;amp;flags;
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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: invalid length in advertising init</title><link>https://devzone.nordicsemi.com/thread/14794?ContentTypeID=1</link><pubDate>Fri, 17 Oct 2014 13:28:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0142fcd1-1d81-4926-bb22-bbcc51522599</guid><dc:creator>Vebj&amp;#248;rn</dc:creator><description>&lt;p&gt;I&amp;#39;m guessing it&amp;#39;s &lt;a href="https://devzone.nordicsemi.com/documentation/nrf51/6.1.0/s110/html/a00911.html#gab9b31b762b72a309a725925635c5ad25"&gt;sd_ble_gap_adv_data_set&lt;/a&gt; that is throwing the NRF_ERROR_INVALID_LENGTH? I would perhaps try printing both dlen and srdlen before the call to this function to see what they are&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>