<?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>GATT database configuration in server</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51437/gatt-database-configuration-in-server</link><description>Hi, 
 I am developing smartphone controlled BLE door lock based on nRF52840. 
 The door lock is a peripheral (also GATT server) and the smartphone is central (GATT client). 
 I am now planning the services and their charasteristics, but i am stuck with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Aug 2019 12:35:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51437/gatt-database-configuration-in-server" /><item><title>RE: GATT database configuration in server</title><link>https://devzone.nordicsemi.com/thread/206625?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2019 12:35:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4e89661-500c-4a7d-86a4-a9e420b341be</guid><dc:creator>Gil</dc:creator><description>&lt;p&gt;Thanks for the insights, i will use&amp;nbsp;them to plan the system&amp;#39;s architecture.&lt;/p&gt;
&lt;p&gt;You can close the issue&lt;/p&gt;
&lt;p&gt;Gil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT database configuration in server</title><link>https://devzone.nordicsemi.com/thread/206394?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:52:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1c0dbff-e5c4-4cc7-9e0e-9df283c74b34</guid><dc:creator>cbd</dc:creator><description>&lt;p&gt;You could change the structure of the data that you send depending on the command value.&lt;/p&gt;
&lt;p&gt;For example Command to Change PIN uses the structure as we&amp;#39;ve described (with an index field added).&lt;/p&gt;
&lt;p&gt;Command to Get All PIN just has the current PIN for security and then, if you&amp;#39;ve extended the MTU, returns an array of PINs e.g. something along the lines of&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct
{
    byte PIN_Value[4];
}single_pin_t;

typedef struct
{
    byte PIN_Count;
    single_pin_t PINs[];
} char_resp_get_all_pin_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT database configuration in server</title><link>https://devzone.nordicsemi.com/thread/206383?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:36:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc15a8a9-952e-497f-a49e-0a7bade16bbf</guid><dc:creator>cbd</dc:creator><description>&lt;p&gt;Yes.&lt;/p&gt;
&lt;p&gt;In your situation it may be easier to have two characteristics, one is used to send data from the smartphone to your device and the other is used to send data from your device to the &amp;#39;phone.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By doing this it is easier to follow and debug you code.&amp;nbsp;&lt;span style="background-color:#ffffff;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;You set the notification bit for the characteristic that you are using to send data with when you update it and the receiver just handles the Characteristic changed event without any need to regularly poll (read) the characteristic value.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The Nordic NUS example code uses this principle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT database configuration in server</title><link>https://devzone.nordicsemi.com/thread/206377?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:20:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce197853-6083-41b4-93c0-88d82b8efa3e</guid><dc:creator>Gil</dc:creator><description>&lt;p&gt;I see.&lt;/p&gt;
&lt;p&gt;So, in this case, i want the smartphone to read a list of all PIN codes stored in the door (which are stored in an indexed manner), it would probably require the characteristic struct&amp;nbsp;pin_char_data_t to include an &amp;quot;PIN_Index&amp;quot; field.&lt;/p&gt;
&lt;p&gt;Did i get it right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT database configuration in server</title><link>https://devzone.nordicsemi.com/thread/206305?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 09:42:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97c0e123-7215-4cbd-bdd9-73b9c79496a1</guid><dc:creator>cbd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Why would you need to add a new characteristic for every pin code?&lt;/p&gt;
&lt;p&gt;Characteristics are just a means of passing data.&lt;/p&gt;
&lt;p&gt;For a custom characteristic you decide how you wish to interpret the data passed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For example for a range of 0 to 999,999,999 you could pass the pin code as a 32bit unsigned integer taking 4 bytes or (not recommended) as ASCII&amp;nbsp; bytes taking 9 bytes.&lt;/p&gt;
&lt;p&gt;It may be that you wish to use the same characteristic to set a new pin, in which case you could also pass the old pin as well as the new one and still use a byte to indicate the action.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So your characteristic data could be something like:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef
{
    byte command;  //enter = 0, change = 1, read = 2, reset=3
    byte PIN_Current[4]
    byte PIN_New[4]
}pin_char_data_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I would suggest though that you need to seriously look at security here.&lt;/p&gt;
&lt;p&gt;In particular I wouldn&amp;#39;t pass PIN without some form of encryption and you need to make sure that the PIN is stored securely in flash as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>