Adjust a change of updated data class for C++ to Android
authorJihun Ha <jihun.ha@samsung.com>
Wed, 27 Jul 2016 08:13:19 +0000 (17:13 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 28 Jul 2016 08:15:07 +0000 (08:15 +0000)
For simplicity, OcRepresentation object is passed from Android to C++ and
C++ to Android to deliver data to be delivered and received data.
For this change, all related class in JNI and Android are changed.

Reference patch: https://gerrit.iotivity.org/gerrit/#/c/9733/

Change-Id: Iee5ae90e181b1f5a953952e18bae585729c34a59
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9777
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
19 files changed:
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/CloudProp.java
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/DeviceProp.java
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java [new file with mode: 0644]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeConf.java [changed mode: 0644->0755]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/RemoteEnrollee.java
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/enums/WIFI_FREQ.java
service/easy-setup/mediator/richsdk/android/jni/JniCloudPropProvisioningStatusListener.cpp
service/easy-setup/mediator/richsdk/android/jni/JniDevicePropProvisioningStatusListener.cpp
service/easy-setup/mediator/richsdk/android/jni/JniEasySetup.cpp
service/easy-setup/mediator/richsdk/android/jni/JniEsListenerManager.h [changed mode: 0644->0755]
service/easy-setup/mediator/richsdk/android/jni/JniEsUtils.cpp
service/easy-setup/mediator/richsdk/android/jni/JniGetConfigurationStatusListener.cpp
service/easy-setup/mediator/richsdk/android/jni/JniGetConfigurationStatusListener.h [changed mode: 0644->0755]
service/easy-setup/mediator/richsdk/android/jni/JniJvm.cpp
service/easy-setup/mediator/richsdk/android/jni/JniJvm.h
service/easy-setup/mediator/richsdk/android/jni/JniRemoteEnrollee.cpp
service/easy-setup/mediator/richsdk/android/jni/JniRemoteEnrollee.h
service/easy-setup/mediator/richsdk/android/jni/JniSecurityStatusListener.cpp [changed mode: 0644->0755]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java

index 43d677d..90f0477 100644 (file)
 
 package org.iotivity.service.easysetup.mediator;
 
+import android.util.Log;
+
+import org.iotivity.base.OcException;
+import org.iotivity.base.OcRepresentation;
+
 /**
  * This class contains cloud server properties to be delivered to Enrollee
  */
 public class CloudProp {
-
-    private final String mAuthCode;
-    private final String mAuthProvider;
-    private final String mCiServer;
+    private static final String TAG = CloudProp.class.getName();
+    protected OcRepresentation mRep;
 
     /**
      * Constructor
-     *
-     * @param authCode Authcode issued by OAuth 2.0 protocol compatible account server
-     * @param authProvider Auth provider which issued the auth code
-     * @param ciServer Cloud interface server that Enrollee is going to be registered
      */
-    public CloudProp(String authCode, String authProvider, String ciServer) {
-        mAuthCode = authCode;
-        mAuthProvider = authProvider;
-        mCiServer = ciServer;
+    public CloudProp() {
+        mRep = new OcRepresentation();
+    }
+
+    public void setCloudProp(String authCode, String authProvider, String ciServer)
+    {
+        try {
+            mRep.setValue(ESConstants.OC_RSRVD_ES_AUTHCODE, authCode);
+            mRep.setValue(ESConstants.OC_RSRVD_ES_AUTHPROVIDER, authProvider);
+            mRep.setValue(ESConstants.OC_RSRVD_ES_CISERVER, ciServer);
+        } catch (OcException e) {
+            Log.e(TAG, "setCloudProp is failed.");
+        }
     }
 
     /**
      * This method returns the authCode used for the first registration to IoTivity cloud
      * @return AuthCode for sign-up to IoTivity cloud
      */
-    public String getAuthCode() {
-        return mAuthCode;
+    public String getAuthCode()
+    {
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHCODE))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHCODE);
+        } catch (OcException e) {
+            Log.e(TAG, "getAuthCode is failed.");
+        }
+        return new String("");
     }
 
     /**
      * This method returns the auth provider which issued the given AuthCode
      * @return Auth provider which issued the given AuthCode
      */
-    public String getAuthProvider() {
-        return mAuthProvider;
+    public String getAuthProvider()
+    {
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHPROVIDER))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHPROVIDER);
+        } catch (OcException e) {
+            Log.e(TAG, "getAuthProvider is failed.");
+        }
+        return new String("");
     }
 
        /**
      * This method returns the Cloud Interface server's URL to be registered
      * @return CI server's URL to be registered
      */
-    public String getCiServer() {
-        return mCiServer;
+    public String getCiServer()
+    {
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CISERVER))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_CISERVER);
+        } catch (OcException e) {
+            Log.e(TAG, "getCiServer is failed.");
+        }
+        return new String("");
+    }
+
+    public OcRepresentation toOCRepresentation()
+    {
+        return mRep;
     }
 }
index 3f207b2..ea77df1 100644 (file)
 
 package org.iotivity.service.easysetup.mediator;
 
+import android.util.Log;
+
 import org.iotivity.service.easysetup.mediator.enums.WIFI_AUTHTYPE;
 import org.iotivity.service.easysetup.mediator.enums.WIFI_ENCTYPE;
 
+import org.iotivity.base.OcException;
+import org.iotivity.base.OcRepresentation;
+
 /**
  * This class contains device properties to be delivered to Enrollee
  */
 public class DeviceProp {
-
-    private final String mSsid;
-    private final String mPwd;
-    private final WIFI_AUTHTYPE mAuthType;
-    private final WIFI_ENCTYPE mEncType;
-    private final String mLanguage;
-    private final String mCountry;
+    private static final String TAG = DeviceProp.class.getName();
+    protected OcRepresentation mRep;
 
     /**
      * Constructor
-     *
-     * @param ssid WiFi AP's SSID
-     * @param pwd WiFi AP's password
-     * @param authType WiFi AP's authenticate type
-     * @param encType WiFi AP's encryption type
-     * @param language IETF language tag using ISO 639X
-     * @param country ISO Country Code (ISO 3166-1 Alpha-2)
      */
-    public DeviceProp(String ssid, String pwd, WIFI_AUTHTYPE authType, WIFI_ENCTYPE encType,
-                                     String language, String country)
+    public DeviceProp() {
+        mRep = new OcRepresentation();
+    }
+
+    public void setWiFiProp(String ssid, String pwd, WIFI_AUTHTYPE authtype, WIFI_ENCTYPE enctype)
     {
-        mSsid = ssid;
-        mPwd = pwd;
-        mAuthType = authType;
-        mEncType = encType;
-        mLanguage = language;
-        mCountry = country;
+        try
+        {
+            mRep.setValue(ESConstants.OC_RSRVD_ES_SSID, ssid);
+            mRep.setValue(ESConstants.OC_RSRVD_ES_CRED, pwd);
+            mRep.setValue(ESConstants.OC_RSRVD_ES_AUTHTYPE, authtype.getValue());
+            mRep.setValue(ESConstants.OC_RSRVD_ES_ENCTYPE, enctype.getValue());
+        } catch (OcException e) {
+            Log.e(TAG, "setWiFiProp is failed.");
+        }
+    }
+
+    public void setDevConfProp(String language, String country)
+    {
+        try {
+            mRep.setValue(ESConstants.OC_RSRVD_ES_LANGUAGE, language);
+            mRep.setValue(ESConstants.OC_RSRVD_ES_COUNTRY, country);
+        } catch (OcException e) {
+            Log.e(TAG, "setDevConfProp is failed.");
+        }
     }
 
     /**
@@ -63,7 +72,13 @@ public class DeviceProp {
      */
     public String getSsid()
     {
-        return mSsid;
+        try {
+            if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_SSID))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_SSID);
+        } catch (OcException e) {
+            Log.e(TAG, "getSsid is failed.");
+        }
+        return new String("");
     }
 
     /**
@@ -71,9 +86,15 @@ public class DeviceProp {
      *
      * @return String WiFi AP's password
      */
-    public String getPwd()
+    public String getPassword()
     {
-        return mPwd;
+        try {
+            if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CRED))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_CRED);
+        } catch (OcException e) {
+            Log.e(TAG, "getPassword is failed.");
+        }
+        return new String("");
     }
 
     /**
@@ -84,7 +105,13 @@ public class DeviceProp {
      */
     public WIFI_AUTHTYPE getAuthType()
     {
-        return mAuthType;
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHTYPE))
+                return WIFI_AUTHTYPE.fromInt((int)mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHTYPE));
+        } catch (OcException e) {
+            Log.e(TAG, "getAuthType is failed.");
+        }
+        return WIFI_AUTHTYPE.NONE_AUTH;
     }
 
     /**
@@ -95,7 +122,13 @@ public class DeviceProp {
      */
     public WIFI_ENCTYPE getEncType()
     {
-        return mEncType;
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_ENCTYPE))
+                return WIFI_ENCTYPE.fromInt((int)mRep.getValue(ESConstants.OC_RSRVD_ES_ENCTYPE));
+        } catch (OcException e) {
+            Log.e(TAG, "getEncType is failed.");
+        }
+        return WIFI_ENCTYPE.NONE_ENC;
     }
 
     /**
@@ -105,7 +138,13 @@ public class DeviceProp {
      */
     public String getLanguage()
     {
-        return mLanguage;
+        try {
+            if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_LANGUAGE))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_LANGUAGE);
+        } catch (OcException e) {
+            Log.e(TAG, "getLanguage is failed.");
+        }
+        return new String("");
     }
 
     /**
@@ -115,6 +154,17 @@ public class DeviceProp {
      */
     public String getCountry()
     {
-        return mCountry;
+        try {
+            if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_COUNTRY))
+                return mRep.getValue(ESConstants.OC_RSRVD_ES_COUNTRY);
+        } catch (OcException e) {
+            Log.e(TAG, "getCountry is failed.");
+        }
+        return new String("");
+    }
+
+    public OcRepresentation toOCRepresentation()
+    {
+        return mRep;
     }
 }
diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java
new file mode 100644 (file)
index 0000000..a6061a1
--- /dev/null
@@ -0,0 +1,37 @@
+package org.iotivity.service.easysetup.mediator;
+
+/**
+ * Created by jhha85 on 7/27/16.
+ */
+public class ESConstants {
+
+    public static final String OC_RSRVD_ES_PROVSTATUS = "ps";
+    public static final String OC_RSRVD_ES_LAST_ERRORCODE = "lec";
+    public static final String OC_RSRVD_ES_LINKS = "links";
+    public static final String OC_RSRVD_ES_SUPPORTEDWIFIMODE = "swmt";
+    public static final String OC_RSRVD_ES_SUPPORTEDWIFIFREQ = "swf";
+    public static final String OC_RSRVD_ES_SSID = "tnn";
+    public static final String OC_RSRVD_ES_CRED = "cd";
+    public static final String OC_RSRVD_ES_AUTHTYPE = "wat";
+    public static final String OC_RSRVD_ES_ENCTYPE = "wet";
+    public static final String OC_RSRVD_ES_AUTHCODE = "ac";
+    public static final String OC_RSRVD_ES_AUTHPROVIDER = "apn";
+    public static final String OC_RSRVD_ES_CISERVER = "cis";
+    public static final String OC_RSRVD_ES_SERVERID = "sid";
+    public static final String OC_RSRVD_ES_DEVNAME = "dn";
+    public static final String OC_RSRVD_ES_LANGUAGE = "lang";
+    public static final String OC_RSRVD_ES_COUNTRY = "ctry";
+
+/**
+* Easysetup defined resoruce types and uris
+*/
+    public static final String OC_RSRVD_ES_RES_TYPE_PROV = "ocf.wk.prov";
+    public static final String OC_RSRVD_ES_URI_PROV = "/ProvisioningResURI";
+    public static final String OC_RSRVD_ES_RES_TYPE_WIFI = "ocf.wk.wifi";
+    public static final String OC_RSRVD_ES_URI_WIFI = "/WiFiProvisioningResURI";
+    public static final String OC_RSRVD_ES_RES_TYPE_CLOUDSERVER = "ocf.wk.cloudserver";
+    public static final String OC_RSRVD_ES_URI_CLOUDSERVER = "/CloudServerProvisioningResURI";
+    public static final String OC_RSRVD_ES_RES_TYPE_DEVCONF = "ocf.wk.devconf";
+    public static final String OC_RSRVD_ES_URI_DEVCONF = "/DevConfProvisioningResURI";
+    
+}
old mode 100644 (file)
new mode 100755 (executable)
index d41db41..dca0ef5
 
 package org.iotivity.service.easysetup.mediator;
 
+import android.util.Log;
+
+import org.iotivity.base.OcException;
+import org.iotivity.base.OcRepresentation;
+import org.iotivity.service.easysetup.mediator.ESConstants;
 import org.iotivity.service.easysetup.mediator.enums.WIFI_FREQ;
 import org.iotivity.service.easysetup.mediator.enums.WIFI_MODE;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * This class stores Enrollee's configuration including WiFi and Device configuration
@@ -31,61 +38,106 @@ import java.util.ArrayList;
  */
 public class EnrolleeConf
 {
-    private final DeviceConfig mDevConf;
-    private final WiFiConfig mWiFiConf;
-    private final boolean mCloudable;
-
+    private static final String TAG = EnrolleeConf.class.getName();
+    private OcRepresentation mProvRep = null, mWiFiRep = null, mDevConfRep = null, mCloudRep = null;
     /**
      * Constructor
      *
-     * @param devConf
-     *          device name, language, and country
-     * @param wifiConf
-     *          supported WiFi modes and frequency
-     * @param cloudable
-     *          a preference if Enrollee is supposed to be registered to Cloud
+     * @param rep received properties in a form of OcRepresentation
+     *
      */
-    public EnrolleeConf(DeviceConfig devConf, WiFiConfig wifiConf, boolean cloudable)
+    public EnrolleeConf(OcRepresentation rep)
     {
-        mDevConf = devConf;
-        mWiFiConf = wifiConf;
-        mCloudable = cloudable;
+        mProvRep = rep;
+
+        List<OcRepresentation> children = rep.getChildren();
+
+        for (OcRepresentation child : children) {
+            List<String> rts = child.getResourceTypes();
+
+            if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_WIFI) != -1)
+            {
+                mWiFiRep = child;
+            }
+            else if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_DEVCONF) != -1)
+            {
+                mDevConfRep = child;
+            }
+            else if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_CLOUDSERVER) != -1)
+            {
+                mCloudRep = child;
+            }
+        }
     }
 
     /**
-     * Get device configuration
-     *
-     * @return DeviceConfig
-     *          device name, language, and country
+     * Get Device Name property in DevConf resource
      *
-     * @see DeviceConfig
+     * @return deviceName
      */
-    public DeviceConfig getDeviceConfig()
+    public String getDeviceName()
     {
-        return mDevConf;
+        try
+        {
+            if(mDevConfRep != null && mDevConfRep.hasAttribute(ESConstants.OC_RSRVD_ES_DEVNAME)) {
+                return (String) mDevConfRep.getValue(ESConstants.OC_RSRVD_ES_DEVNAME);
+            }
+        } catch (OcException e) {
+                Log.e(TAG, "getWiFiModes is failed.");
+        }
+        return new String("");
     }
 
     /**
-     * Get WiFi configuration
+     * Get Supported WiFi Modes property in WiFi resource
      *
-     * @return WiFiConfig
-     *          supported WiFi modes and frequency
+     * @return a list of WiFi modes
+     */
+    public ArrayList<WIFI_MODE> getWiFiModes()
+    {
+        ArrayList<WIFI_MODE> modes = new ArrayList<WIFI_MODE>();
+        try {
+            if (mWiFiRep != null && mWiFiRep.hasAttribute(ESConstants.OC_RSRVD_ES_SUPPORTEDWIFIMODE)) {
+                int modes_int[] = mWiFiRep.getValue(ESConstants.OC_RSRVD_ES_SUPPORTEDWIFIMODE);
+                for (int i = 0 ; i < modes_int.length ; ++i) {
+                    modes.add(WIFI_MODE.fromInt(modes_int[i]));
+                }
+            }
+        } catch (OcException e) {
+            Log.e(TAG, "getWiFiModes is failed.");
+        }
+        return modes;
+    }
+
+    /**
+     * Get Supported WiFi frequency property in WiFi resource
      *
-     * @see WiFiConfig
+     * @return WiFi frequency
      */
-    public WiFiConfig getWiFiConfig()
+    public WIFI_FREQ getWiFiFreq()
     {
-        return mWiFiConf;
+        try{
+            if(mWiFiRep != null && mWiFiRep.hasAttribute(ESConstants.OC_RSRVD_ES_SUPPORTEDWIFIFREQ))
+                return WIFI_FREQ.fromInt(
+                        (int)mWiFiRep.getValue(ESConstants.OC_RSRVD_ES_SUPPORTEDWIFIFREQ));
+        } catch (OcException e) {
+            Log.e(TAG, "getWiFiFreq is failed.");
+        }
+        return WIFI_FREQ.WIFI_FREQ_NONE;
     }
 
     /**
-     * Get a preference of cloud registration of Enrollee
+     * To check if Enrollee can access to cloud. To decide its preference, we check if a cloudserver
+     * resource is registered on Enrollee.
      *
-     * @return true if Enrollee is supposed to be registered to Cloud
+     * @return boolean
      */
-    public boolean isCloudable()
+    public boolean isCloudAccessible()
     {
-        return mCloudable;
+        if(mCloudRep != null && mCloudRep.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_CLOUDSERVER) != -1)
+            return true;
+
+        return false;
     }
 }
 
index 075be61..726bc90 100755 (executable)
@@ -25,6 +25,8 @@ package org.iotivity.service.easysetup.mediator;
 
 import android.util.Log;
 
+import org.iotivity.base.OcRepresentation;
+
 /**
  * This class represents Remote Enrollee device instance. What operations the class provides:
  * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee
@@ -40,10 +42,10 @@ public class RemoteEnrollee{
 
     private native void nativeGetConfiguration(GetConfigurationCallback callback);
     private native void nativeProvisionSecurity(SecurityProvisioningCallback callback);
-    private native void nativeProvisionDeviceProperties(String ssid, String pwd, int authType, int encType,
-                                              String language, String country, DevicePropProvisioningCallback callback);
-    private native void nativeProvisionCloudProperties(String authCode, String autoProvider,
-                                               String ciServer, CloudPropProvisioningCallback callback);
+    private native void nativeProvisionDeviceProperties(OcRepresentation deviceProp,
+                                                        DevicePropProvisioningCallback callback);
+    private native void nativeProvisionCloudProperties(OcRepresentation cloudProp,
+                                                       CloudPropProvisioningCallback callback);
 
     /* constructor will be invoked from the native layer */
     private RemoteEnrollee(long nativeHandle){
@@ -93,7 +95,7 @@ public class RemoteEnrollee{
      * 1. WiFi AP information includes a SSID, password, auth type, and encryption type.
      * 2. Device configuration includes a language (IETF language tags) and country (ISO 3166-1 Alpha-2)
      *
-     * @param devProp a data structure storing the above information to be delivered
+     * @param deviceProp a data structure storing the above information to be delivered
      * @param callback will give the result if the provisioning succeeds or fails
      *
      * @throws ESException If some errors happen in this function
@@ -105,9 +107,7 @@ public class RemoteEnrollee{
     {
         if(callback != null)
         {
-            nativeProvisionDeviceProperties(deviceProp.getSsid(), deviceProp.getPwd(),
-                              deviceProp.getAuthType().getValue(), deviceProp.getEncType().getValue(),
-                              deviceProp.getLanguage(), deviceProp.getCountry(), callback);
+            nativeProvisionDeviceProperties(deviceProp.toOCRepresentation(), callback);
             return;
         }
         Log.d(TAG, "DevicePropProvisioningCallback is null ");
@@ -132,8 +132,7 @@ public class RemoteEnrollee{
     public void provisionCloudProperties(CloudProp cloudProp, CloudPropProvisioningCallback callback) throws ESException{
         if(callback != null)
         {
-            nativeProvisionCloudProperties(cloudProp.getAuthCode(), cloudProp.getAuthProvider(),
-                               cloudProp.getCiServer(), callback);
+            nativeProvisionCloudProperties(cloudProp.toOCRepresentation(), callback);
             return;
         }
         Log.d(TAG, "CloudPropProvisioningCallback is null ");
index 525c726..7708c1f 100755 (executable)
@@ -31,7 +31,7 @@ JniCloudPropProvisioningStatusListener::JniCloudPropProvisioningStatusListener(J
 
 JniCloudPropProvisioningStatusListener::~JniCloudPropProvisioningStatusListener()
 {
-    LOGI("~JniCloudPropProvisioningStatusListener()");
+    ES_LOGI("~JniCloudPropProvisioningStatusListener()");
     if (m_jwListener)
     {
         jint ret;
@@ -46,7 +46,7 @@ void JniCloudPropProvisioningStatusListener::onCloudPropProvisioningStatus(std::
         cloudPropProvisioningStatus)
 {
 
-    LOGI("JniCloudPropProvisioningStatusListener::onCloudPropProvisioningStatus enter");
+    ES_LOGI("JniCloudPropProvisioningStatusListener::onCloudPropProvisioningStatus enter");
 
     jint ret;
     JNIEnv *env = GetESJNIEnv(ret);
@@ -88,10 +88,10 @@ void JniCloudPropProvisioningStatusListener::onCloudPropProvisioningStatus(std::
                                                 (jint)esResult,
                                                 (jint)cloudProvisionState);
 
-    LOGI("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus - %d, %d", esResult, cloudProvisionState);
+    ES_LOGI("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus - %d, %d", esResult, cloudProvisionState);
     if (!jCloudPropProvisioningStatus)
     {
-        LOGE("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus Unable to create the java object");
+        ES_LOGE("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus Unable to create the java object");
         return ;
     }
 
@@ -107,7 +107,7 @@ void JniCloudPropProvisioningStatusListener::onCloudPropProvisioningStatus(std::
 
     if (env->ExceptionCheck())
     {
-        LOGE("Java exception is thrown");
+        ES_LOGE("Java exception is thrown");
         if(needRemoveListener)
             checkExAndRemoveListener(env);
         if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
index 3b9c6bc..c65ce7c 100755 (executable)
@@ -32,7 +32,7 @@ JniDevicePropProvisioningStatusListener::JniDevicePropProvisioningStatusListener
 
 JniDevicePropProvisioningStatusListener::~JniDevicePropProvisioningStatusListener()
 {
-    LOGI("~JniDevicePropProvisioningStatusListener()");
+    ES_LOGI("~JniDevicePropProvisioningStatusListener()");
     if (m_jwListener)
     {
         jint ret;
@@ -47,7 +47,7 @@ void JniDevicePropProvisioningStatusListener::onDevicePropProvisioningStatusCall
         devicePropProvStatusCb)
 {
 
-    LOGI("JniDevicePropProvisioningStatusListener::onDevicePropProvisioningStatusCallback enter");
+    ES_LOGI("JniDevicePropProvisioningStatusListener::onDevicePropProvisioningStatusCallback enter");
 
     jint ret;
     JNIEnv *env = GetESJNIEnv(ret);
@@ -87,10 +87,10 @@ void JniDevicePropProvisioningStatusListener::onDevicePropProvisioningStatusCall
                                                 g_mid_DevicePropProvisioningStatus_ctor,
                                                 (jint)nativeESResult);
 
-    LOGI("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus - %d", nativeESResult);
+    ES_LOGI("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus - %d", nativeESResult);
     if (!jDevicePropProvisioningStatus)
     {
-        LOGE("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus Unable to create the java object");
+        ES_LOGE("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus Unable to create the java object");
         return ;
     }
 
@@ -98,7 +98,7 @@ void JniDevicePropProvisioningStatusListener::onDevicePropProvisioningStatusCall
 
     if (env->ExceptionCheck())
     {
-        LOGE("Java exception is thrown");
+        ES_LOGE("Java exception is thrown");
         checkExAndRemoveListener(env);
         if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
         return;
index e7dc496..cae9ec5 100755 (executable)
@@ -25,7 +25,6 @@
 #include "octypes.h"
 #include "ESRichCommon.h"
 
-#include "JniOcPlatform.h"
 #include "JniOcResource.h"
 #include "JniEasySetup.h"
 
@@ -39,7 +38,7 @@ JNIEXPORT jobject JNICALL
 Java_org_iotivity_service_easysetup_mediator_EasySetup_nativeCreateRemoteEnrollee
 (JNIEnv *env, jobject thiz, jobject jResource)
 {
-    LOGI("JniEasySetup::nativeCreateRemoteEnrollee enter");
+    ES_LOGI("JniEasySetup::nativeCreateRemoteEnrollee enter");
 
     std::shared_ptr<RemoteEnrollee> nativeRemoteEnrollee;
     jobject jRemoteEnrollee;
@@ -48,7 +47,7 @@ Java_org_iotivity_service_easysetup_mediator_EasySetup_nativeCreateRemoteEnrolle
 
     if (!jniOcResource)
     {
-        LOGE("JniEasySetup::nativeCreateRemoteEnrollee getJniOcResourcePtr returns nullptr.");
+        ES_LOGE("JniEasySetup::nativeCreateRemoteEnrollee getJniOcResourcePtr returns nullptr.");
         return nullptr;
     }
 
@@ -59,7 +58,7 @@ Java_org_iotivity_service_easysetup_mediator_EasySetup_nativeCreateRemoteEnrolle
         jRemoteEnrollee = env->NewObject(g_cls_RemoteEnrollee, g_mid_RemoteEnrollee_ctor);
         if (!jRemoteEnrollee)
         {
-            LOGE("JniEasySetup::nativeCreateRemoteEnrollee Unable to create the java object");
+            ES_LOGE("JniEasySetup::nativeCreateRemoteEnrollee Unable to create the java object");
             return NULL;
         }
         JniRemoteEnrollee *jniRemoteEnrollee = new JniRemoteEnrollee(nativeRemoteEnrollee);
@@ -67,12 +66,12 @@ Java_org_iotivity_service_easysetup_mediator_EasySetup_nativeCreateRemoteEnrolle
     }
     catch (ESBadRequestException exception)
     {
-        LOGE("JniEasySetup::nativeCreateRemoteEnrollee Unable to create the Native EnrolleeDevice");
+        ES_LOGE("JniEasySetup::nativeCreateRemoteEnrollee Unable to create the Native EnrolleeDevice");
         //throw the exception to java layer
         throwESException( env,  exception.what());
     }
 
-    LOGI("JniEasySetup::nativeCreateRemoteEnrollee exit");
+    ES_LOGI("JniEasySetup::nativeCreateRemoteEnrollee exit");
 
     return jRemoteEnrollee;
 }
old mode 100644 (file)
new mode 100755 (executable)
index a01ec8d..98daf1d
@@ -60,7 +60,7 @@ class JniEsListenerManager
                     refPair.second++;
                     it->second = refPair;
                     m_listenerMap.insert(*it);
-                    LOGD("OnEventListener: ref. count is incremented");
+                    ES_LOGD("OnEventListener: ref. count is incremented");
                     break;
                 }
             }
@@ -77,10 +77,10 @@ class JniEsListenerManager
                 }
                 else
                 {
-                    LOGD("OnEventListener: Failed to create global listener ref.");
+                    ES_LOGD("OnEventListener: Failed to create global listener ref.");
                     delete onEventListener;
                 }
-                LOGD("OnEventListener: new listener");
+                ES_LOGD("OnEventListener: new listener");
             }
             m_mapMutex.unlock();
             return onEventListener;
@@ -102,7 +102,7 @@ class JniEsListenerManager
                         refPair.second--;
                         it->second = refPair;
                         m_listenerMap.insert(*it);
-                        LOGI("OnEventListener: ref. count is decremented");
+                        ES_LOGI("OnEventListener: ref. count is decremented");
                     }
                     else
                     {
@@ -111,7 +111,7 @@ class JniEsListenerManager
                         delete listener;
                         m_listenerMap.erase(it);
 
-                        LOGI("OnEventListener is removed");
+                        ES_LOGI("OnEventListener is removed");
                     }
                     break;
                 }
index e45986e..4ab4da1 100755 (executable)
@@ -26,7 +26,7 @@ void throwESException(JNIEnv *env, std::string reason)
                                 env->NewStringUTF(reason.c_str()));
     if (!ex)
     {
-        LOGI("throwException : jobject is NULL");
+        ES_LOGI("throwException : jobject is NULL");
     }
     env->Throw((jthrowable)ex);
 }
index 5541393..ac02811 100755 (executable)
@@ -21,6 +21,7 @@
 #include "JniGetConfigurationStatusListener.h"
 #include "JniRemoteEnrollee.h"
 
+using namespace OC;
 using namespace OIC::Service;
 
 JniGetConfigurationStatusListener::JniGetConfigurationStatusListener(JNIEnv *env, jobject jListener,
@@ -32,7 +33,7 @@ JniGetConfigurationStatusListener::JniGetConfigurationStatusListener(JNIEnv *env
 
 JniGetConfigurationStatusListener::~JniGetConfigurationStatusListener()
 {
-    LOGI("~JniGetConfigurationStatusListener()");
+    ES_LOGI("~JniGetConfigurationStatusListener()");
     if (m_jwListener)
     {
         jint ret;
@@ -46,7 +47,7 @@ JniGetConfigurationStatusListener::~JniGetConfigurationStatusListener()
 void JniGetConfigurationStatusListener::getConfigurationStatusCallback (
     std::shared_ptr<GetConfigurationStatus> getConfigurationStatusCb)
 {
-    LOGI("JniGetConfigurationStatusListener::provisioiningStatusCallback enter");
+    ES_LOGI("JniGetConfigurationStatusListener::provisioiningStatusCallback enter");
 
     jint ret;
     JNIEnv *env = GetESJNIEnv(ret);
@@ -79,56 +80,28 @@ void JniGetConfigurationStatusListener::getConfigurationStatusCallback (
         return;
     }
 
-    const EnrolleeConf enrolleeConf = getConfigurationStatusCb->getEnrolleeConf();
-    DeviceConfig devConf = enrolleeConf.getDevConf();
-    WiFiConfig wifiConf = enrolleeConf.getWiFiConf();
-
-    jobject jDevConf = NULL;
-    jDevConf = env->NewObject(g_cls_DeviceConfig,
-                                                g_mid_DeviceConfig_ctor,
-                                                (jstring)env->NewStringUTF(devConf.name.c_str()),
-                                                (jstring)env->NewStringUTF(devConf.language.c_str()),
-                                                (jstring)env->NewStringUTF(devConf.country.c_str()));
-    if (!jDevConf) {
-        LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the jDevConf");
-        return ;
-    }
-
-    jclass clazz = env->FindClass("java/util/ArrayList");
-    jobject wifiModes = env->NewObject(clazz, env->GetMethodID(clazz, "<init>", "()V"));
-    jmethodID arraylist_add = env->GetMethodID(clazz, "add", "(Ljava/lang/Object;)Z");
+    EnrolleeConf enrolleeConf = getConfigurationStatusCb->getEnrolleeConf();
+    OCRepresentation m_ProvRep = enrolleeConf.getProvResRep();
 
-    for (int n=0; n<wifiConf.modes.size(); n++)
+    OCRepresentation* rep = new OCRepresentation(m_ProvRep);
+    jlong handle = reinterpret_cast<jlong>(rep);
+    jobject jRepresentation = env->NewObject(g_cls_OcRepresentation, g_mid_OcRepresentation_N_ctor_bool,
+                                            handle, true);
+    if (!jRepresentation)
     {
-        jobject value = env->NewObject(g_cls_Integer,
-                                        g_mid_Integer_ctor,
-                                        convertNativeWifiModeToInt(static_cast<WIFI_MODE>(wifiConf.modes[n])));
-       env->CallBooleanMethod(wifiModes, arraylist_add, value);
-    }
-    if (!wifiModes) {
-        LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the wifiModes");
-        return ;
-    }
-
-
-    jobject jWiFiConf = NULL;
-    jWiFiConf = env->NewObject(g_cls_WiFiConfig,
-                                                g_mid_WiFiConfig_ctor,
-                                                (jobject)wifiModes,
-                                                (jint)convertNativeWifiFreqToInt(wifiConf.freq));
-    if (!jWiFiConf) {
-        LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the jWiFiConf");
-        return ;
+        delete rep;
+        checkExAndRemoveListener(env);
+        if (JNI_EDETACHED == ret)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+        return;
     }
 
     jobject jEnrolleeConf = NULL;
-    jEnrolleeConf = env->NewObject(g_cls_EnrolleeConf,
-                                                g_mid_EnrolleeConf_ctor,
-                                                (jobject)jDevConf,
-                                                (jobject)jWiFiConf,
-                                                (jboolean)enrolleeConf.isCloudable());
+    jEnrolleeConf = env->NewObject(g_cls_EnrolleeConf, g_mid_EnrolleeConf_ctor, (jobject)jRepresentation);
     if (!jEnrolleeConf) {
-        LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the jEnrolleeConf");
+        ES_LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the jEnrolleeConf");
         return ;
     }
 
@@ -141,7 +114,7 @@ void JniGetConfigurationStatusListener::getConfigurationStatusCallback (
 
     if (!jgetConfigurationStatus)
     {
-        LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the java object");
+        ES_LOGE("JniGetConfigurationStatusListener::getConfigurationStatusCallback Unable to create the java object");
         return ;
     }
 
@@ -149,7 +122,7 @@ void JniGetConfigurationStatusListener::getConfigurationStatusCallback (
 
     if (env->ExceptionCheck())
     {
-        LOGE("Java exception is thrown");
+        ES_LOGE("Java exception is thrown");
         checkExAndRemoveListener(env);
         if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
         return;
index 5e7cbe8..9f11652 100755 (executable)
@@ -31,6 +31,7 @@ jclass g_cls_SecurityProvisioningStatus = NULL;
 jclass g_cls_DevicePropProvisioningStatus = NULL;
 jclass g_cls_CloudPropProvisioningStatus = NULL;
 jclass g_cls_Integer = NULL;
+jclass g_cls_OcRepresentation = NULL;
 
 jmethodID g_mid_RemoteEnrollee_ctor = NULL;
 jmethodID g_mid_ESException_ctor = NULL;
@@ -42,17 +43,18 @@ jmethodID g_mid_SecurityProvisioningStatus_ctor = NULL;
 jmethodID g_mid_DevicePropProvisioningStatus_ctor = NULL;
 jmethodID g_mid_CloudPropProvisioningStatus_ctor = NULL;
 jmethodID g_mid_Integer_ctor = NULL;
+jmethodID g_mid_OcRepresentation_N_ctor_bool = NULL;
 
 // JNI OnLoad
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
 {
-    LOGI("JNI_OnLoad");
+    ES_LOGI("JNI_OnLoad");
     JNIEnv *env;
     g_jvm = vm;
 
     if (g_jvm->GetEnv((void **)&env, JNI_CURRENT_VERSION) != JNI_OK)
     {
-        LOGE("Failed to get the environment using GetEnv()");
+        ES_LOGE("Failed to get the environment using GetEnv()");
         return JNI_ERR;
     }
 
@@ -107,7 +109,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
     env->DeleteLocalRef(clazz);
 
     g_mid_EnrolleeConf_ctor = env->GetMethodID(g_cls_EnrolleeConf, "<init>",
-                                "(Lorg/iotivity/service/easysetup/mediator/DeviceConfig;Lorg/iotivity/service/easysetup/mediator/WiFiConfig;Z)V");
+                                "(Lorg/iotivity/base/OcRepresentation;)V");
     if (!g_mid_EnrolleeConf_ctor) return JNI_ERR;
 
     // getConfigurationStatus
@@ -163,18 +165,27 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
                                 "(I)V");
     if (!g_mid_Integer_ctor) return JNI_ERR;
 
+    //OcRepresentation
+    clazz = env->FindClass("org/iotivity/base/OcRepresentation");
+    if (!clazz) return JNI_ERR;
+    g_cls_OcRepresentation = (jclass)env->NewGlobalRef(clazz);
+    env->DeleteLocalRef(clazz);
+
+    g_mid_OcRepresentation_N_ctor_bool = env->GetMethodID(g_cls_OcRepresentation, "<init>", "(JZ)V");
+    if (!g_mid_OcRepresentation_N_ctor_bool) return JNI_ERR;
+
     return JNI_CURRENT_VERSION;
 }
 
 //JNI OnUnload
 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
 {
-    LOGI("JNI_OnUnload");
+    ES_LOGI("JNI_OnUnload");
     JNIEnv *env;
 
     if (g_jvm->GetEnv((void **)&env, JNI_CURRENT_VERSION) != JNI_OK)
     {
-        LOGE("Failed to get the environment using GetEnv()");
+        ES_LOGE("Failed to get the environment using GetEnv()");
         return;
     }
     env->DeleteGlobalRef(g_cls_RemoteEnrollee);
index 7d27e08..542d745 100755 (executable)
@@ -35,9 +35,9 @@
 #define ESTAG "ES-JNI"
 #define JNI_CURRENT_VERSION JNI_VERSION_1_6
 
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, ESTAG, __VA_ARGS__)
-#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, ESTAG, __VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, ESTAG, __VA_ARGS__)
+#define ES_LOGI(...) __android_log_print(ANDROID_LOG_INFO, ESTAG, __VA_ARGS__)
+#define ES_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, ESTAG, __VA_ARGS__)
+#define ES_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, ESTAG, __VA_ARGS__)
 
 extern JavaVM *g_jvm;
 
@@ -51,6 +51,7 @@ extern jclass g_cls_SecurityProvisioningStatus;
 extern jclass g_cls_DevicePropProvisioningStatus;
 extern jclass g_cls_CloudPropProvisioningStatus;
 extern jclass g_cls_Integer;
+extern jclass g_cls_OcRepresentation;
 
 extern jmethodID g_mid_RemoteEnrollee_ctor;
 extern jmethodID g_mid_ESException_ctor;
@@ -62,6 +63,7 @@ extern jmethodID g_mid_SecurityProvisioningStatus_ctor;
 extern jmethodID g_mid_DevicePropProvisioningStatus_ctor;
 extern jmethodID g_mid_CloudPropProvisioningStatus_ctor;
 extern jmethodID g_mid_Integer_ctor;
+extern jmethodID g_mid_OcRepresentation_N_ctor_bool;
 
 typedef void(*RemoveListenerCallback)(JNIEnv *env, jobject jListener);
 
@@ -110,7 +112,7 @@ static JNIEnv *GetESJNIEnv(jint &ret)
         case JNI_EDETACHED:
             if (g_jvm->AttachCurrentThread(&env, NULL) < 0)
             {
-                LOGE("Failed to get the environment");
+                ES_LOGE("Failed to get the environment");
                 return nullptr;
             }
             else
@@ -119,9 +121,9 @@ static JNIEnv *GetESJNIEnv(jint &ret)
             }
 
         case JNI_EVERSION:
-            LOGE("JNI version not supported");
+            ES_LOGE("JNI version not supported");
         default:
-            LOGE("Failed to get the environment");
+            ES_LOGE("Failed to get the environment");
             return nullptr;
     }
 }
index d566b51..8191650 100755 (executable)
@@ -20,6 +20,8 @@
 
 #include "JniRemoteEnrollee.h"
 
+#include "JniOcRepresentation.h"
+
 using namespace OIC::Service;
 
 JniRemoteEnrollee::JniRemoteEnrollee(std::shared_ptr<RemoteEnrollee> remoteEnrollee)
@@ -27,7 +29,7 @@ JniRemoteEnrollee::JniRemoteEnrollee(std::shared_ptr<RemoteEnrollee> remoteEnrol
 
 JniRemoteEnrollee::~JniRemoteEnrollee()
 {
-    LOGD("JniRemoteEnrollee::~JniRemoteEnrollee()");
+    ES_LOGD("JniRemoteEnrollee::~JniRemoteEnrollee()");
     m_sharedResource = NULL;
 
     jint envRet;
@@ -42,11 +44,11 @@ JniRemoteEnrollee *JniRemoteEnrollee::getJniRemoteEnrollee(JNIEnv *env, jobject
     JniRemoteEnrollee *remoteEnrollee = ESGetHandle<JniRemoteEnrollee>(env, thiz);
     if (env->ExceptionCheck())
     {
-        LOGE("getJniRemoteEnrollee :: Failed to get native handle from RemoteEnrollee object");
+        ES_LOGE("getJniRemoteEnrollee :: Failed to get native handle from RemoteEnrollee object");
     }
     if (!remoteEnrollee)
     {
-        LOGE("getJniRemoteEnrollee :: no resource");
+        ES_LOGE("getJniRemoteEnrollee :: no resource");
     }
     return remoteEnrollee;
 }
@@ -68,7 +70,7 @@ void JniRemoteEnrollee::getConfiguration(JNIEnv *env, jobject jListener)
     }
     catch (ESBadRequestException exception)
     {
-        LOGE("JNI getConfiguration :: Exception occured");
+        ES_LOGE("JNI getConfiguration :: Exception occured");
         //throw the exception to java
         throwESException( env,  exception.what());
     }
@@ -91,24 +93,21 @@ void JniRemoteEnrollee::provisionSecurity(JNIEnv *env, jobject jListener)
     }
     catch (ESBadRequestException exception)
     {
-        LOGE("JNI provisionSecurity :: Exception occured");
+        ES_LOGE("JNI provisionSecurity :: Exception occured");
         //throw the exception to java
         throwESException( env,  exception.what());
     }
 }
 
-void JniRemoteEnrollee::provisionDeviceProperties(JNIEnv *env, jstring jssid, jstring jpwd, jint jauthType,
-    jint jencType, jstring jlanguage, jstring jcountry, jobject jListener)
+void JniRemoteEnrollee::provisionDeviceProperties(JNIEnv *env, jobject jRepresentation, jobject jListener)
 {
-    DeviceProp prop;
-
-    prop.WIFI.ssid = env->GetStringUTFChars(jssid, NULL);
-    prop.WIFI.pwd = env->GetStringUTFChars(jpwd, NULL);
-    prop.WIFI.authtype = getWifiAuthTypeFromInt(jauthType);
-    prop.WIFI.enctype = getWifiEncTypeFromInt(jencType);
-    prop.Device.language = env->GetStringUTFChars(jlanguage, NULL);
-    prop.Device.country = env->GetStringUTFChars(jcountry, NULL);
+    OCRepresentation *representation = JniOcRepresentation::getOCRepresentationPtr(env, jRepresentation);
+    if (!representation)
+    {
+        return;
+    }
 
+    DeviceProp deviceProp(*representation);
     JniDevicePropProvisioningStatusListener *onDevicePropProvStatusReceived =
                     addStatusListener<JniDevicePropProvisioningStatusListener>(env, jListener);
 
@@ -120,25 +119,25 @@ void JniRemoteEnrollee::provisionDeviceProperties(JNIEnv *env, jstring jssid, js
 
     try
     {
-        m_sharedResource->provisionDeviceProperties(prop, devicePropProvStatusCallback);
+        m_sharedResource->provisionDeviceProperties(deviceProp, devicePropProvStatusCallback);
     }
     catch (ESBadRequestException exception)
     {
-        LOGE("JNI provisionDeviceProperties :: Exception occured");
+        ES_LOGE("JNI provisionDeviceProperties :: Exception occured");
         //throw the exception to java
         throwESException( env,  exception.what());
     }
 }
 
-void JniRemoteEnrollee::provisionCloudProperties(JNIEnv *env, jstring jauthCode, jstring jauthProvider,
-    jstring jciServer, jobject jListener)
+void JniRemoteEnrollee::provisionCloudProperties(JNIEnv *env, jobject jRepresentation, jobject jListener)
 {
-    CloudProp prop;
-
-    prop.authCode = env->GetStringUTFChars(jauthCode, NULL);
-    prop.authProvider = env->GetStringUTFChars(jauthProvider, NULL);
-    prop.ciServer = env->GetStringUTFChars(jciServer, NULL);
+    OCRepresentation *representation = JniOcRepresentation::getOCRepresentationPtr(env, jRepresentation);
+    if (!representation)
+    {
+        return;
+    }
 
+    CloudProp cloudProp(*representation);
     JniCloudPropProvisioningStatusListener *onCloudPropProvisioningStatusReceived =
                     addStatusListener<JniCloudPropProvisioningStatusListener>(env, jListener);
 
@@ -151,11 +150,11 @@ void JniRemoteEnrollee::provisionCloudProperties(JNIEnv *env, jstring jauthCode,
 
     try
     {
-        m_sharedResource->provisionCloudProperties(prop, cloudPropProvStatusCallback);
+        m_sharedResource->provisionCloudProperties(cloudProp, cloudPropProvStatusCallback);
     }
     catch (ESBadRequestException exception)
     {
-        LOGE("JNI startProvisioning :: Exception occured");
+        ES_LOGE("JNI startProvisioning :: Exception occured");
         //throw the exception to java
         throwESException(env, exception.what());
     }
@@ -166,49 +165,46 @@ JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeGetConfiguration
 (JNIEnv *env, jobject jClass, jobject jListener)
 {
-    LOGD("nativegetConfiguration Enter");
+    ES_LOGD("nativegetConfiguration Enter");
 
     JniRemoteEnrollee *remoteEnrollee = JniRemoteEnrollee::getJniRemoteEnrollee(env, jClass);
     remoteEnrollee->getConfiguration(env, jListener);
 
-    LOGD("nativegetConfiguration Exit");
+    ES_LOGD("nativegetConfiguration Exit");
 }
 
 JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionSecurity
 (JNIEnv *env, jobject jClass, jobject jListener)
 {
-    LOGD("nativeStartSecurityProvision Enter");
+    ES_LOGD("nativeStartSecurityProvision Enter");
 
     JniRemoteEnrollee *remoteEnrollee = JniRemoteEnrollee::getJniRemoteEnrollee(env, jClass);
     remoteEnrollee->provisionSecurity(env, jListener);
 
-    LOGD("nativeStartSecurityProvision Exit");
+    ES_LOGD("nativeStartSecurityProvision Exit");
 }
 
 JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionDeviceProperties
-(JNIEnv *env, jobject jClass, jstring jssid, jstring jpwd, jint jauthType,
-    jint jencType, jstring jlanguage, jstring jcountry, jobject jListener)
+(JNIEnv *env, jobject jClass, jobject jRepresentation, jobject jListener)
 {
-    LOGD("nativeProvisionDeviceProperties Enter");
+    ES_LOGD("nativeProvisionDeviceProperties Enter");
 
     JniRemoteEnrollee *remoteEnrollee = JniRemoteEnrollee::getJniRemoteEnrollee(env, jClass);
-    remoteEnrollee->provisionDeviceProperties(env, jssid, jpwd, jauthType, jencType,
-                                                                            jlanguage, jcountry, jListener);
+    remoteEnrollee->provisionDeviceProperties(env, jRepresentation, jListener);
 
-    LOGD("nativeProvisionDeviceProperties Exit");
+    ES_LOGD("nativeProvisionDeviceProperties Exit");
 }
 
 JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionCloudProperties
-(JNIEnv *env, jobject jClass, jstring authCode, jstring authProvider,
-    jstring ciServer, jobject jListener)
+(JNIEnv *env, jobject jClass, jobject jRepresentation, jobject jListener)
 {
-    LOGD("nativeprovisionCloudProperties Enter");
+    ES_LOGD("nativeprovisionCloudProperties Enter");
 
     JniRemoteEnrollee *remoteEnrollee = JniRemoteEnrollee::getJniRemoteEnrollee(env, jClass);
-    remoteEnrollee->provisionCloudProperties(env, authCode, authProvider, ciServer, jListener);
+    remoteEnrollee->provisionCloudProperties(env, jRepresentation, jListener);
 
-    LOGD("nativeprovisionCloudProperties Exit");
+    ES_LOGD("nativeprovisionCloudProperties Exit");
 }
\ No newline at end of file
index bba5d5f..b3f013b 100755 (executable)
@@ -64,10 +64,9 @@ class JniRemoteEnrollee
         // ***** JNI APIs internally call the APIs of this class ***** //
         void getConfiguration(JNIEnv *env, jobject jListener);
         void provisionSecurity(JNIEnv *env, jobject jListener);
-        void provisionDeviceProperties(JNIEnv *env, jstring jssid, jstring jpwd, jint jauthType,
-                                            jint jencType, jstring jlanguage, jstring jcountry, jobject jListener);
-        void provisionCloudProperties(JNIEnv *env, jstring authCode, jstring authProvider,
-                                            jstring ciServer, jobject jListener);
+
+        void provisionDeviceProperties(JNIEnv *env, jobject jRepresentation, jobject jListener);
+        void provisionCloudProperties(JNIEnv *env, jobject jRepresentation, jobject jListener);
 
         static JniRemoteEnrollee *getJniRemoteEnrollee(JNIEnv *env, jobject thiz);
 
@@ -111,16 +110,14 @@ Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionSecur
  */
 JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionDeviceProperties
-(JNIEnv *env, jobject jClass, jstring jssid, jstring jpwd, jint jauthType,
-    jint jencType, jstring jlanguage, jstring jcountry, jobject jListener);
+(JNIEnv *env, jobject jClass, jobject jRepresentation, jobject jListener);
 
 /**
  * API for starting the cloud provisioning process.
  */
 JNIEXPORT void JNICALL
 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionCloudProperties
-(JNIEnv *env, jobject jClass, jstring authCode, jstring authProvider,
-    jstring ciServer, jobject jListener);
+(JNIEnv *env, jobject jClass, jobject jRepresentation, jobject jListener);
 
 #ifdef __cplusplus
 }
old mode 100644 (file)
new mode 100755 (executable)
index ae44797..bfa31a4
@@ -34,7 +34,7 @@ JniSecurityStatusListener::JniSecurityStatusListener(JNIEnv *env, jobject jListe
 
 JniSecurityStatusListener::~JniSecurityStatusListener()
 {
-    LOGI("~JniSecurityStatusListener()");
+    ES_LOGI("~JniSecurityStatusListener()");
     if (m_jwListener)
     {
         jint ret;
@@ -48,7 +48,7 @@ void JniSecurityStatusListener::secProvisionStatusCallback(
                 std::shared_ptr<SecProvisioningStatus> secProvisioningStatus)
 {
 
-    LOGI("JniSecurityStatusListener::secProvisionStatusCallback enter");
+    ES_LOGI("JniSecurityStatusListener::secProvisionStatusCallback enter");
 
     jint ret;
     JNIEnv *env = GetESJNIEnv(ret);
@@ -86,15 +86,16 @@ void JniSecurityStatusListener::secProvisionStatusCallback(
     //create the java object
     jobject jSecurityProvisioningStatus = NULL;
     jSecurityProvisioningStatus = env->NewObject(g_cls_SecurityProvisioningStatus,
-                                                g_mid_SecurityProvisioningStatus_ctor,
-                                                (jint)esResult,
-                                                env->NewStringUTF(secProvisioningStatus->getDeviceUUID().c_str()));
+                                        g_mid_SecurityProvisioningStatus_ctor,
+                                        (jint)esResult,
+                                        env->NewStringUTF(secProvisioningStatus->getDeviceUUID().c_str()));
 
-    LOGE("JniSecurityStatusListener::onSecurityProvisioningStatus UUID : %s", secProvisioningStatus->getDeviceUUID().c_str());
+    ES_LOGE("JniSecurityStatusListener::onSecurityProvisioningStatus UUID : %s",
+                                                     secProvisioningStatus->getDeviceUUID().c_str());
 
     if (!jSecurityProvisioningStatus)
     {
-        LOGE("JniSecurityStatusListener::onSecurityProvisioningStatus Unable to create the java object");
+        ES_LOGE("JniSecurityStatusListener::onSecurityProvisioningStatus Unable to create the java object");
         return ;
     }
 
@@ -102,7 +103,7 @@ void JniSecurityStatusListener::secProvisionStatusCallback(
 
     if (env->ExceptionCheck())
     {
-        LOGE("Java exception is thrown");
+        ES_LOGE("Java exception is thrown");
         checkExAndRemoveListener(env);
         if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
         return;
index 0785c3a..8ed6ebd 100755 (executable)
@@ -494,19 +494,15 @@ public class EasysetupActivity extends Activity {
                                     if(getConfigurationStatus.getESResult() == ESResult.ES_OK) {
 
                                         final EnrolleeConf enrolleeConf = getConfigurationStatus.getEnrolleeConf();
-                                        final DeviceConfig devConf = enrolleeConf.getDeviceConfig();
-                                        final WiFiConfig netInfo = enrolleeConf.getWiFiConfig();
                                         runOnUiThread(new Runnable() {
                                             @Override
                                             public void run() {
                                                 mGetconfigurationStateText.setText("Success");
-                                                mDevNameText.setText(devConf.getName());
-                                                mLanguageText.setText(devConf.getLanguage());
-                                                mCountryText.setText(devConf.getCountry());
-                                                setWifiModes(netInfo.getWifiModes());
-                                                setWifiFreq(netInfo.getWifiFreq());
+                                                mDevNameText.setText(enrolleeConf.getDeviceName());
+                                                setWifiModes(enrolleeConf.getWiFiModes());
+                                                setWifiFreq(enrolleeConf.getWiFiFreq());
 
-                                                if(enrolleeConf.isCloudable()) {
+                                                if(enrolleeConf.isCloudAccessible()) {
                                                     mCloudAccessableText.setText("TRUE");
                                                 }
                                                 else {
@@ -570,9 +566,9 @@ public class EasysetupActivity extends Activity {
                             String inputLanguage = mInputLanguageText.getText().toString();
                             String inputCountry = mInputCountryText.getText().toString();
 
-                            DeviceProp deviceProp =
-                                    new DeviceProp(enrollerSSID, enrollerPW, authType, encType,
-                                                    inputLanguage, inputCountry);
+                            DeviceProp deviceProp = new DeviceProp();
+                            deviceProp.setWiFiProp(enrollerSSID, enrollerPW, authType, encType);
+                            deviceProp.setDevConfProp(inputLanguage, inputCountry);
 
                             mRemoteEnrollee.provisionDeviceProperties(deviceProp, new DevicePropProvisioningCallback() {
                                 @Override
@@ -633,8 +629,8 @@ public class EasysetupActivity extends Activity {
                             String authProvider = mAuthProviderText.getText().toString();
                             String ciserver = mCIServerText.getText().toString();
 
-                            CloudProp cloudProp =
-                                    new CloudProp(authCode, authProvider, ciserver);
+                            CloudProp cloudProp = new CloudProp();
+                            cloudProp.setCloudProp(authCode, authProvider, ciserver);
 
                             mRemoteEnrollee.provisionCloudProperties(cloudProp, new CloudPropProvisioningCallback() {
                                 @Override