<?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>How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27894/how-to-change-the-peripheral-depends-on-battery-level</link><description>Hello All, 
 We have One central device and four peripheral devices.
From every peripheral device we are transmitting battery level. 
 I want to change the peripheral or want to connect to other peripheral when the battery level of connected peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Dec 2017 14:44:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27894/how-to-change-the-peripheral-depends-on-battery-level" /><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110070?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 14:44:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f55b727-4d9b-4e95-8fd9-cacfd9ba4f9a</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;So what happens? Have you tried to debug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110069?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 14:16:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95c62caf-7459-4175-ba1e-3b1888e73c5a</guid><dc:creator>Hrushi</dc:creator><description>&lt;p&gt;Yes I tested but its not working for me.
Even I am not able to connect using MAC ID&amp;#39;s.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why but I am getting connected only using advertising UUID&amp;#39;s.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110068?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 08:48:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a185449-abda-4c02-a48b-356f79dd9eda</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Looks like it should. Have you tested?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110067?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 08:30:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d66372-9fe5-423c-b226-b459e1cfedda</guid><dc:creator>Hrushi</dc:creator><description>&lt;p&gt;Hello Peter,&lt;/p&gt;
&lt;p&gt;I enables the static bool is_connect_per_addr = true;
and I also modified below code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (is_connect_per_addr)
        {
            if (find_peer_addr(&amp;amp;p_gap_evt-&amp;gt;params.adv_report, &amp;amp;m_target_periph_addr1))
            {
                NRF_LOG_INFO(&amp;quot;Address match send connect_request to peripheral1.&amp;quot;);
	    printf(&amp;quot;\n\rAddress match send connect_request to peripheral1.\n\r&amp;quot;);
                do_connect = true;
            }

        if (find_peer_addr(&amp;amp;p_gap_evt-&amp;gt;params.adv_report, &amp;amp;m_target_periph_addr2))
            {
                NRF_LOG_INFO(&amp;quot;Address match send connect_request peripheral2.&amp;quot;);
	    printf(&amp;quot;\n\rAddress match send connect_request to peripheral2.\n\r&amp;quot;);
                do_connect = true;
            }

	  if (find_peer_addr(&amp;amp;p_gap_evt-&amp;gt;params.adv_report, &amp;amp;m_target_periph_addr3))
            {
                NRF_LOG_INFO(&amp;quot;Address match send connect_request peripheral2.&amp;quot;);
	    printf(&amp;quot;\n\rAddress match send connect_request to peripheral2.\n\r&amp;quot;);
                do_connect = true;
            }

        }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will it work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110066?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 11:53:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee983980-e49b-4111-80fb-d1e62b0ebef7</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Why shouldn&amp;#39;t it work?&lt;/p&gt;
&lt;p&gt;Then you will have to modify the example to use something else than the service UUID. Could be the device name, the address, some manufacturer specific data. It is up to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110064?ContentTypeID=1</link><pubDate>Sat, 02 Dec 2017 08:57:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd4bebd4-5105-46ef-a544-b829c1699254</guid><dc:creator>Hrushi</dc:creator><description>&lt;p&gt;Hello  Peter,
I did the below modifications&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;case BLE_BAS_C_EVT_BATT_READ_RESP:
            NRF_LOG_INFO(&amp;quot;Battery Level Read as %d %%.&amp;quot;, p_bas_c_evt-&amp;gt;params.battery_level);
	    if(p_bas_c_evt-&amp;gt;params.battery_level &amp;lt; 40 )
	    {
		err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
		APP_ERROR_CHECK(err_code);

		scan_start();
	    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will it work?
Currently HRS example is connecting with the help of service UUID.
Then how can I connect to other peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110063?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 10:09:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7eef805-34ef-4fa0-8ff9-a695cd0b07ee</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;You disconnect with sd_ble_gap_disconnect(). Then you need to scan with sd_ble_gap_scan_start(), receive an advertisement from this other peripheral, and connect to it with sd_ble_gap_connect().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110065?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2017 15:31:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84fb2222-81d8-4873-868a-4c0727955ac1</guid><dc:creator>Hrushi</dc:creator><description>&lt;p&gt;Hello Peter,&lt;/p&gt;
&lt;p&gt;I have one central device running HRS central code and four peripheral devices running HRS peripheral code.&lt;/p&gt;
&lt;p&gt;Now my central is connected to one peripheral and that peripheral is sending battery level and HRS readings.&lt;/p&gt;
&lt;p&gt;Now I want to disconnect that peripheral if the battery level of that peripheral goes below 20% and connect to another peripheral&lt;/p&gt;
&lt;p&gt;Please guide me on how to disconnect from that device and connect to another peripheral.&lt;/p&gt;
&lt;p&gt;Best Regards,
Hrushi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change the peripheral depends on battery level?</title><link>https://devzone.nordicsemi.com/thread/110062?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2017 13:39:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60f4df94-3efc-41dd-92e8-b17dddbcb455</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Could you be a bit more specific on what you need guidance on?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>