From 706830c3dc5cb4126bfcba98809ce0c732cfcbfd Mon Sep 17 00:00:00 2001 From: Michal Pawluk Date: Mon, 24 Aug 2015 10:43:43 +0200 Subject: [PATCH] [SAMPLE APP][EVENT] Update of the "Application Initialization" section Change-Id: Ife808542d28e02a7c59eac125bf83b2d741a8121 Signed-off-by: Michal Pawluk --- .../html/mobile_n/event_sd_mn.htm | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm b/org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm index 794e36e..368ddd9 100644 --- a/org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm +++ b/org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm @@ -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 view_create_base_gui() 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 - __add_system_event_handlers() function. + __add_system_event_handlers() function (see the function's listing below). +

+

+ For reference of all model related functions that are not listed here refer to the Model section.

@@ -274,6 +277,28 @@ bool controller_init(viewdata_s *vd)
 
+static void __add_system_event_handlers(void)
+{
+   int i;
+   /* Iteration over all available system events. */
+   for (i = 0; i < model_get_system_events_count(); i++) {
+      system_ev_info_s *ev_info = NULL;
+
+      /* System's event information structure is obtained. */
+      if (!model_get_system_event_info(i, &ev_info))
+         continue;
+
+      /* Event's handler is created and a callback function is attached. */
+      model_add_system_event_handler(ev_info, __system_event_cb, (void *)ev_info);
+   }
+}
+
+ +

+ The implementation of callback functions attached in the controller_init() function is described below. +

+ +
 static void __controller_event_do_publish_cb(const char *event_name)
 {
    controller_log(DLOG_INFO, "Event publishing: '%s'.", event_name);
-- 
2.7.4