<?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>Understanding Zephyr example samples/bluetooth/peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67587/understanding-zephyr-example-samples-bluetooth-peripheral</link><description>I need to build a simple BLE dc motor control with a potentiometer to provide the rotational position of the motor. 
 Anyways, my first step is understanding the Nordic libraries. I opened up the Zephyr peripheral sample and have a few questions. 
 Here</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Oct 2020 14:24:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67587/understanding-zephyr-example-samples-bluetooth-peripheral" /><item><title>RE: Understanding Zephyr example samples/bluetooth/peripheral</title><link>https://devzone.nordicsemi.com/thread/276915?ContentTypeID=1</link><pubDate>Mon, 26 Oct 2020 14:24:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8e8bda9-75c4-48eb-8fe6-f9f53d70d54a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Q1. The UUID can be any value. But you need to generate it from an UUID generator. For example this:&amp;nbsp;&lt;a href="https://www.uuidgenerator.net/"&gt;https://www.uuidgenerator.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think vnd_enc and vnd_auth have any specific meaning, they are only example UUIDs used in the example.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q2. In the read call back (e.g read_vnd) you can choose if you want to change the value attribute of the attribute before you answer to the read request from the peer. In the example there isn&amp;#39;t any change and we simply assign the value to the actual value of the attribute (user_data) and response to the read command with this value.&amp;nbsp;&lt;br /&gt;Could you please try to test again with nRF Connect if you see any return ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q3. When you receive a write callback, it&amp;#39;s only the buffer contain the data for the write, the user_data doesn&amp;#39;t get written yet. In the&amp;nbsp;write_vnd() you can find that we use memcpy to write to the user_data (which is used as the value of the characteristic). If you don&amp;#39;t do anything in the callback, the data from the client will not be written to anywhere.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q4. Please double check again with NRF Connect. What I&amp;#39;m seeing here is 4 bytes when I&amp;#39;m trying to read the characteristic which match with the size of int. Please make sure you bonded with the device when you test this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Understanding Zephyr example samples/bluetooth/peripheral</title><link>https://devzone.nordicsemi.com/thread/276727?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2020 00:46:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52a2b743-0ea6-46c6-9d82-bb1a21985af1</guid><dc:creator>yayembedded</dc:creator><description>&lt;p&gt;&lt;strong&gt;Question #4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The function below is the callback for the characteristic ending in F3.&amp;nbsp; When I connect to the device and read this characteristic, I get a really long value.&amp;nbsp; What is this value? Where is it coming from?&amp;nbsp; Also, I changed the value of &lt;span style="font-family:courier new,courier;"&gt;*value = &amp;quot;foo&lt;span style="font-family:arial,helvetica,sans-serif;"&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;quot;;&lt;/span&gt;, but this foo was not returned when I did another read.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;font-family:courier new,courier;"&gt;static ssize_t read_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void *buf, u16_t len, u16_t offset)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;const char *value = attr-&amp;gt;user_data; //&amp;quot;foo&amp;quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;font-family:courier new,courier;"&gt;&amp;nbsp;return bt_gatt_attr_read(conn, attr, buf, len, offset, value,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(signed_value));&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>