[Resource-Encapsulation] Updated Java SDK and RE Android Samples 84/2484/4
authorJay Sharma <jay.sharma@samsung.com>
Mon, 14 Sep 2015 06:10:20 +0000 (11:40 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 14 Sep 2015 08:18:20 +0000 (08:18 +0000)
- Renamed Applications to REServer and REClient
- Fixed sample app issues.
- FIxed issues in JNI.
- Added separate Listener for set and get attributes.
- Updated Doxygen comments

Change-Id: I86f186b1153f02b15064177ac4b41ffcf6d6ddfe
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2484
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
75 files changed:
service/resource-encapsulation/examples/android/REClient/.classpath [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/.classpath with 77% similarity]
service/resource-encapsulation/examples/android/REClient/.project [moved from service/resource-encapsulation/examples/android/SampleServer/.project with 96% similarity]
service/resource-encapsulation/examples/android/REClient/AndroidManifest.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/AndroidManifest.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/ic_launcher-web.png [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/ic_launcher-web.png with 100% similarity]
service/resource-encapsulation/examples/android/REClient/project.properties [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/project.properties with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/drawable-hdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/drawable-hdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/drawable-hdpi/iot.jpg [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/drawable-hdpi/iot.jpg with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/drawable-mdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/drawable-mdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/drawable-xhdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/drawable-xhdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/drawable-xxhdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/drawable-xxhdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/layout/activity_main.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/layout/activity_main.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/layout/resource_container.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/layout/resource_container.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/layout/resourceclientapis.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/layout/resourceclientapis.xml with 89% similarity]
service/resource-encapsulation/examples/android/REClient/res/layout/userinputforattributevalue.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/layout/userinputforattributevalue.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/menu/main.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/menu/main.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/values-v11/styles.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values-v11/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/values-v14/styles.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values-v14/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/values-w820dp/dimens.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values-w820dp/dimens.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/values/dimens.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values/dimens.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/res/values/strings.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values/strings.xml with 76% similarity]
service/resource-encapsulation/examples/android/REClient/res/values/styles.xml [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/res/values/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REClient/src/com/re/sampleclient/ContainerClientActivity.java [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/src/com/re/sampleclient/ContainerClientActivity.java with 92% similarity]
service/resource-encapsulation/examples/android/REClient/src/com/re/sampleclient/MainActivity.java [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/src/com/re/sampleclient/MainActivity.java with 99% similarity]
service/resource-encapsulation/examples/android/REClient/src/com/re/sampleclient/ResourceClient.java [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/src/com/re/sampleclient/ResourceClient.java with 85% similarity]
service/resource-encapsulation/examples/android/REClient/src/com/re/sampleclient/ResourceClientActivity.java [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/src/com/re/sampleclient/ResourceClientActivity.java with 97% similarity]
service/resource-encapsulation/examples/android/REServer/.classpath [moved from service/resource-encapsulation/examples/android/SampleServer/.classpath with 74% similarity]
service/resource-encapsulation/examples/android/REServer/.project [moved from service/resource-encapsulation/examples/android/SampleResourceClientApp/.project with 95% similarity]
service/resource-encapsulation/examples/android/REServer/AndroidManifest.xml [moved from service/resource-encapsulation/examples/android/SampleServer/AndroidManifest.xml with 96% similarity]
service/resource-encapsulation/examples/android/REServer/assets/lib/ResourceContainerConfig.xml [moved from service/resource-encapsulation/examples/android/SampleServer/assets/lib/ResourceContainerConfig.xml with 87% similarity]
service/resource-encapsulation/examples/android/REServer/ic_launcher-web.png [moved from service/resource-encapsulation/examples/android/SampleServer/ic_launcher-web.png with 100% similarity]
service/resource-encapsulation/examples/android/REServer/project.properties [moved from service/resource-encapsulation/examples/android/SampleServer/project.properties with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/drawable-hdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleServer/res/drawable-hdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/drawable-hdpi/iot.jpg [new file with mode: 0644]
service/resource-encapsulation/examples/android/REServer/res/drawable-mdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleServer/res/drawable-mdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/drawable-xhdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleServer/res/drawable-xhdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/drawable-xxhdpi/ic_launcher.png [moved from service/resource-encapsulation/examples/android/SampleServer/res/drawable-xxhdpi/ic_launcher.png with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/activity_main.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/activity_main.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/resource_container.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/resource_container.xml with 92% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/server_builder.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/server_builder.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/server_builder_auto.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/server_builder_auto.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/server_builder_dev.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/server_builder_dev.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/layout/userinputfortemperaturevalue.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/layout/userinputfortemperaturevalue.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/menu/main.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/menu/main.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/values-v11/styles.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values-v11/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/values-v14/styles.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values-v14/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/values-w820dp/dimens.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values-w820dp/dimens.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/values/dimens.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values/dimens.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/res/values/strings.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values/strings.xml with 74% similarity]
service/resource-encapsulation/examples/android/REServer/res/values/styles.xml [moved from service/resource-encapsulation/examples/android/SampleServer/res/values/styles.xml with 100% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/MainActivity.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/MainActivity.java with 98% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ResourceContainer.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ResourceContainer.java with 97% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ResourceContainerActivity.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ResourceContainerActivity.java with 97% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ServerBuilder.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ServerBuilder.java with 98% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ServerBuilderActivity.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ServerBuilderActivity.java with 100% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ServerBuilderAutoActivity.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ServerBuilderAutoActivity.java with 100% similarity]
service/resource-encapsulation/examples/android/REServer/src/com/example/sampleserver/ServerBuilderDevActivity.java [moved from service/resource-encapsulation/examples/android/SampleServer/src/com/example/sampleserver/ServerBuilderDevActivity.java with 100% similarity]
service/resource-encapsulation/sdk/java/jni/Android.mk
service/resource-encapsulation/sdk/java/jni/jniutil/src/jni_re_utils.cpp
service/resource-encapsulation/sdk/java/jni/re/src/jni_re_rcs_discovery_manager.cpp
service/resource-encapsulation/sdk/java/jni/re/src/jni_re_rcs_remoteresourceobject.cpp
service/resource-encapsulation/sdk/java/jni/re/src/jni_re_setattributes_listener.cpp
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/client/RCSAddress.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/client/RCSDiscoveryManager.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/client/RCSRemoteResourceObject.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/common/RCSException.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/common/RCSResourceAttributes.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/Builder.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSBundleInfo.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSGetResponse.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSRequest.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSResourceContainer.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSResourceObject.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/server/RCSSetResponse.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/utils/DiscoveryType.java
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/utils/EntityHandlerResult.java

@@ -4,7 +4,6 @@
        <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 combineaccessrules="false" exported="true" kind="src" path="/java"/>
-       <classpathentry exported="true" kind="lib" path="E:/Projects/Mixed_backup/master_22_aug/android/android_api/base/build/intermediates/bundles/release/classes.jar"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
        <classpathentry kind="output" path="bin/classes"/>
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>SampleServer</name>
+       <name>REClient</name>
        <comment></comment>
        <projects>
        </projects>
@@ -2,7 +2,7 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
-    
+
        <Button
         android:id="@+id/button1"
         android:layout_width="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:text="Discover Resource" />
-       
-       
+
         <ListView
             android:id="@+id/groupaApiList"
             android:layout_width="match_parent"
-            android:layout_height="300dp" 
+            android:layout_height="300dp"
              android:layout_below="@id/button1">
          </ListView>
-         
+
          <EditText
         android:id="@+id/EditText"
         android:layout_width="fill_parent"
         android:layout_alignParentLeft="true"
         android:layout_below="@+id/groupaApiList"
         android:layout_marginTop="15dp"
-        android:ems="10" 
+        android:ems="10"
         android:editable="false" >
 
         <requestFocus />
     </EditText>
-      
-        
+
 </RelativeLayout>
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <string name="app_name">RESampleClient</string>
+    <string name="app_name">REClient</string>
     <string name="hello_world">Hello world!</string>
     <string name="action_settings">Settings</string>
 
@@ -98,18 +98,16 @@ public class ContainerClientActivity extends Activity {
             Vector<String> resourceInterfaces = foundResource.getInterFaces();
 
             logMessage = "URI : " + resourceURI + "\n";
-            logMessage = logMessage + "Host : " + hostAddress + "\n";
+            logMessage += "Host : " + hostAddress + "\n";
             for (int i = 0; i < resourceTypes.size(); i++) {
-                logMessage = logMessage + "resourceType : "
-                        + resourceTypes.get(i) + "\n";
+                logMessage += "resourceType : " + resourceTypes.get(i) + "\n";
             }
 
             for (int i = 0; i < resourceInterfaces.size(); i++) {
-                logMessage = logMessage + "resourceInterfaces : "
+                logMessage += "resourceInterfaces : "
                         + resourceInterfaces.get(i) + "\n";
             }
-            logMessage = logMessage + "isObservable : " + isObservableflag
-                    + "\n";
+            logMessage += "isObservable : " + isObservableflag + "\n";
 
             ContainerClientActivity.this.runOnUiThread(new Runnable() {
                 public void run() {
@@ -67,7 +67,7 @@ public class MainActivity extends Activity {
         apisList = new ArrayList<String>();
 
         // adding the item to list that will be displayed on the UI.
-        apisList.add("Resource Client API's");
+        apisList.add("Resource Client");
         apisList.add("Discover Container Resource");
         apis = new ArrayAdapter<String>(activityObj,
                 android.R.layout.simple_list_item_1, apisList);
@@ -24,9 +24,10 @@ import java.util.Vector;
 import org.iotivity.ResourceEncapsulation.client.RCSAddress;
 import org.iotivity.ResourceEncapsulation.client.RCSDiscoveryManager;
 import org.iotivity.ResourceEncapsulation.client.RCSDiscoveryManager.IDiscoverResourceListener;
+import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.IGetRemoteAttributeListener;
+import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.ISetRemoteAttributeListener;
 import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.IStateChangedCallbackListener;
 import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.ICacheUpdateListener;
-import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.IRemoteAttributeListener;
 import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.CacheState;
 import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject.ResourceState;
 import org.iotivity.ResourceEncapsulation.client.RCSRemoteResourceObject;
@@ -44,20 +45,21 @@ import android.util.Log;
  */
 public class ResourceClient {
 
-    private static final String            LOG_TAG                  = "[RESample] Client";
-    private static Message                 msg;
-    public String                          logMessage;
+    private static final String              LOG_TAG                  = "[RESample] Client";
+    private static Message                   msg;
+    public String                            logMessage;
 
-    private final RCSDiscoveryManager      discoveyManagerObj;
-    public RCSRemoteResourceObject         remoteResourceObj;
+    private final RCSDiscoveryManager        discoveyManagerObj;
+    public RCSRemoteResourceObject           remoteResourceObj;
 
-    private static ResourceClientActivity  resourcClientActivityObj = null;
-    private final DiscoverResourceListener discoverResourceListener;
-    private final StateChangedListener     stateChangedListener;
-    private final CacheUpdateListener      cacheUpdateListener;
-    private final RemoteAttributeListener  remoteAttributeListener;
-    static boolean                         monitoringState          = false;
-    static boolean                         cachingState             = false;
+    private static ResourceClientActivity    resourcClientActivityObj = null;
+    private final DiscoverResourceListener   discoverResourceListener;
+    private final StateChangedListener       stateChangedListener;
+    private final CacheUpdateListener        cacheUpdateListener;
+    private final RemoteAttributeGetListener remoteAttributeGetListener;
+    private final RemoteAttributeSetListener remoteAttributeSetListener;
+    static boolean                           monitoringState          = false;
+    static boolean                           cachingState             = false;
 
     // constructor
     public ResourceClient() {
@@ -65,7 +67,8 @@ public class ResourceClient {
         discoverResourceListener = new DiscoverResourceListener();
         stateChangedListener = new StateChangedListener();
         cacheUpdateListener = new CacheUpdateListener();
-        remoteAttributeListener = new RemoteAttributeListener();
+        remoteAttributeGetListener = new RemoteAttributeGetListener();
+        remoteAttributeSetListener = new RemoteAttributeSetListener();
 
         discoveyManagerObj
                 .setDiscoverResourceListener(discoverResourceListener);
@@ -90,24 +93,24 @@ public class ResourceClient {
             Vector<String> resourceTypes = foundResource.getTypes();
             Vector<String> resourceInterfaces = foundResource.getInterFaces();
             remoteResourceObj = foundResource;
+            cachingState = false;
+            monitoringState = false;
 
             msg = Message.obtain();
             msg.what = 0;
             resourcClientActivityObj.getHandler().sendMessage(msg);
 
             logMessage = "URI : " + resourceURI + "\n";
-            logMessage = logMessage + "Host : " + hostAddress + "\n";
+            logMessage += "Host : " + hostAddress + "\n";
             for (int i = 0; i < resourceTypes.size(); i++) {
-                logMessage = logMessage + "resourceType : "
-                        + resourceTypes.get(i) + "\n";
+                logMessage += "resourceType : " + resourceTypes.get(i) + "\n";
             }
 
             for (int i = 0; i < resourceInterfaces.size(); i++) {
-                logMessage = logMessage + "resourceInterfaces : "
+                logMessage += "resourceInterfaces : "
                         + resourceInterfaces.get(i) + "\n";
             }
-            logMessage = logMessage + "isObservable : " + isObservableflag
-                    + "\n";
+            logMessage += "isObservable : " + isObservableflag + "\n";
 
             ResourceClientActivity.setMessageLog(logMessage);
             msg = Message.obtain();
@@ -145,8 +148,7 @@ public class ResourceClient {
                 case LOST_SIGNAL:
                     Log.i(LOG_TAG, "Current Resource State : LOST_SIGNAL");
                     logMessage = "Current Resource State : LOST_SIGNAL\n";
-                    logMessage = logMessage
-                            + "Start the server and press discover resource button"
+                    logMessage += "Start the server and press discover resource button"
                             + "\n";
                     break;
 
@@ -161,7 +163,6 @@ public class ResourceClient {
             msg.what = 1;
             resourcClientActivityObj.getHandler().sendMessage(msg);
         }
-
     }
 
     /**
@@ -179,9 +180,10 @@ public class ResourceClient {
 
     /**
      * Listener for receiving the resource attributes as a result of
-     * getRemoteAttributes() and setRemoteAttributes() API
+     * getRemoteAttributes() API
      */
-    private class RemoteAttributeListener implements IRemoteAttributeListener {
+    private class RemoteAttributeGetListener implements
+            IGetRemoteAttributeListener {
         @Override
         public void onRemoteAttributesGetCallback(
                 RCSResourceAttributes attributes) {
@@ -191,6 +193,21 @@ public class ResourceClient {
         }
     };
 
+    /**
+     * Listener for receiving the resource attributes as a result of
+     * setRemoteAttributes() API
+     */
+    private class RemoteAttributeSetListener implements
+            ISetRemoteAttributeListener {
+        @Override
+        public void onRemoteAttributesSetCallback(
+                RCSResourceAttributes attributes) {
+
+            Log.i(LOG_TAG, "onRemoteAttributesSetCallback invoked");
+            printAttributes(attributes);
+        }
+    };
+
     // Discover Resource
     public void disocverResources() {
         Log.d(LOG_TAG, "discover resources entry");
@@ -273,9 +290,9 @@ public class ResourceClient {
 
         try {
             remoteResourceObj
-                    .setRemoteAttributesListener(remoteAttributeListener);
+                    .setGetRemoteAttributesListener(remoteAttributeGetListener);
 
-            if (null != remoteAttributeListener) {
+            if (null != remoteAttributeGetListener) {
                 remoteResourceObj.getRemoteAttributes();
             }
         } catch (Exception e) {
@@ -297,9 +314,9 @@ public class ResourceClient {
 
         try {
             remoteResourceObj
-                    .setRemoteAttributesListener(remoteAttributeListener);
+                    .setSetRemoteAttributesListener(remoteAttributeSetListener);
 
-            if (null != remoteAttributeListener) {
+            if (null != remoteAttributeSetListener) {
                 RCSResourceAttributes attr = new RCSResourceAttributes();
                 attr.setValueInt("Temperature", value);
                 remoteResourceObj.setRemoteAttributes(attr);
@@ -427,7 +444,7 @@ public class ResourceClient {
                 return;
             }
             logMessage = "Key : " + key + "\n";
-            logMessage = logMessage + "Value : " + attribute + "\n";
+            logMessage += "Value : " + attribute + "\n";
             ResourceClientActivity.setMessageLog(logMessage);
             msg = Message.obtain();
             msg.what = 1;
@@ -173,13 +173,15 @@ public class ResourceClientActivity extends Activity {
                     EditText temperatureValue = (EditText) dialog
                             .findViewById(R.id.attributeValue);
                     String value = temperatureValue.getText().toString();
-                    if (value.equalsIgnoreCase("")) {
-                        String toastmessage = "Please enter the Temperature Value";
-                        displayToastMessage(toastmessage);
-                    } else {
+
+                    try {
+                        int intValue = Integer.parseInt(value);
+                        resourceClientObj.setRemoteAttributes(intValue);
                         dialog.dismiss();
-                        int val = Integer.parseInt(value);
-                        resourceClientObj.setRemoteAttributes(val);
+
+                    } catch (NumberFormatException e) {
+                        String toastmessage = "Please enter the Integer Value";
+                        displayToastMessage(toastmessage);
                     }
                 }
             });
@@ -3,7 +3,6 @@
        <classpathentry exported="true" 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 exported="true" kind="lib" path="E:/Projects/Mixed_backup/master_22_aug/android/android_api/base/build/intermediates/bundles/release/classes.jar"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
        <classpathentry kind="output" path="bin/classes"/>
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>SampleResourceClientApp</name>
+       <name>REServer</name>
        <comment></comment>
        <projects>
        </projects>
@@ -13,7 +13,7 @@
 
     <application
         android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
+        android:icon="@drawable/iot"
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<container>      
+<container>
     <bundle>
         <id>oic.bundle.discomfortIndexSensor</id>
         <path>data/data/com.example.sampleresourceserver/files/libSoftSensorBundle.so</path>
@@ -7,7 +7,7 @@
         <resources>
             <resourceInfo>
                 <name>DiscomfortIndexSensor1</name>
-                               <resourceType>oic.softsensor</resourceType>
+                <resourceType>oic.softsensor</resourceType>
                 <outputs>
                   <output>
                     <name>discomfortIndex</name>
                     <name>humidity</name>
                     <type>double</type>
                   </input>
-                                 <input>
+                  <input>
                     <name>temperature</name>
                     <type>double</type>
                   </input>
                 </inputs>
-            </resourceInfo>       
+            </resourceInfo>
         </resources>
     </bundle>
 </container>
diff --git a/service/resource-encapsulation/examples/android/REServer/res/drawable-hdpi/iot.jpg b/service/resource-encapsulation/examples/android/REServer/res/drawable-hdpi/iot.jpg
new file mode 100644 (file)
index 0000000..17c5a93
Binary files /dev/null and b/service/resource-encapsulation/examples/android/REServer/res/drawable-hdpi/iot.jpg differ
@@ -2,7 +2,7 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
-    
+
        <Button
         android:id="@+id/startContainer"
         android:layout_width="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:text="Start Container" />
-       
-       
+
         <ListView
             android:id="@+id/containerApiList"
             android:layout_width="match_parent"
-            android:layout_height="300dp" 
+            android:layout_height="300dp"
              android:layout_below="@id/startContainer">
          </ListView>
-         
+
          <EditText
         android:id="@+id/log"
         android:layout_width="fill_parent"
@@ -26,7 +25,7 @@
         android:layout_alignParentLeft="true"
         android:layout_below="@+id/containerApiList"
         android:layout_marginTop="15dp"
-        android:ems="10" 
+        android:ems="10"
         android:editable="false" >
 
         <requestFocus />
@@ -39,5 +38,5 @@
              android:layout_alignParentRight="true"
              android:layout_alignParentTop="true"
              android:text="Stop Container" />
-        
+
 </RelativeLayout>
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <string name="app_name">SampleResourceServer</string>
+    <string name="app_name">REServer</string>
     <string name="hello_world">Hello world!</string>
     <string name="action_settings">Settings</string>
 
@@ -76,8 +76,8 @@ public class MainActivity extends Activity {
         apisList = new ArrayList<String>();
 
         // adding the item to list that will be displayed on the UI.
-        apisList.add("Server Builder APIs");
-        apisList.add("Resource Container APIs");
+        apisList.add("Server Builder");
+        apisList.add("Resource Container");
         apis = new ArrayAdapter<String>(activityObj,
                 android.R.layout.simple_list_item_1, apisList);
         list.setAdapter(apis);
@@ -28,6 +28,7 @@ import java.util.Map;
 import org.iotivity.ResourceEncapsulation.server.RCSBundleInfo;
 import org.iotivity.ResourceEncapsulation.server.RCSResourceContainer;
 
+import android.content.Context;
 import android.os.Message;
 
 /**
@@ -53,12 +54,11 @@ public class ResourceContainer {
     }
 
     // Start Container
-    public void startContainer() {
+    public void startContainer(String sdCardPath) {
 
         startBundleFlag = true;
-        String configFile = "/data/data/"
-                + resourceContainerActivityInstance.getPackageName()
-                + "/files/ResourceContainerConfig.xml";
+        String configFile = sdCardPath + "/ResourceContainerConfig.xml";
+
         if (!isStarted) {
             for (int i = 0; i < 2; i++) {
                 containerInstance.startContainer(configFile);
@@ -94,7 +94,7 @@ public class ResourceContainer {
 
         List<String> bundleResources = containerInstance
                 .listBundleResources("oic.bundle.discomfortIndexSensor");
-        Iterator it = bundleResources.iterator();
+        Iterator<String> it = bundleResources.iterator();
         logMessage = "";
 
         if (0 == bundleResources.size()) {
@@ -115,7 +115,7 @@ public class ResourceContainer {
     public void listBundles() {
 
         List<RCSBundleInfo> bundleList = containerInstance.listBundles();
-        Iterator it = bundleList.iterator();
+        Iterator<RCSBundleInfo> it = bundleList.iterator();
         logMessage = "";
         logMessage = logMessage + "size of bundleList : " + bundleList.size()
                 + "\n";
@@ -58,6 +58,7 @@ public class ResourceContainerActivity extends Activity {
     private Button                           startContainer;
     private Button                           stopContainer;
     private static EditText                  logs;
+    private static String                    sdCardPath;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -76,6 +77,7 @@ public class ResourceContainerActivity extends Activity {
         stopContainer.setEnabled(false);
         logs = (EditText) findViewById(R.id.log);
 
+        sdCardPath = this.getFilesDir().getPath();
         // adding the item to list that will be displayed on the UI.
         containerApiList.add("1. List Bundles");
         containerApiList.add("2. List bundle resources");
@@ -117,7 +119,7 @@ public class ResourceContainerActivity extends Activity {
             @Override
             public void onClick(View v) {
 
-                resourceContainerInstance.startContainer();
+                resourceContainerInstance.startContainer(sdCardPath);
                 startContainer.setEnabled(false);
                 stopContainer.setEnabled(true);
 
@@ -69,6 +69,8 @@ public class ServerBuilder {
 
         try {
             rcsResourceObject = builderObject.build();
+            rcsResourceObject
+                    .setSetRequestHandlerPolicy(SetRequestHandlerPolicy.ACCEPTANCE);
         } catch (RCSException e) {
             e.printStackTrace();
         }
index 2212fb1..6c51202 100644 (file)
@@ -67,7 +67,7 @@ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/librcs_container.so
 include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
-OIC_SRC_DIR := ../../../../..
+OIC_SRC_DIR := ../../../..
 LOCAL_MODULE    := re-jni
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/jniutil/inc \
index e259a8a..95f8c61 100644 (file)
@@ -79,19 +79,19 @@ OCEntityHandlerResult convertIntToOCEntityHandlerResult(int result)
 {
     switch (result)
     {
-        case 1:
+        case 0:
             return OCEntityHandlerResult::OC_EH_OK;
-        case 2:
+        case 1:
             return OCEntityHandlerResult::OC_EH_ERROR;
-        case 3:
+        case 2:
             return OCEntityHandlerResult::OC_EH_RESOURCE_CREATED;
-        case 4:
+        case 3:
             return OCEntityHandlerResult::OC_EH_RESOURCE_DELETED;
-        case 5:
+        case 4:
             return OCEntityHandlerResult::OC_EH_SLOW;
-        case 6:
+        case 5:
             return OCEntityHandlerResult::OC_EH_FORBIDDEN;
-        case 7:
+        case 6:
             return OCEntityHandlerResult::OC_EH_RESOURCE_NOT_FOUND;
     }
     return OCEntityHandlerResult::OC_EH_ERROR;
@@ -199,13 +199,13 @@ RCSResourceObject::AutoNotifyPolicy convertJavaNotifyPolicyToNativePolicy( int p
 {
     switch (policy)
     {
-        case 1:
+        case 0:
             return RCSResourceObject::AutoNotifyPolicy::NEVER;
 
-        case 2:
+        case 1:
             return RCSResourceObject::AutoNotifyPolicy::ALWAYS;
 
-        case 3:
+        case 2:
             return RCSResourceObject::AutoNotifyPolicy::UPDATED;
     }
 }
@@ -215,10 +215,10 @@ RCSResourceObject::SetRequestHandlerPolicy convertJavasetRequestHandlerPolicyToN
 {
     switch (policy)
     {
-        case 1:
+        case 0:
             return RCSResourceObject::SetRequestHandlerPolicy::NEVER;
 
-        case 2:
+        case 1:
             return RCSResourceObject::SetRequestHandlerPolicy::ACCEPTANCE;
     }
 }
index ea8ece5..4476458 100644 (file)
@@ -119,13 +119,13 @@ Java_org_iotivity_ResourceEncapsulation_client_RCSDiscoveryManager_discoverResou
     {
         onResFoundListener->discoverResourceCallback(resource);
     };
-    if ( 0 == jTypeofDiscovery )
+    if ( 1 == jTypeofDiscovery )
     {
         RCSDiscoveryManager::getInstance()->discoverResourceByType(RCSAddress::multicast(), relativeUri,
                 resourceType, discoverCallback);
         LOGI("NativeInterface_discoverResource multicast");
     }
-    else if ( 1 == jTypeofDiscovery)
+    else if ( 0 == jTypeofDiscovery)
     {
         RCSDiscoveryManager::getInstance()->discoverResourceByType(RCSAddress::unicast(address),
                 relativeUri, resourceType, discoverCallback );
index 441ac3d..e4e4932 100644 (file)
@@ -453,6 +453,12 @@ Java_org_iotivity_ResourceEncapsulation_client_RCSRemoteResourceObject_nativeGet
 (JNIEnv *env, jobject interfaceClass, jobject jResourceAttributesListener)
 {
     LOGD("RCSRemoteResourceObject_nativeGetRemoteAttributes");
+    if (!jResourceAttributesListener)
+    {
+        LOGE("RCSRemoteResourceObject_nativeGetRemoteAttributes: listener is NULL");
+        throwRCSException(env,  "Invalid parameter");
+        return;
+    }
     JniRCSRemoteResourceObject *resource = JniRCSRemoteResourceObject::getJniRCSRemoteResourceObject(
             env, interfaceClass);
     if (!resource) return;
@@ -467,6 +473,12 @@ Java_org_iotivity_ResourceEncapsulation_client_RCSRemoteResourceObject_nativeSet
  jobject jResourceAttributesListener)
 {
     LOGD("RCSRemoteResourceObject_nativeSetRemoteAttributes");
+    if (!jResourceAttributesListener)
+    {
+        LOGE("RCSRemoteResourceObject_nativeSetRemoteAttributes: listener is NULL");
+        throwRCSException(env,  "Invalid parameter");
+        return;
+    }
     JniRCSRemoteResourceObject *resource = JniRCSRemoteResourceObject::getJniRCSRemoteResourceObject(
             env, interfaceClass);
     if (!resource) return;
index e48910e..4da2491 100644 (file)
@@ -81,7 +81,7 @@ void JniSetAttributesListener::onRemoteAttributesSetCallback(OIC::Service::RCSRe
         return;
     }
 
-    jmethodID midL = env->GetMethodID(clsL, "onRemoteAttributesGetCallback",
+    jmethodID midL = env->GetMethodID(clsL, "onRemoteAttributesSetCallback",
                                       "(Lorg/iotivity/ResourceEncapsulation/common/RCSResourceAttributes;)V");
 
     if (!midL)
index aa1deb7..294d180 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSAddress.java
- *
- * @brief    This file provides a class for a set of APIs relating to resource address and the
- *        the type of discovery request for a resource of interest.
- *
+ * @file
+ * This file provides a class for a set of APIs relating to resource address and the
+ * the type of discovery request for a resource of interest.
  */
 
 package org.iotivity.ResourceEncapsulation.client;
index 2899183..67ac7a5 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSDiscoveryManager.java
- *
- * @brief    This file provides a class for a set of APIs relating to discovery of a particular
- *         resource in the network
- *
+ * @file
+ * This file provides a class for a set of APIs relating to discovery of a particular
+ * resource in the network
  */
 
 package org.iotivity.ResourceEncapsulation.client;
@@ -109,8 +107,8 @@ public class RCSDiscoveryManager {
      * @param address
      *            A RCSAddress object
      *
-     *            {@link RCSAddress}
-     *
+     * @throws RCSException
+     *             {@link RCSAddress}
      */
     public void discoverResource(RCSAddress address) throws RCSException {
 
@@ -127,8 +125,8 @@ public class RCSDiscoveryManager {
      * @param relativeURI
      *            The relative uri of resource to be searched
      *
-     *            {@link RCSAddress}
-     *
+     * @throws RCSException
+     *             {@link RCSAddress}
      */
     public void discoverResource(RCSAddress address, String relativeURI)
             throws RCSException {
@@ -145,8 +143,8 @@ public class RCSDiscoveryManager {
      * @param resourceType
      *            Ressource Type
      *
-     *            {@link RCSAddress}
-     *
+     * @throws RCSException
+     *             {@link RCSAddress}
      */
     public void discoverResourceByType(RCSAddress address, String resourceType)
             throws RCSException {
@@ -166,8 +164,8 @@ public class RCSDiscoveryManager {
      * @param resourceType
      *            Ressource Type
      *
-     *            {@link RCSAddress}
-     *
+     * @throws RCSException
+     *             {@link RCSAddress}
      */
     public void discoverResourceByType(RCSAddress address, String relativeURI,
             String resourceType) throws RCSException {
@@ -189,5 +187,4 @@ public class RCSDiscoveryManager {
         this.discoverResource(addr, typeOfDiscovery.ordinal(), relativeURI,
                 resourceType, m_discoverListener);
     }
-
 }
index 64f01a6..a586a3b 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSRemoteResourceObject.java
- *
- * @brief     This file provides a class which provides a set of native functions and API's
- *        of resource client, provided to the developers.
+ * @file
+ * This file provides a class which provides a set of native functions and API's
+ * of resource client, provided to the developers.
  */
 
 package org.iotivity.ResourceEncapsulation.client;
@@ -43,13 +42,13 @@ import android.util.Log;
  * API.
  *
  * {@link RCSDiscoveryManager}
- *
  */
 public class RCSRemoteResourceObject {
 
     private IStateChangedCallbackListener m_stateChangedListener;
     private ICacheUpdateListener          m_cacheUpdateListener;
-    private IRemoteAttributeListener      m_remoteAttributeListener;
+    private IGetRemoteAttributeListener   m_getremoteAttributeListener;
+    private ISetRemoteAttributeListener   m_setremoteAttributeListener;
     private long                          m_nativeHandle;
     private String                        LOG_TAG = this.getClass()
                                                           .getSimpleName();
@@ -81,10 +80,11 @@ public class RCSRemoteResourceObject {
     private native String nativeGetCachedAttribute(String key);
 
     private native void nativeGetRemoteAttributes(
-            IRemoteAttributeListener listener);
+            IGetRemoteAttributeListener listener);
 
     private native void nativeSetRemoteAttributes(
-            RCSResourceAttributes attributes, IRemoteAttributeListener listener);
+            RCSResourceAttributes attributes,
+            ISetRemoteAttributeListener listener);
 
     private native String nativeGetUri();
 
@@ -110,17 +110,17 @@ public class RCSRemoteResourceObject {
      */
     public enum ResourceState {
 
-        NONE, /** < Monitoring is not started. */
-        REQUESTED, /**
-         * < Monitoring is started and checking state is in progress.
-         * This is the default state after startMonitoring.
-         */
-        ALIVE, /** < The resource is alive. */
-        LOST_SIGNAL, /** < Failed to reach the resource. */
+        NONE, /* < Monitoring is not started. */
+        REQUESTED, /*
+                    * < Monitoring is started and checking state is in progress.
+                    * This is the default state after startMonitoring.
+                    */
+        ALIVE, /* < The resource is alive. */
+        LOST_SIGNAL, /* < Failed to reach the resource. */
         DESTROYED;
-        /** < The resource is deleted. */
+        /* < The resource is deleted. */
 
-        /**
+        /*
          * Utility API for integer to enum conversion.
          */
         public static ResourceState getResourceState(int ordinal) {
@@ -133,6 +133,8 @@ public class RCSRemoteResourceObject {
                 return ResourceState.values()[2];
             else if (ordinal == 3)
                 return ResourceState.values()[3];
+            else if (ordinal == 4)
+                return ResourceState.values()[4];
 
             return null;
         }
@@ -149,30 +151,30 @@ public class RCSRemoteResourceObject {
      */
     public enum CacheState {
 
-        NONE, /** < Caching is not started. */
-        UNREADY, /**
-         * < Caching is started, but the data is not ready yet. This is
-         * the default state after startCaching.
-         */
-        READY, /** < The data is ready. */
+        NONE, /* < Caching is not started. */
+        UNREADY, /*
+                  * < Caching is started, but the data is not ready yet. This is
+                  * the default state after startCaching.
+                  */
+        READY, /* < The data is ready. */
         LOST_SIGNAL;
-        /** < Failed to reach the resource. */
+        /* < Failed to reach the resource. */
 
-        /**
+        /*
          * Utility API for int to enum conversion.
          */
         public static CacheState getCacheState(int ordinal) {
 
-            CacheState result = CacheState.values()[0];
-
-            if (ordinal == 1)
-                result = CacheState.values()[1];
+            if (ordinal == 0)
+                return CacheState.values()[0];
+            else if (ordinal == 1)
+                return CacheState.values()[1];
             else if (ordinal == 2)
-                result = CacheState.values()[2];
+                return CacheState.values()[2];
             else if (ordinal == 3)
-                result = CacheState.values()[3];
+                return CacheState.values()[3];
 
-            return result;
+            return null;
         }
     }
 
@@ -197,14 +199,13 @@ public class RCSRemoteResourceObject {
 
     /**
      * Provides interface for receiving the callback for the getRemoteAttributes
-     * and setRemoteAttributes requested actions.
+     * requested action.
      */
-    public interface IRemoteAttributeListener {
+    public interface IGetRemoteAttributeListener {
 
         /**
          * This callback method is called when a asynchronous response for the
-         * getRemoteAttributes request or setRemoteAttributes request is
-         * received.
+         * getRemoteAttributes request is received.
          *
          * @param attributes
          *            It is the updated resource attributes value received from
@@ -217,6 +218,27 @@ public class RCSRemoteResourceObject {
 
     }
 
+    /**
+     * Provides interface for receiving the callback for the setRemoteAttributes
+     * requested action.
+     */
+    public interface ISetRemoteAttributeListener {
+
+        /**
+         * This callback method is called when a asynchronous response for the
+         * setRemoteAttributes request is received.
+         *
+         * @param attributes
+         *            It is the updated resource attributes value received from
+         *            the remote resource.
+         *
+         *            {@link RCSResourceAttributes}
+         */
+        public void onRemoteAttributesSetCallback(
+                RCSResourceAttributes attributes);
+
+    }
+
     /**
      * Provides interface for receiving the callback for the startMonitoring
      * This callback is received on remote resource state change.
@@ -260,14 +282,28 @@ public class RCSRemoteResourceObject {
 
     /**
      * Set listener for receiving asynchronous response for resource attributes
-     * SET and GET request.
+     * GET request.
      *
      * @param listener
-     *            IRemoteAttributeListener to receive asynchronous response for
-     *            resource attributes SET and GET request.
+     *            IGetRemoteAttributeListener to receive asynchronous response
+     *            for resource attributes SET and GET request.
      */
-    public void setRemoteAttributesListener(IRemoteAttributeListener listener) {
-        m_remoteAttributeListener = listener;
+    public void setGetRemoteAttributesListener(
+            IGetRemoteAttributeListener listener) {
+        m_getremoteAttributeListener = listener;
+    }
+
+    /**
+     * Set listener for receiving asynchronous response for resource attributes
+     * SET request.
+     *
+     * @param listener
+     *            IGetRemoteAttributeListener to receive asynchronous response
+     *            for resource attributes SET and GET request.
+     */
+    public void setSetRemoteAttributesListener(
+            ISetRemoteAttributeListener listener) {
+        m_setremoteAttributeListener = listener;
     }
 
     /**
@@ -321,7 +357,6 @@ public class RCSRemoteResourceObject {
      *
      *             {@link IStateChangedCallbackListener} {@link ResourceState}
      *             {@link #isMonitoring()} {@link #stopMonitoring()}
-     *
      */
     public void startMonitoring() throws RCSException {
 
@@ -441,7 +476,6 @@ public class RCSRemoteResourceObject {
      *
      *             {@link RCSResourceAttributes} {@link #isCachedAvailable()}
      *             {@link #startCaching()}
-     *
      */
     public RCSResourceAttributes getCachedAttributes() throws RCSException {
 
@@ -466,7 +500,6 @@ public class RCSRemoteResourceObject {
      *
      *             {@link RCSResourceAttributes} {@link #isCachedAvailable()}
      *             {@link #startCaching()}
-     *
      */
     public String getCachedAttribute(String key) throws RCSException {
 
@@ -481,14 +514,15 @@ public class RCSRemoteResourceObject {
      * attributes to the caller in the RemoteAttributesReceivedCallback.
      *
      * <p>
-     * IRemoteAttributeListener should be set to get the attributes
+     * IGetRemoteAttributeListener should be set to get the attributes
      *
-     * {@link IRemoteAttributeListener}
+     * @throws RCSException
+     *             {@link IGetRemoteAttributeListener}
      */
     public void getRemoteAttributes() throws RCSException {
 
         Log.i(LOG_TAG, "getRemoteAttributes called");
-        this.nativeGetRemoteAttributes(m_remoteAttributeListener);
+        this.nativeGetRemoteAttributes(m_getremoteAttributeListener);
     }
 
     /**
@@ -501,15 +535,16 @@ public class RCSRemoteResourceObject {
      *            Attribute value to set for the remote resource.
      *
      *            <p>
-     *            IRemoteAttributeListener should be set to call this API
+     *            ISetRemoteAttributeListener should be set to call this API
      *
-     *            {@link IRemoteAttributeListener}
+     * @throws RCSException
+     *             {@link ISetRemoteAttributeListener}
      */
     public void setRemoteAttributes(RCSResourceAttributes attributes)
             throws RCSException {
 
         Log.i(LOG_TAG, "getRemoteAttributes called");
-        this.nativeSetRemoteAttributes(attributes, m_remoteAttributeListener);
+        this.nativeSetRemoteAttributes(attributes, m_setremoteAttributeListener);
     }
 
     /**
index 5c39190..7f07bb1 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSException.java
- *
- * @brief     This file provides RCSException class for RE layer
- *
+ * @file
+ *This file provides RCSException class for RE layer
  */
 
 package org.iotivity.ResourceEncapsulation.common;
index c536191..f00943d 100644 (file)
@@ -18,9 +18,8 @@
  *
  ******************************************************************/
 /**
- * @file    RCSResourceAttributes.java
- *
- * @brief     This file provides a class which represents the attributes for a resource.
+ * @file
+ * This file provides a class which represents the attributes for a resource.
  */
 
 package org.iotivity.ResourceEncapsulation.common;
@@ -33,7 +32,7 @@ import org.iotivity.ResourceEncapsulation.server.RCSResourceObject;
  * RCSResourceAttributes represents the attributes for a resource.
  *
  * An attribute value can be one of various types : integer, double, boolean,
- * String<br/>
+ * String.
  *
  * <p>
  * If developer on client side wants to get the RCSResourceAttributes for the
@@ -111,7 +110,6 @@ public class RCSResourceAttributes {
      *            - Key of the element.
      *
      * @return int - integer value of key provided.
-     *
      */
     public int getValueInt(String key) {
         Integer value = 0;
@@ -130,7 +128,6 @@ public class RCSResourceAttributes {
      *            - Key of the element.
      *
      * @return boolean - boolean value of key provided.
-     *
      */
     public double getValueDouble(String key) {
         double value = 0;
@@ -149,7 +146,6 @@ public class RCSResourceAttributes {
      *            - Key of the element.
      *
      * @return boolean - boolean value of key provided.
-     *
      */
     public boolean getValueBool(String key) {
         Boolean value = false;
@@ -168,7 +164,6 @@ public class RCSResourceAttributes {
      *            - Key of the element.
      *
      * @return String - String value of key provided.
-     *
      */
     public String getValueString(String key) {
         String value = "";
@@ -189,6 +184,7 @@ public class RCSResourceAttributes {
      * @param value
      *            - integer value of key to be set.
      *
+     * @throws RCSException
      */
     public void setValueInt(String key, int value) throws RCSException {
         try {
@@ -207,6 +203,7 @@ public class RCSResourceAttributes {
      * @param value
      *            - double value of key to be set.
      *
+     * @throws RCSException
      */
     public void setValueDouble(String key, double value) throws RCSException {
         try {
@@ -225,6 +222,7 @@ public class RCSResourceAttributes {
      * @param value
      *            - integer value of key to be set.
      *
+     * @throws RCSException
      */
     public void setValueBool(String key, boolean value) throws RCSException {
         try {
@@ -243,6 +241,7 @@ public class RCSResourceAttributes {
      * @param value
      *            - integer value of key to be set.
      *
+     * @throws RCSException
      */
     public void setValueString(String key, String value) throws RCSException {
         try {
index e174152..a04d562 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    Builder.java
- *
- *    This file contains Builder class which provides the easy creation of Resource.
- *
+ * @file
+ *  This file contains Builder class which provides the easy creation of Resource.
  */
 
 package org.iotivity.ResourceEncapsulation.server;
@@ -76,7 +74,6 @@ public class Builder {
      *            Resource type value to be set
      * @param resourceInterface
      *            Interface value to be set
-     *
      */
     public Builder(String resourceURI, String resourceType,
             String resourceInterface) {
@@ -90,7 +87,6 @@ public class Builder {
      *
      * @param isDiscoverable
      *            Whether to be discovered or not
-     *
      */
     public void setDiscoverable(boolean isDiscoverable) {
         m_discovervableFlag = isDiscoverable;
@@ -101,7 +97,6 @@ public class Builder {
      *
      * @param isObservable
      *            Whether to be observed or not
-     *
      */
     public void setObservable(boolean isObservable) {
         m_observableFlag = isObservable;
@@ -135,7 +130,6 @@ public class Builder {
      *             Observable as needed. [optional] - Set the attributes for the
      *             resource. [optional] - At last call the build() method to
      *             create the resource.
-     *
      */
     public RCSResourceObject build() throws RCSException {
         return this.nativeBuild(m_resourceUri, m_resourceType,
index ab966fe..c040fee 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSBundleInfo.java
- *
- *  This file contains RCSBundleInfo class, which provides APIs related to Bundle information.
- *
+ * @file
+ * This file contains RCSBundleInfo class, which provides APIs related to Bundle information.
  */
 
 package org.iotivity.ResourceEncapsulation.server;
@@ -63,7 +61,6 @@ public class RCSBundleInfo {
      * API for getting the Id of the bundle
      *
      * @return string - Id of the bundle
-     *
      */
     public String getID() {
         return this.nativeGetID();
@@ -73,7 +70,6 @@ public class RCSBundleInfo {
      * API for getting the path of the bundle
      *
      * @return path - path of the bundle
-     *
      */
     public String getPath() {
         return this.nativeGetPath();
@@ -83,7 +79,6 @@ public class RCSBundleInfo {
      * API for setting the Activator name for the bundle
      *
      * @return string - Name of the activator
-     *
      */
     public String getActivatorName() {
         return nativeGetActivatorName();
@@ -93,7 +88,6 @@ public class RCSBundleInfo {
      * API for getting the library path for the bundle
      *
      * @return string - Library path in string form
-     *
      */
     public String getLibraryPath() {
         return nativeGetLibraryPath();
@@ -103,7 +97,6 @@ public class RCSBundleInfo {
      * API for getting the version of the bundle
      *
      * @return string - version of the bundle
-     *
      */
     public String getVersion() {
         return nativeGetVersion();
@@ -114,7 +107,6 @@ public class RCSBundleInfo {
      *
      * @param id
      *            - Id of the bundle in string form
-     *
      */
     public void setID(String id) {
         this.nativeSetID(id);
@@ -125,7 +117,6 @@ public class RCSBundleInfo {
      *
      * @param path
      *            - path of the bundle in string form
-     *
      */
     public void setPath(String path) {
         this.nativeSetPath(path);
@@ -134,9 +125,8 @@ public class RCSBundleInfo {
     /**
      * API for setting the Activator name for the bundle
      *
-     * @param activator
+     * @param activatorName
      *            - Activator name in string form
-     *
      */
     public void setActivatorName(String activatorName) {
         this.nativeSetActivatorName(activatorName);
@@ -145,9 +135,8 @@ public class RCSBundleInfo {
     /**
      * API for setting the library path for the bundle
      *
-     * @param libpath
+     * @param libraryPath
      *            - Library path in string form
-     *
      */
     public void setLibraryPath(String libraryPath) {
         this.nativeSetLibraryPath(libraryPath);
@@ -158,7 +147,6 @@ public class RCSBundleInfo {
      *
      * @param version
      *            - version of the bundle in string form
-     *
      */
     public void setVersion(String version) {
         this.nativeSetVersion(version);
index 264eeea..c1a3cb6 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSGetResponse.java
- *
- *    This file contains the class for creating a Get response
- *             for the received Get request.
+ * @file
+ * This file contains the class for creating a Get response
+ * for the received Get request.
  *
  */
 
@@ -71,7 +70,6 @@ public class RCSGetResponse {
      * @return RCSGetResponse
      *
      *         {@link EntityHandlerResult}
-     *
      */
     public static RCSGetResponse create(EntityHandlerResult result,
             int errorCode) {
@@ -90,7 +88,6 @@ public class RCSGetResponse {
      * @return RCSGetResponse
      *
      *         {@link RCSResourceAttributes}
-     *
      */
     public static RCSGetResponse create(RCSResourceAttributes attributes) {
         return new RCSGetResponse(attributes);
@@ -142,22 +139,18 @@ public class RCSGetResponse {
         this.m_errorCode = errorCode;
     }
 
-    @SuppressWarnings("unused")
     private int getTypeOfGetResponse() {
         return m_typeOfGetResponse;
     }
 
-    @SuppressWarnings("unused")
     private int getResult() {
         return m_handlerResult;
     }
 
-    @SuppressWarnings("unused")
     private int getErrorCode() {
         return m_errorCode;
     }
 
-    @SuppressWarnings("unused")
     private RCSResourceAttributes getAttributes() {
         return m_attributes;
     }
index eacf56a..aa47bc5 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSRequest.java
- *
- *      This file provides RCSRequest class which will describes the request.
- *
+ * @file
+ * This file provides RCSRequest class which will describes the request.
  */
 
 package org.iotivity.ResourceEncapsulation.server;
index a8c674a..5e5de1a 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSResourceContainer.java
- *
- *    This file contains the Resource Container APIs
- *
+ * @file
+ * This file contains the Resource Container APIs
  */
 
 package org.iotivity.ResourceEncapsulation.server;
@@ -116,8 +114,7 @@ public class RCSResourceContainer {
     /**
      * API for getting the list of all bundles in the container
      *
-     * @return list<RCSBundleInfo> -List of BundleInfo objects each associated
-     *         with a bundle
+     * @return list -List of BundleInfo objects each associated with a bundle
      *
      *         {@link RCSBundleInfo}
      */
@@ -213,7 +210,7 @@ public class RCSResourceContainer {
      * @param bundleId
      *            - Id of the Bundle
      *
-     * @return List<String> All the bundle resources
+     * @return List All the bundle resources
      */
     public List<String> listBundleResources(String bundleId) {
         return this.nativeListBundleResources(bundleId);
index 7db95d1..ff086e7 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************
+/* *****************************************************************
  *
  * Copyright 2015 Samsung Electronics All Rights Reserved.
  *
  *
  ******************************************************************/
 /**
- * @file   RCSResourceObject.java
- *
- *  This file contains the resource object APIs provided to the developers.
- *        RCSResourceObject is a part of the server builder module.
- *
+ * @file
+ * This file contains the resource object APIs provided to the developers.
+ * RCSResourceObject is a part of the server builder module.
  */
 
 package org.iotivity.ResourceEncapsulation.server;
@@ -114,12 +112,12 @@ public class RCSResourceObject {
      * {@link RCSResourceObject}
      */
     public enum AutoNotifyPolicy {
-        NEVER, /** < Never notify. */
-        ALWAYS, /** < Always notify. */
+        NEVER, /* < Never notify. */
+        ALWAYS, /* < Always notify. */
         UPDATED;
-        /** < When attributes are changed, notify. */
+        /* < When attributes are changed, notify. */
 
-        /**
+        /*
          * Utility API for integer to enum conversion.
          */
         public static AutoNotifyPolicy getAutoNotifyPolicy(int ordinal) {
@@ -135,17 +133,17 @@ public class RCSResourceObject {
 
     public enum SetRequestHandlerPolicy {
 
-        NEVER, /**
-         * < Server ignore when server is received set-request of
-         * attributes of the new key.
-         */
+        NEVER, /*
+                * < Server ignore when server is received set-request of
+                * attributes of the new key.
+                */
         ACCEPTANCE;
-        /**
+        /*
          * < Server creates attributes of the new key When server is received
          * set-request of attributes of the new key.
          */
 
-        /**
+        /*
          * Utility API for integer to enum conversion.
          */
         public static SetRequestHandlerPolicy getSetRequestHandlerPolicy(
@@ -279,7 +277,7 @@ public class RCSResourceObject {
      *            The thread-safety for attributes is taken care internally.
      */
     public void setAttribute(String key, int value) {
-        Log.e(LOG_TAG, "setAttribute (integer) called");
+        Log.i(LOG_TAG, "setAttribute (integer) called");
         this.nativeSetAttributeInteger(key, value);
     }
 
@@ -294,7 +292,7 @@ public class RCSResourceObject {
      *            The thread-safety for attributes is taken care internally.
      */
     public void setAttribute(String key, double value) {
-        Log.e(LOG_TAG, "setAttribute (float) called");
+        Log.i(LOG_TAG, "setAttribute (float) called");
         this.nativeSetAttributeDouble(key, value);
     }
 
@@ -309,7 +307,7 @@ public class RCSResourceObject {
      *            The thread-safety for attributes is taken care internally.
      */
     public void setAttribute(String key, boolean value) {
-        Log.e(LOG_TAG, "setAttribute (double) called ");
+        Log.i(LOG_TAG, "setAttribute (double) called ");
         this.nativeSetAttributeBool(key, value);
     }
 
@@ -324,7 +322,7 @@ public class RCSResourceObject {
      *            The thread-safety for attributes is taken care internally.
      */
     public void setAttribute(String key, String value) {
-        Log.e(LOG_TAG, "setAttribute (String) called ");
+        Log.i(LOG_TAG, "setAttribute (String) called ");
         this.nativeSetAttributeString(key, value);
     }
 
@@ -339,7 +337,7 @@ public class RCSResourceObject {
      *         The thread-safety for attributes is taken care internally.
      */
     public String getAttributeValue(String key) {
-        Log.e(LOG_TAG, "getAttributeValue called");
+        Log.i(LOG_TAG, "getAttributeValue called");
         return this.nativeGetAttributeValue(key);
     }
 
@@ -354,7 +352,7 @@ public class RCSResourceObject {
      *         The thread-safety for attributes is taken care internally.
      */
     public boolean removeAttribute(String key) {
-        Log.e(LOG_TAG, "removeAttribute called");
+        Log.i(LOG_TAG, "removeAttribute called");
         return this.nativeRemoveAttribute(key);
     }
 
@@ -370,7 +368,7 @@ public class RCSResourceObject {
      *         The thread-safety for attributes is taken care internally.
      */
     public boolean containsAttribute(String key) {
-        Log.e(LOG_TAG, "containsAttribute called");
+        Log.i(LOG_TAG, "containsAttribute called");
         return this.nativeContainsAttribute(key);
     }
 
@@ -382,7 +380,7 @@ public class RCSResourceObject {
      *         {@link RCSResourceAttributes}
      */
     public RCSResourceAttributes getAttributes() {
-        Log.e(LOG_TAG, "getAttributes called");
+        Log.i(LOG_TAG, "getAttributes called");
         return this.nativeGetAttributes();
     }
 
@@ -392,7 +390,7 @@ public class RCSResourceObject {
      * @return true if observable otherwise false
      */
     public boolean isObservable() {
-        Log.e(LOG_TAG, "isObservable called");
+        Log.i(LOG_TAG, "isObservable called");
         return this.nativeIsObservable();
     }
 
@@ -402,7 +400,7 @@ public class RCSResourceObject {
      * @return true if discoverable else false
      */
     public boolean isDiscoverable() {
-        Log.e(LOG_TAG, "isDiscoverable called");
+        Log.i(LOG_TAG, "isDiscoverable called");
         return this.nativeIsDiscoverable();
     }
 
@@ -417,11 +415,10 @@ public class RCSResourceObject {
      * listener call setGetRequestListener() API
      *
      * {@link RCSGetResponse} {@link #setGetRequestListener(IGetRequestHandler)}
-     *
      */
     public void setGetRequestHandler() {
         if (null == m_getRequestListener) {
-            Log.e(LOG_TAG, "getRequestListener is not set");
+            Log.i(LOG_TAG, "getRequestListener is not set");
             return;
         } else {
             this.nativeSetGetRequestHandler(m_getRequestListener);
@@ -439,11 +436,10 @@ public class RCSResourceObject {
      * listener call setSetRequestListener() API
      *
      * {@link RCSSetResponse} {@link #setSetRequestListener(ISetRequestHandler)}
-     *
      */
     public void setSetRequestHandler() {
         if (null == m_setRequestListener) {
-            Log.e(LOG_TAG, "setRequestListener is not set");
+            Log.i(LOG_TAG, "setRequestListener is not set");
             return;
         } else {
             this.nativeSetSetRequestHandler(m_setRequestListener);
@@ -462,7 +458,7 @@ public class RCSResourceObject {
      */
     public void addAttributeUpdatedListener(String key) {
         if (null == m_attributeUpdatedListener) {
-            Log.e(LOG_TAG, "addAttributeUpdatedListener is not set");
+            Log.i(LOG_TAG, "addAttributeUpdatedListener is not set");
             return;
         } else {
             this.nativeAddAttributeUpdatedListener(key,
@@ -487,7 +483,7 @@ public class RCSResourceObject {
      * attributes value
      */
     public void notifyObservers() {
-        Log.e(LOG_TAG, "notifyObservers called");
+        Log.i(LOG_TAG, "notifyObservers called");
         this.nativeNotify();
     }
 
@@ -498,23 +494,21 @@ public class RCSResourceObject {
      *            policy to be set
      *
      *            {@link AutoNotifyPolicy}
-     *
      */
     public void setAutoNotifyPolicy(AutoNotifyPolicy policy) {
-        Log.e(LOG_TAG, "setAutoNotifyPolicy called");
+        Log.i(LOG_TAG, "setAutoNotifyPolicy called");
         this.nativeSetAutoNotifyPolicy(policy.ordinal());
     }
 
     /**
      * API for getting auto notify policy
      *
-     * @return AntoNotify policy
+     * @return AutoNotifyPolicy
      *
      *         {@link AutoNotifyPolicy}
-     *
      */
     public AutoNotifyPolicy getAutoNotifyPolicy() {
-        Log.e(LOG_TAG, "getAutoNotifyPolicy called");
+        Log.i(LOG_TAG, "getAutoNotifyPolicy called");
         return AutoNotifyPolicy.getAutoNotifyPolicy(this
                 .nativeGetAutoNotifyPolicy());
     }
@@ -526,23 +520,21 @@ public class RCSResourceObject {
      *            policy to be set
      *
      *            {@link SetRequestHandlerPolicy}
-     *
      */
     public void setSetRequestHandlerPolicy(SetRequestHandlerPolicy policy) {
-        Log.e(LOG_TAG, "setSetRequestHandlerPolicy called");
+        Log.i(LOG_TAG, "setSetRequestHandlerPolicy called");
         this.nativeSetSetRequestHandlerPolicy(policy.ordinal());
     }
 
     /**
      * API for getting the SetRequestHandler Policy.
      *
-     * @return Property of setRequesthandler
+     * @return SetRequestHandlerPolicy
      *
      *         {@link SetRequestHandlerPolicy}
-     *
      */
     public SetRequestHandlerPolicy getSetRequestHandlerPolicy() {
-        Log.e(LOG_TAG, "getSetRequestHandlerPolicy called");
+        Log.i(LOG_TAG, "getSetRequestHandlerPolicy called");
         return SetRequestHandlerPolicy.getSetRequestHandlerPolicy(this
                 .nativeGetSetRequestHandlerPolicy());
     }
index a6273a7..48fde74 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    RCSSetResponse.java
- *
- *    This file contains the class for creating a Set response
- *             for the received Set request.
- *
+ * @file
+ * This file contains the class for creating a Set response
+ * for the received Set request.
  */
 
 package org.iotivity.ResourceEncapsulation.server;
 
 import org.iotivity.ResourceEncapsulation.common.RCSResourceAttributes;
 import org.iotivity.ResourceEncapsulation.utils.EntityHandlerResult;
+import org.iotivity.ResourceEncapsulation.server.RCSResourceObject;
 
 /**
  * This class provides methods to create the response for a received set
@@ -59,10 +58,6 @@ public class RCSSetResponse {
      *
      * <p>
      * DEFAULT : Follow SetRequestHandlerPolicy of the RCSResourceObject.
-     *
-     * @return RCSSetResponse
-     *
-     *         {@link SetRequestHandlerPolicy}
      */
     public static RCSSetResponse defaultAction() {
         return new RCSSetResponse(DEFAULT_RESPONSE);
@@ -229,22 +224,18 @@ public class RCSSetResponse {
         m_errorCode = errorCode;
     }
 
-    @SuppressWarnings("unused")
     private int getTypeOfGetResponse() {
         return m_typeOfSetResponse;
     }
 
-    @SuppressWarnings("unused")
     private int getResult() {
         return m_handlerResult;
     }
 
-    @SuppressWarnings("unused")
     private int getErrorCode() {
         return m_errorCode;
     }
 
-    @SuppressWarnings("unused")
     private RCSResourceAttributes getAttributes() {
         return m_attributes;
     }
index cf6daf9..96463be 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    DiscoveryType.java
- *
- * @brief     This file provides a Enum to handle unicast or multicast discovery.
- *
- *@link RCSAddress
+ * @file
+ * This file provides a Enum to handle unicast or multicast discovery.
+ * @link RCSAddress
  */
 
 package org.iotivity.ResourceEncapsulation.utils;
 
+import org.iotivity.ResourceEncapsulation.client.RCSAddress;
+
 /**
  * This Enum discovery codes for different discovery types.
  *
@@ -38,12 +38,12 @@ package org.iotivity.ResourceEncapsulation.utils;
  */
 public enum DiscoveryType {
 
-    UNICAST, /** < Unicast type discovery. */
+    UNICAST, /* < Unicast type discovery. */
     MULTICAST;
-    /** < Multicast type discovery. */
+    /* < Multicast type discovery. */
 
-    /**
-     * Utility API for int to enum conversion.
+    /*
+     * Utility API for integer to enum conversion.
      */
     public static DiscoveryType getDiscoveryType(int ordinal) {
 
index 42f48ea..b56435a 100644 (file)
  *
  ******************************************************************/
 /**
- * @file    EntityHandlerResult.java
- *
- * @brief     This file provides EntityHandlerResult Enum & utility function.
- *
+ * @file
+ * This file provides EntityHandlerResult Enum & utility function.
  */
 
 package org.iotivity.ResourceEncapsulation.utils;
 
+import org.iotivity.ResourceEncapsulation.server.*;
+
 /**
  * Represents the EntityHandlerResult, that application can send for a Get or a
  * Set request.