<?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>Is my understanding of BLE model wrong?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16595/is-my-understanding-of-ble-model-wrong</link><description>Through a few days of studying, I now decided that: (please correct any statements I said wrong below) 
 
 
 The BLE is more friendly to object oriented programming 
 
 
 The BLE focus more on OOP concepts like Objects and Events, instead of transmission</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Sep 2016 22:58:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16595/is-my-understanding-of-ble-model-wrong" /><item><title>RE: Is my understanding of BLE model wrong?</title><link>https://devzone.nordicsemi.com/thread/63486?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 22:58:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b44af6b6-8ef0-4139-9fab-c7c9317e9e0e</guid><dc:creator>Bill Siever</dc:creator><description>&lt;p&gt;No, that&amp;#39;s not at all what I meant.  I was assuming you when you meant &amp;quot;struct&amp;quot; you meant a C struct (record). You can not directly use an arbitrary C struct for a service.  You can use the concept of a struct and convert it into a service programmatically.  For example, given this set of data elements:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;struct RemoteControlCar {
   uint8 speed;  // I want this to be an unsigned 8-bit value that is readable &amp;amp; writeable
   uint8 steeringDirection // I want this to be an 8-signed value that is readable &amp;amp; writeable
   bool bumpSensor;  // This indicates the bump sensor has hit something.  It should be readable &amp;amp; notifiable.
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can use code to create a service with three characteristics that match this sort of functionality.  You do this by passing in C-structs that are used to specify the data sizes, permissions, and where the actual backing data is stored.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is my understanding of BLE model wrong?</title><link>https://devzone.nordicsemi.com/thread/63485?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2016 22:43:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e69f70d3-a196-4d9b-be2f-8b9b43ffa280</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;Thank you for your very informative reply, on point 3, am I to understand that Nord Semi provided a series of lego blocks, and the best thing you can do is to build something &lt;strong&gt;resembles&lt;/strong&gt; best the picture in your mind, instead of EXACTLY the thing in your mind, because you can&amp;#39;t make your own lego blocks? Isn&amp;#39;t that kinda wasteful? I would hate to build a room Temp monitor based on a heart-rate monitor services, I could be wrong though, since the function of the two may be virtually the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is my understanding of BLE model wrong?</title><link>https://devzone.nordicsemi.com/thread/63484?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2016 23:56:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a86c425-a61d-4c13-822d-65beab4a6c7c</guid><dc:creator>Bill Siever</dc:creator><description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;BLE&amp;#39;s GATT Services/Characteristics tend to have protocols that are comparable to those often used by Objects.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;GATT is a layer of the BLE network stack.  If you are just using the GATT services all the lower level details are hidden from you. Nordic&amp;#39;s Softdevice architecture (the SXXX stuff) helps hide most of these lower level details from the application developer. You &lt;strong&gt;&lt;em&gt;DO&lt;/em&gt;&lt;/strong&gt; have to decide on the specific format yourself. So you have to worry about the kind of data, but not the low level details of how it is sent.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The way a service (or profile) is constructed depends on the specific platform.  Nordic&amp;#39;s APIs use structs to pass information.  If you are designing a specific service you have to use their API to construct the service.  You can&amp;#39;t just construct your own arbitrary struct and have it automatically converted to a service.  The conversion is somewhat mechanical, so tools could do this --- I believe Nordic&amp;#39;s plugin for Bluetooth Developer Studio would be pretty close to this.  Different embedded platforms take different approaches.
In my experience it&amp;#39;s usually a little easier to construct services on Mobile/Desktop platforms than embedded ones because of the added power of the platform (less severe memory constraints can allow for more freedom).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Your &amp;quot;server&amp;quot; would have to provide a service.  Assuming you&amp;#39;re using a Nordic device: Ideally the server would write updated values to the characteristic periodically so the data would actually change.  The client &lt;em&gt;could&lt;/em&gt; poll for it, but that&amp;#39;s a poor use of services. It would be better if the characteristic supported Notifications or Indications, which would allow the server to &amp;quot;push&amp;quot; updates to the client when they occurred. Using Nordic&amp;#39;s API you do have to use &amp;quot;&lt;code&gt;sd_ble_gatts_hvx()&lt;/code&gt;&amp;quot; to push the update.  Other platforms may automatically push updates when characteristic data is updated.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>