<?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>documentation and code style</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15584/documentation-and-code-style</link><description>Hello I&amp;#39;m trying to learn your API using nrf5-ble-tutorial-advertising example. Over all the example is much help and API documentation is quite good. But part of API code is obfuscated and some links in documentation are missing. There is many such places</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Aug 2016 08:04:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15584/documentation-and-code-style" /><item><title>RE: documentation and code style</title><link>https://devzone.nordicsemi.com/thread/59462?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 08:04:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68856ed2-16c7-4f23-bfef-18bcc6be6301</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi vbe,&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Maybe there is obvious way how to
find out what flags can user fill
into:&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;uint8_t              service_type;
/**&amp;lt; Bit mask identifying services that the application intends to support for all peers. */
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;If it so please tell me - how to use your
documentation to know what mask I can
fill into service_type?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I agree with your conclusion. In the struct &lt;code&gt;dm_application_param_t&lt;/code&gt;
I cannot see any references to the bitmask that shall be populated in member &lt;code&gt;.service_type&lt;/code&gt;.
As you have already found; this shall not be of a type &lt;code&gt;uint8_t&lt;/code&gt;, but of type &lt;code&gt;service_type_t&lt;/code&gt;.
Apart from this bug in the API (which I will report internally), the structure follows the SoftDevice API guidelines.&lt;/p&gt;
&lt;p&gt;I agree that using enums instead of defines is easier to maneuver in, seen from the developers POV, but you do not have full control over your types, unless you type-cast at a later point, which may cause the flow to be a bit messy.&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol start="2"&gt;
&lt;li&gt;If it is truly imperfection in
documentation - are you planning on
filling gaps in documentation in near
future? (- probably in most places
adding adding \ref would be enough)&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;A \ref should have been added here, and type changed from &lt;code&gt;uint8_t&lt;/code&gt; to &lt;code&gt;service_type_t&lt;/code&gt; to align with generic API documentation.&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Are you planning to use more enum
instead of #define in your code? Or
why would you prefer #define over
enum? I&amp;#39;m really interested - perhaps
you wanna have stronger control of
type and enum can be sometimes encoded
into uint32_t?&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Stronger control of the types is the main reason. Enums can be 8/16/32 bits, depending on compiler, optimization, and settings used. Since our stack uses SVCalls in all API calls, it is important that the sizes match on &amp;quot;both ends of the SVCalls&amp;quot;&lt;/p&gt;
&lt;p&gt;Thanks for reporting this back to us and helping us to improve our deliveries.
It is always helpful to get feedback!&lt;/p&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>