<?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>Creating a custom ble service</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2371/creating-a-custom-ble-service</link><description>Hello, 
 I am doing some experiments with 2 pca10001 and the ble_hrs example (with s110, s120). As it works well, I would like to mofify this example to fit my needs. I only need to transfer some booleans, some integers and one or two strings. So I start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Apr 2015 09:52:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2371/creating-a-custom-ble-service" /><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9703?ContentTypeID=1</link><pubDate>Fri, 03 Apr 2015 09:52:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccaa544d-d256-4ac2-8714-b79754e2991d</guid><dc:creator>Yasmine_Chtourou</dc:creator><description>&lt;p&gt;Hi , i&amp;#39;m working on nRF51822 and i wanna add a gatt service as well . what does p_pws refers to ? and how can I send data to the Androïd app ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9702?ContentTypeID=1</link><pubDate>Thu, 07 Aug 2014 11:24:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ae979e2-7356-4095-8362-898294f9577a</guid><dc:creator>ebbekaer</dc:creator><description>&lt;p&gt;Do you know what to do if the UUID has to be different in all digits. In this case only octets 12 and 13 differs from service to characteristic. But what if all octects different?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9701?ContentTypeID=1</link><pubDate>Wed, 25 Jun 2014 02:47:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c464a90-a168-4d85-9964-f4afeb630e29</guid><dc:creator>Chris Lovett</dc:creator><description>&lt;p&gt;Yeah, either way the format on the nrf51822 is reverse of that on the PC, so the nrf51822 uses big endian and the PC uses little endian, hence the need to reverse the bits somewhere.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9700?ContentTypeID=1</link><pubDate>Wed, 25 Jun 2014 02:34:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb0814b2-9ab4-42f1-8ed6-36dbf551f8bd</guid><dc:creator>Lucas</dc:creator><description>&lt;p&gt;Im am confused by your use of &amp;quot;Big Endian&amp;quot;. I was under the impression that big Endian meant MSB lowest in memory. From the looks of it you have put the LSB lowest in memory. Did you mean to say &amp;quot;Little Endian&amp;quot; or am I completly confused.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9704?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2014 08:22:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2e1a75f-11e8-437a-91b9-074128efea87</guid><dc:creator>Olivier Scalbert</dc:creator><description>&lt;p&gt;Thank a lot Chris !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating a custom ble service</title><link>https://devzone.nordicsemi.com/thread/9699?ContentTypeID=1</link><pubDate>Mon, 28 Apr 2014 23:23:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cd4b2c1-2837-4c39-9dd8-de4794932f13</guid><dc:creator>Chris Lovett</dc:creator><description>&lt;p&gt;I was able to register total custom service and characteristics using my own custom Guids, but you have to reverse the Guid bytes so they are in big endian.  For example, I generated the following service Guid:&lt;/p&gt;
&lt;p&gt;{227cb85f-855b-4044-9b80-7b8cf0f32854}&lt;/p&gt;
&lt;p&gt;But then in order to register this guid I do this (notice the order of the bytes is reversed):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_uuid128_t ble_uuid128 = { 0x54, 0x28, 0xf3, 0xf0, 0x8c, 0x7b, 0x80, 0x9b, 0x44, 0x40, 0x5b, 0x85, 0x5f, 0xb8, 0x7c, 0x22 };
uint8_t ble_custom_type;
ble_uuid_t ble_uuid;

err_code = sd_ble_uuid_vs_add(&amp;amp;ble_uuid128, &amp;amp;ble_custom_type);		
if (err_code != NRF_SUCCESS)
{
    return err_code;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I can use octets 12 and 13 in the service_add call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Use our custom registered service type.
ble_uuid.type = ble_custom_type;
blle_uuid.uuid = 0xb85f; // octets 12-13 of 128-bit UUID
p_pws-&amp;gt;uuid = 0xb8f5;

// Initialize service structure
p_pws-&amp;gt;evt_handler = p_pws_init-&amp;gt;evt_handler;
p_pws-&amp;gt;conn_handle = BLE_CONN_HANDLE_INVALID;
	
// Add service
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, 
                                                             &amp;amp;ble_uuid, &amp;amp;p_pws-&amp;gt;service_handle);
if (err_code != NRF_SUCCESS)
{
    return err_code;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Same trick works for any custom characteristics.  Now when I pair my device and dump the GATT service on my PC I see the service guid: {227cb85f-855b-4044-9b80-7b8cf0f32854}, so everything works great.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>