Notification manager Tizen sample application
authorHarish Kumara Marappa <h.marappa@samsung.com>
Fri, 24 Apr 2015 15:54:43 +0000 (21:24 +0530)
committerUze Choi <uzchoi@samsung.com>
Wed, 29 Apr 2015 00:56:14 +0000 (00:56 +0000)
Change-Id: I5bee6c4f7ecc64e6c6085e37451ab3bedde0030f
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/825
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
12 files changed:
service/notification-manager/SConscript
service/notification-manager/SampleApp/tizen/NMSampleApp/.exportMap [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/.tproject [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/edc_resource/hosting_control.edc [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmsampleapp.h [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmutil.h [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/res/ui_controls.edc [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/shared/res/nmsampleapp.png [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/src/main.cpp [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmsampleapp.cpp [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmutil.cpp [new file with mode: 0644]
service/notification-manager/SampleApp/tizen/NMSampleApp/tizen-manifest.xml [new file with mode: 0644]

index 09123fa..572cc99 100755 (executable)
@@ -68,7 +68,10 @@ notimgr_src = [
         NOTI_SRC_DIR + 'requestHandler.c',
         NOTI_SRC_DIR + 'virtualResource.c']
 
-notificationsdk = notimgr_env.StaticLibrary('NOTISDKLibrary', notimgr_src)
+if target_os in ['tizen'] :
+    notificationsdk = notimgr_env.SharedLibrary('NOTISDKLibrary', notimgr_src)
+else :
+    notificationsdk = notimgr_env.StaticLibrary('NOTISDKLibrary', notimgr_src)
 
 notimgr_env.InstallTarget(notificationsdk, 'libNMSDK')
 
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/.exportMap b/service/notification-manager/SampleApp/tizen/NMSampleApp/.exportMap
new file mode 100644 (file)
index 0000000..43e310e
--- /dev/null
@@ -0,0 +1,4 @@
+{
+       global: main;
+       local: *;
+};
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/.tproject b/service/notification-manager/SampleApp/tizen/NMSampleApp/.tproject
new file mode 100644 (file)
index 0000000..f1cc1fd
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<tproject xmlns="http://www.tizen.org/tproject">
+    <platforms>
+        <platform>
+            <name>mobile-2.3</name>
+        </platform>
+    </platforms>
+    <package>
+        <blacklist/>
+    </package>
+</tproject>
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/edc_resource/hosting_control.edc b/service/notification-manager/SampleApp/tizen/NMSampleApp/edc_resource/hosting_control.edc
new file mode 100644 (file)
index 0000000..d217dee
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+group { name: "group_layout";
+   parts {
+      part { name: "start_button";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            rel1.relative: 0.01 0.01;
+            rel2.relative: 0.5 0.09;
+         }
+      }
+      part { name: "stop_button";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            rel1.relative: 0.01 0.2;
+            rel2.relative: 0.5 0.09;
+         }
+      }
+         part { name: "log_bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.relative: 0.01 0.71;
+                       rel2.relative: 0.98 1.0;
+                       color: 220 220 220 255;
+         }
+      }
+         part { name: "log";
+         type: SWALLOW;
+         scale: 1;
+         description {
+                       rel1.to: "log_bg";
+            rel2.to: "log_bg";
+         }
+      }
+   }
+}
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmsampleapp.h b/service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmsampleapp.h
new file mode 100644 (file)
index 0000000..65860e4
--- /dev/null
@@ -0,0 +1,52 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#ifndef __NMSAMPLEAPP_H__
+#define __NMSAMPLEAPP_H__
+
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <efl_extension.h>
+#include <dlog.h>
+
+#include "OCPlatform.h"
+#include "OCApi.h"
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "nmsampleapp"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.nmsampleapp"
+#endif
+
+#define ELM_DEMO_EDJ "opt/usr/apps/org.tizen.nmsampleapp/res/ui_controls.edj"
+
+void start_cb(void *data, Evas_Object *obj, void *event_info);
+
+void stop_cb(void *data, Evas_Object *obj, void *event_info);
+
+void stop_hosting();
+
+void *updateGroupLog(void *data);
+
+#endif // __NMSAMPLEAPP_H__
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmutil.h b/service/notification-manager/SampleApp/tizen/NMSampleApp/inc/nmutil.h
new file mode 100644 (file)
index 0000000..692e1dd
--- /dev/null
@@ -0,0 +1,36 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#include<iostream>
+
+using namespace std;
+
+#ifndef NMUTIL_H_
+#define NMUTIL_H_
+
+#define LOGI(...) dlog_print(DLOG_INFO, LOG_TAG, __VA_ARGS__)
+#define LOGD(...) dlog_print(DLOG_DEBUG, LOG_TAG, __VA_ARGS__)
+#define LOGE(...) dlog_print(DLOG_ERROR, LOG_TAG, __VA_ARGS__)
+
+extern std::string getOCStackResultStringFromInt(int result);
+
+#endif // TMUTIL_H_
+
+
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/res/ui_controls.edc b/service/notification-manager/SampleApp/tizen/NMSampleApp/res/ui_controls.edc
new file mode 100644 (file)
index 0000000..151d32f
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+collections {
+   base_scale: 1.8;
+   #include "../edc_resource/hosting_control.edc"
+}
+
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/shared/res/nmsampleapp.png b/service/notification-manager/SampleApp/tizen/NMSampleApp/shared/res/nmsampleapp.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/service/notification-manager/SampleApp/tizen/NMSampleApp/shared/res/nmsampleapp.png differ
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/src/main.cpp b/service/notification-manager/SampleApp/tizen/NMSampleApp/src/main.cpp
new file mode 100644 (file)
index 0000000..18e1c67
--- /dev/null
@@ -0,0 +1,108 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#include "nmsampleapp.h"
+#include "nmutil.h"
+#include <algorithm>
+#include <signal.h>
+#include "hosting.h"
+#include "virtualResource.h"
+
+using namespace std;
+using namespace OC;
+
+namespace PH = std::placeholders;
+
+static uint8_t interfaceName[] = "wlan0";
+int g_quitFlag = 0;
+
+static void printLog(int logType, string data)
+{
+    (DLOG_ERROR == logType) ? LOGE(data.c_str()) : LOGI(data.c_str());
+    ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateGroupLog,
+                                          &data);
+}
+
+// Method for Finding the resource and hosting it
+static void start_hosting(int seconds)
+{
+    string logMessage = "OCResourceHosting started <br>";
+    logMessage = logMessage + "Interface Name : " + reinterpret_cast<char *>(interfaceName) + "<br>";
+    printLog(DLOG_INFO, logMessage);
+
+    if (OCInit((char *) NULL, 0, OC_CLIENT_SERVER) != OC_STACK_OK)
+    {
+        logMessage = "OCStack init error <br>";
+        printLog(DLOG_ERROR, logMessage);
+        return;
+    }
+
+    OICStartCoordinate();
+    g_quitFlag = 0;
+    logMessage = "OICStartCoordinate done successfully";
+    printLog(DLOG_INFO, logMessage);
+
+    while (!g_quitFlag)
+    {
+        if (OCProcess() != OC_STACK_OK)
+        {
+            OICStopCoordinate();
+            logMessage = "OCStack process error <br>";
+            printLog(DLOG_ERROR, logMessage);
+            return;
+        }
+        sleep(seconds);
+    }
+
+    OICStopCoordinate();
+    logMessage = "OICStopCoordinate done successfully <br>";
+    printLog(DLOG_INFO, logMessage);
+
+    if (OCStop() != OC_STACK_OK)
+    {
+        logMessage = "OCStack stop error <br>";
+        printLog(DLOG_ERROR, logMessage);
+    }
+    LOGI("start EXIT");
+}
+
+// Method for Finding the resource and hosting it
+void stop_hosting()
+{
+    string logMessage = "Terminating Resource Hosting <br>";
+    printLog(DLOG_INFO, logMessage);
+
+    g_quitFlag = 1;
+    LOGI("stop_hosting EXIT");
+}
+
+// Method to be called when the find and host UI Button is selected
+void start_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    std::thread exec(std::function< void(int second) >(start_hosting), 3);
+    exec.detach();
+}
+
+// Method to be called when the find and host UI Button is selected
+void stop_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    LOGI("Stopping resource hosting");
+    stop_hosting();
+}
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmsampleapp.cpp b/service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmsampleapp.cpp
new file mode 100644 (file)
index 0000000..02a463d
--- /dev/null
@@ -0,0 +1,307 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#include "nmsampleapp.h"
+#include "nmutil.h"
+#include <tizen.h>
+
+using namespace std;
+using namespace OC;
+
+static Evas_Object *log_entry = NULL;
+static Evas_Object *list = NULL;
+static Evas_Object *naviframe = NULL;
+
+typedef struct appdata
+{
+    Evas_Object *win;
+    Evas_Object *conform;
+    Evas_Object *layout;
+    Evas_Object *nf;
+    Evas_Object *findButton;
+    Evas_Object *logtext;
+    Evas_Object *listview;
+} appdata_s;
+
+// Function to update the log in UI
+void *updateGroupLog(void *data)
+{
+    string *log = (string *)data;
+    // Show the log
+    elm_entry_entry_append(log_entry, (*log).c_str());
+    elm_entry_cursor_end_set(log_entry);
+    return NULL;
+}
+
+static void
+win_delete_request_cb(void *data , Evas_Object *obj , void *event_info)
+{
+    ui_app_exit();
+}
+
+static void
+list_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+    elm_list_item_selected_set(it, EINA_FALSE);
+}
+
+static void
+win_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    appdata_s *ad = (appdata_s *)data;
+    // Let window go to hide state.
+    elm_win_lower(ad->win);
+}
+
+static Eina_Bool
+naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+    stop_hosting();
+    ui_app_exit();
+    return EINA_FALSE;
+}
+
+static void
+create_list_view(appdata_s *ad)
+{
+    Evas_Object *layout;
+    Evas_Object *scroller;
+    Evas_Object *nf = ad->nf;
+    Evas_Object *start_button;
+    Evas_Object *stop_button;
+    Elm_Object_Item *nf_it;
+
+    naviframe = nf;
+
+    // scroller
+    scroller = elm_scroller_add(nf);
+    elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+    elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+    // layout
+    layout = elm_layout_add(nf);
+    elm_layout_file_set(layout, ELM_DEMO_EDJ, "group_layout");
+    evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+    elm_object_content_set(scroller, layout);
+
+    // button
+    start_button = elm_button_add(layout);
+    elm_object_part_content_set(layout, "start_button", start_button);
+    elm_object_text_set(start_button, "Find and Host");
+    evas_object_smart_callback_add(start_button, "clicked", start_cb, NULL);
+
+    // button
+    stop_button = elm_button_add(layout);
+    elm_object_part_content_set(layout, "stop_button", stop_button);
+    elm_object_text_set(stop_button, "Stop");
+    evas_object_smart_callback_add(stop_button, "clicked", stop_cb, NULL);
+
+    // entry - textarea for log
+    log_entry = elm_entry_add(layout);
+    elm_entry_scrollable_set(log_entry, EINA_TRUE);
+    elm_entry_editable_set(log_entry, EINA_FALSE);
+    elm_object_part_text_set(log_entry, "elm.guide", "Logs will be updated here!!!");
+    evas_object_size_hint_weight_set(log_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(log_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    elm_object_part_content_set(layout, "log", log_entry);
+
+    nf_it = elm_naviframe_item_push(nf, "Notification Manager", NULL, NULL, scroller, NULL);
+    elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, NULL);
+}
+
+
+static void
+create_base_gui(appdata_s *ad)
+{
+    // Window
+    ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+    elm_win_conformant_set(ad->win, EINA_TRUE);
+    elm_win_autodel_set(ad->win, EINA_TRUE);
+
+    if (elm_win_wm_rotation_supported_get(ad->win))
+    {
+        int rots[4] = { 0, 90, 180, 270 };
+        elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+    }
+
+    evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+
+    // Conformant
+    ad->conform = elm_conformant_add(ad->win);
+    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    elm_win_resize_object_add(ad->win, ad->conform);
+    evas_object_show(ad->conform);
+
+    // Base Layout
+    ad->layout = elm_layout_add(ad->conform);
+    evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    elm_layout_theme_set(ad->layout, "layout", "application", "default");
+    evas_object_show(ad->layout);
+
+    elm_object_content_set(ad->conform, ad->layout);
+
+    // Naviframe
+    ad->nf = elm_naviframe_add(ad->layout);
+    create_list_view(ad);
+    elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+    eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+    eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
+
+    // Show window after base gui is set up
+    evas_object_show(ad->win);
+}
+
+// Configures the OCPlatform
+static void
+configure_platform()
+{
+    try
+    {
+        PlatformConfig config
+        { OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
+
+        OCPlatform::Configure(config);
+
+        dlog_print(DLOG_INFO, LOG_TAG, "#### Platform configuration done!!!!");
+    }
+    catch (OCException &e)
+    {
+        dlog_print(DLOG_INFO, LOG_TAG, "#### Platform configuration failed!!!!");
+    }
+}
+
+static bool
+app_create(void *data)
+{
+    /* Hook to take necessary actions before main event loop starts
+        Initialize UI resources and application's data
+        If this function returns true, the main loop of application starts
+        If this function returns false, the application is terminated */
+    appdata_s *ad = (appdata_s *)data;
+
+    elm_app_base_scale_set(1.8);
+
+    create_base_gui(ad);
+
+    configure_platform();
+
+    return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+    // Handle the launch request.
+}
+
+static void
+app_pause(void *data)
+{
+    // Take necessary actions when application becomes invisible.
+}
+
+static void
+app_resume(void *data)
+{
+    // Take necessary actions when application becomes visible.
+}
+
+static void
+app_terminate(void *data)
+{
+    // Release all resources.
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+    // APP_EVENT_LANGUAGE_CHANGED
+    char *locale = NULL;
+    system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+    elm_language_set(locale);
+    free(locale);
+    return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+    // APP_EVENT_DEVICE_ORIENTATION_CHANGED
+    return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+    // APP_EVENT_REGION_FORMAT_CHANGED
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+    // APP_EVENT_LOW_BATTERY
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+    // APP_EVENT_LOW_MEMORY
+}
+
+int
+main(int argc, char *argv[])
+{
+    appdata_s ad = {0,};
+    int ret = 0;
+
+    ui_app_lifecycle_callback_s event_callback = {0,};
+    app_event_handler_h handlers[5] = {NULL, };
+
+    event_callback.create = app_create;
+    event_callback.terminate = app_terminate;
+    event_callback.pause = app_pause;
+    event_callback.resume = app_resume;
+    event_callback.app_control = app_control;
+
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY,
+                             ui_app_low_battery, &ad);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY,
+                             ui_app_low_memory, &ad);
+    ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
+                             APP_EVENT_DEVICE_ORIENTATION_CHANGED,
+                             ui_app_orient_changed, &ad);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+                             APP_EVENT_LANGUAGE_CHANGED,
+                             ui_app_lang_changed, &ad);
+    ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+                             APP_EVENT_REGION_FORMAT_CHANGED,
+                             ui_app_region_changed, &ad);
+    ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+    ret = ui_app_main(argc, argv, &event_callback, &ad);
+    if (ret != APP_ERROR_NONE)
+    {
+        dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+    }
+
+    return ret;
+}
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmutil.cpp b/service/notification-manager/SampleApp/tizen/NMSampleApp/src/nmutil.cpp
new file mode 100644 (file)
index 0000000..ac2590b
--- /dev/null
@@ -0,0 +1,130 @@
+/******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#include "nmutil.h"
+
+// Utility function to return the string equivalent of OCStackResult for the given int value
+std::string getOCStackResultStringFromInt(int result)
+{
+    string ocresultstr;
+
+    switch (result)
+    {
+        case 0 :
+            ocresultstr = "OC_STACK_OK";
+            break;
+        case 1 :
+            ocresultstr = "OC_STACK_RESOURCE_CREATED";
+            break;
+        case 2 :
+            ocresultstr = "OC_STACK_RESOURCE_DELETED";
+            break;
+        case 3 :
+            ocresultstr = "OC_STACK_CONTINUE";
+            break;
+        case 20 :
+            ocresultstr = "OC_STACK_INVALID_URI";
+            break;
+        case 21 :
+            ocresultstr = "OC_STACK_INVALID_QUERY";
+            break;
+        case 22 :
+            ocresultstr = "OC_STACK_INVALID_QUERY";
+            break;
+        case 23 :
+            ocresultstr = "OC_STACK_INVALID_PORT";
+            break;
+        case 24 :
+            ocresultstr = "OC_STACK_INVALID_CALLBACK";
+            break;
+        case 25 :
+            ocresultstr = "OC_STACK_INVALID_METHOD";
+            break;
+        case 26 :
+            ocresultstr = "OC_STACK_INVALID_PARAM";
+            break;
+        case 27 :
+            ocresultstr = "OC_STACK_INVALID_OBSERVE_PARAM";
+            break;
+        case 28 :
+            ocresultstr = "OC_STACK_NO_MEMORY";
+            break;
+        case 29 :
+            ocresultstr = "OC_STACK_COMM_ERROR";
+            break;
+        case 30 :
+            ocresultstr = "OC_STACK_NOTIMPL";
+            break;
+        case 31 :
+            ocresultstr = "OC_STACK_NO_RESOURCE";
+            break;
+        case 32 :
+            ocresultstr = "OC_STACK_RESOURCE_ERROR";
+            break;
+        case 33 :
+            ocresultstr = "OC_STACK_SLOW_RESOURCE";
+            break;
+        case 34 :
+            ocresultstr = "OC_STACK_DUPLICATE_REQUEST";
+            break;
+        case 35 :
+            ocresultstr = "OC_STACK_NO_OBSERVERS";
+            break;
+        case 36 :
+            ocresultstr = "OC_STACK_OBSERVER_NOT_FOUND";
+            break;
+        case 37 :
+            ocresultstr = "OC_STACK_VIRTUAL_DO_NOT_HANDLE";
+            break;
+        case 38 :
+            ocresultstr = "OC_STACK_INVALID_OPTION";
+            break;
+        case 39 :
+            ocresultstr = "OC_STACK_MALFORMED_RESPONSE";
+            break;
+        case 40 :
+            ocresultstr = "OC_STACK_PERSISTENT_BUFFER_REQUIRED";
+            break;
+        case 41 :
+            ocresultstr = "OC_STACK_INVALID_REQUEST_HANDLE";
+            break;
+        case 42 :
+            ocresultstr = "OC_STACK_INVALID_DEVICE_INFO";
+            break;
+        case 43 :
+            ocresultstr = "OC_STACK_INVALID_JSON";
+            break;
+        case 128 :
+            ocresultstr = "OC_STACK_PRESENCE_STOPPED";
+            break;
+        case 129 :
+            ocresultstr = "OC_STACK_PRESENCE_TIMEOUT";
+            break;
+        case 130 :
+            ocresultstr = "OC_STACK_PRESENCE_DO_NOT_HANDLE";
+            break;
+        case 255 :
+            ocresultstr = "OC_STACK_ERROR";
+            break;
+        default :
+            ocresultstr = "OC_STACK_ERROR";
+    }
+    return ocresultstr;
+}
diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/tizen-manifest.xml b/service/notification-manager/SampleApp/tizen/NMSampleApp/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..1b160cd
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="org.tizen.nmsampleapp" version="1.0.0">
+    <profile name="mobile"/>
+    <ui-application appid="org.tizen.nmsampleapp" exec="nmsampleapp" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+        <label>nmsampleapp</label>
+        <icon>nmsampleapp.png</icon>
+    </ui-application>
+    <privileges>
+        <privilege>http://tizen.org/privilege/network.get</privilege>
+        <privilege>http://tizen.org/privilege/systemsettings</privilege>
+        <privilege>http://tizen.org/privilege/network.set</privilege>
+        <privilege>http://tizen.org/privilege/internet</privilege>
+        <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+    </privileges>
+    <feature name="http://tizen.org/feature/network.wifi">true</feature>
+</manifest>