<?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>Exploring Introduction to service structure</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61727/exploring-introduction-to-service-structure</link><description>I am new to BLE and I am exploring Introduction to service. However I am stuck with Step 1 and Step 2. Is Step 1: static ble_os_t m_our_service; (to declare a service) and step 2: our_service_init(ble_os_t*m_our_service); (the error says expected expression</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Jun 2020 15:50:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61727/exploring-introduction-to-service-structure" /><item><title>RE: Exploring Introduction to service structure</title><link>https://devzone.nordicsemi.com/thread/252813?ContentTypeID=1</link><pubDate>Tue, 02 Jun 2020 15:50:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c771012-de61-4637-88b2-d563b4edc298</guid><dc:creator>destiny98</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;For Step 1 I have changed to :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;static uint16_t&amp;nbsp; m_our_service;&lt;/p&gt;
&lt;p&gt;and Step 2:&amp;nbsp;void our_service_init(ble_os_t * m_our_service);&lt;/p&gt;
&lt;p&gt;And it is able to compile. However it does not advertise successfully. I tried to refer to the forum&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial" rel="noopener noreferrer" target="_blank"&gt;here&lt;/a&gt;&amp;nbsp;about the changing the RAM_START/RAM_SIZE&amp;nbsp; for it to advertise it still does not work. What could I have done wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Exploring Introduction to service structure</title><link>https://devzone.nordicsemi.com/thread/252416?ContentTypeID=1</link><pubDate>Fri, 29 May 2020 12:46:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9412fc36-5da9-4353-9776-79f23d3000a9</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;Sorry for my late reply.&lt;br /&gt;&lt;br /&gt;The &amp;#39; conflicting types for &amp;quot;&amp;quot; &amp;#39; error is commonly caused by providing the wrong type of argument to a function or structure.&lt;br /&gt;You could read more about this error &lt;a href="https://stackoverflow.com/questions/1549631/getting-conflicting-types-for-function-in-c-why"&gt;here&lt;/a&gt; and &lt;a href="https://www.includehelp.com/c-programming-questions/what-is-conflicting-types-for-error.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;I highly recommend using Stackoverflow to troubleshoot and learn more about the intrinsic of C programming.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Exploring Introduction to service structure</title><link>https://devzone.nordicsemi.com/thread/251563?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 18:04:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70ea25c3-6005-4e09-9f8e-62ec6711a340</guid><dc:creator>destiny98</dc:creator><description>&lt;div class="author"&gt;
&lt;div class="avatar"&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/destiny98"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;
&lt;div class="content"&gt;
&lt;p&gt;Hi Karl, I tried the below code on SDK 16.0. I have referred to the replies from the Intro to services and followed some of the edits to the code to update it in SDK16.0. However I got the following error. What do they mean?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="align-left" style="float:left;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5123.Capture.PNG" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Exploring Introduction to service structure</title><link>https://devzone.nordicsemi.com/thread/251558?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 17:01:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27cc586d-2174-4b8e-ad58-b41fda8a32ce</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I am new to BLE and I am exploring Introduction to service.[/quote]
&lt;p&gt;Welcome!&amp;nbsp;&lt;/p&gt;
[quote user=""]However I am stuck with Step 1 and Step 2. Is Step 1: static ble_os_t&amp;nbsp; &amp;nbsp;m_our_service; (to declare a service) and step 2: our_service_init(ble_os_t*m_our_service); (the error says expected expression before ble_os_t).[/quote]
&lt;p&gt;How familiar are you with C and embedded programming?&lt;br /&gt;In short, we need to &lt;em&gt;declare&lt;/em&gt; that a new service exists - and then we need to fill in the empty service with the contents and functionality it will provide, by initializing it.&lt;br /&gt;A more in-depth explanation of the concepts declaration, definition and initialization &lt;a href="https://www.quora.com/What-is-the-difference-between-definition-declaration-and-initialization-in-C"&gt;can be read here&lt;/a&gt;.&lt;/p&gt;
[quote user=""]What is the way to define and initialise a service?[/quote]
&lt;p&gt;Have you retrieved the &lt;a href="https://github.com/NordicPlayground/nrf51-ble-tutorial-service"&gt;tutorials example code from the github&lt;/a&gt;?&lt;br /&gt;&lt;br /&gt;Step 1 of the tutorial calls for declaration of a service structure.&lt;br /&gt;If you check out the our_service.h file, you will see the code exempt:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief This structure contains various status information for our service. 
 * It only holds one entry now, but will be populated with more items as we go.
 * The name is based on the naming convention used in Nordic&amp;#39;s SDKs. 
 * &amp;#39;ble’ indicates that it is a Bluetooth Low Energy relevant structure and 
 * ‘os’ is short for Our Service). 
 */
typedef struct
{
    uint16_t    service_handle;     /**&amp;lt; Handle of Our Service (as provided by the BLE stack). */
}ble_os_t;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Relevant examples of other, similar, declarations can be seen in main.c, for example:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID;                        /**&amp;lt; Handle of the current connection. */&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]2: our_service_init(ble_os_t*m_our_service); (the error says expected expression before ble_os_t).[/quote]
&lt;p&gt;Here, you are supposed to pass the function the service structure you declared earlier.&lt;br /&gt;&lt;br /&gt;Looking into the our_service.h file again, we see the following exempt:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing our new service.
 *
 * @param[in]   p_our_service       Pointer to Our Service structure.
 */
void our_service_init(ble_os_t * p_our_service);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Which means that the our_service_init function takes a pointer to a ble_os_t struct as its argument.&lt;br /&gt;You must therefore provide this when you call the function, and it is done by using the referencing operator &amp;amp;, i.e passing the argument&amp;nbsp;&lt;em&gt;&amp;amp;m_our_service.&lt;/em&gt;&lt;br /&gt;You should read more about referencing and pointers in &lt;a href="https://stackoverflow.com/questions/14224831/meaning-of-referencing-and-dereferencing-in-c"&gt;this stackoverflow discussion&lt;/a&gt;, as it is crucial when working with C and embedded programming.&lt;br /&gt;&lt;br /&gt;Please let me know if anything should still be unclear!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>