<?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>Changing service depending on state</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40134/changing-service-depending-on-state</link><description>The thing I currently try to implement is to combine two 128-bit services in one app - custom and UART. 
 I arleady made run them separately - one service at app. 
 Way they should change - at the init before BLE init the state of variable is checked</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Nov 2018 11:30:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40134/changing-service-depending-on-state" /><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/156131?ContentTypeID=1</link><pubDate>Tue, 06 Nov 2018 11:30:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c74d9ec-4e9d-46f6-8f6e-c6ac2cdcade0</guid><dc:creator>darkkat</dc:creator><description>&lt;p&gt;I found a way to run two services at the same time, so no need to make them run one of two depends on condition.&lt;/p&gt;
&lt;p&gt;This post helped me a lot:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/b/blog/posts/merging-two-ble-examples-together"&gt;devzone.nordicsemi.com/.../merging-two-ble-examples-together&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/156068?ContentTypeID=1</link><pubDate>Tue, 06 Nov 2018 08:06:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8143e065-9ebc-4320-b2ed-0e95505e4b58</guid><dc:creator>darkkat</dc:creator><description>&lt;p&gt;What you can check - is take CUS project and just add&amp;nbsp;&lt;br /&gt;&lt;br /&gt;#include &amp;quot;ble_nus.h&amp;quot;&lt;br /&gt;#include &amp;quot;app_uart.h&amp;quot;&lt;br /&gt;#include &amp;quot;app_util_platform.h&amp;quot;&lt;br /&gt;&lt;br /&gt;BLE_NUS_DEF(m_nus);&lt;br /&gt;&lt;br /&gt;and it should brake the project - data to board will come and from board will not.&lt;br /&gt;&lt;br /&gt;Or take NUS project and add&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;#include &amp;quot;ble_nus.h&amp;quot; - from a Github example&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BLE_CUS_DEF(m_cus);&lt;br /&gt;&lt;br /&gt;and this way connection will fail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/156000?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 14:59:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90a41d1b-24df-4056-938a-26ed6c4af06c</guid><dc:creator>darkkat</dc:creator><description>&lt;p&gt;When I have two separate projects - each wprks like a charm.&lt;br /&gt;If I add initialisation of CUS to NUS, NUS fails to connect - but dev kit indicates as connected (light continiously on, not blinking).&lt;br /&gt;If I add initialisation of NUS to CUS, CUS connects, data is received by board but when I try to send the data from board by notify, it works one time and then core helds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I added two services to the code and it failed to work, so I rolled back each step to make it work again, and this step was adding&amp;nbsp;&lt;span&gt;BLE_CUS_DEF(m_cus) or&amp;nbsp;BLE_NUS_DEF(m_nus).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/155940?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 12:17:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3964cff-d51f-429c-939f-dee7b69f7993</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what may be failing here, a few things I would need to understand what may be failing:&lt;/p&gt;
&lt;p&gt;Does it connect as expected, does the discovery of services occur as expected,&amp;nbsp;do the service and characteristic handles change after adding another service, is there any asserts,&amp;nbsp;does&amp;nbsp;BLE_GATTS_EVT_WRITE occur as expected (to enable CCCD or write to the rx handle), does the&amp;nbsp;sd_ble_gatts_hvx() return any error code and does&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE occur?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/155931?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 11:54:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8451938b-32f1-4460-8132-af74055d0abb</guid><dc:creator>darkkat</dc:creator><description>&lt;p&gt;Already tried that, nothing changed. Allowed two services, increased memory - this changes are still in project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing service depending on state</title><link>https://devzone.nordicsemi.com/thread/155929?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 11:50:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af4dea23-2756-4aa4-bac3-df85a2ebd4d0</guid><dc:creator>Kenneth</dc:creator><description>[quote user=""]I know that I can&amp;#39;t run two 128-bit services at one time[/quote]
&lt;p&gt;Sure you can, but you need to increase&amp;nbsp;NRF_SDH_BLE_VS_UUID_COUNT to 2, and in addition increase ram base (ram used by the softdevice).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>