[IOT-1020], [IOT-1024], [IOT-1029], [IOT-1030] fixes
authorMarkus Jung <markus.jung@samsung.com>
Wed, 23 Mar 2016 06:50:14 +0000 (15:50 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 24 Mar 2016 11:07:49 +0000 (11:07 +0000)
- param check for getConfiguredResourceParams API
- updated example configuration for Android sample of resource container
- removed getLibraryPath API from Android wrapper

Change-Id: Ib825240a2ebec7cfa0a61e1ae63e156408904bd6
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6211
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/resource-container/android/resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsBundleInfo.java
service/resource-container/android/resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsResourceContainer.java
service/resource-container/android/resource-container/src/main/jni/JniRcsResourceContainer.cpp
service/resource-container/examples/android/RCSampleServerApp/app/src/main/assets/lib/ResourceContainerConfig.xml

index 5d2964f..8e6273f 100644 (file)
@@ -87,16 +87,6 @@ public class RcsBundleInfo {
     }
 
     /**
-     * API for getting the library path for the bundle
-     *
-     * @return string - Library path in string form
-     *
-     */
-    public String getLibraryPath() {
-        return mLibraryPath;
-    }
-
-    /**
      * API for getting the version of the bundle
      *
      * @return string - version of the bundle
index 9d06a86..eec885c 100644 (file)
@@ -269,7 +269,7 @@ public class RcsResourceContainer implements RcsResourceContainerBundleAPI {
         List<RcsBundleInfo> bundles = listBundles();
 
         for(RcsBundleInfo bundleInfo : bundles){
-            if(bundleInfo.getID().equals(bundleId) && bundleInfo.getLibraryPath().endsWith(".apk")){
+            if(bundleInfo.getID().equals(bundleId) && bundleInfo.getPath().endsWith(".apk")){
                 Log.d(TAG, "Have to start android bundle");
                 Log.d(TAG, "bundle-id: " + bundleInfo.getID() + ", " + bundleInfo.getPath());
                 if(bundleInfo.getPath().endsWith(".apk")){
index 3bd2beb..5a5b420 100644 (file)
@@ -460,19 +460,23 @@ Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeGetConfig
 {
     (void)obj;
     jobjectArray ret;
-    const char *str_bundleId = env->GetStringUTFChars(bundleId, 0);
-
-    ResourceContainerImpl *container = ResourceContainerImpl::getImplInstance();
-    vector< resourceInfo > resourceConfig;
-    container->getResourceConfiguration(str_bundleId, &resourceConfig);
-    resourceInfo conf = resourceConfig[resourceId];
     ret = (jobjectArray) env->NewObjectArray(4, env->FindClass("java/lang/String"),
-            env->NewStringUTF(""));
+                    env->NewStringUTF(""));
+    if(bundleId != NULL){
+        const char *str_bundleId = env->GetStringUTFChars(bundleId, 0);
 
-    env->SetObjectArrayElement(ret, 0, env->NewStringUTF(conf.name.c_str()));
-    env->SetObjectArrayElement(ret, 1, env->NewStringUTF(conf.uri.c_str()));
-    env->SetObjectArrayElement(ret, 2, env->NewStringUTF(conf.resourceType.c_str()));
-    env->SetObjectArrayElement(ret, 3, env->NewStringUTF(conf.address.c_str()));
+        ResourceContainerImpl *container = ResourceContainerImpl::getImplInstance();
+        vector< resourceInfo > resourceConfig;
+        container->getResourceConfiguration(str_bundleId, &resourceConfig);
+
+        if(resourceConfig.size() > resourceId && resourceId >=0){
+            resourceInfo conf = resourceConfig[resourceId];
+            env->SetObjectArrayElement(ret, 0, env->NewStringUTF(conf.name.c_str()));
+            env->SetObjectArrayElement(ret, 1, env->NewStringUTF(conf.uri.c_str()));
+            env->SetObjectArrayElement(ret, 2, env->NewStringUTF(conf.resourceType.c_str()));
+            env->SetObjectArrayElement(ret, 3, env->NewStringUTF(conf.address.c_str()));
+        }
+    }
     return ret;
 }
 
index 493d638..d6fe5b3 100755 (executable)
@@ -1,45 +1,8 @@
 <container>
+<!--
     <bundle>
-        <id>oic.bundle.discomfortIndexSensor</id>
-        <path>data/data/org.iotivity.service.sample.resourcecontainer/files/libDISensorBundle.so</path>
-        <activator>disensor</activator>
-        <version>1.0.0</version>
-        <resources>
-            <resourceInfo>
-                <name>DiscomfortIndexSensor1</name>
-                <resourceType>oic.r.sensor</resourceType>
-                <outputs>
-                    <output>
-                        <name>discomfortIndex</name>
-                        <type>int</type>
-                    </output>
-                    <output>
-                        <name>humidity</name>
-                        <type>double</type>
-                    </output>
-                    <output>
-                        <name>temperature</name>
-                        <type>double</type>
-                    </output>
-                </outputs>
-                <inputs>
-                    <input>
-                        <name>humidity</name>
-                        <type>double</type>
-                        <resourceType>oic.r.humidity</resourceType>
-                    </input>
-                    <input>
-                        <name>temperature</name>
-                        <type>double</type>
-                        <resourceType>oic.r.temperature</resourceType>
-                    </input>
-                </inputs>
-            </resourceInfo>
-        </resources>
-    </bundle>
-    <!--<bundle>
         <id>oic.android.sample</id>
-        <path>org.iotivity.service.sample.androidbundle.apk</path>
+        <path>data/data/org.iotivity.service.sample.resourcecontainer/files/android_sample_bundle.jar</path>
         <activator>org.iotivity.service.sample.androidbundle.SampleActivator</activator>
         <version>1.0.0</version>
         <resources>
@@ -49,9 +12,9 @@
                 <resourceUri>/android/light/1</resourceUri>
             </resourceInfo>
             <resourceInfo>
-                 <name>LightIntensity1</name>
-                 <resourceType>oic.r.lightintensity</resourceType>
-                 <resourceUri>/android/lightintensity/1</resourceUri>
+                <name>LightIntensity1</name>
+                <resourceType>oic.r.lightintensity</resourceType>
+                <resourceUri>/android/lightintensity/1</resourceUri>
             </resourceInfo>
             <resourceInfo>
                 <name>Humidity1</name>
@@ -72,6 +35,7 @@
                 <name>DiscomfortIndexSensor1</name>
                 <resourceType>oic.r.discomfortindex</resourceType>
                 <resourceUri>/android/discomfortindex/1</resourceUri>
+                <resourceClass>org.iotivity.service.sample.androidbundle.resources.DiscomfortIndexResource</resourceClass>
                 <outputs>
                     <output>
                         <name>discomfortIndex</name>
             </resourceInfo>
         </resources>
     </bundle>
-    <bundle>
-        <id>oic.android.sample</id>
-        <path>data/data/org.iotivity.service.sample.resourcecontainer/files/android_sample_bundle.jar</path>
-        <activator>org.iotivity.service.sample.androidbundle.SampleActivator</activator>
+   <bundle>
+        <id>oic.bundle.discomfortIndexSensor</id>
+        <path>data/data/org.iotivity.service.sample.resourcecontainer/files/libDISensorBundle.so</path>
+        <activator>disensor</activator>
         <version>1.0.0</version>
         <resources>
             <resourceInfo>
-                <name>LightResource1</name>
-                <resourceType>oic.r.light</resourceType>
-                <resourceUri>/android/light/1</resourceUri>
-            </resourceInfo>
-            <resourceInfo>
-                 <name>LightIntensity1</name>
-                 <resourceType>oic.r.lightintensity</resourceType>
-                 <resourceUri>/android/lightintensity/1</resourceUri>
-            </resourceInfo>
-            <resourceInfo>
-                <name>Humidity1</name>
-                <resourceType>oic.r.humidity</resourceType>
-                <resourceUri>/android/humidity/1</resourceUri>
-            </resourceInfo>
-            <resourceInfo>
-                <name>Tepmerature1</name>
-                <resourceType>oic.r.temperature</resourceType>
-                <resourceUri>/android/temperature/1</resourceUri>
-            </resourceInfo>
-            <resourceInfo>
-                <name>Gyroscope1</name>
-                <resourceType>oic.r.gyroscope</resourceType>
-                <resourceUri>/android/gyroscope/1</resourceUri>
-            </resourceInfo>
-            <resourceInfo>
                 <name>DiscomfortIndexSensor1</name>
-                <resourceType>oic.r.discomfortindex</resourceType>
-                <resourceUri>/android/discomfortindex/1</resourceUri>
+                <resourceType>oic.r.sensor</resourceType>
                 <outputs>
                     <output>
                         <name>discomfortIndex</name>
                 </inputs>
             </resourceInfo>
         </resources>
-    </bundle>-->
+    </bundle>
+-->
 </container>
\ No newline at end of file