<?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 Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79075/how-to-change-frequency-of-notification-subscription-of-read-value-in-ble-central-example-code</link><description>In BLE Central Example like HRS and RSCS, 
 Central has Enabled the notification when event handler find Case : BLE_RSCS/HRS_C_EVT_DISCOVERY_COMPLETE. 
 But what if we want to read the value in fixed timed interval. Which function we need to use? 
 Also</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Sep 2021 13:31:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79075/how-to-change-frequency-of-notification-subscription-of-read-value-in-ble-central-example-code" /><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/330303?ContentTypeID=1</link><pubDate>Mon, 20 Sep 2021 13:31:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17a6e27e-b8dc-43b1-b714-2533c3fc6dee</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="Vipul2988"]We are using &lt;span&gt;Lithium-thionyl chloride battery for central about 4500mAh.&lt;/span&gt;[/quote]
&lt;p&gt;That is a pretty big battery compared to the coin cells used in many Bluetooth applications (a CR2032 coin cell has a capacity of around 230mAh for comparison). You might want to have very long battery life with such a big battery, but I don&amp;#39;t expect a couple of extra writes and reads over the Bluetooth connection to make a measurable impact.&amp;nbsp;&lt;/p&gt;
[quote user="Vipul2988"]One more question here, if we subscribe notification and Unsubscribe notification uses the TX I believe, is that correct? from central to peripheral .[/quote]
&lt;p&gt;That is correct. The central is already sending empty packets to keep the connection alive, so the only difference is that you are adding a small TX packet to write to the CCCD characteristic, adding 5 bytes to the&amp;nbsp;payload (3 bytes for the ATT header, and 2 bytes for the CCCD value).&amp;nbsp;&lt;/p&gt;
[quote user="Vipul2988"]So how that will be different from reading the value from peripheral instead of enabling the notification.&amp;nbsp;[/quote]
&lt;p&gt;Good point. If the characteristic supports read then it will be more efficient to send a read request rather than to enable and disable notifications.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="Vipul2988"]I have read in so many tickets that Nordics Experts are advising to Notification function than Reading.&lt;br /&gt;what will be the best thing in this case? in terms of power and performance.&amp;nbsp;&amp;nbsp;[/quote]
&lt;p&gt;Notifications are the most efficient way to send data from the server to the client. Having the client issue reads is quite slow, since you are only able to get one packet through per connection event (the host is not able to respond to the read request immediately, and you will have to wait for the next connection event before the data is sent).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In most applications it is more important for the client to be informed every time the data changes on the server side, which is&amp;nbsp;what notifications are designed for, rather than keep the communication to an absolute minimum in order to save power.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your case it should work OK to only issue reads once in a while if you don&amp;#39;t care about receiving all the data updates, but please do some checking in order to verify that the data changes also when notifications are disabled.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Some peripheral devices might assume that you don&amp;#39;t care about data updates at all if you disable notifications, and might not update the value in the stack at all.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/330028?ContentTypeID=1</link><pubDate>Fri, 17 Sep 2021 12:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30483c35-5f1c-43b3-90f2-0081ca6734ec</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;This will really helps. Thank you..!&lt;/p&gt;
&lt;p&gt;We are using &lt;span&gt;Lithium-thionyl chloride battery for central about 4500mAh.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One more question here, if we subscribe notification and Unsubscribe notification uses the TX I believe, is that correct? from central to peripheral .&lt;br /&gt;&lt;br /&gt;So how that will be different from reading the value from peripheral instead of enabling the notification.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I have read in so many tickets that Nordics Experts are advising to Notification function than Reading.&lt;br /&gt;what will be the best thing in this case? in terms of power and performance.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329944?ContentTypeID=1</link><pubDate>Fri, 17 Sep 2021 07:44:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0dcba4a-6c5b-47e9-839e-2c36625ee81e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;What kind of battery are you using?&lt;/p&gt;
&lt;p&gt;The BLE protocol is optimized for very low power consumption, and even if you are receiving notifications every second this should not make a big impact on average system current.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since you are controlling the central you can decide the connection parameters, and by using a long connection interval you should be able to ensure that the Bluetooth connection itself doesn&amp;#39;t add a lot to the power consumption.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To estimate the average current draw with different connection parameters you can use the &lt;a href="https://devzone.nordicsemi.com/nordic/power/w/opp/2/online-power-profiler-for-ble"&gt;Online Power Profiler&lt;/a&gt;&amp;nbsp;(OPP).&amp;nbsp;&lt;br /&gt;With the OPP you can also add TX or RX data to each connection event, and see how much this affects&amp;nbsp;the average current.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That being said, if you only want to get an update on the data every 5 minutes, why can&amp;#39;t you just unsubscribe to the notifications, and subscribe again 5 minutes later?&lt;/p&gt;
&lt;p&gt;Essentially follow this flow:&lt;/p&gt;
&lt;p&gt;1) Unsubscribe to notifications&lt;br /&gt;2) Wait 5 minutes (using app_timer)&lt;br /&gt;3) Subscribe&lt;br /&gt;4) Wait until a notification is reported&amp;nbsp;&lt;br /&gt;5) Repeat from 1)&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329841?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 12:37:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af5a0681-eeb2-4914-b6ed-a56e8def5184</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have concern about battery life of the central device, peripheral is sending a notification let say 1 second interval. but I want to be notified in the interval of 5 minutes. And I can not modify the code of peripheral what should we have to do in this case.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329741?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 08:02:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d98ef426-9784-40ae-a3fb-15ac32b13666</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="Vipul2988"]Then how we can separate Notification case out of hrs_c_evt_handler?&amp;nbsp;[/quote]
&lt;p&gt;Not sure what you mean by this. Why do you need to separate the notification case out of the handler?&lt;/p&gt;
&lt;p&gt;If you want to run some code on the client side at a fixed timer interval, whether or not you get a notification from the peripheral, there is nothing stopping you from doing this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just run the repeated_timer_handler at the rate you wish, and use the old data value if no new data has been sent.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Every time the&amp;nbsp;BLE_HRS_C_EVT_HRM_NOTIFICATION event occurs you simply update the local variable, and then the next time the&amp;nbsp;&lt;span&gt;repeated_timer_handler runs it will use the new value.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;br /&gt;Torbjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329583?ContentTypeID=1</link><pubDate>Wed, 15 Sep 2021 11:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e06445fb-cb9b-4d40-9f8c-7d8549e789d3</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;Then how we can separate Notification case out of hrs_c_evt_handler?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329544?ContentTypeID=1</link><pubDate>Wed, 15 Sep 2021 08:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a7e6f49-c2fa-4831-99a4-71fb15570399</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Why have you moved the HRS client init code into the repeated_timer_handler?&lt;/p&gt;
&lt;p&gt;This code should be run during initialization, after you have initialized the BLE stack and the GAP settings, and before you start advertising or scanning.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/329291?ContentTypeID=1</link><pubDate>Tue, 14 Sep 2021 02:38:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a848327-0d32-496d-9a87-208063d7a1fd</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have tried above example in peripheral, which is working fine but when I am trying to implement on SDK 17.0.2--&amp;gt; examples--&amp;gt;ble_central --&amp;gt; ble_app_hrs_c&lt;/p&gt;
&lt;p&gt;In which I have removed battery Services. and related event handler&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;I am getting below Error:--&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;info&amp;gt; app: Heart Rate collector example started.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;info&amp;gt; app: Starting scan.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;info&amp;gt; app: Connected.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE] at C:\Nordic_Semi\nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_hrs_c\main.c:281&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;PC at: 0x00033613&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It says error at :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;// Discover peer&amp;#39;s services.&lt;br /&gt; err_code = ble_db_discovery_start(&amp;amp;m_db_disc, p_ble_evt-&amp;gt;evt.gap_evt.conn_handle);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/734176.main.c"&gt;devzone.nordicsemi.com/.../734176.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please Find Modified Main.c File&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/328967?ContentTypeID=1</link><pubDate>Fri, 10 Sep 2021 09:22:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6667a7f-732f-44f5-972b-64e37adf0e5a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I would recommend starting by reading &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/application-timer-tutorial"&gt;this blog&lt;/a&gt; on the app_timer module. It is based on an older SDK, but the app_timer module hasn&amp;#39;t changed much in recent versions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By setting up a repeated app_timer in your code you can use this to schedule notifications at a fixed interval, and you can change the interval by stopping and starting the app_timer with different settings.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/328834?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2021 12:49:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68ff1156-c61d-446c-9839-39531c399b47</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was checking ble_app_uart_c Example and I did not find any time related thing on the same.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found BLE_NUS_C_EVT_NUS_TX_EVT which is&amp;nbsp;indicating that the central received something from a peer.&lt;/p&gt;
&lt;p&gt;But no idea about how to change the timer thing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/327319?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 06:20:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04811abb-bed1-4936-a018-73790cf6a05f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="Vipul2988"]Do we have any Example on this &amp;quot; custom characteristic that allows the client to tell the server how often it should send notifications&amp;quot; ?[/quote]
&lt;p&gt;No, we don&amp;#39;t have an example for this unfortunately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to implement a custom application using a custom Bluetooth service I would recommend starting out with the ble_app_uart and ble_app_uart_c examples instead.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;They show you how to set up the Nordic UART Service (NUS), which allows you to send strings of varying length from one device to the other.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With this service it is quite straight forward to implement a custom command that lets the client instruct the server when to send notifications.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can also extend the example by adding more characteristics, in order to set up separate characteristics for sensor information and control information for instance.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/327279?ContentTypeID=1</link><pubDate>Mon, 30 Aug 2021 15:46:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02c2b9db-4af4-42a2-9bad-4f75cb9f0761</guid><dc:creator>Vipul2988</dc:creator><description>&lt;p&gt;Thank you for quick Response.&lt;/p&gt;
&lt;p&gt;I am talking about&amp;nbsp;ble_rscs_c_rsc_notif_enable()&lt;/p&gt;
&lt;p&gt;I am trying to implement it on Standard Example first than I will implement on other custom application.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do we have any Example on this &amp;quot; custom characteristic that allows the client to tell the server how often it should send notifications&amp;quot; ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?</title><link>https://devzone.nordicsemi.com/thread/327270?ContentTypeID=1</link><pubDate>Mon, 30 Aug 2021 15:14:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c05b34c6-8b94-40ae-9dc7-3d464a5b52b0</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;It is up to the device sending the notifications (the GATT server) to decide when to send them, and the Bluetooth specification doesn&amp;#39;t define any way for the client to control this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could define a custom characteristic that allows the client to tell the server how often it should send notifications, but&amp;nbsp;if you want to implement a standard GATT profile then this will not be compliant.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It sounds a bit odd that you wouldn&amp;#39;t get notifications when the value is the same, I thought this should be implemented out of the box. Do you have more information about this &amp;#39;Enable notification&amp;#39; function that you are using?&lt;/p&gt;
&lt;p&gt;Is this a part of the standard examples?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>