Distributed Resource Hosting Sample App and ResourceHosting for JAVA API folder.
authordoil.kwon <doil.kwon@samsung.com>
Thu, 2 Jul 2015 09:05:26 +0000 (18:05 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 3 Jul 2015 07:08:53 +0000 (07:08 +0000)
- Added new folder in NotificationManager folder
- "/NotificationManger/android/resource_hosting"

Modified notification-manager's Sconscript

- ~_JNI.cpp file is not included in Sconscript.

Changed folder name : ResourceHostingSampleApp->SampleResourceHosting

Deleted files : resourceCoordinator_JNI.cpp and resourceCoordinator_JNI.h in Notification/src folder.

Modified about ResourceHosing_JNI.h path is relative path to absolute path in ResourceHosing_JNI.cpp
Added "OCProcessFunc"'s  return value : none -> return;

Change-Id: I2c44c31f1399ca9722c4f2281ec2b8af1646ed21
Signed-off-by: doil.kwon <doil.kwon@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1487
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
42 files changed:
service/notification-manager/NotificationManager/android/resource_hosting/.classpath [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/.project [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/AndroidManifest.xml [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/jni/Android.mk [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/jni/Application.mk [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.cpp [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.h [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/project.properties [new file with mode: 0755]
service/notification-manager/NotificationManager/android/resource_hosting/src/org/iotivity/ResourceHosting/ResourceHosting.java [new file with mode: 0755]
service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.cpp [deleted file]
service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.h [deleted file]
service/notification-manager/SConscript
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.classpath [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.project [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/AndroidManifest.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/ic_launcher-web.png [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Android.mk [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Application.mk [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/armeabi [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/project.properties [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-hdpi/ic_launcher.png [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-mdpi/ic_launcher.png [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xhdpi/ic_launcher.png [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xxhdpi/ic_launcher.png [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/layout/activity_main.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v11/styles.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v14/styles.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/strings.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/styles.xml [deleted file]
service/notification-manager/SampleApp/android/ResourceHostingSampleApp/src/com/example/resourcehostingsampleapp/ResourceHosting.java [deleted file]
service/notification-manager/SampleApp/android/SampleResourceHosting/AndroidManifest.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/project.properties [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-hdpi/ic_launcher.png [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-mdpi/ic_launcher.png [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xhdpi/ic_launcher.png [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xxhdpi/ic_launcher.png [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/layout/activity_main.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v11/styles.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v14/styles.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/strings.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/styles.xml [new file with mode: 0755]
service/notification-manager/SampleApp/android/SampleResourceHosting/src/com/example/resourcehostingsampleapp/ResourceHostingSampleApp.java [new file with mode: 0755]

diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/.classpath b/service/notification-manager/NotificationManager/android/resource_hosting/.classpath
new file mode 100755 (executable)
index 0000000..7bc01d9
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/.project b/service/notification-manager/NotificationManager/android/resource_hosting/.project
new file mode 100755 (executable)
index 0000000..22c971c
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>ResourceHosting</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/AndroidManifest.xml b/service/notification-manager/NotificationManager/android/resource_hosting/AndroidManifest.xml
new file mode 100755 (executable)
index 0000000..bb17c60
--- /dev/null
@@ -0,0 +1,17 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="org.iotivity.ResourceHosting"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="21" />
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+    </application>
+
+</manifest>
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/jni/Android.mk b/service/notification-manager/NotificationManager/android/resource_hosting/jni/Android.mk
new file mode 100755 (executable)
index 0000000..4bac6bd
--- /dev/null
@@ -0,0 +1,65 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ca
+LOCAL_SRC_FILES := ../libs/libconnectivity_abstraction.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ca_i
+LOCAL_SRC_FILES := ../libs/libca-interface.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := oc_logger_core
+LOCAL_SRC_FILES := ../libs/liboc_logger_core.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := oc_logger
+LOCAL_SRC_FILES := ../libs/liboc_logger.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := octbstack
+LOCAL_SRC_FILES := ../libs/liboctbstack.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := oc
+LOCAL_SRC_FILES := ../libs/liboc.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ocstack-jni
+LOCAL_SRC_FILES := ../libs/libocstack-jni.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := NotificationManager
+LOCAL_SRC_FILES := ../libs/libNotificationManager.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ResourceHosing_JNI
+LOCAL_CPPFLAGS := -std=c++0x -frtti -fexceptions
+
+LOCAL_STATIC_LIBRARIES = ca_i
+LOCAL_STATIC_LIBRARIES += ca
+LOCAL_STATIC_LIBRARIES += oc_logger_core
+LOCAL_STATIC_LIBRARIES += oc_logger
+LOCAL_STATIC_LIBRARIES += octbstack
+LOCAL_STATIC_LIBRARIES += oc
+LOCAL_STATIC_LIBRARIES += ocstack-jni
+LOCAL_STATIC_LIBRARIES += NotificationManager
+
+LOCAL_C_INCLUDES := ../../../../../../resource/csdk/stack/include/
+LOCAL_C_INCLUDES += ../../../../../../resource/csdk/logger/include/
+LOCAL_C_INCLUDES += ../../../../../../resource/include/
+LOCAL_C_INCLUDES += ../../../../../../resource/oc_logger/include/
+LOCAL_C_INCLUDES += ../../../../../../extlibs/boost/boost_1_58_0/
+LOCAL_C_INCLUDES += ../../../../NotificationManager/include/
+
+
+LOCAL_SRC_FILES := ResourceHosing_JNI.cpp
+include $(BUILD_SHARED_LIBRARY)
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/jni/Application.mk b/service/notification-manager/NotificationManager/android/resource_hosting/jni/Application.mk
new file mode 100755 (executable)
index 0000000..3baa444
--- /dev/null
@@ -0,0 +1,2 @@
+APP_STL:=gnustl_shared
+NDK_TOOLCHAIN_VERSION := 4.9
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.cpp b/service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.cpp
new file mode 100755 (executable)
index 0000000..2b7106b
--- /dev/null
@@ -0,0 +1,127 @@
+
+//******************************************************************
+//
+// 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.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+extern "C" {
+#include "hosting.h"
+}
+#include "ResourceHosing_JNI.h"
+#include "OCAndroid.h"
+
+using namespace std;
+
+atomic_bool threadRun;
+thread ocProcessThread;
+/*
+ * To execute OCProcess when threadRun value is only true
+ */
+void ocProcessFunc()
+{
+    while (threadRun)
+    {
+
+        if (OCProcess() != OC_STACK_OK)
+        {
+            return ;
+        }
+
+        sleep(2);
+    }
+}
+
+/*
+ *  for Hosting Device Side
+ */
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStart
+(JNIEnv *env, jobject obj)
+{
+    jint result = 0;
+    if(threadRun==true)
+    {
+        result = (jint)HOSTING_THREAD_ERROR;
+        return result;
+    }
+    else
+    {
+        result = (jint)OICStartCoordinate();
+
+        threadRun = true;
+        ocProcessThread = thread(ocProcessFunc);
+        return result;
+    }
+}
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStop
+(JNIEnv *env, jobject obj)
+{
+    jint result = 0;
+    //terminate Thread
+    if (ocProcessThread.joinable())
+    {
+        threadRun = false;
+        ocProcessThread.join();
+    }
+    else
+    {
+            result = (jint)HOSTING_THREAD_ERROR;
+            return result;
+    }
+    result = (jint)OICStopCoordinate();
+
+    return result;
+}
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingInit
+(JNIEnv *env, jobject obj,jstring j_addr)
+{
+    const char* addr = env->GetStringUTFChars(j_addr,NULL);
+
+    if (NULL == j_addr)
+        return (jint)OCSTACK_ERROR;
+
+    if(OCInit(addr,USE_RANDOM_PORT,OC_CLIENT_SERVER)!=OC_STACK_OK)
+    {
+        return (jint)OCSTACK_ERROR;
+    }
+
+    env->ReleaseStringUTFChars(j_addr,addr);
+    return (jint)OCSTACK_OK;
+}
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingTerminate
+(JNIEnv *env, jobject obj)
+{
+    if (OCStop() != OC_STACK_OK)
+    {
+        return (jint)OCSTACK_ERROR;
+    }
+    //terminate Thread
+    if (ocProcessThread.joinable())
+    {
+        threadRun = false;
+        ocProcessThread.join();
+    }
+    else
+    {
+        return (jint)HOSTING_THREAD_ERROR;
+    }
+
+    return (jint)OCSTACK_OK;
+}
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.h b/service/notification-manager/NotificationManager/android/resource_hosting/jni/ResourceHosing_JNI.h
new file mode 100755 (executable)
index 0000000..fc62f94
--- /dev/null
@@ -0,0 +1,75 @@
+//******************************************************************
+//
+// 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 RESOURCEHOSTING_JNI_H_
+#define RESOURCEHOSTING_JNI_H_
+
+#include <jni.h>
+#include <thread>
+#include <atomic>
+#include <unistd.h>
+
+#define TAG "OIC-JNI"
+
+#define JNI_CURRENT_VERSION JNI_VERSION_1_6
+#define OCSTACK_OK  0
+#define OCSTACK_ERROR  255
+#define HOSTING_THREAD_ERROR  -2
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Class:     org_iotivity_service_resourcehosting_ResourceHosting
+ * Method:    OICCoordinatorStart
+ * Signature: ()V
+ */
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStart
+(JNIEnv *, jobject);
+/*
+ * @Class:     org_iotivity_service_resourcehosting_ResourceHosting
+ * @Method:    OICCoordinatorStop
+ * @Signature: ()V
+ */
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStop
+(JNIEnv *, jobject);
+/*
+ * Class:     org_iotivity_service_resourcehosting_ResourceHosting
+ * Method:    ResourceHostingInit
+ * Signature: ()V
+ */
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingInit
+(JNIEnv *env, jobject obj,jstring j_addr);
+/*
+ * Class:     org_iotivity_service_resourcehosting_ResourceHosting
+ * Method:    ResourceHostingTerminate
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingTerminate
+(JNIEnv *env, jobject obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RESOURCEHOSTING_JNI_H_ */
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/project.properties b/service/notification-manager/NotificationManager/android/resource_hosting/project.properties
new file mode 100755 (executable)
index 0000000..00cf62b
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-22
diff --git a/service/notification-manager/NotificationManager/android/resource_hosting/src/org/iotivity/ResourceHosting/ResourceHosting.java b/service/notification-manager/NotificationManager/android/resource_hosting/src/org/iotivity/ResourceHosting/ResourceHosting.java
new file mode 100755 (executable)
index 0000000..451b773
--- /dev/null
@@ -0,0 +1,88 @@
+//******************************************************************
+//
+// 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.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+package org.iotivity.ResourceHosting;
+import java.lang.System;
+import java.lang.String;;
+/**
+ * To execute resource hosting function for android sample application .
+ * 
+ * @author Copyright 2015 Samsung Electronics All Rights Reserved.
+ * @see className class : ResourceHosting</br>
+ *
+ */
+
+public class ResourceHosting {
+
+    /**
+     * jni function - OicCorrdinatorstart() method.
+     * 
+     * @see Class class :
+     *      org_iotivity_resourcehosting_ResourceHosting</br>
+     * @see Method method : OICCoordinatorStart</br>
+     * @see Signature signature : ()V</br>
+     */
+    public native int OICCoordinatorStart();
+
+    /**
+     * jni function - OICCoordinatorStop() method.
+     * 
+     * @see Class class :
+     *      org_iotivity_resourcehosting_ResourceHosting</br>
+     * @see Method method : OICCoordinatorStop</br>
+     * @see signature signature : ()V</br>
+     */
+    public native int OICCoordinatorStop();
+
+    /**
+     * jni function - ResourceHostingInit() method in order to execute
+     * OICCoordinatorStart() method.
+     * 
+     * @see Class class :
+     *      org_iotivity_resourcehosting_ResourceHosting</br>
+     * @see Method method : ResourceHostingInit</br>
+     * @param addr
+     *            ipAddress
+     * @see signature signature : (Ljava/lang/String;)V</br>
+     */
+    public native int ResourceHostingInit(String addr);
+
+    /**
+     * jni function - ResourceHostingTerminate() method in order to terminate
+     * resource hosting
+     * 
+     * @see Class class :
+     *      org_iotivity_resourcehosting_ResourceHosting</br>
+     * @see Method method : ResourceHostingTerminate</br>
+     * @see signature signature : ()V</br>
+     */
+    public native int ResourceHostingTerminate();
+
+    static {
+        System.loadLibrary("connectivity_abstraction");
+        System.loadLibrary("ca-interface");
+        System.loadLibrary("oc_logger_core");
+        System.loadLibrary("oc_logger");
+        System.loadLibrary("octbstack");
+        System.loadLibrary("oc");
+        System.loadLibrary("ocstack-jni");
+        System.loadLibrary("NotificationManager");
+       System.loadLibrary("ResourceHosing_JNI");
+    }
+}
diff --git a/service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.cpp b/service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.cpp
deleted file mode 100644 (file)
index 4382ea8..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-//******************************************************************
-//
-// 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-extern "C" {
-#include "hosting.h"
-}
-#include "resourceCoordinator_JNI.h"
-#include "android_cpp11_compat.h"
-
-using namespace std;
-
-atomic_bool threadRun;
-thread ocProcessThread;
-/*
- * To execute OCProcess when threadRun value is only true
- */
-void ocProcessFunc()
-{
-    while (threadRun)
-    {
-
-        if (OCProcess() != OC_STACK_OK)
-        {
-            //OCProcess ERROR
-        }
-
-        sleep(2);
-    }
-}
-/*
- * To callback log message from C++ to Java for android
- */
-void messageCallback(JNIEnv *env, jobject obj, const char *c_str)
-{
-      jstring jstr = (env)->NewStringUTF(c_str);
-      jclass cls = env->GetObjectClass(obj);
-      jmethodID cbMessage = env->GetMethodID(cls, "cbMessage", "(Ljava/lang/String;)V");
-      env->CallVoidMethod(obj,cbMessage, jstr);
-}
-/*
- *  for Hosting Device Side
- */
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_OICCoordinatorStart
-(JNIEnv *env, jobject obj)
-{
-    jint result = 0;
-    if(threadRun==true)
-    {
-
-        messageCallback(env,obj,"OICCoordinatorStart already executed");
-        result = (jint)HOSTING_THREAD_ERROR;
-        return result;
-    }
-    else
-    {
-        messageCallback(env,obj,"OICCoordinatorStart");
-        result = (jint)OICStartCoordinate();
-        string str = "OICStartCoordinate result : ";
-        string result_str = std::to_string(result);
-        str += result_str;
-        messageCallback(env,obj,str.c_str());
-        threadRun = true;
-        ocProcessThread = thread(ocProcessFunc);
-        return result;
-    }
-}
-
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_OICCoordinatorStop
-(JNIEnv *env, jobject obj)
-{
-    messageCallback(env,obj,"OICCoordinatorStop");
-    jint result = 0;
-    //terminate Thread
-    if (ocProcessThread.joinable())
-    {
-        threadRun = false;
-        ocProcessThread.join();
-    }
-    else
-    {
-            messageCallback(env,obj,"OICCoordinatorStop already terminated");
-            result = (jint)HOSTING_THREAD_ERROR;
-            return result;
-    }
-    result = (jint)OICStopCoordinate();
-    string str = "OICStopCoordinate result : ";
-    string result_str = std::to_string(result);
-    str += result_str;
-    messageCallback(env,obj,str.c_str());
-    return result;
-}
-
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_ResourceHostingInit
-(JNIEnv *env, jobject obj,jstring j_addr)
-{
-    messageCallback(env,obj,"ResourceHostingInit");
-    const char* addr = env->GetStringUTFChars(j_addr,NULL);
-
-    if (NULL == j_addr)
-        return (jint)OCSTACK_ERROR;
-
-    if(OCInit(addr,USE_RANDOM_PORT,OC_CLIENT_SERVER)!=OC_STACK_OK)
-    {
-        messageCallback(env,obj,"OCStack init Error");
-        return (jint)OCSTACK_ERROR;
-    }
-
-    env->ReleaseStringUTFChars(j_addr,addr);
-    return (jint)OCSTACK_OK;
-}
-
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_ResourceHostingTerminate
-(JNIEnv *env, jobject obj)
-{
-    messageCallback(env,obj,"ResourceHostingTerminate");
-    if (OCStop() != OC_STACK_OK)
-    {
-
-        messageCallback(env,obj,"OCStack stop error");
-        return (jint)OCSTACK_ERROR;
-    }
-    //terminate Thread
-    if (ocProcessThread.joinable())
-    {
-        threadRun = false;
-        ocProcessThread.join();
-    }
-    else
-    {
-        messageCallback(env,obj,"The thread may be not running.");
-        return (jint)HOSTING_THREAD_ERROR;
-    }
-
-    return (jint)OCSTACK_OK;
-}
diff --git a/service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.h b/service/notification-manager/NotificationManager/src/resourceCoordinator_JNI.h
deleted file mode 100644 (file)
index cce1e35..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//******************************************************************
-//
-// 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 RESOURCECOORDINATOR_JNI_H_
-#define RESOURCECOORDINATOR_JNI_H_
-
-#include <jni.h>
-#include <thread>
-#include <atomic>
-#include <unistd.h>
-
-#define TAG "OIC-JNI"
-
-#define JNI_CURRENT_VERSION JNI_VERSION_1_6
-#define OCSTACK_OK  0
-#define OCSTACK_ERROR  255
-#define HOSTING_THREAD_ERROR  -2
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Class:     org_iotivity_service_resourcehostingsampleapp_ResourceHosting
- * Method:    OICCoordinatorStart
- * Signature: ()V
- */
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_OICCoordinatorStart
-(JNIEnv *, jobject);
-/*
- * @Class:     org_iotivity_service_resourcehostingsampleapp_ResourceHosting
- * @Method:    OICCoordinatorStop
- * @Signature: ()V
- */
-
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_OICCoordinatorStop
-(JNIEnv *, jobject);
-/*
- * Class:     org_iotivity_service_resourcehostingsampleapp_ResourceHosting
- * Method:    ResourceHostingInit
- * Signature: ()V
- */
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_ResourceHostingInit
-(JNIEnv *env, jobject obj,jstring j_addr);
-/*
- * Class:     org_iotivity_service_resourcehostingsampleapp_ResourceHosting
- * Method:    ResourceHostingTerminate
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT jint JNICALL Java_com_example_resourcehostingsampleapp_ResourceHosting_ResourceHostingTerminate
-(JNIEnv *env, jobject obj);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RESOURCECOORDINATOR_JNI_H_ */
index 7dc91283f755ccc5f88ca87ed7afec044b9ff629..94aa89ef23964d41e683ed79ebecf2d429771478 100644 (file)
@@ -68,9 +68,6 @@ notimgr_src = [
         NOTI_SRC_DIR + 'requestHandler.c',
         NOTI_SRC_DIR + 'virtualResource.c']
 
-if target_os == 'android':
-        notimgr_src.append(NOTI_SRC_DIR + 'resourceCoordinator_JNI.cpp')
-
 if target_os in ['tizen','android'] :
     notificationsdk = notimgr_env.SharedLibrary('NotificationManager', notimgr_src)
 else :
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.classpath b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.classpath
deleted file mode 100644 (file)
index c2653d9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="gen"/>
-       <classpathentry exported="true" kind="lib" path="C:/Users/jay.sharma/Desktop/master_19_may/iotivity/android/android_api/base/build/intermediates/bundles/release/classes.jar"/>
-       <classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.project b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/.project
deleted file mode 100644 (file)
index 22c971c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>ResourceHosting</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/AndroidManifest.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/AndroidManifest.xml
deleted file mode 100644 (file)
index 31ac554..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.example.resourcehostingsampleapp"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk
-        android:minSdkVersion="8"
-        android:targetSdkVersion="19" />
-    
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.INTERNET_ACCESS" />
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-    <uses-permission android:name="android.permission.GET_TASKS"/>
-    <uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION"/>
-    <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>
-
-    <application
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-        <activity
-            android:name="com.example.resourcehostingsampleapp.ResourceHosting"
-            android:label="@string/app_name" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-</manifest>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/ic_launcher-web.png b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/ic_launcher-web.png
deleted file mode 100644 (file)
index a18cbb4..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/ic_launcher-web.png and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Android.mk b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Android.mk
deleted file mode 100644 (file)
index f2f39d8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := ca
-LOCAL_SRC_FILES := ../libs/libconnectivity_abstraction.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := oc_logger_core
-LOCAL_SRC_FILES := ../libs/liboc_logger_core.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := oc_logger
-LOCAL_SRC_FILES := ../libs/liboc_logger.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := octbstack
-LOCAL_SRC_FILES := ../libs/liboctbstack.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := oc
-LOCAL_SRC_FILES := ../libs/liboc.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libNotificationManager
-LOCAL_SRC_FILES := ../libs/libNotificationManager.so
-include $(PREBUILT_SHARED_LIBRARY)
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Application.mk b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/Application.mk
deleted file mode 100644 (file)
index 3baa444..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-APP_STL:=gnustl_shared
-NDK_TOOLCHAIN_VERSION := 4.9
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/armeabi b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/armeabi
deleted file mode 100644 (file)
index a2f1b66..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/jni/armeabi and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/project.properties b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/project.properties
deleted file mode 100644 (file)
index 4ab1256..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-hdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644 (file)
index 288b665..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-mdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644 (file)
index 6ae570b..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xhdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644 (file)
index d4fb7cd..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xxhdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644 (file)
index 85a6081..0000000
Binary files a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/layout/activity_main.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/layout/activity_main.xml
deleted file mode 100644 (file)
index 3cb37b5..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="vertical"
-    android:paddingBottom="5dp"
-    android:paddingLeft="10dp"
-    android:paddingRight="10dp"
-    android:paddingTop="10dp" >
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" >
-        
-            <Button
-                android:id="@+id/btnStartHosting"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="startHosting"
-                android:textSize="18sp" />    
-    </LinearLayout>
-    
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" >
-        
-            <Button
-                android:id="@+id/btnStopHosting"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="StopHosting"
-                android:textSize="18sp" />    
-    </LinearLayout>
-
-       
-       <Space
-               android:layout_width="match_parent"
-               android:layout_height="10dp" />
-
-       <LinearLayout
-           android:layout_width="match_parent"
-           android:layout_height="5dp"
-           android:orientation="vertical"
-           android:background="#111111" >
-       </LinearLayout>
-
-       <Space
-           android:layout_width="match_parent"
-           android:layout_height="5dp" />
-      
-       <LinearLayout
-           android:layout_width="match_parent"
-           android:layout_height="wrap_content"
-           android:orientation="vertical"
-           android:paddingTop="0dp" >
-
-               <Button
-                   android:id="@+id/btLogClear"
-                   android:layout_width="match_parent"
-                   android:layout_height="wrap_content"
-                   android:text="CLEAR LOG"
-                   android:textSize="18sp" />
-
-               <ScrollView
-                   android:id="@+id/sclLog"
-                   android:layout_width="match_parent"
-                   android:layout_height="match_parent" >
-                       
-                       <TextView
-                           android:id="@+id/txtLog"
-                           android:layout_width="match_parent"
-                           android:layout_height="match_parent"
-                           android:layout_alignParentBottom="true"
-                           android:layout_alignParentLeft="true"
-                           android:textSize="15sp" />
-          
-               </ScrollView>
-       
-       </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v11/styles.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v11/styles.xml
deleted file mode 100644 (file)
index 3c02242..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 11+. This theme completely replaces
-        AppBaseTheme from res/values/styles.xml on API 11+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
-        <!-- API 11 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v14/styles.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values-v14/styles.xml
deleted file mode 100644 (file)
index a91fd03..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 14+. This theme completely replaces
-        AppBaseTheme from BOTH res/values/styles.xml and
-        res/values-v11/styles.xml on API 14+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
-        <!-- API 14 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/strings.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/strings.xml
deleted file mode 100644 (file)
index 9ac731d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-    <string name="app_name">ResourceHostingSampleApp</string>
-    <string name="hello_world">Hello world!</string>
-
-</resources>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/styles.xml b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/res/values/styles.xml
deleted file mode 100644 (file)
index 6ce89c7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
diff --git a/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/src/com/example/resourcehostingsampleapp/ResourceHosting.java b/service/notification-manager/SampleApp/android/ResourceHostingSampleApp/src/com/example/resourcehostingsampleapp/ResourceHosting.java
deleted file mode 100644 (file)
index 219b622..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-//******************************************************************
-//
-// 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-package com.example.resourcehostingsampleapp;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Enumeration;
-
-import org.iotivity.base.ModeType;
-import org.iotivity.base.OcPlatform;
-import org.iotivity.base.OcResourceHandle;
-import org.iotivity.base.PlatformConfig;
-import org.iotivity.base.QualityOfService;
-import org.iotivity.base.ServiceType;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.TextView;
-import android.widget.Toast;
-
-/**
- * To execute resource hosting function for android sample application .
- * @author Copyright 2015 Samsung Electronics All Rights Reserved.
- * @see className class :   ResourceHosting</br>
- *
- */
-
-public class ResourceHosting extends Activity implements OnClickListener
-{
-        private final int OCSTACK_OK = 0;
-        private final int OCSTACK_ERROR = 255;
-        private final int RESOURCEHOSTING_DO_NOT_THREADRUNNING = -2;
-
-        private final String TAG = "NMResourceHosting : " + this.getClass().getSimpleName();
-        private TextView mLogTextView;
-        private String mLog = "";
-        /**
-         * To initialize UI Function Setting.
-         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : onCreate</br>
-         */
-        protected void onCreate(Bundle savedInstanceState)
-        {
-            super.onCreate(savedInstanceState);
-            setContentView(R.layout.activity_main);
-            mLogTextView = (TextView) findViewById(R.id.txtLog);
-            findViewById(R.id.btnStartHosting).setOnClickListener(this);
-            findViewById(R.id.btnStopHosting).setOnClickListener(this);
-            findViewById(R.id.btLogClear).setOnClickListener(this);
-
-            PlatformConfig platformConfigObj;
-
-            platformConfigObj = new PlatformConfig(this,ServiceType.IN_PROC,
-                    ModeType.CLIENT_SERVER, "0.0.0.0", 0, QualityOfService.LOW);
-
-            Log.i(TAG, "Before Calling Configure of ocPlatform");
-            OcPlatform.Configure(platformConfigObj);
-            Log.i(TAG, "Configuration done Successfully");
-        }
-
-        /**
-         * To execute initOICStack for running Resource hosting.
-         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : onStart</br>
-         */
-        @Override
-        protected void onStart()
-        {
-            super.onStart();
-        }
-
-        /**
-         * To terminate Resource hosting.
-         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : onStop</br>
-         */
-        @Override
-        protected void onStop()
-        {
-            super.onStop();
-        }
-
-        protected void onResume()
-        {
-            super.onResume();
-        }
-
-        /**
-         * To execute initOICStack for running Resource hosting.
-         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : onRestart</br>
-         */
-        @Override
-        protected void onRestart()
-        {
-            super.onRestart();
-        }
-
-        /**
-         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : onDestroy</br>
-         */
-        protected void onDestroy()
-        {
-            super.onDestroy();
-            int result;
-            result = OICCoordinatorStop();
-            Log.d(TAG, "OICCoordinatorStop() : "+ result);
-        }
-
-        /**
-         * @see Class  class :   com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method method :   onClick</br>
-         * @param v view to choice
-         */
-        public void onClick(View v)
-        {
-            int getId = v.getId();
-
-            switch (getId)
-            {
-                case R.id.btnStartHosting:
-                    try
-                    {
-                        int result;
-                        result = OICCoordinatorStart();
-                        Log.d(TAG, "OICCoordinatorStart : " + result);
-                    }
-                    catch (Exception e)
-                    {
-                        Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
-                        Log.d(TAG, e.getMessage() + result);
-                    }
-                    break;
-                case R.id.btnStopHosting:
-                    int result;
-                    result = OICCoordinatorStop();
-                    Log.d(TAG, "OICCoordinatorStop : "+ result);
-                    break;
-                case R.id.btLogClear:
-                    clearLog();
-                default:
-                    break;
-            }
-        }
-
-        /**
-         * all clear log view
-         * @see Class   class :  com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method :  clearLog</br>
-         */
-        private void clearLog()
-        {
-            mLog = "";
-            mLogTextView.setText(mLog);
-            Log.i(TAG, "Log textbox is cleared");
-        }
-
-        /**
-         * recieve the callback log message.
-         * @see Class   class :  com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method :  cbMessage</br>
-         * @param msg callback log message
-         */
-        public void cbMessage(String msg)
-        {
-            mLog += msg + "\n";
-            mLogTextView.setText(mLog);
-            Log.i(TAG, msg);
-        }
-
-        /**
-         * jni function - OicCorrdinatorstart() method.
-         * @see Class   class :    com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method :  OICCoordinatorStart</br>
-         * @see Signature signature : ()V</br>
-         */
-        public native int OICCoordinatorStart();
-
-        /**
-         * jni function - OICCoordinatorStop() method.
-         * @see Class   class :  com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method :  OICCoordinatorStop</br>
-         * @see signature  signature : ()V</br>
-         */
-        public native int OICCoordinatorStop();
-
-        /**
-         * jni function - ResourceHostingInit() method in order to execute OICCoordinatorStart() method.
-         * @see Class   class :  com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method :  ResourceHostingInit</br>
-         * @param addr ipAddress
-         * @see signature signature : (Ljava/lang/String;)V</br>
-         */
-        public native int ResourceHostingInit(String addr);
-
-        /**
-         * jni function - ResourceHostingTerminate() method in order to terminate resource hosting
-         * @see Class   class  : com_example_resourcehostingsampleapp_ResourceHosting</br>
-         * @see Method  method : ResourceHostingTerminate</br>
-         * @see signature signature : ()V</br>
-         */
-        public native int ResourceHostingTerminate();
-
-    static
-    {
-        System.loadLibrary("gnustl_shared");
-        System.loadLibrary("oc_logger");
-        System.loadLibrary("connectivity_abstraction");
-        System.loadLibrary("ca-interface");
-        System.loadLibrary("octbstack");
-        System.loadLibrary("oc");
-        System.loadLibrary("ocstack-jni");
-        System.loadLibrary("NotificationManager");
-    }
-}
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/AndroidManifest.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/AndroidManifest.xml
new file mode 100755 (executable)
index 0000000..275534b
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.resourcehostingsampleapp"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="19" />
+    
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.INTERNET_ACCESS" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.GET_TASKS"/>
+    <uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION"/>
+    <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="com.example.resourcehostingsampleapp.ResourceHostingSampleApp"
+            android:label="@string/app_name" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/project.properties b/service/notification-manager/SampleApp/android/SampleResourceHosting/project.properties
new file mode 100755 (executable)
index 0000000..4ab1256
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-19
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-hdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-hdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..288b665
Binary files /dev/null and b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-hdpi/ic_launcher.png differ
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-mdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-mdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..6ae570b
Binary files /dev/null and b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-mdpi/ic_launcher.png differ
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xhdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xhdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..d4fb7cd
Binary files /dev/null and b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xxhdpi/ic_launcher.png b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..85a6081
Binary files /dev/null and b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/layout/activity_main.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/layout/activity_main.xml
new file mode 100755 (executable)
index 0000000..3cb37b5
--- /dev/null
@@ -0,0 +1,80 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical"
+    android:paddingBottom="5dp"
+    android:paddingLeft="10dp"
+    android:paddingRight="10dp"
+    android:paddingTop="10dp" >
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" >
+        
+            <Button
+                android:id="@+id/btnStartHosting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="startHosting"
+                android:textSize="18sp" />    
+    </LinearLayout>
+    
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" >
+        
+            <Button
+                android:id="@+id/btnStopHosting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="StopHosting"
+                android:textSize="18sp" />    
+    </LinearLayout>
+
+       
+       <Space
+               android:layout_width="match_parent"
+               android:layout_height="10dp" />
+
+       <LinearLayout
+           android:layout_width="match_parent"
+           android:layout_height="5dp"
+           android:orientation="vertical"
+           android:background="#111111" >
+       </LinearLayout>
+
+       <Space
+           android:layout_width="match_parent"
+           android:layout_height="5dp" />
+      
+       <LinearLayout
+           android:layout_width="match_parent"
+           android:layout_height="wrap_content"
+           android:orientation="vertical"
+           android:paddingTop="0dp" >
+
+               <Button
+                   android:id="@+id/btLogClear"
+                   android:layout_width="match_parent"
+                   android:layout_height="wrap_content"
+                   android:text="CLEAR LOG"
+                   android:textSize="18sp" />
+
+               <ScrollView
+                   android:id="@+id/sclLog"
+                   android:layout_width="match_parent"
+                   android:layout_height="match_parent" >
+                       
+                       <TextView
+                           android:id="@+id/txtLog"
+                           android:layout_width="match_parent"
+                           android:layout_height="match_parent"
+                           android:layout_alignParentBottom="true"
+                           android:layout_alignParentLeft="true"
+                           android:textSize="15sp" />
+          
+               </ScrollView>
+       
+       </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v11/styles.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v11/styles.xml
new file mode 100755 (executable)
index 0000000..3c02242
--- /dev/null
@@ -0,0 +1,11 @@
+<resources>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v14/styles.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values-v14/styles.xml
new file mode 100755 (executable)
index 0000000..a91fd03
--- /dev/null
@@ -0,0 +1,12 @@
+<resources>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/strings.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/strings.xml
new file mode 100755 (executable)
index 0000000..9ac731d
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">ResourceHostingSampleApp</string>
+    <string name="hello_world">Hello world!</string>
+
+</resources>
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/styles.xml b/service/notification-manager/SampleApp/android/SampleResourceHosting/res/values/styles.xml
new file mode 100755 (executable)
index 0000000..6ce89c7
--- /dev/null
@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>
diff --git a/service/notification-manager/SampleApp/android/SampleResourceHosting/src/com/example/resourcehostingsampleapp/ResourceHostingSampleApp.java b/service/notification-manager/SampleApp/android/SampleResourceHosting/src/com/example/resourcehostingsampleapp/ResourceHostingSampleApp.java
new file mode 100755 (executable)
index 0000000..602c9ac
--- /dev/null
@@ -0,0 +1,224 @@
+//******************************************************************
+//
+// 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.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+package com.example.resourcehostingsampleapp;
+
+import java.lang.reflect.Method;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+
+import org.iotivity.ResourceHosting.ResourceHosting;
+import org.iotivity.base.ModeType;
+import org.iotivity.base.OcPlatform;
+import org.iotivity.base.OcResourceHandle;
+import org.iotivity.base.PlatformConfig;
+import org.iotivity.base.QualityOfService;
+import org.iotivity.base.ServiceType;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * To execute resource hosting function for android sample application .
+ * @author Copyright 2015 Samsung Electronics All Rights Reserved.
+ * @see className class :   ResourceHosting</br>
+ *
+ */
+
+public class ResourceHostingSampleApp extends Activity implements OnClickListener
+{
+        private final int OCSTACK_OK = 0;
+        private final int OCSTACK_ERROR = 255;
+        private final int RESOURCEHOSTING_DO_NOT_THREADRUNNING = -2;
+
+        private String TAG = "ResourceHosting";
+        private OcResourceHandle mResourceHandle;
+        private String  mIpAddress;
+        private TextView mLogTextView;
+        private String mLog = "";
+        private ResourceHosting resourceHosting;
+        /**
+         * To initialize UI Function Setting.
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : onCreate</br>
+         */
+        protected void onCreate(Bundle savedInstanceState)
+        {
+            super.onCreate(savedInstanceState);
+            setContentView(R.layout.activity_main);
+            mLogTextView = (TextView) findViewById(R.id.txtLog);
+            findViewById(R.id.btnStartHosting).setOnClickListener(this);
+            findViewById(R.id.btnStopHosting).setOnClickListener(this);
+            findViewById(R.id.btLogClear).setOnClickListener(this);
+
+            PlatformConfig platformConfigObj;
+            resourceHosting = new ResourceHosting();
+            platformConfigObj = new PlatformConfig(this,ServiceType.IN_PROC,
+                    ModeType.CLIENT_SERVER, "0.0.0.0", 0, QualityOfService.LOW);
+
+            Log.i(TAG, "Before Calling Configure of ocPlatform");
+            OcPlatform.Configure(platformConfigObj);
+            Log.i(TAG, "Configuration done Successfully");
+        }
+
+        /**
+         * To execute initOICStack for running Resource hosting.
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : onStart</br>
+         */
+        @Override
+        protected void onStart()
+        {
+            super.onStart();
+            initOICStack();
+        }
+
+        /**
+         * To terminate Resource hosting.
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : onStop</br>
+         */
+        @Override
+        protected void onStop()
+        {
+            super.onStop();
+            int result;
+            result = resourceHosting.ResourceHostingTerminate();
+            Log.d(TAG, "ResourceHostingTerminate : "+ result);
+        }
+
+        protected void onResume()
+        {
+            super.onResume();
+        }
+
+        /**
+         * To execute initOICStack for running Resource hosting.
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : onRestart</br>
+         */
+        @Override
+        protected void onRestart()
+        {
+            super.onRestart();
+            initOICStack();
+        }
+
+        /**
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : onDestroy</br>
+         */
+        protected void onDestroy()
+        {
+            super.onDestroy();
+        }
+
+        /**
+         * get IpAddress and execute resourceHostingInit() method.
+         * @see Class   class : com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method : initOICStack</br>
+         */
+        private void initOICStack()
+        {
+            try
+            {
+                mIpAddress = getIpAddress();
+                int result = 0;
+                result = resourceHosting.ResourceHostingInit(mIpAddress);
+                Log.d(TAG, "ResourceHostingInit : " + result);
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+
+        /**
+         * @see Class   class :  com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method  method :  getIpAddress</br>
+         */
+        private String getIpAddress()
+        {
+            try
+            {
+                for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
+                     en.hasMoreElements();)
+                {
+                    NetworkInterface intf = (NetworkInterface) en.nextElement();
+                    for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
+                    {
+                        InetAddress inetAddress = (InetAddress) enumIpAddr.nextElement();
+                        if (!inetAddress.isLoopbackAddress())
+                        {
+                            if (inetAddress instanceof Inet4Address)
+                                return inetAddress.getHostAddress().toString();
+                        }
+                    }
+                }
+            }
+            catch (SocketException e)
+            {
+                e.printStackTrace();
+            }
+            return null;
+        }
+
+        /**
+         * @see Class  class :   com_example_resourcehostingsampleapp_ResourceHosting</br>
+         * @see Method method :   onClick</br>
+         * @param v view to choice
+         */
+        public void onClick(View v)
+        {
+            int getId = v.getId();
+
+            switch (getId)
+            {
+                case R.id.btnStartHosting:
+                    try
+                    {
+                        int result;
+                        result = resourceHosting.OICCoordinatorStart();
+                        Log.d(TAG, "OICCoordinatorStart : " + result);
+                    }
+                    catch (Exception e)
+                    {
+                        Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
+                    }
+                    break;
+                case R.id.btnStopHosting:
+                    int result;
+                    result = resourceHosting.OICCoordinatorStop();
+                    Log.d(TAG, "OICCoordinatorStop : "+ result);
+                    break;
+                case R.id.btLogClear:
+                default:
+                    break;
+            }
+        }
+
+}