<?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 access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1766/how-to-access-the-device-name-characteristic</link><description>I was trying around some experiments with the Sdk 5.1 Hrs Example code.
I want to do something special (e.g. turn on a led on the nRF6100 board) when the devicename was changed by a ble central to a specific value. 
 For that, I think I have to hook</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Apr 2014 09:54:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1766/how-to-access-the-device-name-characteristic" /><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7727?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2014 09:54:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af8e5f71-0567-49f9-9db9-ee81e34c753f</guid><dc:creator>Krishna Shingala</dc:creator><description>&lt;p&gt;Hi Julian,&lt;/p&gt;
&lt;p&gt;As Balaji recommends using PStorage module in SDK can help you store the device name persistently.&lt;/p&gt;
&lt;p&gt;PStorage module is  currently used to store bonding information in persistent memory (flash on nrf51 devices). What you can do to be able to store your data is register with the module using the pstorage_register API. Note that in pstorage_platform.h for your example, increase the number of applications by 1 in order that the API succeeds. You can request 1 block of maximum_size you wish to  permit for your device name. Please note that BLE_GAP_DEVNAME_MAX_LEN limits the device name to be set locally, hence this may be a consideration to chose the maximum limit.&lt;/p&gt;
&lt;p&gt;On success of this API, you will get a reference &amp;#39;handle&amp;#39; to the persistent memory where you can store device name. Using this handle you can store and load data when you like using pstorage_store and pstorage_load functions respectively. I recommend you read PStorage &lt;a href="https://devzone.nordicsemi.com/documentation/nrf51/5.1.0/html/a00131.html"&gt;documentation&lt;/a&gt; before getting started.&lt;/p&gt;
&lt;p&gt;Things to consider:
a. You may want to store the length of local device name along with the name instead of relying in null terminated strings to be to support variable length device name with errors.
b. When registering with the PStorage module, remember that you request only multiples of 4, therefore, if you wish to maximum limit the device name to 31, you will have to request a block of size 32.
c. One entire flash page of size 1024 will be reserved even if you request 1 block of size 32.&lt;/p&gt;
&lt;p&gt;Hope this helps!&lt;/p&gt;
&lt;p&gt;Regards,
Krishna&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7728?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2014 09:24:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62d14559-2d24-4512-bd5d-cb533e54e6cd</guid><dc:creator>Juliane</dc:creator><description>&lt;p&gt;Hi Balaji,&lt;/p&gt;
&lt;p&gt;It is the best way to solve my problem,but I don&amp;#39;t know how can I achieve that,is there any example for my problem?&lt;/p&gt;
&lt;p&gt;Thanks!
Juliane&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7726?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2014 09:15:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cd32aa3-9a6f-493a-88e6-67fedb180118</guid><dc:creator>Balaji Srinivasan</dc:creator><description>&lt;p&gt;Hi Juliane,&lt;/p&gt;
&lt;p&gt;Once the IOS app writes to the Device Name characteristic, you will have to store it in flash at a predefined location. Each time the app starts up (from System Off mode), it should read that location and advertise with that device name. You can use the pstorage module included in the SDK to do the flash operation.&lt;/p&gt;
&lt;p&gt;Does it answer your question?&lt;/p&gt;
&lt;p&gt;Cheers,
Balaji&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7725?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2014 07:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05ea3b79-a30f-4f0c-b94b-b74092b5a35e</guid><dc:creator>Juliane</dc:creator><description>&lt;p&gt;Hi Balaji,&lt;/p&gt;
&lt;p&gt;If I want to chang the device name by an IOS APP ,how can I do with my application ble_app_hrs?&lt;/p&gt;
&lt;p&gt;I am  looking forward to your reply.
Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7721?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2014 06:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51752e13-913b-469e-b928-f03f78712e12</guid><dc:creator>Juliane</dc:creator><description>&lt;p&gt;Hi Joe,&lt;/p&gt;
&lt;p&gt;I want to chang the device name by a central app,and next time ,device advertise the changed name .how can i achive that ,and could you share the solution with me?&lt;/p&gt;
&lt;p&gt;thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7724?ContentTypeID=1</link><pubDate>Mon, 03 Mar 2014 12:25:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adbc33c1-24fd-4abf-aaab-402acee018b5</guid><dc:creator>Balaji Srinivasan</dc:creator><description>&lt;p&gt;Yes. It is a good idea to check the &amp;#39;type&amp;#39; as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7723?ContentTypeID=1</link><pubDate>Mon, 03 Mar 2014 12:17:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e96d8e6a-e6e8-46cc-aa48-b2dc6c7a7d71</guid><dc:creator>Joe Merten</dc:creator><description>&lt;p&gt;Yep, that works!&lt;/p&gt;
&lt;p&gt;But I have to access to char_uuid.uuid.
Should I also check for
char_uuid.type == BLE_UUID_TYPE_BLE
or is that not necessary?&lt;/p&gt;
&lt;p&gt;Regarding write.data: That data array isn&amp;#39;t zero terminated right? That&amp;#39;s the reason why I also have to consider write.data.&lt;/p&gt;
&lt;p&gt;Funny: I can set a device name that includes zero bytes.
And Utf-8 looks well supported e.g. in Android nRF MCP:
$ gatttool -b C2:73:79:CE:FC:0E --char-write --handle=0x0003 --value=48616C6C6F20F09F988E&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access the Device Name Characteristic</title><link>https://devzone.nordicsemi.com/thread/7722?ContentTypeID=1</link><pubDate>Mon, 03 Mar 2014 10:00:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc772d8f-49bf-4352-b84d-062b1e21e5fc</guid><dc:creator>Balaji Srinivasan</dc:creator><description>&lt;p&gt;Hi Joe,&lt;/p&gt;
&lt;p&gt;@TODO JM: is there a better way?&lt;/p&gt;
&lt;p&gt;The UUID of the Device name characteristic is 0x2A00. So you can do something like this..&lt;/p&gt;
&lt;p&gt;[i]if (p_ble_evt-&amp;gt;evt.gatts_evt.params.write.context.char_uuid == BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME)
[/i]
instead of&lt;/p&gt;
&lt;p&gt;&lt;em&gt;if (p_evt_write-&amp;gt;handle == 3)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The macro BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME is defined to 0x2A00 in ble_types.h.&lt;/p&gt;
&lt;p&gt;@How to access the Device Name&lt;/p&gt;
&lt;p&gt;You can retrieve the device name from the field &lt;em&gt;p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data&lt;/em&gt;. The length of the device name will be in &lt;em&gt;p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;Cheers,
Balaji&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>