[SAMPLE APP][EVENT] Update of the "Application Initialization" section
authorMichal Pawluk <m.pawluk@samsung.com>
Mon, 24 Aug 2015 08:43:43 +0000 (10:43 +0200)
committerMichal Pawluk <m.pawluk@samsung.com>
Tue, 25 Aug 2015 12:14:17 +0000 (14:14 +0200)
Change-Id: Ife808542d28e02a7c59eac125bf83b2d741a8121
Signed-off-by: Michal Pawluk <m.pawluk@samsung.com>
org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm

index 794e36e..368ddd9 100644 (file)
@@ -254,7 +254,10 @@ static bool __create_app(void *data)
   The first and the third callback function is called when the user performs appropriate action from the application's UI. The second callback function is called during the application's UI creation.
   The application's UI is afterwards created by the <span style="font-family: Courier New,Courier,monospace">view_create_base_gui()</span> function. Its source code is not listed
   within this documentation, as it is not a subject of this document. At the end of the initialization phase, a callback function is attached to each of the available system events within the
-  <span style="font-family: Courier New,Courier,monospace">__add_system_event_handlers()</span> function.
+  <span style="font-family: Courier New,Courier,monospace">__add_system_event_handlers()</span> function (see the function's listing below).
+  </p>
+  <p>
+  For reference of all model related functions that are not listed here refer to the <a href="#model">Model</a> section.
   </p>
 
 <pre class="prettyprint">
@@ -274,6 +277,28 @@ bool controller_init(viewdata_s *vd)
 </pre>
 
 <pre class="prettyprint">
+static void __add_system_event_handlers(void)
+{
+&nbsp;&nbsp;&nbsp;int i;
+&nbsp;&nbsp;&nbsp;/* Iteration over all available system events. */
+&nbsp;&nbsp;&nbsp;for (i = 0; i < model_get_system_events_count(); i++) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system_ev_info_s *ev_info = NULL;
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* System's event information structure is obtained. */
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!model_get_system_event_info(i, &ev_info))
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Event's handler is created and a callback function is attached. */
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;model_add_system_event_handler(ev_info, __system_event_cb, (void *)ev_info);
+&nbsp;&nbsp;&nbsp;}
+}
+</pre>
+
+  <p>
+  The implementation of callback functions attached in the <span style="font-family: Courier New,Courier,monospace">controller_init()</span> function is described below.
+  </p>
+
+<pre class="prettyprint">
 static void __controller_event_do_publish_cb(const char *event_name)
 {
 &nbsp;&nbsp;&nbsp;controller_log(DLOG_INFO, "Event publishing: '%s'.", event_name);