<?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>Custom Service Setup in Central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51016/custom-service-setup-in-central</link><description>Hello Nordic Staff, 
 I am using the NRF52832, SDK 15.3, Keil, and the NRF52 dk dev kits. I want to modify a program such as the UART central example to recognize my custom peripheral service. The peripheral application runs on a third party device. It</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Aug 2019 10:42:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51016/custom-service-setup-in-central" /><item><title>RE: Custom Service Setup in Central</title><link>https://devzone.nordicsemi.com/thread/204268?ContentTypeID=1</link><pubDate>Thu, 15 Aug 2019 10:42:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a29be523-0011-4e3d-9dfa-ca531ece16c5</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Gerber,&lt;/p&gt;
[quote user=""]Is the&amp;nbsp;ble_app_uart_c project a suitable template for adding code to recognize a custom service?[/quote]
&lt;p&gt;You need to modify ble_nus_c.c so that it recognizes your customer UUID: For now you can see that it is designed to work with&amp;nbsp;NUS_BASE_UUID.&amp;nbsp;Also&amp;nbsp;ble_nus_c_on_db_disc_evt is trying to match&amp;nbsp;BLE_UUID_NUS_SERVICE so that it can lock itself to this service handle. NUS_C example gives a good starting template for you to figure how how initializng the central and locking to the service works.&lt;/p&gt;
[quote user=""]If yes, do I directly modify the ble_nus_c.c file to do this?[/quote]
&lt;p&gt;That is correct.&lt;/p&gt;
[quote user=""]Which &lt;span style="font-size:150%;"&gt;functions, header files, C files and defines&lt;/span&gt; specifically should I focus on when making modifications?[/quote]
&lt;ol&gt;
&lt;li&gt;in&amp;nbsp; ble_nus_c_on_db_disc_evt to listen to your service handle instead of&amp;nbsp;BLE_UUID_NUS_SERVICE&lt;/li&gt;
&lt;li&gt;save all the handle values of all 5 characteristics you just discovered. The template example only saves two (BLE_UUID_NUS_RX_CHARACTERISTIC and&amp;nbsp;BLE_UUID_NUS_TX_CHARACTERISTIC)&lt;/li&gt;
&lt;li&gt;handle&amp;nbsp;on_hvx if there are any notification enabled in any of your characteristics&lt;/li&gt;
&lt;li&gt;ble_nus_c_init needs to be changed to discover your primary service instead of&amp;nbsp;BLE_UUID_NUS_SERVICE&lt;/li&gt;
&lt;li&gt;The reset of the functions in ble_nus_c.c are helpers to work with handles on&amp;nbsp;&lt;span&gt;BLE_UUID_NUS_RX_CHARACTERISTIC and&amp;nbsp;BLE_UUID_NUS_TX_CHARACTERISTIC. If you want to handle your writes and reads differently, then you modify these helpers accordingly.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;/Susheel&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>