[SAMPLE APP][EVENT] Type definitions section added
authorMichal Pawluk <m.pawluk@samsung.com>
Fri, 21 Aug 2015 08:03:35 +0000 (10:03 +0200)
committerMichal Pawluk <m.pawluk@samsung.com>
Fri, 21 Aug 2015 09:53:52 +0000 (11:53 +0200)
Change-Id: I93cebe8f7488ae0ebd507df2c144fbb443748de5
Signed-off-by: Michal Pawluk <m.pawluk@samsung.com>
org.tizen.sampledescriptions/html/mobile_n/event_sd_mn.htm

index 25108be..ed4af18 100644 (file)
 
 <h2>Implementation</h2>
 
-<h3>Type definitions</h3>
+<h3 id="type-defs">Type definitions</h3>
+
+<pre class="prettyprint">
+/* The general structure for application's data storage. */
+struct __appdata {
+&nbsp;&nbsp;&nbsp;viewdata_s view;
+};
+</pre>
+
+<pre class="prettyprint">
+/* All the Evas_Object objects represent UI widgets. */
+struct __viewdata {
+&nbsp;&nbsp;&nbsp;Evas_Object *win;
+&nbsp;&nbsp;&nbsp;Evas_Object *conform;
+&nbsp;&nbsp;&nbsp;Evas_Object *layout_main_panel;
+&nbsp;&nbsp;&nbsp;Evas_Object *main_toolbar;
+&nbsp;&nbsp;&nbsp;Evas_Object *main_toolbar_item_system_ev;
+&nbsp;&nbsp;&nbsp;Evas_Object *main_toolbar_item_custom_ev;
+&nbsp;&nbsp;&nbsp;Evas_Object *layout_system_ev;
+&nbsp;&nbsp;&nbsp;Evas_Object *system_ev_list;
+&nbsp;&nbsp;&nbsp;Evas_Object *layout_custom_ev;
+&nbsp;&nbsp;&nbsp;Evas_Object *custom_ev_name;
+&nbsp;&nbsp;&nbsp;Evas_Object *custom_ev_submit;
+&nbsp;&nbsp;&nbsp;Evas_Object *custom_ev_list;
+&nbsp;&nbsp;&nbsp;Elm_Genlist_Item_Class *custom_ev_itc;
+&nbsp;&nbsp;&nbsp;/* The structure of callbacks handlers used by the Controller module to establish interaction with the Model module. */
+&nbsp;&nbsp;&nbsp;viewcallbacks_s *callbacks;
+};
+
+typedef struct __viewdata viewdata_s;
+</pre>
+
+<pre class="prettyprint">
+/* All the callbacks handlers are hooked by the Controller module in order to relate the control flow between the View and the Model modules. */
+struct __viewcallbacks {
+&nbsp;&nbsp;&nbsp;/* The callback handler is invoked when the custom event needs to be published. */
+&nbsp;&nbsp;&nbsp;event_do_publish_cb do_publish_cb;
+&nbsp;&nbsp;&nbsp;/* The callback handler is invoked at the initialization phase to obtain all the information about system events for UI generation purpose. */
+&nbsp;&nbsp;&nbsp;event_get_system_info_cb get_system_info_cb;
+&nbsp;&nbsp;&nbsp;/* The callback handler is invoked when the user requests to register the custom event handler. */
+&nbsp;&nbsp;&nbsp;event_set_custom_info_cb set_custom_info_cb;
+};
+
+typedef struct __viewcallbacks viewcallbacks_s;
+</pre>
+
+<pre class="prettyprint">
+/* The definition of callbacks handlers declared in the viewcallbacks_s structure. */
+&nbsp;&nbsp;&nbsp;typedef void (* event_do_publish_cb)(const char *event_name);
+&nbsp;&nbsp;&nbsp;typedef bool (* event_get_system_info_cb)(int index, void **ev_info);
+&nbsp;&nbsp;&nbsp;typedef bool (* event_set_custom_info_cb)(const char *event_name, void **ev_info);
+</pre>
+
+<pre class="prettyprint">
+/* The structure keeps all the event related information. */
+struct __system_ev_info {
+&nbsp;&nbsp;&nbsp;/* The type of the event - used only for the system events specification.
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The type is defined as an enum whose values represents all available system events. */
+&nbsp;&nbsp;&nbsp;event_type_t type;
+&nbsp;&nbsp;&nbsp;/* The name of the event. */
+&nbsp;&nbsp;&nbsp;char *name;
+&nbsp;&nbsp;&nbsp;/* The readable description of the event. */
+&nbsp;&nbsp;&nbsp;char *desc;
+&nbsp;&nbsp;&nbsp;/* The status of the event. */
+&nbsp;&nbsp;&nbsp;char *status_1;
+&nbsp;&nbsp;&nbsp;/* The status of the event. Used if the event contains up to two different status information:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Incoming message type / id; */
+&nbsp;&nbsp;&nbsp;char *status_2;
+&nbsp;&nbsp;&nbsp;/* The status of the event. Used if the event contains up to three different status information:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Bluetooth state / LE state / transferring state; */
+&nbsp;&nbsp;&nbsp;char *status_3;
+&nbsp;&nbsp;&nbsp;/* Event's callback handler function. */
+&nbsp;&nbsp;&nbsp;event_handler_h event_h;
+};
+
+typedef struct __system_ev_info system_ev_info_s;
+typedef struct __system_ev_info custom_ev_info_s;
+</pre>
+
+   <p>
+   The Model module declares two arrays:
+     <ul>
+          <li><span style="font-family: Courier New,Courier,monospace">static system_ev_info_s __system_ev[__SYSTEM_EVENT_COUNT_MAX];</span></li>
+          <li><span style="font-family: Courier New,Courier,monospace">static custom_ev_info_s __custom_ev[__CUSTOM_EVENT_COUNT_MAX];</span></li>
+         </ul>
+       which are used to store system and custom events information, respectively. The <span style="font-family: Courier New,Courier,monospace">__SYSTEM_EVENT_COUNT_MAX</span> and
+       <span style="font-family: Courier New,Courier,monospace">__CUSTOM_EVENT_COUNT_MAX</span> values are both set to 25 as an upperbound limit.
+   </p>
 
 <h3 id="app-init">Application initialization</h3>