<?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>GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96538/gatt-battery-service-client-on-nrf52820</link><description>Hello, 
 is there an example application in the nRF SDK 17.1.0 where the GATT Battery Service Client is implemented? I would like to add to my application the feature that the nRF52820 detects the battery level of all devices that send out their battery</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Feb 2023 11:57:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96538/gatt-battery-service-client-on-nrf52820" /><item><title>RE: GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/thread/411088?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2023 11:57:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:961da6d7-6a4c-4a57-ae4e-3008cd313802</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If the device is advertising, it can advertise the Battery Service. You can look at the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_hrc.html"&gt;BLE Heart Rate Collector Example&lt;/a&gt;, which uses the Battery Service. The service is added to the advertising UUIDs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static ble_uuid_t m_adv_uuids[] =                                   /**&amp;lt; Universally unique service identifiers. */
{
    {BLE_UUID_HEART_RATE_SERVICE,           BLE_UUID_TYPE_BLE},
    {BLE_UUID_BATTERY_SERVICE,              BLE_UUID_TYPE_BLE},
    {BLE_UUID_DEVICE_INFORMATION_SERVICE,   BLE_UUID_TYPE_BLE}
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing the Advertising functionality.
 */
static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = true;
    init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is a picture from the nRF Connect for Mobile app showing the heart rate collector advertising the Battery Service (0x180F):&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1676980582087v1.jpeg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/thread/410837?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2023 10:01:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f2528f0-68f0-4f1a-a5cc-881447957cfe</guid><dc:creator>Louis_263</dc:creator><description>&lt;p&gt;Hi Marte,&lt;/p&gt;
&lt;p&gt;Is it possible to find a device UUID for a device that sends out the Battery Service UUID? I have several devices that send advertisements with a certain hex sequence in the UUID (BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA), and I would like to add the Battery Service to them. When I have found out that the devices are mine (i.e. they send out a specific device UUID), I want to see if they also offer the Battery Service.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Louis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/thread/410108?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2023 14:02:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b244f5da-e671-4112-a621-347d8cffa38a</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Louis,&lt;/p&gt;
&lt;p&gt;Peer Manager is not necessary for the Battery Service, as it does not require security. You can remove the Peer Manager and use BLE events to handle security requests. For an example of this, you can look in ble_evt_handler() in the Nordic UART Service Client example (examples/ble_central/ble_app_uart_c/main.c):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
    // Pairing not supported.
    err_code = sd_ble_gap_sec_params_reply(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
    APP_ERROR_CHECK(err_code);
    break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/thread/409996?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2023 08:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27bb5301-1e51-4638-bf4a-500202666394</guid><dc:creator>Louis_263</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is the Peer Manager module absolutely necessary for the Battery Service (it is present in the Heart Rate Collector example)? In my application I only want to detect the RSSI of devices in my vicinity (this already works) and now I would like to implement that the battery status of the devices can be detected.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Louis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT Battery Service Client on nRF52820</title><link>https://devzone.nordicsemi.com/thread/409340?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2023 12:15:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d2c5235-c8a3-4bd7-8004-10d2ade7aac2</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_hrc.html"&gt;BLE Heart Rate Collector Example&lt;/a&gt; uses the Battery Service Client. You can look in the function bas_c_evt_handler() for how notifications on the Battery Level characteristics are enabled and how to read the battery level.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>