<?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>Adding a service to existing SDK example code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25417/adding-a-service-to-existing-sdk-example-code</link><description>Hello,
I am trying to add an extra service like &amp;quot;experimental_ble_app_blinky&amp;quot; into &amp;quot;ble_app_hids_keyboard&amp;quot; example code. &amp;quot;ble_app_hids_keyboard&amp;quot; example code has 3 servcies HID, Device info and battery info services, I would like to add the 4th service</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 24 Sep 2017 21:12:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25417/adding-a-service-to-existing-sdk-example-code" /><item><title>RE: Adding a service to existing SDK example code</title><link>https://devzone.nordicsemi.com/thread/100175?ContentTypeID=1</link><pubDate>Sun, 24 Sep 2017 21:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c27cf853-daeb-43b0-b7f9-19312864ef76</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;so now I suggest you put all this information into a new question, format it properly and ask it. Since all the information is now in a comment, it&amp;#39;s likely nobody is going to read it and, since it&amp;#39;s in a comment, it&amp;#39;s a mess to read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a service to existing SDK example code</title><link>https://devzone.nordicsemi.com/thread/100174?ContentTypeID=1</link><pubDate>Sun, 24 Sep 2017 12:53:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6981dfad-10e4-4fd1-920d-fd10de3b62a0</guid><dc:creator>alikob</dc:creator><description>&lt;p&gt;As I mentioned, I added this service into exiting code:&lt;/p&gt;
&lt;p&gt;static void services_init(void)
{
dis_init();
bas_init();
hids_init();
lbs_init();
}&lt;/p&gt;
&lt;p&gt;last line is the led button service, which comes right from example experimental_led blinky:
static void lbs_init(void)
{
uint32_t       err_code;
ble_lbs_init_t init;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;init.led_write_handler = led_write_handler;

err_code = ble_lbs_init(&amp;amp;m_lbs, &amp;amp;init);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Of course I added all relevant code for building and compile with no error. What I was expecting to see 1 more service which is a custom service in addition to device manager service and battery service, in my iphone which I am running some BLE scnner apps, but all I saw was device manger service and batter service only, no custom service!!. Am I missing something here? Also in hid keyboard example, during advertisement, in example code there is only one UUID number and type, like this:&lt;/p&gt;
&lt;p&gt;static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE, BLE_UUID_TYPE_BLE}};&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any UUID for DI Service, and battery service, although it shows up as services in my iphone BLE scan app, which I don&amp;#39;t understand. Now do I need to add the UUID of my custom service into advertisement init? I have seen some example they are adding all services in there, like HRS example:
static ble_uuid_t m_adv_uuids[] =                                                       /**&amp;lt; Universally unique service identifiers. */
{
{BLE_UUID_HEART_RATE_SERVICE,         BLE_UUID_TYPE_BLE},
{BLE_UUID_BATTERY_SERVICE,            BLE_UUID_TYPE_BLE},
{BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE}
};
I am thinking may be its optional! I also added scan response part of lbs service into advertising _init(), the hid keyboard code was like this:
err_code = ble_advertising_init(&amp;amp;advdata, NULL, &amp;amp;options, on_adv_evt, ble_advertising_error_handler);
as you can see the second parameter is NULL, so I changed it to this:
rr_code = ble_advertising_init(&amp;amp;advdata, &amp;amp;scanrsp, &amp;amp;options, on_adv_evt, ble_advertising_error_handler);
Again it just like the example LED_BLINKY custom service, which scan response is pass into this code:&lt;/p&gt;
&lt;p&gt;err_code = ble_advdata_set(&amp;amp;advdata, &amp;amp;scanrsp);&lt;/p&gt;
&lt;p&gt;Please let me know if you need more information? Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a service to existing SDK example code</title><link>https://devzone.nordicsemi.com/thread/100173?ContentTypeID=1</link><pubDate>Sun, 24 Sep 2017 04:15:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81a1e980-260a-4768-adf0-dee755d6727c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes it&amp;#39;s perfectly possibly to add multiple services. Since you have given no details at all about what &amp;quot;didn&amp;#39;t work&amp;quot; it&amp;#39;s rather hard to suggest what your problem is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>