Update on android sample resource bundle
authorMarkus Jung <markus.jung@samsung.com>
Thu, 3 Dec 2015 04:57:36 +0000 (13:57 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 14 Dec 2015 00:54:25 +0000 (00:54 +0000)
- Renamed classes and new package structure
- Sample for temperature and humidity sensor based on Android
- Added copyright note
- Changed source files to Unix new-line

Change-Id: I8afdfaf3cffdf1ed0a9f5383e83bb58ef1771b22
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4463
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
39 files changed:
service/resource-container/android/resource-container/src/main/jni/Android.mk
service/resource-container/android/resource-container/src/main/jni/AndroidResource.cpp
service/resource-container/examples/ContainerSampleClient.cpp
service/resource-container/examples/android/AndroidBundle/app/build.gradle
service/resource-container/examples/android/AndroidBundle/app/src/androidTest/java/org/iotivity/service/sample/androidbundle/ApplicationTest.java
service/resource-container/examples/android/AndroidBundle/app/src/main/AndroidManifest.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLightResource.java [deleted file]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLocationResource.java [deleted file]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidSampleActivator.java [deleted file]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/DummyActivity.java [moved from service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/MainActivity.java with 54% similarity]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/SampleActivator.java [new file with mode: 0755]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/DiscomfortIndexResource.java [moved from service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/DiscomfortIndexSensorResource.java with 61% similarity]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/HumidityResource.java [new file with mode: 0755]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/LightIntensityResource.java [moved from service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/LightSensor.java with 62% similarity]
service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/TemperatureResource.java [new file with mode: 0755]
service/resource-container/examples/android/AndroidBundle/app/src/main/res/layout/activity_main.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/menu/menu_main.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/values-v21/styles.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/values-w820dp/dimens.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/values/dimens.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/values/strings.xml
service/resource-container/examples/android/AndroidBundle/app/src/main/res/values/styles.xml
service/resource-container/examples/android/AndroidBundle/build.gradle
service/resource-container/examples/android/AndroidBundle/gradle.properties [deleted file]
service/resource-container/examples/android/AndroidBundle/gradle/wrapper/gradle-wrapper.properties
service/resource-container/examples/android/AndroidBundle/gradlew.bat
service/resource-container/examples/android/AndroidBundle/settings.gradle
service/resource-container/examples/android/ContainerSampleApp/RESampleServerApp.iml
service/resource-container/examples/android/ContainerSampleApp/app/src/main/assets/lib/ResourceContainerConfig.xml
service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/DroidLED.java [deleted file]
service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/FlashLightResource.java [deleted file]
service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/OicLightActivity.java [deleted file]
service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainerActivity.java
service/resource-container/examples/android/ContainerSampleApp/gradle.properties [deleted file]
service/resource-container/examples/android/ContainerSampleApp/gradlew.bat
service/resource-container/src/BundleResource.cpp
service/resource-container/src/DiscoverResourceUnit.cpp
service/resource-container/src/DiscoverResourceUnit.h
service/resource-container/src/ResourceContainerImpl.cpp

index 915ada5..d5620f6 100644 (file)
@@ -34,6 +34,8 @@ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/resource-container/src
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/resource-encapsulation/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/resource-encapsulation/src/serverBuilder/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/stack/include
+LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
+LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
 
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/
index 1a08ff3..46ec01a 100644 (file)
@@ -62,7 +62,7 @@ void AndroidResource::initAttributes()
 AndroidResource::AndroidResource(JNIEnv *env, jobject obj, jobject bundleResource,
                                        string bundleId, jobjectArray attributes)
 {
-    LOGD("Creating android resource");
+    LOGD("Creating android resource, bundleId: %s", bundleId.c_str());
     (void) obj;
     m_env = env;
     int stringCount = m_env->GetArrayLength(attributes);
@@ -87,10 +87,43 @@ AndroidResource::AndroidResource(JNIEnv *env, jobject obj, jobject bundleResourc
     LOGD("Looking for getter.");
     m_attributeGetRequestHandler = m_env->GetMethodID(m_bundleResourceClass,
             "handleGetAttributesRequest", "()Lorg/iotivity/service/resourcecontainer/RcsResourceAttributes;");
-    jclass androidBundleSoftSensorResourceClass = m_env->FindClass("org/iotivity/service/resourcecontainer/AndroidBundleSoftSensorResource");
-    m_onUpdatedInputResource = m_env->GetMethodID(androidBundleSoftSensorResourceClass, "onUpdatedInputResource", "(java/lang/String,java/util/Vector)V");
-    m_vectorClazz = m_env->FindClass("java/util/Vector");
-    m_vectorAddMethod =  m_env->GetMethodID(m_vectorClazz, "add", "(java/lang/Object)V");
+    //LOGD("Looking for softSensorResource class.");
+    //jclass androidBundleSoftSensorResourceClass = m_env->FindClass("org/iotivity/service/resourcecontainer/AndroidBundleSoftSensorResource");
+    LOGD("Looking for onUpdatedInputResource2.");
+    jclass superclass = m_env->GetSuperclass(m_bundleResourceClass);
+
+    jclass classClass = m_env->FindClass("java/lang/Class");
+
+    // Find the getName() method on the class object
+    jmethodID mid = env->GetMethodID(classClass, "getName", "()Ljava/lang/String;");
+
+    // Call the getName() to get a jstring object back
+    jstring strObj = (jstring)env->CallObjectMethod(superclass, mid);
+
+    // Now get the c string from the java jstring object
+    const char* str = env->GetStringUTFChars(strObj, NULL);
+
+    LOGD("Name of super class is %s", str);
+
+    //check for softsensor resource
+    if(strcmp("org.iotivity.service.resourcecontainer.AndroidBundleSoftSensorResource", str) == 0){
+       m_onUpdatedInputResource = m_env->GetMethodID(m_bundleResourceClass, "onUpdatedInputResource", "(Ljava/lang/String;Ljava/util/Vector;)V");
+       if (env->ExceptionCheck()) {
+           env->ExceptionDescribe();
+       }
+       LOGD("Looking up vector.");
+       m_vectorClazz = m_env->FindClass("java/util/Vector");
+       if (env->ExceptionCheck()) {
+               env->ExceptionDescribe();
+       }
+       LOGD("Looking up vector add method.");
+       m_vectorAddMethod =  m_env->GetMethodID(m_vectorClazz, "add", "(Ljava/lang/Object;)Z");
+       if (env->ExceptionCheck()) {
+              env->ExceptionDescribe();
+       }
+    }
+
+
     LOGD("Get java vm.");
     int jvmAccess = m_env->GetJavaVM(&m_jvm);
     LOGD("JVM: %s", (jvmAccess ? "false" : "true") );
index b81b288..0619a70 100644 (file)
@@ -116,6 +116,45 @@ void onObserve(const HeaderOptions headerOptions, const OCRepresentation &rep,
 
 }
 
+
+void onLightIntensityObserve(const HeaderOptions headerOptions, const OCRepresentation &rep,
+               const int &eCode, const int &sequenceNumber)
+{
+    (void)headerOptions;
+    try
+    {
+        if (eCode == OC_STACK_OK)
+        {
+            std::cout << "OBSERVE RESULT:" << std::endl;
+            std::cout << "\tSequenceNumber: " << sequenceNumber << std::endl;
+
+
+            std::cout << "\tintensity: " << rep.getValue<int>("intensity") << std::endl;
+
+
+            if (observe_count() > 10)
+            {
+                std::cout << "Cancelling Observe..." << std::endl;
+                OCStackResult result = curResource->cancelObserve();
+
+                std::cout << "Cancel result: " << result << std::endl;
+                sleep(10);
+                std::cout << "DONE" << std::endl;
+                std::exit(0);
+            }
+        }
+        else
+        {
+            std::cout << "onObserve Response error: " << eCode << std::endl;
+        }
+    }
+    catch (std::exception &e)
+    {
+        std::cout << "Exception: " << e.what() << " in onObserve" << std::endl;
+    }
+
+}
+
 void onPost2(const HeaderOptions &headerOptions, const OCRepresentation &rep, const int eCode)
 {
     (void)headerOptions;
@@ -377,7 +416,19 @@ void onGetForLightIntensitySensor(const HeaderOptions &headerOptions, const OCRe
 
             std::cout << "Payload: " << rep.getPayload() << std::endl;
 
-            std::cout << "\lightIntensity: " << rep.getValue<int>("lightintensity") << std::endl;
+            std::cout << "\tlightIntensity: " << rep.getValue<int>("intensity") << std::endl;
+
+            // iterating over all elements
+            OCRepresentation::const_iterator itr = rep.begin();
+            OCRepresentation::const_iterator endItr = rep.end();
+
+            for(;itr!=endItr;++itr)
+            {
+                std::cout << itr->attrname() << " ";
+                std::cout << itr->getValue<int>() << std::endl;
+            }
+
+            curResource->observe(OBSERVE_TYPE_TO_USE, QueryParamsMap(), &onLightIntensityObserve);
         }
         else
         {
@@ -451,7 +502,7 @@ void foundResource(std::shared_ptr<OCResource> resource)
                     // Call a local function which will internally invoke get API on the resource pointer
                     getLightRepresentation(resource);
                 }*/
-                if (resourceTypes == "oic.r.lightintensity")
+                if (resourceTypes == "oic.r.lightsensor")
                 {
                     curResource = resource;
                     // Call a local function which will internally invoke get API on the resource pointer
index a307910..043b375 100755 (executable)
@@ -1,25 +1,25 @@
-apply plugin: 'com.android.application'\r
-\r
-android {\r
-    compileSdkVersion 23\r
-    buildToolsVersion "22.0.1"\r
-\r
-    defaultConfig {\r
-        applicationId "org.iotivity.service.sample.androidbundle"\r
-        minSdkVersion 21\r
-        targetSdkVersion 23\r
-        versionCode 1\r
-        versionName "1.0"\r
-    }\r
-    buildTypes {\r
-        release {\r
-            minifyEnabled false\r
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\r
-        }\r
-    }\r
-}\r
-\r
-dependencies {\r
-    compile fileTree(dir: 'libs', include: ['*.jar'])\r
-    compile(name:'iotivity-armeabi-v7a-resource-container-release', ext:'aar')\r
-}\r
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 23
+    buildToolsVersion "22.0.1"
+
+    defaultConfig {
+        applicationId "org.iotivity.service.sample.androidbundle"
+        minSdkVersion 21
+        targetSdkVersion 23
+        versionCode 1
+        versionName "1.0"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile(name:'iotivity-armeabi-v7a-resource-container-release', ext:'aar')
+}
index e1b035e..6d4ab8e 100755 (executable)
@@ -1,13 +1,13 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.app.Application;\r
-import android.test.ApplicationTestCase;\r
-\r
-/**\r
- * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>\r
- */\r
-public class ApplicationTest extends ApplicationTestCase<Application> {\r
-    public ApplicationTest() {\r
-        super(Application.class);\r
-    }\r
+package org.iotivity.service.sample.androidbundle;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+    public ApplicationTest() {
+        super(Application.class);
+    }
 }
\ No newline at end of file
index 4961797..0d6218a 100755 (executable)
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"\r
-    package="org.iotivity.service.sample.androidbundle" >\r
-\r
-    <application\r
-        android:allowBackup="true"\r
-        android:icon="@mipmap/ic_launcher"\r
-        android:label="@string/app_name"\r
-        android:theme="@style/AppTheme" >\r
-        <activity\r
-            android:name=".MainActivity"\r
-            android:label="@string/app_name" >\r
-            <intent-filter>\r
-                <action android:name="android.intent.action.MAIN" />\r
-\r
-                <category android:name="android.intent.category.LAUNCHER" />\r
-            </intent-filter>\r
-        </activity>\r
-    </application>\r
-\r
-</manifest>\r
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="org.iotivity.service.sample.androidbundle" >
+
+    <application
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name=".DummyActivity"
+            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/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLightResource.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLightResource.java
deleted file mode 100755 (executable)
index fcdd994..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.content.Context;\r
-import android.util.Log;\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceAttributes;\r
-\r
-/**\r
- * Created by markus.jung on 11/8/2015.\r
- */\r
-public class AndroidLightResource extends AndroidBundleResource {\r
-    private static final String LOG_TAG = AndroidLightResource.class.getSimpleName();\r
-    public AndroidLightResource(Context context){\r
-        super(context);\r
-        this.setResourceType("oic.r.light");\r
-        this.setName("androidLightResource");\r
-    }\r
-    @Override\r
-    protected void initAttributes() {\r
-        this.m_attributes.put("on-off", false);\r
-    }\r
-\r
-    @Override\r
-    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {\r
-\r
-        for(String key: attrs.keySet()){\r
-            Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));\r
-        }\r
-\r
-        Log.i(LOG_TAG, "Set Attributes called with " + attrs);\r
-\r
-        Log.i(LOG_TAG, "On-off value: " + attrs.get("on-off"));\r
-    }\r
-\r
-    @Override\r
-    public RcsResourceAttributes handleGetAttributesRequest() {\r
-        Log.i(LOG_TAG, "Get Attributes called");\r
-        Log.i(LOG_TAG, "Returning: ");\r
-        for(String key: m_attributes.keySet()){\r
-            Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));\r
-        }\r
-        return this.m_attributes;\r
-    }\r
-}\r
diff --git a/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLocationResource.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidLocationResource.java
deleted file mode 100755 (executable)
index 39bef3f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceAttributes;\r
-\r
-/**\r
- * Created by markus.jung on 11/8/2015.\r
- */\r
-public class AndroidLocationResource extends AndroidBundleResource {\r
-    @Override\r
-    protected void initAttributes() {\r
-\r
-    }\r
-\r
-    @Override\r
-    public void handleSetAttributesRequest(RcsResourceAttributes rcsResourceAttributes) {\r
-\r
-    }\r
-\r
-    @Override\r
-    public RcsResourceAttributes handleGetAttributesRequest() {\r
-        return null;\r
-    }\r
-}\r
diff --git a/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidSampleActivator.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/AndroidSampleActivator.java
deleted file mode 100755 (executable)
index d392bbe..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.content.Context;\r
-import android.util.Log;\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleActivator;\r
-import org.iotivity.service.resourcecontainer.AndroidBundleResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceContainerBundleAPI;\r
-import org.iotivity.service.resourcecontainer.ResourceConfig;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * Created by markus.jung on 11/7/2015.\r
- */\r
-public class AndroidSampleActivator extends AndroidBundleActivator {\r
-\r
-    public AndroidSampleActivator(RcsResourceContainerBundleAPI bundleAPI, Context appContext){\r
-        super(bundleAPI, appContext);\r
-        Log.d(AndroidSampleActivator.class.getName(), "Created activator instance");\r
-    }\r
-\r
-    @Override\r
-    public void activateBundle() {\r
-        Log.d(AndroidSampleActivator.class.getName(), "Activate bundle called");\r
-\r
-        // make a test resource\r
-        AndroidLightResource lightRes = new AndroidLightResource(this.appContext);\r
-        lightRes.setURI("/android/light/1");\r
-        bundleAPI.registerResource("oic.android.sample", lightRes);\r
-\r
-        LightSensor lightSensor = new LightSensor(this.appContext);\r
-        lightSensor.setURI("/android/lightsensor/1");\r
-        bundleAPI.registerResource("oic.android.sample", lightSensor);\r
-\r
-        DiscomfortIndexSensorResource diResource = new DiscomfortIndexSensorResource(this.appContext);\r
-        diResource.setURI("/android/discomfortindex/1");\r
-        bundleAPI.registerResource("oic.android.sample", diResource);\r
-    }\r
-\r
-    @Override\r
-    public void deactivateBundle() {\r
-\r
-    }\r
-\r
-    @Override\r
-    public void createResource(ResourceConfig resourceConfig) {\r
-\r
-    }\r
-\r
-    @Override\r
-    public void destroyResource(AndroidBundleResource androidBundleResource) {\r
-\r
-    }\r
-\r
-    @Override\r
-    public List<ResourceConfig> getConfiguredBundleResources() {\r
-        return null;\r
-    }\r
-}\r
@@ -1,37 +1,58 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.app.Activity;\r
-import android.os.Bundle;\r
-import android.view.Menu;\r
-import android.view.MenuItem;\r
-\r
-public class MainActivity extends Activity {\r
-\r
-    @Override\r
-    protected void onCreate(Bundle savedInstanceState) {\r
-        super.onCreate(savedInstanceState);\r
-        setContentView(R.layout.activity_main);\r
-    }\r
-\r
-    @Override\r
-    public boolean onCreateOptionsMenu(Menu menu) {\r
-        // Inflate the menu; this adds items to the action bar if it is present.\r
-        getMenuInflater().inflate(R.menu.menu_main, menu);\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public boolean onOptionsItemSelected(MenuItem item) {\r
-        // Handle action bar item clicks here. The action bar will\r
-        // automatically handle clicks on the Home/Up button, so long\r
-        // as you specify a parent activity in AndroidManifest.xml.\r
-        int id = item.getItemId();\r
-\r
-        //noinspection SimplifiableIfStatement\r
-        if (id == R.id.action_settings) {\r
-            return true;\r
-        }\r
-\r
-        return super.onOptionsItemSelected(item);\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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.service.sample.androidbundle;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+public class DummyActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // Inflate the menu; this adds items to the action bar if it is present.
+        getMenuInflater().inflate(R.menu.menu_main, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Handle action bar item clicks here. The action bar will
+        // automatically handle clicks on the Home/Up button, so long
+        // as you specify a parent activity in AndroidManifest.xml.
+        int id = item.getItemId();
+
+        //noinspection SimplifiableIfStatement
+        if (id == R.id.action_settings) {
+            return true;
+        }
+
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/SampleActivator.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/SampleActivator.java
new file mode 100755 (executable)
index 0000000..83c9ef7
--- /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.service.sample.androidbundle;
+
+import android.content.Context;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleActivator;
+import org.iotivity.service.resourcecontainer.AndroidBundleResource;
+import org.iotivity.service.resourcecontainer.RcsResourceContainerBundleAPI;
+import org.iotivity.service.resourcecontainer.ResourceConfig;
+import org.iotivity.service.sample.androidbundle.resources.DiscomfortIndexResource;
+import org.iotivity.service.sample.androidbundle.resources.HumidityResource;
+import org.iotivity.service.sample.androidbundle.resources.LightIntensityResource;
+import org.iotivity.service.sample.androidbundle.resources.TemperatureResource;
+
+import java.util.List;
+
+/**
+ * Created by markus.jung on 11/7/2015.
+ */
+public class SampleActivator extends AndroidBundleActivator {
+
+    public SampleActivator(RcsResourceContainerBundleAPI bundleAPI, Context appContext){
+        super(bundleAPI, appContext);
+        Log.d(SampleActivator.class.getName(), "Created activator instance");
+    }
+
+    @Override
+    public void activateBundle() {
+        Log.d(SampleActivator.class.getName(), "Activate bundle called");
+
+        LightIntensityResource lightIntensityResource = new LightIntensityResource(this.appContext);
+        lightIntensityResource.setURI("/lightsensor/1");
+        bundleAPI.registerResource("oic.android.sample", lightIntensityResource);
+
+        HumidityResource humidityResource = new HumidityResource(this.appContext);
+        humidityResource.setURI("/humidity/1");
+        bundleAPI.registerResource("oic.android.sample", humidityResource);
+
+        TemperatureResource tempResource = new TemperatureResource(this.appContext);
+        tempResource.setURI("/temperature/1");
+        bundleAPI.registerResource("oic.android.sample", tempResource);
+
+        DiscomfortIndexResource diResource = new DiscomfortIndexResource(this.appContext);
+        diResource.setURI("/android/discomfortindex/1");
+        bundleAPI.registerResource("oic.android.sample", diResource);
+    }
+
+    @Override
+    public void deactivateBundle() {
+
+    }
+
+    @Override
+    public void createResource(ResourceConfig resourceConfig) {
+
+    }
+
+    @Override
+    public void destroyResource(AndroidBundleResource androidBundleResource) {
+
+    }
+
+    @Override
+    public List<ResourceConfig> getConfiguredBundleResources() {
+        return null;
+    }
+}
@@ -1,68 +1,85 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.content.Context;\r
-import android.hardware.Sensor;\r
-import android.hardware.SensorManager;\r
-import android.util.Log;\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleSoftSensorResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceAttributes;\r
-import org.iotivity.service.resourcecontainer.RcsValue;\r
-\r
-import java.util.Vector;\r
-\r
-/**\r
- * Created by markus.jung on 11/27/2015.\r
- */\r
-public class DiscomfortIndexSensorResource extends AndroidBundleSoftSensorResource {\r
-    private static final String LOG_TAG = DiscomfortIndexSensorResource.class.getSimpleName();\r
-\r
-    public DiscomfortIndexSensorResource(Context context){\r
-        super(context);\r
-        this.setResourceType("oic.r.discomfortindex");\r
-        this.setName("discomfortIndex");\r
-    }\r
-\r
-    @Override\r
-    protected void initAttributes() {\r
-        this.m_attributes.put("discomfortIndex", 0);\r
-        this.m_attributes.put("humidity", 0);\r
-        this.m_attributes.put("temperature",0);\r
-    }\r
-\r
-    @Override\r
-    protected void onUpdatedInputResource(String attributeName, Vector<RcsValue> values) {\r
-        m_mapInputData.put(attributeName, values.get(0));\r
-    }\r
-\r
-    @Override\r
-    protected void executeLogic() {\r
-        if(m_mapInputData.get("humidity") != null && m_mapInputData.get("temperature") != null){\r
-            double dDI = 0.0;\r
-\r
-            int t = m_mapInputData.get("temperature").asInt();\r
-            int h = m_mapInputData.get("humidity").asInt();\r
-            double F = (9.0 * (double) t) / 5.0 + 32.0;\r
-\r
-            // calculation of discomfortIndex\r
-            dDI = F - (F - 58.0) * (double)((100 - h) * 55) / 10000.0;\r
-\r
-            this.setAttribute("temperature", new RcsValue(t));\r
-            this.setAttribute("humidity", new RcsValue(h));\r
-            this.setAttribute("discomfortIndex", new RcsValue(dDI));\r
-\r
-            Log.i(LOG_TAG, "Discomfort Index" + dDI);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public void handleSetAttributesRequest(RcsResourceAttributes rcsResourceAttributes) {\r
-        this.setAttributes(rcsResourceAttributes);\r
-        executeLogic();\r
-    }\r
-\r
-    @Override\r
-    public RcsResourceAttributes handleGetAttributesRequest() {\r
-        return this.getAttributes();\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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.service.sample.androidbundle.resources;
+
+import android.content.Context;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleSoftSensorResource;
+import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
+import org.iotivity.service.resourcecontainer.RcsValue;
+
+import java.util.Vector;
+
+public class DiscomfortIndexResource extends AndroidBundleSoftSensorResource {
+    private static final String LOG_TAG = DiscomfortIndexResource.class.getSimpleName();
+
+    public DiscomfortIndexResource(Context context){
+        super(context);
+        this.setResourceType("oic.r.discomfortindex");
+        this.setName("discomfortIndex");
+    }
+
+    @Override
+    protected void initAttributes() {
+        this.m_attributes.put("discomfortIndex", 0);
+        this.m_attributes.put("humidity", 0);
+        this.m_attributes.put("temperature",0);
+    }
+
+    @Override
+    protected void onUpdatedInputResource(String attributeName, Vector<RcsValue> values) {
+        m_mapInputData.put(attributeName, values.get(0));
+    }
+
+    @Override
+    protected void executeLogic() {
+        if(m_mapInputData.get("humidity") != null && m_mapInputData.get("temperature") != null){
+            double dDI = 0.0;
+            Vector v = new Vector();
+
+
+            int t = m_mapInputData.get("temperature").asInt();
+            int h = m_mapInputData.get("humidity").asInt();
+            double F = (9.0 * (double) t) / 5.0 + 32.0;
+
+            // calculation of discomfortIndex
+            dDI = F - (F - 58.0) * (double)((100 - h) * 55) / 10000.0;
+
+            this.setAttribute("temperature", new RcsValue(t));
+            this.setAttribute("humidity", new RcsValue(h));
+            this.setAttribute("discomfortIndex", new RcsValue(dDI));
+
+            Log.i(LOG_TAG, "Discomfort Index" + dDI);
+        }
+    }
+
+    @Override
+    public void handleSetAttributesRequest(RcsResourceAttributes rcsResourceAttributes) {
+        this.setAttributes(rcsResourceAttributes);
+        executeLogic();
+    }
+
+    @Override
+    public RcsResourceAttributes handleGetAttributesRequest() {
+        return this.getAttributes();
+    }
+}
diff --git a/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/HumidityResource.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/HumidityResource.java
new file mode 100755 (executable)
index 0000000..811f406
--- /dev/null
@@ -0,0 +1,83 @@
+//******************************************************************
+//
+// 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.service.sample.androidbundle.resources;
+
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleResource;
+import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
+import org.iotivity.service.resourcecontainer.RcsValue;
+
+public class HumidityResource extends AndroidBundleResource  implements SensorEventListener {
+    private static final String LOG_TAG = HumidityResource.class.getSimpleName();
+    private final SensorManager mSensorManager;
+    private final Sensor humiditySensor;
+
+    public HumidityResource(Context context){
+        super(context);
+        this.setResourceType("oic.r.humidity");
+        this.setName("humiditySensor");
+        mSensorManager = (SensorManager) context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
+        humiditySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_RELATIVE_HUMIDITY);
+        mSensorManager.registerListener(this, humiditySensor, SensorManager.SENSOR_DELAY_NORMAL);
+    }
+
+    @Override
+    protected void initAttributes() {
+        this.m_attributes.put("humidity", 0d);
+    }
+
+    @Override
+    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {
+        Log.i(LOG_TAG, "Set Attributes called with ");
+        for(String key: attrs.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));
+        }
+    }
+
+    @Override
+    public RcsResourceAttributes handleGetAttributesRequest() {
+        Log.i(LOG_TAG, "Get Attributes called");
+        Log.i(LOG_TAG, "Returning: ");
+        for(String key: m_attributes.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));
+        }
+        return this.m_attributes;
+    }
+
+    @Override
+    public void onSensorChanged(SensorEvent sensorEvent) {
+        Log.i(LOG_TAG, "Sensor event " + sensorEvent.values[0]);
+
+        setAttribute("humidity", new RcsValue( (int) (sensorEvent.values[0]) ) , true);
+    }
+
+    @Override
+    public void onAccuracyChanged(Sensor sensor, int i) {
+
+    }
+}
@@ -1,65 +1,83 @@
-package org.iotivity.service.sample.androidbundle;\r
-\r
-import android.content.Context;\r
-import android.hardware.Sensor;\r
-import android.hardware.SensorEvent;\r
-import android.hardware.SensorEventListener;\r
-import android.hardware.SensorManager;\r
-import android.util.Log;\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceAttributes;\r
-import org.iotivity.service.resourcecontainer.RcsValue;\r
-\r
-/**\r
- * Created by markus.jung on 11/26/2015.\r
- */\r
-public class LightSensor extends AndroidBundleResource implements SensorEventListener {\r
-    private static final String LOG_TAG = AndroidLightResource.class.getSimpleName();\r
-    private final SensorManager mSensorManager;\r
-    private final Sensor lightSensor;\r
-\r
-    public LightSensor(Context context){\r
-        super(context);\r
-        this.setResourceType("oic.r.lightsensor");\r
-        this.setName("lightSensor");\r
-        mSensorManager = (SensorManager) context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);\r
-        lightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);\r
-        mSensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL);\r
-    }\r
-\r
-    @Override\r
-    protected void initAttributes() {\r
-        this.m_attributes.put("intensity", 0);\r
-    }\r
-\r
-    @Override\r
-    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {\r
-        Log.i(LOG_TAG, "Set Attributes called with ");\r
-        for(String key: attrs.keySet()){\r
-            Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public RcsResourceAttributes handleGetAttributesRequest() {\r
-        Log.i(LOG_TAG, "Get Attributes called");\r
-        Log.i(LOG_TAG, "Returning: ");\r
-        for(String key: m_attributes.keySet()){\r
-            Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));\r
-        }\r
-        return this.m_attributes;\r
-    }\r
-\r
-    @Override\r
-    public void onSensorChanged(SensorEvent sensorEvent) {\r
-        Log.i(LOG_TAG, "Sensor event " + sensorEvent.values[0]);\r
-\r
-        setAttribute("intensity", new RcsValue( (int) (sensorEvent.values[0]) ) , true);\r
-    }\r
-\r
-    @Override\r
-    public void onAccuracyChanged(Sensor sensor, int i) {\r
-\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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.service.sample.androidbundle.resources;
+
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleResource;
+import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
+import org.iotivity.service.resourcecontainer.RcsValue;
+
+public class LightIntensityResource extends AndroidBundleResource implements SensorEventListener {
+    private static final String LOG_TAG = LightIntensityResource.class.getSimpleName();
+    private final SensorManager mSensorManager;
+    private final Sensor lightSensor;
+
+    public LightIntensityResource(Context context){
+        super(context);
+        this.setResourceType("oic.r.lightsensor");
+        this.setName("lightSensor");
+        mSensorManager = (SensorManager) context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
+        lightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
+        mSensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL);
+    }
+
+    @Override
+    protected void initAttributes() {
+        this.m_attributes.put("intensity", 0);
+    }
+
+    @Override
+    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {
+        Log.i(LOG_TAG, "Set Attributes called with ");
+        for(String key: attrs.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));
+        }
+    }
+
+    @Override
+    public RcsResourceAttributes handleGetAttributesRequest() {
+        Log.i(LOG_TAG, "Get Attributes called");
+        Log.i(LOG_TAG, "Returning: ");
+        for(String key: m_attributes.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));
+        }
+        return this.m_attributes;
+    }
+
+    @Override
+    public void onSensorChanged(SensorEvent sensorEvent) {
+        Log.i(LOG_TAG, "Sensor event " + sensorEvent.values[0]);
+
+        setAttribute("intensity", new RcsValue( (int) (sensorEvent.values[0]) ) , true);
+    }
+
+    @Override
+    public void onAccuracyChanged(Sensor sensor, int i) {
+
+    }
+}
diff --git a/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/TemperatureResource.java b/service/resource-container/examples/android/AndroidBundle/app/src/main/java/org/iotivity/service/sample/androidbundle/resources/TemperatureResource.java
new file mode 100755 (executable)
index 0000000..c2a499f
--- /dev/null
@@ -0,0 +1,83 @@
+//******************************************************************
+//
+// 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.service.sample.androidbundle.resources;
+
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleResource;
+import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
+import org.iotivity.service.resourcecontainer.RcsValue;
+
+public class TemperatureResource  extends AndroidBundleResource implements SensorEventListener {
+    private static final String LOG_TAG = HumidityResource.class.getSimpleName();
+    private final SensorManager mSensorManager;
+    private final Sensor temperatureSensor;
+
+    public TemperatureResource(Context context){
+        super(context);
+        this.setResourceType("oic.r.temperature");
+        this.setName("humiditySensor");
+        mSensorManager = (SensorManager) context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
+        temperatureSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_RELATIVE_HUMIDITY);
+        mSensorManager.registerListener(this, temperatureSensor, SensorManager.SENSOR_DELAY_NORMAL);
+    }
+
+    @Override
+    protected void initAttributes() {
+        this.m_attributes.put("temperature", 0d);
+    }
+
+    @Override
+    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {
+        Log.i(LOG_TAG, "Set Attributes called with ");
+        for(String key: attrs.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));
+        }
+    }
+
+    @Override
+    public RcsResourceAttributes handleGetAttributesRequest() {
+        Log.i(LOG_TAG, "Get Attributes called");
+        Log.i(LOG_TAG, "Returning: ");
+        for(String key: m_attributes.keySet()){
+            Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));
+        }
+        return this.m_attributes;
+    }
+
+    @Override
+    public void onSensorChanged(SensorEvent sensorEvent) {
+        Log.i(LOG_TAG, "Sensor event " + sensorEvent.values[0]);
+
+        setAttribute("temperature", new RcsValue( (int) (sensorEvent.values[0]) ) , true);
+    }
+
+    @Override
+    public void onAccuracyChanged(Sensor sensor, int i) {
+
+    }
+}
index 1f8ac75..f7158b8 100755 (executable)
@@ -1,11 +1,11 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"\r
-    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"\r
-    android:paddingRight="@dimen/activity_horizontal_margin"\r
-    android:paddingTop="@dimen/activity_vertical_margin"\r
-    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">\r
-\r
-    <TextView android:text="@string/hello_world" android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content" />\r
-\r
-</RelativeLayout>\r
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
+    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
+
+    <TextView android:text="@string/hello_world" android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+</RelativeLayout>
index 32b5445..87a750e 100755 (executable)
@@ -1,5 +1,5 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"\r
-    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">\r
-    <item android:id="@+id/action_settings" android:title="@string/action_settings"\r
-        android:orderInCategory="100" android:showAsAction="never" />\r
-</menu>\r
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
+    <item android:id="@+id/action_settings" android:title="@string/action_settings"
+        android:orderInCategory="100" android:showAsAction="never" />
+</menu>
index 68fef58..dba3c41 100755 (executable)
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<resources>\r
-    <style name="AppTheme" parent="android:Theme.Material.Light">\r
-    </style>\r
-</resources>\r
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="AppTheme" parent="android:Theme.Material.Light">
+    </style>
+</resources>
index 62df187..63fc816 100755 (executable)
@@ -1,6 +1,6 @@
-<resources>\r
-    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\r
-         (such as screen margins) for screens with more than 820dp of available width. This\r
-         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->\r
-    <dimen name="activity_horizontal_margin">64dp</dimen>\r
-</resources>\r
+<resources>
+    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+         (such as screen margins) for screens with more than 820dp of available width. This
+         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+    <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
index 295b5a9..47c8224 100755 (executable)
@@ -1,5 +1,5 @@
-<resources>\r
-    <!-- Default screen margins, per the Android Design guidelines. -->\r
-    <dimen name="activity_horizontal_margin">16dp</dimen>\r
-    <dimen name="activity_vertical_margin">16dp</dimen>\r
-</resources>\r
+<resources>
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
index e76f575..26cc74c 100755 (executable)
@@ -1,6 +1,6 @@
-<resources>\r
-    <string name="app_name">AndroidBundle</string>\r
-\r
-    <string name="hello_world">Hello world!</string>\r
-    <string name="action_settings">Settings</string>\r
-</resources>\r
+<resources>
+    <string name="app_name">AndroidBundle</string>
+
+    <string name="hello_world">Hello world!</string>
+    <string name="action_settings">Settings</string>
+</resources>
index efe449b..ff6c9d2 100755 (executable)
@@ -1,8 +1,8 @@
-<resources>\r
-\r
-    <!-- Base application theme. -->\r
-    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">\r
-        <!-- Customize your theme here. -->\r
-    </style>\r
-\r
-</resources>\r
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- Customize your theme here. -->
+    </style>
+
+</resources>
index d8b6a5d..dcc70df 100755 (executable)
@@ -1,20 +1,20 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.\r
-\r
-buildscript {\r
-    repositories {\r
-        jcenter()\r
-    }\r
-    dependencies {\r
-        classpath 'com.android.tools.build:gradle:1.3.0'\r
-\r
-        // NOTE: Do not place your application dependencies here; they belong\r
-        // in the individual module build.gradle files\r
-    }\r
-}\r
-\r
-allprojects {\r
-    repositories {\r
-        maven { url 'http://jcenter.bintray.com/' }\r
-        flatDir { dirs 'libs' }\r
-    }\r
-}\r
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    repositories {
+        jcenter()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:1.3.0'
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+allprojects {
+    repositories {
+        maven { url 'http://jcenter.bintray.com/' }
+        flatDir { dirs 'libs' }
+    }
+}
diff --git a/service/resource-container/examples/android/AndroidBundle/gradle.properties b/service/resource-container/examples/android/AndroidBundle/gradle.properties
deleted file mode 100755 (executable)
index 0c9c39a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-## Project-wide Gradle settings.\r
-#\r
-# For more details on how to configure your build environment visit\r
-# http://www.gradle.org/docs/current/userguide/build_environment.html\r
-#\r
-# Specifies the JVM arguments used for the daemon process.\r
-# The setting is particularly useful for tweaking memory settings.\r
-# Default value: -Xmx10248m -XX:MaxPermSize=256m\r
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\r
-#\r
-# When configured, Gradle will run in incubating parallel mode.\r
-# This option should only be used with decoupled projects. More details, visit\r
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\r
-# org.gradle.parallel=true\r
-#Sun Nov 08 19:01:43 KST 2015\r
-systemProp.http.proxyHost=168.219.61.252\r
-systemProp.http.proxyPort=8080\r
index 0a74de7..c882135 100755 (executable)
@@ -1,6 +1,6 @@
-#Sun Nov 08 19:01:42 KST 2015\r
-distributionBase=GRADLE_USER_HOME\r
-distributionPath=wrapper/dists\r
-zipStoreBase=GRADLE_USER_HOME\r
-zipStorePath=wrapper/dists\r
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip\r
+#Sun Nov 08 19:01:42 KST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
index aec9973..8a0b282 100755 (executable)
@@ -1,90 +1,90 @@
-@if "%DEBUG%" == "" @echo off\r
-@rem ##########################################################################\r
-@rem\r
-@rem  Gradle startup script for Windows\r
-@rem\r
-@rem ##########################################################################\r
-\r
-@rem Set local scope for the variables with windows NT shell\r
-if "%OS%"=="Windows_NT" setlocal\r
-\r
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
-set DEFAULT_JVM_OPTS=\r
-\r
-set DIRNAME=%~dp0\r
-if "%DIRNAME%" == "" set DIRNAME=.\r
-set APP_BASE_NAME=%~n0\r
-set APP_HOME=%DIRNAME%\r
-\r
-@rem Find java.exe\r
-if defined JAVA_HOME goto findJavaFromJavaHome\r
-\r
-set JAVA_EXE=java.exe\r
-%JAVA_EXE% -version >NUL 2>&1\r
-if "%ERRORLEVEL%" == "0" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:findJavaFromJavaHome\r
-set JAVA_HOME=%JAVA_HOME:"=%\r
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
-\r
-if exist "%JAVA_EXE%" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:init\r
-@rem Get command-line arguments, handling Windowz variants\r
-\r
-if not "%OS%" == "Windows_NT" goto win9xME_args\r
-if "%@eval[2+2]" == "4" goto 4NT_args\r
-\r
-:win9xME_args\r
-@rem Slurp the command line arguments.\r
-set CMD_LINE_ARGS=\r
-set _SKIP=2\r
-\r
-:win9xME_args_slurp\r
-if "x%~1" == "x" goto execute\r
-\r
-set CMD_LINE_ARGS=%*\r
-goto execute\r
-\r
-:4NT_args\r
-@rem Get arguments from the 4NT Shell from JP Software\r
-set CMD_LINE_ARGS=%$\r
-\r
-:execute\r
-@rem Setup the command line\r
-\r
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
-\r
-@rem Execute Gradle\r
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
-\r
-:end\r
-@rem End local scope for the variables with windows NT shell\r
-if "%ERRORLEVEL%"=="0" goto mainEnd\r
-\r
-:fail\r
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
-rem the _cmd.exe /c_ return code!\r
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
-exit /b 1\r
-\r
-:mainEnd\r
-if "%OS%"=="Windows_NT" endlocal\r
-\r
-:omega\r
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
index c089350..2a02201 100755 (executable)
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">\r
-  <component name="FacetManager">\r
-    <facet type="java-gradle" name="Java-Gradle">\r
-      <configuration>\r
-        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />\r
-      </configuration>\r
-    </facet>\r
-  </component>\r
-  <component name="NewModuleRootManager" inherit-compiler-output="false">\r
-    <output url="file://$MODULE_DIR$/build/classes/main" />\r
-    <output-test url="file://$MODULE_DIR$/build/classes/test" />\r
-    <exclude-output />\r
-    <content url="file://$MODULE_DIR$">\r
-      <excludeFolder url="file://$MODULE_DIR$/.gradle" />\r
-    </content>\r
-    <orderEntry type="inheritedJdk" />\r
-    <orderEntry type="sourceFolder" forTests="false" />\r
-  </component>\r
-</module>\r
-\r
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="java-gradle" name="Java-Gradle">
+      <configuration>
+        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/classes/main" />
+    <output-test url="file://$MODULE_DIR$/build/classes/test" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
+
index 8c0833a..ba1972f 100755 (executable)
     <bundle>
         <id>oic.bundle.android.light</id>
         <path>org.iotivity.service.sample.androidbundle.apk</path>
-        <activator>org.iotivity.service.sample.androidbundle.AndroidSampleActivator</activator>
+        <activator>org.iotivity.service.sample.androidbundle.SampleActivator</activator>
         <version>1.0.0</version>
         <resources>
             <resourceInfo>
-                <name>androidLIghtResource</name>
+                <name>LightResource1</name>
                 <resourceType>oic.r.light</resourceType>
                 <resourceUri>/android/light/1</resourceUri>
             </resourceInfo>
             <resourceInfo>
-                <name>androidLightSensor</name>
-                <resourceType>oic.r.lightsensor</resourceType>
-                <resourceUri>/android/lightsensor/1</resourceUri>
+                <name>LightIntensity1</name>
+                <resourceType>oic.r.lightintensity</resourceType>
+                <resourceUri>/android/lightintensity/1</resourceUri>
             </resourceInfo>
             <resourceInfo>
                 <name>DiscomfortIndexSensor1</name>
diff --git a/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/DroidLED.java b/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/DroidLED.java
deleted file mode 100755 (executable)
index 1726012..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.iotivity.service.sample.container;\r
-\r
-import android.os.IBinder;\r
-import android.util.Log;\r
-\r
-import java.lang.reflect.Method;\r
-\r
-/**\r
- * Created by markus.jung on 11/4/2015.\r
- */\r
-public class DroidLED {\r
-    private Object svc = null;\r
-    private Method getFlashlightEnabled = null;\r
-    private Method setFlashlightEnabled = null;\r
-\r
-    @SuppressWarnings("unchecked")\r
-    public DroidLED() throws Exception {\r
-        try {\r
-            // call ServiceManager.getService("hardware") to get an IBinder for the service.\r
-            // this appears to be totally undocumented and not exposed in the SDK whatsoever.\r
-            Class sm = Class.forName("android.os.ServiceManager");\r
-            Object hwBinder = sm.getMethod("getService", String.class).invoke(null, "hardware");\r
-\r
-            // get the hardware service stub. this seems to just get us one step closer to the proxy\r
-            Class hwsstub = Class.forName("android.os.IHardwareService$Stub");\r
-            Method asInterface = hwsstub.getMethod("asInterface", android.os.IBinder.class);\r
-            svc = asInterface.invoke(null, (IBinder) hwBinder);\r
-\r
-            // grab the class (android.os.IHardwareService$Stub$Proxy) so we can reflect on its methods\r
-            Class proxy = svc.getClass();\r
-\r
-            // save methods\r
-            getFlashlightEnabled = proxy.getMethod("getFlashlightEnabled");\r
-            setFlashlightEnabled = proxy.getMethod("setFlashlightEnabled", boolean.class);\r
-        }\r
-        catch(Exception e) {\r
-            Log.e(DroidLED.class.getName(), "Cannot initialize LED", e);\r
-            throw new Exception("LED could not be initialized");\r
-        }\r
-    }\r
-\r
-    public boolean isEnabled() {\r
-        try {\r
-            return getFlashlightEnabled.invoke(svc).equals(true);\r
-        }\r
-        catch(Exception e) {\r
-            return false;\r
-        }\r
-    }\r
-\r
-    public void enable(boolean tf) {\r
-        try {\r
-            Log.i(DroidLED.class.getName(), "enabling light");\r
-            setFlashlightEnabled.invoke(svc, tf);\r
-        }\r
-        catch(Exception e) {}\r
-    }\r
-}\r
diff --git a/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/FlashLightResource.java b/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/FlashLightResource.java
deleted file mode 100755 (executable)
index 9438ca0..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.iotivity.service.sample.container;\r
-\r
-import android.content.Context;\r
-import android.util.Log;\r
-\r
-\r
-import org.iotivity.service.resourcecontainer.AndroidBundleResource;\r
-import org.iotivity.service.resourcecontainer.RcsResourceAttributes;\r
-\r
-/**\r
- * Created by markus.jung on 11/2/2015.\r
- */\r
-public class FlashLightResource extends AndroidBundleResource {\r
-    private static final String LOG_TAG = FlashLightResource.class.getSimpleName();\r
-\r
-    public FlashLightResource(Context context){\r
-        super(context);\r
-        this.setResourceType("oic.r.light");\r
-        this.setName("flashLightResource");\r
-    }\r
-\r
-    @Override\r
-    protected void initAttributes() {\r
-        this.m_attributes.put("on-off", false);\r
-    }\r
-\r
-    @Override\r
-    public void handleSetAttributesRequest(RcsResourceAttributes attrs) {\r
-        Log.i(LOG_TAG, "Set Attributes called with " + attrs);\r
-\r
-        Log.i(LOG_TAG, "New attributes value: " + attrs.get("on-off"));\r
-        /*super.setAttribute(attribute ,value);\r
-        if("on-off".equals(attribute)){\r
-            if("true".equals(value)){\r
-                Log.i(LOG_TAG, "Turn on");\r
-            }\r
-            else{\r
-                Log.i(LOG_TAG, "Turn off");\r
-            }\r
-        }*/\r
-\r
-    }\r
-\r
-    @Override\r
-    public RcsResourceAttributes handleGetAttributesRequest() {\r
-        return this.m_attributes;\r
-    }\r
-}\r
diff --git a/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/OicLightActivity.java b/service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/OicLightActivity.java
deleted file mode 100755 (executable)
index b0a8581..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.iotivity.service.sample.container;\r
-\r
-import android.app.Activity;\r
-import android.content.Context;\r
-import android.graphics.Color;\r
-import android.os.Bundle;\r
-import android.os.PowerManager;\r
-import android.os.PowerManager.WakeLock;\r
-import android.util.Log;\r
-import android.view.KeyEvent;\r
-import android.view.SurfaceHolder;\r
-import android.view.View;\r
-import android.view.WindowManager;\r
-\r
-/*\r
- * Torch is an LED flashlight.\r
- */\r
-public class OicLightActivity extends Activity implements SurfaceHolder.Callback {\r
-\r
-    private static final String TAG = OicLightActivity.class.getSimpleName();\r
-\r
-    private static final String WAKE_LOCK_TAG = "TORCH_WAKE_LOCK";\r
-\r
-    private View button;\r
-    private View lightText;\r
-\r
-    private WakeLock wakeLock;\r
-    private boolean lightOn = false;\r
-\r
-    private static OicLightActivity torch;\r
-\r
-    public OicLightActivity() {\r
-        super();\r
-        torch = this;\r
-    }\r
-\r
-    public static OicLightActivity getTorch() {\r
-        return torch;\r
-    }\r
-\r
-    /*\r
-     * Called by the view (see main.xml)\r
-     */\r
-    public void toggleLight(View view) {\r
-        toggleLight();\r
-    }\r
-\r
-    private void toggleLight() {\r
-        Log.i(OicLightActivity.class.getName(), "Toggle light");\r
-        if (lightOn) {\r
-            turnLightOff();\r
-        } else {\r
-            turnLightOn();\r
-        }\r
-    }\r
-\r
-    private void turnLightOn() {\r
-        lightOn = true;\r
-        Log.i(OicLightActivity.class.getName(), "Turn light on");\r
-        lightText.setBackgroundColor(Color.WHITE);\r
-    }\r
-\r
-    private void turnLightOff() {\r
-        lightOn = false;\r
-        Log.i(OicLightActivity.class.getName(), "Turn light off");\r
-        lightText.setBackgroundColor(Color.BLACK);\r
-    }\r
-\r
-    private void startWakeLock() {\r
-        if (wakeLock == null) {\r
-            Log.d(TAG, "wakeLock is null, getting a new WakeLock");\r
-            PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);\r
-            Log.d(TAG, "PowerManager acquired");\r
-            wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_TAG);\r
-            Log.d(TAG, "WakeLock set");\r
-        }\r
-        wakeLock.acquire();\r
-        Log.d(TAG, "WakeLock acquired");\r
-    }\r
-\r
-    private void stopWakeLock() {\r
-        if (wakeLock != null) {\r
-            wakeLock.release();\r
-            Log.d(TAG, "WakeLock released");\r
-        }\r
-    }\r
-\r
-    /** Called when the activity is first created. */\r
-    @Override\r
-    public void onCreate(Bundle savedInstanceState) {\r
-        super.onCreate(savedInstanceState);\r
-        button.setOnClickListener(new View.OnClickListener() {\r
-            @Override\r
-            public void onClick(View view) {\r
-                toggleLight();\r
-            }\r
-        });\r
-        disablePhoneSleep();\r
-        Log.i(TAG, "onCreate");\r
-    }\r
-\r
-    private void disablePhoneSleep() {\r
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\r
-    }\r
-\r
-    @Override\r
-    public void onRestart() {\r
-        super.onRestart();\r
-        Log.i(TAG, "onRestart");\r
-    }\r
-\r
-    @Override\r
-    public void onStart() {\r
-        super.onStart();\r
-        Log.i(TAG, "onStart");\r
-    }\r
-\r
-    @Override\r
-    public void onResume() {\r
-        super.onResume();\r
-        turnLightOn();\r
-        Log.i(TAG, "onResume");\r
-    }\r
-\r
-    @Override\r
-    public void onPause() {\r
-        super.onPause();\r
-        turnLightOff();\r
-        Log.i(TAG, "onPause");\r
-    }\r
-\r
-    @Override\r
-    public void onStop() {\r
-        super.onStop();\r
-        torch = null;\r
-        Log.i(TAG, "onStop");\r
-    }\r
-\r
-    @Override\r
-    public void onDestroy() {\r
-        super.onDestroy();\r
-        Log.i(TAG, "onDestroy");\r
-    }\r
-\r
-    @Override\r
-    public boolean onKeyLongPress(int keyCode, KeyEvent event) {\r
-        // When the search button is long pressed, quit\r
-        if (keyCode == KeyEvent.KEYCODE_SEARCH) {\r
-            finish();\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public void surfaceChanged(SurfaceHolder holder, int I, int J, int K) {\r
-        Log.d(TAG, "surfaceChanged");\r
-    }\r
-\r
-    @Override\r
-    public void surfaceCreated(SurfaceHolder holder) {\r
-        Log.d(TAG, "surfaceCreated");\r
-    }\r
-\r
-    @Override\r
-    public void surfaceDestroyed(SurfaceHolder holder) {\r
-        Log.d(TAG, "surfaceDestroyed");\r
-    }\r
-}
\ No newline at end of file
index 64eae81..a8086dd 100755 (executable)
@@ -98,10 +98,10 @@ public class ResourceContainerActivity extends Activity {
         super.onCreate(savedInstanceState);
         context = this;
 
-        if (!isWifiConnected()) {
+        /*if (!isWifiConnected()) {
             showWifiUnavailableDialog();
             return;
-        }
+        }*/
 
         configurePlatform();
         CopyAssetsToSDCard();
diff --git a/service/resource-container/examples/android/ContainerSampleApp/gradle.properties b/service/resource-container/examples/android/ContainerSampleApp/gradle.properties
deleted file mode 100755 (executable)
index 892973b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-## Project-wide Gradle settings.\r
-#\r
-# For more details on how to configure your build environment visit\r
-# http://www.gradle.org/docs/current/userguide/build_environment.html\r
-#\r
-# Specifies the JVM arguments used for the daemon process.\r
-# The setting is particularly useful for tweaking memory settings.\r
-# Default value: -Xmx10248m -XX:MaxPermSize=256m\r
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\r
-#\r
-# When configured, Gradle will run in incubating parallel mode.\r
-# This option should only be used with decoupled projects. More details, visit\r
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\r
-# org.gradle.parallel=true\r
-#Sat Oct 03 13:27:12 KST 2015\r
-systemProp.http.proxyHost=168.219.61.252\r
-systemProp.http.proxyPort=8080\r
index aec9973..8a0b282 100755 (executable)
@@ -1,90 +1,90 @@
-@if "%DEBUG%" == "" @echo off\r
-@rem ##########################################################################\r
-@rem\r
-@rem  Gradle startup script for Windows\r
-@rem\r
-@rem ##########################################################################\r
-\r
-@rem Set local scope for the variables with windows NT shell\r
-if "%OS%"=="Windows_NT" setlocal\r
-\r
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
-set DEFAULT_JVM_OPTS=\r
-\r
-set DIRNAME=%~dp0\r
-if "%DIRNAME%" == "" set DIRNAME=.\r
-set APP_BASE_NAME=%~n0\r
-set APP_HOME=%DIRNAME%\r
-\r
-@rem Find java.exe\r
-if defined JAVA_HOME goto findJavaFromJavaHome\r
-\r
-set JAVA_EXE=java.exe\r
-%JAVA_EXE% -version >NUL 2>&1\r
-if "%ERRORLEVEL%" == "0" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:findJavaFromJavaHome\r
-set JAVA_HOME=%JAVA_HOME:"=%\r
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
-\r
-if exist "%JAVA_EXE%" goto init\r
-\r
-echo.\r
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
-echo.\r
-echo Please set the JAVA_HOME variable in your environment to match the\r
-echo location of your Java installation.\r
-\r
-goto fail\r
-\r
-:init\r
-@rem Get command-line arguments, handling Windowz variants\r
-\r
-if not "%OS%" == "Windows_NT" goto win9xME_args\r
-if "%@eval[2+2]" == "4" goto 4NT_args\r
-\r
-:win9xME_args\r
-@rem Slurp the command line arguments.\r
-set CMD_LINE_ARGS=\r
-set _SKIP=2\r
-\r
-:win9xME_args_slurp\r
-if "x%~1" == "x" goto execute\r
-\r
-set CMD_LINE_ARGS=%*\r
-goto execute\r
-\r
-:4NT_args\r
-@rem Get arguments from the 4NT Shell from JP Software\r
-set CMD_LINE_ARGS=%$\r
-\r
-:execute\r
-@rem Setup the command line\r
-\r
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
-\r
-@rem Execute Gradle\r
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
-\r
-:end\r
-@rem End local scope for the variables with windows NT shell\r
-if "%ERRORLEVEL%"=="0" goto mainEnd\r
-\r
-:fail\r
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
-rem the _cmd.exe /c_ return code!\r
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
-exit /b 1\r
-\r
-:mainEnd\r
-if "%OS%"=="Windows_NT" endlocal\r
-\r
-:omega\r
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
index 22fda57..396c674 100644 (file)
@@ -70,8 +70,10 @@ namespace OIC
                 m_resourceAttributes[it->key()] = it->value();
             }
 
-            if (notify && m_pNotiReceiver)
-                            m_pNotiReceiver->onNotificationReceived(m_uri);
+            if (notify && m_pNotiReceiver){
+                OC_LOG_V(INFO, "BUNDLE_RESOUCE", "Notifying receiver");
+                m_pNotiReceiver->onNotificationReceived(m_uri);
+            }
         }
 
         void BundleResource::setAttributes(RCSResourceAttributes &attrs)
index 1d515f1..7d1e266 100644 (file)
@@ -52,6 +52,8 @@ void DiscoverResourceUnit::startDiscover(DiscoverResourceInfo info, UpdatedCB up
         return;
     }
 
+    OC_LOG_V(DEBUG, CONTAINER_TAG, "Start discover%s", info.resourceUri.c_str());
+
     m_Uri = info.resourceUri;
     m_ResourceType = info.resourceType;
     m_AttrubuteName = info.attributeName;
@@ -86,6 +88,7 @@ void DiscoverResourceUnit::discoverdCB(RCSRemoteResourceObject::Ptr remoteObject
 {
     if (remoteObject && !isAlreadyDiscoveredResource(remoteObject))
     {
+        OC_LOG_V(DEBUG, CONTAINER_TAG, "Discovered%s", uri.c_str());
         RemoteResourceUnit::Ptr newDiscoveredResource =
             RemoteResourceUnit::createRemoteResourceInfo(remoteObject, pUpdatedCBFromServer);
 
@@ -177,4 +180,4 @@ bool DiscoverResourceUnit::isAlreadyDiscoveredResource(
         }
     }
     return false;
-}
\ No newline at end of file
+}
index 227c1a7..7a57627 100644 (file)
@@ -32,6 +32,7 @@
 #include "RCSRemoteResourceObject.h"
 #include "RCSResourceAttributes.h"
 #include "RemoteResourceUnit.h"
+#include "InternalTypes.h"
 
 namespace OIC
 {
index e9d02cc..5cb86a7 100644 (file)
@@ -744,6 +744,7 @@ namespace OIC
 
         void ResourceContainerImpl::discoverInputResource(const std::string &outputResourceUri)
         {
+            OC_LOG_V(DEBUG, CONTAINER_TAG, "Discover input resource%s", outputResourceUri.c_str());
             auto foundOutputResource = m_mapResources.find(outputResourceUri);
             auto resourceProperty = foundOutputResource->second->m_mapResourceProperty;