<?xml-stylesheet type="text/xsl" href="https://test-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/"><channel><title>Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><description>Before we begin
Table of content
Topics that will be covered include:



Before we begin
Basic theory
Attribute tables in nRFConnect Bluetooth Low Energy application
Description of the example
Adding a characteristic
Updating the characteristic and s</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Fri, 23 Jul 2021 04:28:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user106362</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;How to make characteristic value a string according to this tutorial?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Mon, 17 May 2021 21:14:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user104041</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello all i followed the tutorial and is a brilliant one must say but when i use another app_timer instance for to update second characteristic value the code compiles without any errors but nrf connect app doesnt show nordic blinky device.&amp;nbsp;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Sat, 31 Oct 2020 20:23:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user90768</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span&gt;I will agree with all previous commented this post by saying that this is a really helpful and to the point tutorial especially for newcomers. I just want to report a tiny error. At step 2.E the call to&amp;nbsp;our_char_add must be added at the end of&amp;nbsp;our_service_init in order to see the empty characteristic.&lt;br /&gt;Once again excellent work and thank you so much.&lt;/span&gt;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Mon, 06 Apr 2020 22:12:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user89362</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;A general question on characteristic length. In your example (Step 2.h) you set the length to 4 bytes. How large could you theoretically make this?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Thu, 19 Mar 2020 13:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user5297</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Vasiliy, I followed the steps you mentioned, but at &amp;quot;if ((p_evt_write-&amp;gt;handle == p_our_service-&amp;gt;characteristic1_value_write_handler.value_handle))&amp;quot; I get a compiler error: Error[Pe154]: expression must have struct or union type. It seems that &amp;#39;value_handle&amp;#39; is not part of characteristic1_value_write_handler? Any tips what I did wrong?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Sun, 19 Jan 2020 23:56:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user78859</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;&lt;strong&gt;Receiving (retrieve or write) values from characteristics and making use of them. Step by Step:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I used &amp;quot;&lt;a href="/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial"&gt;Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial&lt;/a&gt;&amp;quot; to build on top of what they have (SDK 15).&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In main.c somewhere at the top of the file add the write handler&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:be1d1b90-b8b4-4f40-a50b-c1f9000cd7e8:type=c_cpp&amp;text=%2F%2F%20BLE_WRITE%3A%0D%0A%2F%2A%2A%40brief%20Function%20for%20handling%20write%20events%20to%20the%20LED%20characteristic.%0D%0A%20%2A%0D%0A%20%2A%20%40param%5Bin%5D%20characteristic1_value%20%20%20%20%20value%20that%20was%20received%20from%20the%20phone%0D%0A%20%2A%2F%0D%0A%2F%2F%20called%20from%20our_services.c%20from%20on_write%28%29%3B%0D%0A%2F%2F%20Make%20a%20note%20of%20the%20arguments%20that%20are%20passed%20to%20this%20handler%2C%20we%20will%20use%20that%20later%20on%0D%0Astatic%20void%20characteristic1_value_write_handler%28uint32_t%20characteristic1_value%29%0D%0A%7B%0D%0A%09NRF_LOG_INFO%28%22We%20have%20received%20the%20characteristic1%20value%20into%20our%20App%3A%20%20%25d%22%2C%20characteristic1_value%29%3B%0D%0A%7D%0D%0A%2F%2F%20Add%20other%20handlers%20here...%0D%0A]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In our_service.h file, you need to add the init structure at the top of the file.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:dde544eb-37b8-45dc-beae-ee614371f5d2:type=c_cpp&amp;text=%2F%2F%20BLE_WRITE%3A%0D%0A%2F%2A%2A%20%40brief%20Our%20Service%20init%20structure.%20This%20structure%20contains%20all%20options%20and%20data%20needed%20for%0D%0A%20%2A%20%20%20%20%20%20%20%20initialization%20of%20the%20service.%2A%2F%0D%0A%20%2F%2F%20This%20is%20used%20to%20pass%20the%20write%20handlers%20for%20different%20characteristics%20from%20main.c%0D%0A%20%2F%2F%20This%20is%20essentially%20like%20public%20constructor.%20All%20of%20the%20content%20will%20be%20copied%20to%20instance.%0D%0A%20%2F%2F%20Note%20that%20%22uint32_t%20characteristic1_value%22%20part%20had%20to%20match%20from%20Step%201%0D%0Atypedef%20void%20%28%2Able_os_characteristic1_value_write_handler_t%29%20%28uint32_t%20characteristic1_value%29%3B%0D%0A%0D%0A%2F%2F%20Add%20other%20handlers%20here...%0D%0Atypedef%20struct%0D%0A%7B%0D%0A%09%2F%2A%2A%3C%20Event%20handler%20to%20be%20called%20when%20the%20Characteristic1%20is%20written%20%2A%2F%0D%0A%20%20%20%20ble_os_characteristic1_value_write_handler_t%20characteristic1_value_write_handler%3B%20%0D%0A%20%20%20%20%2F%2F%20Add%20other%20handlers%20here...%0D%0A%0D%0A%7D%20ble_os_init_t%3B%0D%0A%0D%0A]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In our_service.h file modify the structure.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:71603e6c-32de-4ba7-9601-6499a17fbcd5:type=c_cpp&amp;text=%2F%2F%20This%20structure%20contains%20various%20status%20information%20for%20our%20service.%20%0D%0A%2F%2F%20The%20name%20is%20based%20on%20the%20naming%20convention%20used%20in%20Nordics%20SDKs.%20%0D%0A%2F%2F%20%27ble%20indicates%20that%20it%20is%20a%20Bluetooth%20Low%20Energy%20relevant%20structure%20and%20%0D%0A%2F%2F%20os%20is%20short%20for%20Our%20Service%29.%20%0D%0Atypedef%20struct%0D%0A%7B%0D%0A%20%20%20%20uint16_t%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20conn_handle%3B%20%20%20%20%2F%2A%2A%3C%20Handle%20of%20the%20current%20connection%20%28as%20provided%20by%20the%20BLE%20stack%2C%20is%20BLE_CONN_HANDLE_INVALID%20if%20not%20in%20a%20connection%29.%2A%2F%20%20%2F%2F%20keeps%20track%20of%20the%20current%20connection%20and%20has%20nothing%20to%20do%20with%20attribute%20table%20handles%0D%0A%20%20%20%20uint16_t%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20service_handle%3B%20%2F%2A%2A%3C%20Handle%20of%20Our%20Service%20%28as%20provided%20by%20the%20BLE%20stack%29.%20%2A%2F%0D%0A%0D%0A%09...%0D%0A%20%20%20%0D%0A%20%20%20%20%2F%2F%20BLE_WRITE%3A%20Write%20handlers.%20Upon%20BLE%20write%2C%20these%20handler%20will%20be%20called.%20Their%20implementation%20is%20in%20the%20main.c%0D%0A%20%20%20%20ble_os_characteristic1_value_write_handler_t%20characteristic1_value_write_handler%3B%20%20%2F%2A%2A%3C%20Event%20handler%20to%20be%20called%20when%20the%20Characteristic1%20is%20written.%20%2A%2F%0D%0A%20%20%20%20%2F%2F%20Add%20other%20handlers%20here...%0D%0A%0D%0A%7Dble_os_t%3B%0D%0A]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In our_service.c file modify the function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:ab707d82-5161-4cff-974f-cd6f6463c39e:type=c_cpp&amp;text=%2F%2A%2A%40brief%20Function%20for%20initiating%20our%20new%20service.%0D%0A%20%2A%0D%0A%20%2A%20%40param%5Bin%5D%20%20%20p_our_service%20%20%20%20%20%20%20%20Our%20Service%20structure.%0D%0A%20%2A%20%40param%5Bin%5D%20%20%20init%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Our%20Service%20init%20structure.%20%28BLE_WRITE%29%0D%0A%20%2A%0D%0A%20%2A%2F%0D%0Avoid%20our_service_init%28ble_os_t%20%2A%20p_our_service%2C%20ble_os_init_t%20%2A%20init%29%0D%0A%7B%0D%0A%20%20%20%20uint32_t%20%20%20err_code%3B%20%2F%2F%20Variable%20to%20hold%20return%20codes%20from%20library%20and%20softdevice%20functions%0D%0A%0D%0A%09...%0D%0A%20%20%20%20%0D%0A%20%20%20%20%2F%2F%20BLE_WRITE%3A%20transfer%20the%20pointers%20from%20the%20init%20instance%20to%20the%20module%20instance%0D%0A%20%20%20%20p_our_service-%3Echaracteristic1_value_write_handler%20%3D%20init-%3Echaracteristic1_value_write_handler%3B%0D%0A%0D%0A%09...%0D%0A%20%20%20%20%0D%0A%20%20%20%20APP_ERROR_CHECK%28err_code%29%3B%0D%0A%7D%0D%0A]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In main.c file modify the function. We have to init our service module and let it know about the write handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4ab1bd47-6b82-4489-91f9-22da6e1dca0a:type=c_cpp&amp;text=%2F%2A%2A%40brief%20Function%20for%20initializing%20services%20that%20will%20be%20used%20by%20the%20application.%0D%0A%20%2A%2F%0D%0Astatic%20void%20services_init%28void%29%0D%0A%7B%0D%0A%20%20%20%20ret_code_t%20%20%20%20%20%20%20%20%20err_code%3B%0D%0A%20%20%20%20nrf_ble_qwr_init_t%20qwr_init%20%3D%20%7B0%7D%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20%2F%2F%20BLE_WRITE%3A%20Initialize%20Our%20Service%20module.%0D%0A%20%20%20%20ble_os_init_t%20init%20%3D%20%7B0%7D%3B%20%2F%2F%20Init%20Our%20Service%20module%0D%0A%20%20%20%20init.characteristic1_value_write_handler%20%3D%20characteristic1_value_write_handler%3B%0D%0A%20%20%20%20%2F%2F%20Add%20other%20handlers%20here...%0D%0A%0D%0A%20%20%20%20...%20%0D%0A%0D%0A%09%2F%2F%20BLE_WRITE%3A%20We%20need%20to%20add%20the%20init%20instance%20pointer%20to%20our%20service%20instance%20%0D%0A%20%20%20%20%2F%2F%20Initialize%20our%20service%20%0D%0A%20%20%20%20our_service_init%28%26m_our_service%2C%20%26init%29%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20...%0D%0A%0D%0A%7D%0D%0A]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In main.c file, make sure that the following macro exists.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:41884e35-09c3-4e99-aad6-676915d0ee5d:type=c_cpp&amp;text=%2F%2A%2A%40brief%20Function%20for%20initializing%20the%20BLE%20stack.%0D%0A%20%2A%0D%0A%20%2A%20%40details%20Initializes%20the%20SoftDevice%20and%20the%20BLE%20event%20interrupt.%0D%0A%20%2A%2F%0D%0Astatic%20void%20ble_stack_init%28void%29%0D%0A%7B%0D%0A%20%20%20%20ret_code_t%20err_code%3B%0D%0A%0D%0A%20%20%20%20...%0D%0A%0D%0A%20%20%20%20%2F%2F%20BLE_WRITE%3A%20Make%20sure%20this%20macro%20exists%0D%0A%20%20%20%20%2F%2F%20OUR_JOB%3A%20Step%203.C%20Call%20ble_our_service_on_ble_evt%28%29%20to%20do%20housekeeping%20of%20ble%20connections%20related%20to%20our%20service%20and%20characteristics%0D%0A%20%20%20%20%2F%2F%20Needed%20for%20associating%20the%20observer%20with%20the%20event%20handler%20of%20the%20service%0D%0A%20%20%20%20NRF_SDH_BLE_OBSERVER%28m_our_service_observer%2C%20APP_BLE_OBSERVER_PRIO%2C%20ble_our_service_on_ble_evt%2C%20%28void%2A%29%20%26m_our_service%29%3B%20%2F%2F%20Modules%20that%20want%20to%20be%20notified%20about%20SoC%20events%20must%20register%20the%20handler%20using%20this%20macro.%0D%0A%0D%0A%7D%0D%0A]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In our_service.c file modify the function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:27e73f2d-d0c2-420b-8217-938b6313525e:type=c_cpp&amp;text=%2F%2F%20ALREADY_DONE_FOR_YOU%3A%20Declaration%20of%20a%20function%20that%20will%20take%20care%20of%20some%20housekeeping%20of%20ble%20connections%20related%20to%20our%20service%20and%20characteristic%0D%0Avoid%20ble_our_service_on_ble_evt%28ble_evt_t%20const%20%2A%20p_ble_evt%2C%20void%20%2A%20p_context%29%0D%0A%7B%0D%0A%20%20%20%20ble_os_t%20%2A%20p_our_service%20%3D%28ble_os_t%20%2A%29%20p_context%3B%20%20%0D%0A%20%20%20%20%2F%2F%20OUR_JOB%3A%20Step%203.D%20Implement%20switch%20case%20handling%20BLE%20events%20related%20to%20our%20service.%20%0D%0A%09%0D%0A%20%20%20%20switch%28p_ble_evt%20-%3E%20header.evt_id%29%0D%0A%20%20%20%20%7B%0D%0A%09%09%0D%0A%09%09...%0D%0A%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20BLE_WRITE%3A%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20Write%3A%20Data%20was%20received%20to%20the%20module%0D%0A%20%20%20%20%20%20%20%20case%20BLE_GATTS_EVT_WRITE%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20on_write%28p_our_service%2C%20p_ble_evt%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20default%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%2F%2F%20No%20implementation%20needed%0D%0A%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%7D%0D%0A%09%0D%0A%7D%0D%0A]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In our_service.c somewhere at the top of the file add this function&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:9a160a6e-dca4-4ca8-8f2a-7797931fccce:type=c_cpp&amp;text=%2F%2F%20BLE_WRITE%3A%0D%0A%2F%2A%2A%40brief%20Function%20for%20handling%20the%20Write%20event.%0D%0A%20%2A%0D%0A%20%2A%20%40param%5Bin%5D%20p_our_service%20%20%20%20%20Our%20Service%20structure.%0D%0A%20%2A%20%40param%5Bin%5D%20p_ble_evt%20%20%20%20%20%20%20%20%20Event%20received%20from%20the%20BLE%20stack.%0D%0A%20%2A%2F%0D%0Astatic%20void%20on_write%28ble_os_t%20%2A%20p_our_service%2C%20ble_evt_t%20const%20%2A%20p_ble_evt%29%0D%0A%7B%0D%0A%20%20%20%20NRF_LOG_INFO%28%22on_write%3A%20called%22%29%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20ble_gatts_evt_write_t%20const%20%2A%20p_evt_write%20%3D%20%26p_ble_evt-%3Eevt.gatts_evt.params.write%3B%0D%0A%0D%0A%20%20%20%20%0D%0A%0D%0A%20%20%20%20if%20%28%28p_evt_write-%3Ehandle%20%3D%3D%20p_our_service-%3Echaracteristic1_value_write_handler.value_handle%29%29%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20NRF_LOG_INFO%28%22characteristic1_value%3A%20Write%20Happened%21%22%29%3B%0D%0A%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20Make%20sure%20that%20the%20data%20is%204%20bytes%20%28or%20whatever%20the%20size%20of%20your%20characteristic%29%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20It%20has%20to%20match%20the%20exact%20byte%20size%20of%20the%20characteristic%20to%20avoid%20problems%0D%0A%20%20%20%20%20%20%20%20int8_t%20len%20%3D%20p_evt_write-%3Elen%3B%0D%0A%20%20%20%20%20%20%20%20if%20%28len%20%21%3D%204%29%0D%0A%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20NRF_LOG_INFO%28%22ERROR%3A%20incomplete%20package%22%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20NRF_LOG_INFO%28%22len%3A%20%25d%22%2C%20len%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20return%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20Data%20must%20be%20sent%20from%20in%20Little%20Endian%20Format%20and%204%20bytes%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20Convert%20the%20little%20endian%204%20bytes%20of%20data%20into%2032%20bit%20unsigned%20int%0D%0A%20%20%20%20%20%20%20%20uint32_t%20%2Acharacteristic1_value_adr%3B%0D%0A%20%20%20%20%20%20%20%20uint32_t%20characteristic1_value_val%3B%0D%0A%20%20%20%20%20%20%20%20characteristic1_value_adr%20%3D%20%28uint32_t%2A%29%20p_evt_write-%3Edata%3B%0D%0A%20%20%20%20%20%20%20%20characteristic1_value_val%20%3D%20%2Acharacteristic1_value_adr%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20NRF_LOG_INFO%28%22characteristic1_value%3A%20%25d%22%2C%20characteristic1_value_val%29%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20Call%20the%20write%20handler%20function.%20Implementation%20is%20in%20the%20main.%0D%0A%20%20%20%20%20%20%20%20p_our_service-%3Echaracteristic1_value_write_handler%28characteristic1_value_val%29%3B%0D%0A%20%20%20%20%20%20%20%0D%0A%20%20%20%20%7D%0D%0A%0D%0A%7D%0D%0A]&lt;/span&gt;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Fri, 25 Oct 2019 20:48:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user75267</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;First of all, thanks a lot for very useful tutorials, it&amp;#39;s very enjoyable seeing you try to make things easy and understandable!&lt;/p&gt;
&lt;p&gt;Then a question: can I use this procedure to add new service to nordic samples? just add new NewService and add just as done in main.c?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Thu, 29 Aug 2019 13:55:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user82673</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I can&amp;#39;t figure out how to write from central to peripheral&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:358f5b60-db96-4301-a6ce-b8667adf88ee:type=text&amp;text=void%20button_press_update%28ble_os_t%20%2Ap_our_service%2C%20int%20%2Agpio_val%29%20%7B%0D%0A%20%20if%20%28p_our_service-%3Econn_handle%20%21%3D%20BLE_CONN_HANDLE_INVALID%29%20%7B%0D%0A%20%20%20%20uint16_t%20len%20%3D%201%3B%0D%0A%20%20%20%20ble_gatts_hvx_params_t%20hvx_params%3B%0D%0A%20%20%20%20memset%28%26hvx_params%2C%200%2C%20sizeof%28hvx_params%29%29%3B%0D%0A%0D%0A%20%20%20%20hvx_params.handle%20%3D%20p_our_service-%3Echar_handles.value_handle%3B%0D%0A%20%20%20%20hvx_params.type%20%3D%20BLE_GATT_HVX_NOTIFICATION%3B%0D%0A%20%20%20%20hvx_params.offset%20%3D%200%3B%0D%0A%20%20%20%20hvx_params.p_len%20%3D%20%26len%3B%0D%0A%20%20%20%20hvx_params.p_data%20%3D%20%28uint8_t%20%2A%29gpio_val%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20sd_ble_gatts_hvx%28p_our_service-%3Econn_handle%2C%20%26hvx_params%29%3B%0D%0A%20%20%7D%0D%0A%20%20%0D%0A%20%20%2F%2Fworks%2C%20i%20tried%20reversing%20%0D%0A%20%20%0D%0A%20%20%20hvx_params.p_data%20%3D%20%28uint8_t%20%2A%29gpio_val%3B%0D%0A%20%20%20%0D%0A%20%20%20%2F%2Fbut%20without%20effect]&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Thu, 25 Jul 2019 13:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user81983</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span&gt;Hello Nordic! Thanks a lot for these three tutorials!&amp;nbsp;They are really helpfull&lt;/span&gt;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Wed, 12 Jun 2019 01:48:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user78859</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;strong&gt;Adding Multiple Characteristics to your Service and updating their values, Step by Step:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I used &amp;quot;Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial&amp;quot; to build on top of what they have (SDK 15)&lt;br /&gt;&lt;a rel="nofollow" target="_blank" href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial"&gt;devzone.nordicsemi.com/.../ble-characteristics-a-beginners-tutorial&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Step 1.&lt;/strong&gt;&lt;br /&gt;You would need to create another 16-bit characteristic UUID&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:7adab0c9-4537-4ba2-8528-1eced8cd72c1:type=c_cpp&amp;text=%23define%20BLE_UUID_CHARACTERISTIC_1%200xBEEF%20%2F%2F%20Just%20a%20random%2C%20but%20recognizable%20value%0D%0A%23define%20BLE_UUID_CHARACTERISTIC_2%200xB00B]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2.&lt;/strong&gt;&lt;br /&gt;In our_service.h navigate to Step 2.D where we define the structure ble_os_t.&lt;/p&gt;
&lt;p&gt;We need to add the characteristic handles to our structure. We will be using these handle instances when updating a corresponding characteristic.&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4e873fd2-b602-43c4-9227-517f5749caec:type=c_cpp&amp;text=ble_gatts_char_handles_t%20char_handles_1%3B%20%2F%2F%20Adding%20handles%20for%20the%20characteristic%20to%20our%20structure%0D%0Able_gatts_char_handles_t%20char_handles_2%3B%20%2F%2F%20Adding%20handles%20for%20the%20characteristic%20to%20our%20structure]&lt;/p&gt;
&lt;p&gt;The code should look something like that:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:a3145262-3930-454b-b55c-d7e1d7d9e59e:type=c_cpp&amp;text=typedef%20struct%0D%0A%7B%0D%0Auint16_t%20conn_handle%3B%20%2F%2A%2A%3C%20Handle%20of%20the%20current%20connection%20%28as%20provided%20by%20the%20BLE%20stack%2C%20is%20BLE_CONN_HANDLE_INVALID%20if%20not%20in%20a%20connection%29.%2A%2F%20%2F%2F%20keeps%20track%20of%20the%20current%20connection%20and%20has%20nothing%20to%20do%20with%20attribute%20table%20handles%0D%0Auint16_t%20service_handle%3B%20%2F%2A%2A%3C%20Handle%20of%20Our%20Service%20%28as%20provided%20by%20the%20BLE%20stack%29.%20%2A%2F%0D%0A%2F%2F%20OUR_JOB%3A%20Step%202.D%2C%20Add%20handles%20for%20the%20characteristic%20attributes%20to%20our%20struct%0D%0Able_gatts_char_handles_t%20char_handles_1%3B%20%2F%2F%20Adding%20handles%20for%20the%20characteristic%20to%20our%20structure%0D%0Able_gatts_char_handles_t%20char_handles_2%3B%20%2F%2F%20Adding%20handles%20for%20the%20characteristic%20to%20our%20structure%0D%0A%0D%0A%7Dble_os_t%3B]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3.&lt;/strong&gt;&lt;br /&gt;Add an extra characteristic&lt;br /&gt;In our_services.c create a copy of the our_char_add which will create a new characteristic. You should assign it a different name. You should assign it a unique UUID. You must assign it a unique characteristic handle (such as char_handles_1 and char_handles_2). You may choose to set different max_len depending on your application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:081270d1-d345-4af3-a561-44756217f90a:type=c_cpp&amp;text=static%20uint32_t%20our_char_add_1%28ble_os_t%20%2A%20p_our_service%29%0D%0A%7B%0D%0A...%0D%0A%0D%0A%2F%2F%20OUR_JOB%3A%20Step%202.A%2C%20Add%20a%20custom%20characteristic%20UUID%0D%0Achar_uuid.uuid%20%3D%20BLE_UUID_CHARACTERISTIC_1%3B%20%2F%2F%20specifying%20our%20characteristic%20UUID%20%2816-bit%29%0D%0A%0D%0A...%0D%0A%0D%0A%2F%2F%20OUR_JOB%3A%20Step%202.E%2C%20Add%20our%20new%20characteristic%20to%20the%20service.%20%0D%0Aerr_code%20%3D%20sd_ble_gatts_characteristic_add%28p_our_service-%3Eservice_handle%2C%20%2F%2F%20adding%20a%20service%20handle%20to%20the%20attribute%20table%0D%0A%26char_md%2C%20%2F%2F%20adding%20characteristic%20metadata%20to%20the%20attribute%20table%0D%0A%26attr_char_value%2C%20%2F%2F%20adding%20the%20attribute%20characteristic%20value%20to%20the%20attribute%20table%0D%0A%26p_our_service-%3Echar_handles_1%29%3B%20%2F%2F%20adding%20characteristic%20handles%20to%20the%20attribute%20table%0D%0A%0D%0A...%0D%0A%7D%0D%0A%0D%0Astatic%20uint32_t%20our_char_add_2%28ble_os_t%20%2A%20p_our_service%29%0D%0A%7B%0D%0A...%0D%0A%0D%0Achar_uuid.uuid%20%3D%20BLE_UUID_CHARACTERISTIC_2%3B%20%2F%2F%20specifying%20our%20characteristic%20UUID%20%2816-bit%29%0D%0A%0D%0A...%0D%0A%0D%0Aerr_code%20%3D%20sd_ble_gatts_characteristic_add%28p_our_service-%3Eservice_handle%2C%20%2F%2F%20adding%20a%20service%20handle%20to%20the%20attribute%20table%0D%0A%26char_md%2C%20%2F%2F%20adding%20characteristic%20metadata%20to%20the%20attribute%20table%0D%0A%26attr_char_value%2C%20%2F%2F%20adding%20the%20attribute%20characteristic%20value%20to%20the%20attribute%20table%0D%0A%26p_our_service-%3Echar_handles_2%29%3B%20%2F%2F%20adding%20characteristic%20handles%20to%20the%20attribute%20table%0D%0A%0D%0A...%0D%0A%7D%0D%0A%0D%0A]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4.&lt;/strong&gt;&lt;br /&gt;Now we will be initialising those characteristics.&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4c32db76-6847-4213-83e0-3fa0e833541e:type=c_cpp&amp;text=void%20our_service_init%28ble_os_t%20%2A%20p_our_service%29%0D%0A%7B%0D%0A...%0D%0A%0D%0A%2F%2F%20OUR_JOB%3A%20Call%20the%20function%20our_char_add%28%29%20to%20add%20our%20new%20characteristic%20to%20the%20service.%20%0D%0Aour_char_add_1%28p_our_service%29%3B%0D%0Aour_char_add_2%28p_our_service%29%3B%0D%0A%0D%0A...%0D%0A%7D]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Step 5.&lt;/strong&gt;&lt;br /&gt;Now let&amp;#39;s make a function that updates the characteristics. Basically, you would clone your update function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:0a3d18d0-9076-46f4-9715-4a8e4fe08c3d:type=c_cpp&amp;text=void%20characteristic_value_update_1%28ble_os_t%20%2Ap_our_service%2C%20char%20machine_serial_number%5B%5D%29%0D%0A%7B%0D%0A...%0D%0A%0D%0Ahvx_params.handle%20%3D%20p_our_service%20-%3E%20char_handles_1.value_handle%3B%20%2F%2F%20the%20handle%20needs%20to%20know%20what%20%0D%0A%0D%0A...%0D%0A%7D%0D%0A%0D%0Avoid%20characteristic_value_update_2%28ble_os_t%20%2Ap_our_service%2C%20char%20machine_serial_number%5B%5D%29%0D%0A%7B%0D%0A...%0D%0A%0D%0Ahvx_params.handle%20%3D%20p_our_service%20-%3E%20char_handles_2.value_handle%3B%20%2F%2F%20the%20handle%20needs%20to%20know%20what%20%0D%0A%0D%0A...%0D%0A%7D%0D%0A%0D%0A]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Enjoy!!&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Wed, 22 May 2019 09:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user74423</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a working example up to the 3.I but have a small problem :&lt;/p&gt;
&lt;p&gt;the peripheral is running, the connection is establieshed between peripheral and central... I have replace the temperature by a counter... so +1 every seconde&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-489c4284-21be-45fa-a6b0-c6c7d277556c/pastedimage1558517159665v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;When I click on the toggle button notification in NRF connect, the&amp;nbsp;value of the client carateristic&amp;nbsp;is 0x0001 but when I click I have the message disconnection on the peripheral !!&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand why.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-489c4284-21be-45fa-a6b0-c6c7d277556c/pastedimage1558517004581v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Wed, 22 May 2019 09:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user74423</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Tue, 21 May 2019 07:03:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user79875</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;where exactly are the tutorials?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Tue, 14 May 2019 21:48:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user78859</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks a lot for these three tutorials! Really helped me to understand what is going on!&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial</link><pubDate>Wed, 24 Apr 2019 18:15:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489c4284-21be-45fa-a6b0-c6c7d277556c</guid><dc:creator>user74182</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks a lot for the tutorial! However I&amp;#39;m looking for the same thing but for the client side. How to enable notification and read from a peripheral that is notifying a custom value. Could somebody please point me in the right direction?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1175&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>