<?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>Combining BLE UART functionality into a Central+peripheral Relay example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36754/combining-ble-uart-functionality-into-a-central-peripheral-relay-example</link><description>Hi There, 
 I&amp;#39;m stuck with Getting BLE uart working in another example. 
 I wasn&amp;#39;t sure if converting the BLE Uart example into a central/peripheral application would be more of a headache so I chose to start with The relay example and add UART functionality</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Aug 2018 06:28:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36754/combining-ble-uart-functionality-into-a-central-peripheral-relay-example" /><item><title>RE: Combining BLE UART functionality into a Central+peripheral Relay example</title><link>https://devzone.nordicsemi.com/thread/142295?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 06:28:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58939537-2fc8-4961-88bb-7f96c69f232b</guid><dc:creator>kishor babu</dc:creator><description>&lt;p&gt;Hi George,&lt;/p&gt;
&lt;p&gt;I am also trying to implement the UART service which will act as both central and peripheral at a time.&lt;/p&gt;
&lt;p&gt;So, I started including peripheral UART first into the central and peripheral relay example.&lt;/p&gt;
&lt;p&gt;I am also facing the same issue like you, I dumped BLE_UART central example into one board and the modified relay example in another board, both are connected but not able to communicate with each other.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    uint16_t conn_handle;
    uint16_t role;

    ble_conn_state_on_ble_evt(p_ble_evt);
    pm_on_ble_evt(p_ble_evt);

    // The connection handle should really be retrievable for any event type.
   conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
    role        = ble_conn_state_role(conn_handle);

    // Based on the role this device plays in the connection, dispatch to the right applications.
    if (role == BLE_GAP_ROLE_PERIPH)
    {
        // Manages peripheral LEDs.
        on_ble_peripheral_evt(p_ble_evt);

        ble_advertising_on_ble_evt(p_ble_evt);
        ble_conn_params_on_ble_evt(p_ble_evt);

        // Dispatch to peripheral applications.
        ble_nus_on_ble_evt (&amp;amp;m_nus, p_ble_evt);
			  bsp_btn_ble_on_ble_evt(p_ble_evt);
       // ble_rscs_on_ble_evt(&amp;amp;m_rscs, p_ble_evt);
    }
    else if ((role == BLE_GAP_ROLE_CENTRAL) || (p_ble_evt-&amp;gt;header.evt_id == BLE_GAP_EVT_ADV_REPORT))
    {
        /** on_ble_central_evt will update the connection handles, so we want to execute it
         * after dispatching to the central applications upon disconnection. */
        if (p_ble_evt-&amp;gt;header.evt_id != BLE_GAP_EVT_DISCONNECTED)
        {
            on_ble_central_evt(p_ble_evt);
        }

        if (conn_handle &amp;lt; CENTRAL_LINK_COUNT + PERIPHERAL_LINK_COUNT)
        {
            ble_db_discovery_on_ble_evt(&amp;amp;m_ble_db_discovery[conn_handle], p_ble_evt);
        }
        ble_hrs_c_on_ble_evt(&amp;amp;m_ble_hrs_c, p_ble_evt);
       // ble_rscs_c_on_ble_evt(&amp;amp;m_ble_rsc_c, p_ble_evt);

        // If the peer disconnected, we update the connection handles last.
        if (p_ble_evt-&amp;gt;header.evt_id == BLE_GAP_EVT_DISCONNECTED)
        {
            on_ble_central_evt(p_ble_evt);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above is my ble_evt_dispatch function, could you suggest me what are the necessary changes and i need to make?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Combining BLE UART functionality into a Central+peripheral Relay example</title><link>https://devzone.nordicsemi.com/thread/141214?ContentTypeID=1</link><pubDate>Tue, 24 Jul 2018 23:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33cfe25b-bbcb-49ba-b250-d6de1cfec5f7</guid><dc:creator>GeorgeM</dc:creator><description>&lt;p&gt;&lt;em&gt;I never get answers in this form. is it too difficult a question or something? am I a lost cause?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Anyways, I figured it out. to anyone curious, the difference between the two examples seems to be the &lt;em&gt;ble_evt_dispatch function. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;it splits the previous ble_evt_dispatch &lt;/em&gt;into two new modes depending on if its a peripheral connection or central connection.&lt;/p&gt;
&lt;p&gt;In this case, my ble example code falls under the peripheral device category so any previous ble code would have to be funneled in the right mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>