modified OCAccountManager APIs
authorJaewook Jung <jw0213.jung@samsung.com>
Wed, 19 Oct 2016 04:49:45 +0000 (13:49 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Fri, 9 Dec 2016 07:22:01 +0000 (07:22 +0000)
modified some APIs on OCAccountManager since the OCF cloud specification
has been changed.
(C++/Android API, sampleApp and unittest are modified)

- added a string parameter for accessToken on signOut() and deleteDevice().
- removed AclGroupType for createGroup() and added new overloaded one
  that has a map parameter for optional property values.
- changed getGroupList() to getGroupInfoAll() because it does not get a
  list anymore but information of all my group from account server.
- removed joinGroup(), deleteInvitation() and added replyToInvitation().
- removed addDeviceToGroup(), deleteDeviceFromGroup(), leaveGroup() and
  added addPropertyValueToGroup(), deletePropertyValueFromGroup(),
  updatePropertyValueOnGroup().

Change-Id: Ibf462a6667990c1786d8b4111263d96e5c618166
Signed-off-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14335
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Signed-off-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15211

15 files changed:
android/android_api/base/jni/JniOcAccountManager.cpp
android/android_api/base/jni/JniOcAccountManager.h
android/android_api/base/jni/JniUtils.h
android/android_api/base/src/main/java/org/iotivity/base/AclGroupType.java [deleted file]
android/android_api/base/src/main/java/org/iotivity/base/OcAccountManager.java
android/examples/simplebase/src/main/java/org/iotivity/base/examples/CloudFragment.java
android/examples/simplebase/src/main/res/layout/fragment_cloud.xml
android/examples/simplebase/src/main/res/layout/input.xml
cloud/samples/client/group_invite/group_invite.cpp
cloud/samples/client/group_invite/group_light_share.cpp
resource/csdk/stack/include/octypes.h
resource/include/OCAccountManager.h
resource/include/OCApi.h
resource/src/OCAccountManager.cpp
resource/unittests/OCAccountManagerTest.cpp

index 9556111..677e6d0 100644 (file)
 #include "JniOcRepresentation.h"
 #include "JniUtils.h"
 
+#define VERIFY_NON_NULL_THROW_EXCEPTION(arg, log_message, exc) \
+    if (!(arg)) \
+    { \
+        ThrowOcException(exc, log_message); \
+        return; \
+    } \
+
 JniOcAccountManager::JniOcAccountManager(std::shared_ptr<OCAccountManager> accountManager)
     : m_sharedAccountManager(accountManager)
 {
@@ -121,6 +128,11 @@ OCStackResult JniOcAccountManager::signUp(JNIEnv* env, const std::string& authPr
                                           const std::string& authCode, jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -136,6 +148,11 @@ OCStackResult JniOcAccountManager::signUp(JNIEnv* env, const std::string& authPr
                                           const QueryParamsMap& options, jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -150,6 +167,11 @@ OCStackResult JniOcAccountManager::signIn(JNIEnv* env, const std::string& userUu
                                           const std::string& accessToken, jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -160,9 +182,15 @@ OCStackResult JniOcAccountManager::signIn(JNIEnv* env, const std::string& userUu
     return m_sharedAccountManager->signIn(userUuid, accessToken, postCallback);
 }
 
-OCStackResult JniOcAccountManager::signOut(JNIEnv* env, jobject jListener)
+OCStackResult JniOcAccountManager::signOut(JNIEnv* env, const std::string& accessToken,
+                                           jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -170,7 +198,7 @@ OCStackResult JniOcAccountManager::signOut(JNIEnv* env, jobject jListener)
         onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->signOut(postCallback);
+    return m_sharedAccountManager->signOut(accessToken, postCallback);
 }
 
 OCStackResult JniOcAccountManager::refreshAccessToken(JNIEnv* env, const std::string& userUuid,
@@ -178,6 +206,11 @@ OCStackResult JniOcAccountManager::refreshAccessToken(JNIEnv* env, const std::st
                                                       jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -192,6 +225,11 @@ OCStackResult JniOcAccountManager::searchUser(JNIEnv* env, const std::string& us
                                               jobject jListener)
 {
     JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    if (nullptr == onGetListener)
+    {
+        LOGE("onGetListener is null");
+        return OC_STACK_ERROR;
+    }
 
     GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -206,6 +244,11 @@ OCStackResult JniOcAccountManager::searchUser(JNIEnv* env, const QueryParamsMap&
                                               jobject jListener)
 {
     JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    if (nullptr == onGetListener)
+    {
+        LOGE("onGetListener is null");
+        return OC_STACK_ERROR;
+    }
 
     GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -216,10 +259,15 @@ OCStackResult JniOcAccountManager::searchUser(JNIEnv* env, const QueryParamsMap&
     return m_sharedAccountManager->searchUser(queryMap, getCallback);
 }
 
-OCStackResult JniOcAccountManager::deleteDevice(JNIEnv* env, const std::string& deviceId,
-                                                jobject jListener)
+OCStackResult JniOcAccountManager::deleteDevice(JNIEnv* env, const std::string& accessToken,
+                                                const std::string& deviceId, jobject jListener)
 {
     JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    if (nullptr == onDeleteListener)
+    {
+        LOGE("onDeleteListener is null");
+        return OC_STACK_ERROR;
+    }
 
     DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
         const int eCode)
@@ -227,13 +275,17 @@ OCStackResult JniOcAccountManager::deleteDevice(JNIEnv* env, const std::string&
         onDeleteListener->onDeleteCallback(opts, eCode);
     };
 
-    return m_sharedAccountManager->deleteDevice(deviceId, deleteCallback);
+    return m_sharedAccountManager->deleteDevice(accessToken, deviceId, deleteCallback);
 }
 
-OCStackResult JniOcAccountManager::createGroup(JNIEnv* env, AclGroupType groupType,
-                                               jobject jListener)
+OCStackResult JniOcAccountManager::createGroup(JNIEnv* env, jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -241,26 +293,37 @@ OCStackResult JniOcAccountManager::createGroup(JNIEnv* env, AclGroupType groupTy
         onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->createGroup(groupType, postCallback);
+    return m_sharedAccountManager->createGroup(postCallback);
 }
 
-OCStackResult JniOcAccountManager::getGroupList(JNIEnv* env, jobject jListener)
+OCStackResult JniOcAccountManager::createGroup(JNIEnv* env, const QueryParamsMap& queryMap,
+                                               jobject jListener)
 {
-    JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
+    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
     {
-        onGetListener->onGetCallback(opts, rep, eCode);
+        onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->getGroupList(getCallback);
+    return m_sharedAccountManager->createGroup(queryMap, postCallback);
 }
 
 OCStackResult JniOcAccountManager::deleteGroup(JNIEnv* env, const std::string& groupId,
                                                jobject jListener)
 {
     JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    if (nullptr == onDeleteListener)
+    {
+        LOGE("onDeleteListener is null");
+        return OC_STACK_ERROR;
+    }
 
     DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
         const int eCode)
@@ -271,82 +334,115 @@ OCStackResult JniOcAccountManager::deleteGroup(JNIEnv* env, const std::string& g
     return m_sharedAccountManager->deleteGroup(groupId, deleteCallback);
 }
 
-OCStackResult JniOcAccountManager::joinGroup(JNIEnv* env, const std::string& groupId,
-                                             jobject jListener)
+OCStackResult JniOcAccountManager::getGroupInfoAll(JNIEnv* env, jobject jListener)
 {
-    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    if (nullptr == onGetListener)
+    {
+        LOGE("onGetListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
+    GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
     {
-        onPostListener->onPostCallback(opts, rep, eCode);
+        onGetListener->onGetCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->joinGroup(groupId, postCallback);
+    return m_sharedAccountManager->getGroupInfoAll(getCallback);
 }
 
-OCStackResult JniOcAccountManager::addDeviceToGroup(JNIEnv* env, const std::string& groupId,
-                                                    const std::vector<std::string>& deviceId,
-                                                    jobject jListener)
+OCStackResult JniOcAccountManager::getGroupInfo(JNIEnv* env, const std::string& groupId,
+                                                jobject jListener)
 {
-    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    if (nullptr == onGetListener)
+    {
+        LOGE("onGetListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
+    GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
     {
-        onPostListener->onPostCallback(opts, rep, eCode);
+        onGetListener->onGetCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->addDeviceToGroup(groupId, deviceId, postCallback);
+    return m_sharedAccountManager->getGroupInfo(groupId, getCallback);
 }
 
-OCStackResult JniOcAccountManager::getGroupInfo(JNIEnv* env, const std::string& groupId,
-                                                jobject jListener)
+OCStackResult JniOcAccountManager::addPropertyValueToGroup(JNIEnv* env, const std::string& groupId,
+                                                           const OCRepresentation& propertyValue,
+                                                           jobject jListener)
 {
-    JniOnGetListener *onGetListener = addOnGetListener(env, jListener);
+    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    GetCallback getCallback = [onGetListener](const HeaderOptions& opts,
+    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
     {
-        onGetListener->onGetCallback(opts, rep, eCode);
+        onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->getGroupInfo(groupId, getCallback);
+    return m_sharedAccountManager->addPropertyValueToGroup(groupId, propertyValue, postCallback);
 }
 
-OCStackResult JniOcAccountManager::leaveGroup(JNIEnv* env, const std::string& groupId,
-                                              jobject jListener)
+OCStackResult JniOcAccountManager::deletePropertyValueFromGroup(JNIEnv* env,
+                                                        const std::string& groupId,
+                                                        const OCRepresentation& propertyValue,
+                                                        jobject jListener)
 {
-    JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
-        const int eCode)
+    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
+        const OCRepresentation& rep, const int eCode)
     {
-        onDeleteListener->onDeleteCallback(opts, eCode);
+        onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->leaveGroup(groupId, deleteCallback);
+    return m_sharedAccountManager->deletePropertyValueFromGroup(groupId, propertyValue,
+                                                                postCallback);
 }
 
-OCStackResult JniOcAccountManager::deleteDeviceFromGroup(JNIEnv* env, const std::string& groupId,
-                                                         const std::vector<std::string>& deviceId,
-                                                         jobject jListener)
+OCStackResult JniOcAccountManager::updatePropertyValueOnGroup(JNIEnv* env,
+                                                        const std::string& groupId,
+                                                        const OCRepresentation& propertyValue,
+                                                        jobject jListener)
 {
-    JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
-    DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
-        const int eCode)
+    PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
+        const OCRepresentation& rep, const int eCode)
     {
-        onDeleteListener->onDeleteCallback(opts, eCode);
+        onPostListener->onPostCallback(opts, rep, eCode);
     };
 
-    return m_sharedAccountManager->deleteDeviceFromGroup(groupId, deviceId, deleteCallback);
+    return m_sharedAccountManager->updatePropertyValueOnGroup(groupId, propertyValue,
+                                                              postCallback);
 }
 
-OCStackResult JniOcAccountManager::observeGroup(JNIEnv* env, const std::string& groupId,
-                                                jobject jListener)
+OCStackResult JniOcAccountManager::observeGroup(JNIEnv* env, jobject jListener)
 {
     JniOnObserveListener *onObserveListener = addOnObserveListener(env, jListener);
+    if (nullptr == onObserveListener)
+    {
+        LOGE("onObserveListener is null");
+        return OC_STACK_ERROR;
+    }
 
     ObserveCallback observeCallback = [onObserveListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int& eCode, const int& sequenceNumber)
@@ -354,17 +450,22 @@ OCStackResult JniOcAccountManager::observeGroup(JNIEnv* env, const std::string&
         onObserveListener->onObserveCallback(opts, rep, eCode, sequenceNumber);
     };
 
-    return m_sharedAccountManager->observeGroup(groupId, observeCallback);
+    return m_sharedAccountManager->observeGroup(observeCallback);
 }
 
-OCStackResult JniOcAccountManager::cancelObserveGroup(const std::string& groupId)
+OCStackResult JniOcAccountManager::cancelObserveGroup()
 {
-    return m_sharedAccountManager->cancelObserveGroup(groupId);
+    return m_sharedAccountManager->cancelObserveGroup();
 }
 
 OCStackResult JniOcAccountManager::observeInvitation(JNIEnv* env, jobject jListener)
 {
     JniOnObserveListener *onObserveListener = addOnObserveListener(env, jListener);
+    if (nullptr == onObserveListener)
+    {
+        LOGE("onObserveListener is null");
+        return OC_STACK_ERROR;
+    }
 
     ObserveCallback observeCallback = [onObserveListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int& eCode, const int& sequenceNumber)
@@ -384,6 +485,11 @@ OCStackResult JniOcAccountManager::sendInvitation(JNIEnv* env, const std::string
                                                   const std::string& userUuid, jobject jListener)
 {
     JniOnPostListener *onPostListener = addOnPostListener(env, jListener);
+    if (nullptr == onPostListener)
+    {
+        LOGE("onPostListener is null");
+        return OC_STACK_ERROR;
+    }
 
     PostCallback postCallback = [onPostListener](const HeaderOptions& opts,
         const OCRepresentation& rep, const int eCode)
@@ -398,6 +504,11 @@ OCStackResult JniOcAccountManager::cancelInvitation(JNIEnv* env, const std::stri
                                                     const std::string& userUuid, jobject jListener)
 {
     JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    if (nullptr == onDeleteListener)
+    {
+        LOGE("onDeleteListener is null");
+        return OC_STACK_ERROR;
+    }
 
     DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
         const int eCode)
@@ -408,10 +519,15 @@ OCStackResult JniOcAccountManager::cancelInvitation(JNIEnv* env, const std::stri
     return m_sharedAccountManager->cancelInvitation(groupId, userUuid, deleteCallback);
 }
 
-OCStackResult JniOcAccountManager::deleteInvitation(JNIEnv* env, const std::string& groupId,
-                                                    jobject jListener)
+OCStackResult JniOcAccountManager::replyToInvitation(JNIEnv* env, const std::string& groupId,
+                                                     const bool accept, jobject jListener)
 {
     JniOnDeleteListener *onDeleteListener = addOnDeleteListener(env, jListener);
+    if (nullptr == onDeleteListener)
+    {
+        LOGE("onDeleteListener is null");
+        return OC_STACK_ERROR;
+    }
 
     DeleteCallback deleteCallback = [onDeleteListener](const HeaderOptions& opts,
         const int eCode)
@@ -419,10 +535,9 @@ OCStackResult JniOcAccountManager::deleteInvitation(JNIEnv* env, const std::stri
         onDeleteListener->onDeleteCallback(opts, eCode);
     };
 
-    return m_sharedAccountManager->deleteInvitation(groupId, deleteCallback);
+    return m_sharedAccountManager->replyToInvitation(groupId, accept, deleteCallback);
 }
 
-
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    getHost
@@ -465,17 +580,18 @@ JNIEXPORT jint JNICALL Java_org_iotivity_base_OcAccountManager_getConnectivityTy
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    signUp0
-* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp0
     (JNIEnv *env, jobject thiz, jstring jAuthProvider, jstring jAuthCode, jobject jListener)
 {
     LOGD("OcAccountManager_signUp");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAuthProvider, "authProvider cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAuthCode, "authCode cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -484,16 +600,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp0
         return;
     }
 
-    std::string authProvider;
-    std::string authCode;
-    if (jAuthProvider)
-    {
-        authProvider = env->GetStringUTFChars(jAuthProvider, nullptr);
-    }
-    if (jAuthCode)
-    {
-        authCode = env->GetStringUTFChars(jAuthCode, nullptr);
-    }
+    const char *charAuthProvider = env->GetStringUTFChars(jAuthProvider, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAuthProvider, "charAuthProvider is null", JNI_EXCEPTION);
+    std::string authProvider(charAuthProvider);
+    env->ReleaseStringUTFChars(jAuthProvider, charAuthProvider);
+
+    const char *charAuthCode = env->GetStringUTFChars(jAuthCode, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAuthCode, "charAuthCode is null", JNI_EXCEPTION);
+    std::string authCode(charAuthCode);
+    env->ReleaseStringUTFChars(jAuthCode, charAuthCode);
 
     try
     {
@@ -501,7 +616,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp0
                                                       authProvider,
                                                       authCode,
                                                       jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_signUp");
@@ -517,23 +631,20 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    signUp1
-* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp1
     (JNIEnv *env, jobject thiz, jstring jAuthProvider, jstring jAuthCode, jobject jOptionsMap,
      jobject jListener)
 {
     LOGD("OcAccountManager_signUp");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
-    if (!jOptionsMap)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "options cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAuthProvider, "authProvider cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAuthCode, "authCode cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jOptionsMap, "options cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -542,16 +653,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp1
         return;
     }
 
-    std::string authProvider;
-    std::string authCode;
-    if (jAuthProvider)
-    {
-        authProvider = env->GetStringUTFChars(jAuthProvider, nullptr);
-    }
-    if (jAuthCode)
-    {
-        authCode = env->GetStringUTFChars(jAuthCode, nullptr);
-    }
+    const char *charAuthProvider = env->GetStringUTFChars(jAuthProvider, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAuthProvider, "charAuthProvider is null", JNI_EXCEPTION);
+    std::string authProvider(charAuthProvider);
+    env->ReleaseStringUTFChars(jAuthProvider, charAuthProvider);
+
+    const char *charAuthCode = env->GetStringUTFChars(jAuthCode, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAuthCode, "charAuthCode is null", JNI_EXCEPTION);
+    std::string authCode(charAuthCode);
+    env->ReleaseStringUTFChars(jAuthCode, charAuthCode);
 
     QueryParamsMap optionsMap;
     JniUtils::convertJavaMapToQueryParamsMap(env, jOptionsMap, optionsMap);
@@ -563,7 +673,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp1
                                                       authCode,
                                                       optionsMap,
                                                       jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_signUp");
@@ -579,17 +688,18 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signUp1
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    signIn0
-* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signIn0
     (JNIEnv *env, jobject thiz, jstring jUserUuid, jstring jAccessToken, jobject jListener)
 {
     LOGD("OcAccountManager_signIn");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jUserUuid, "userUuid cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAccessToken, "accessToken cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -598,16 +708,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signIn0
         return;
     }
 
-    std::string userUuid;
-    std::string accessToken;
-    if (jUserUuid)
-    {
-        userUuid = env->GetStringUTFChars(jUserUuid, nullptr);
-    }
-    if (jAccessToken)
-    {
-        accessToken = env->GetStringUTFChars(jAccessToken, nullptr);
-    }
+    const char *charUserUuid = env->GetStringUTFChars(jUserUuid, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charUserUuid, "charUserUuid is null", JNI_EXCEPTION);
+    std::string userUuid(charUserUuid);
+    env->ReleaseStringUTFChars(jUserUuid, charUserUuid);
+
+    const char *charAccessToken = env->GetStringUTFChars(jAccessToken, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAccessToken, "charAccessToken is null", JNI_EXCEPTION);
+    std::string accessToken(charAccessToken);
+    env->ReleaseStringUTFChars(jAccessToken, charAccessToken);
 
     try
     {
@@ -615,7 +724,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signIn0
                                                       userUuid,
                                                       accessToken,
                                                       jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_signIn");
@@ -631,17 +739,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signIn0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    signOut0
-* Signature: (Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signOut0
-    (JNIEnv *env, jobject thiz, jobject jListener)
+    (JNIEnv *env, jobject thiz, jstring jAccessToken, jobject jListener)
 {
     LOGD("OcAccountManager_signOut");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAccessToken, "accessToken cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -650,11 +757,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signOut0
         return;
     }
 
+    const char *charAccessToken = env->GetStringUTFChars(jAccessToken, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAccessToken, "charAccessToken is null", JNI_EXCEPTION);
+    std::string accessToken(charAccessToken);
+    env->ReleaseStringUTFChars(jAccessToken, charAccessToken);
+
     try
     {
         OCStackResult result = accountManager->signOut(env,
+                                                       accessToken,
                                                        jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_signOut");
@@ -670,17 +782,18 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_signOut0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    refreshAccessToken0
-* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_refreshAccessToken0
     (JNIEnv *env, jobject thiz, jstring jUserUuid, jstring jRefreshAccessToken, jobject jListener)
 {
     LOGD("OcAccountManager_refreshAccessToken");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jUserUuid, "userUuid cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jRefreshAccessToken, "refreshAccessToken cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -689,16 +802,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_refreshAccessToke
         return;
     }
 
-    std::string userUuid;
-    std::string refreshAccessToken;
-    if (jUserUuid)
-    {
-        userUuid = env->GetStringUTFChars(jUserUuid, nullptr);
-    }
-    if (jRefreshAccessToken)
-    {
-        refreshAccessToken = env->GetStringUTFChars(jRefreshAccessToken, nullptr);
-    }
+    const char *charUserUuid = env->GetStringUTFChars(jUserUuid, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charUserUuid, "charUserUuid is null", JNI_EXCEPTION);
+    std::string userUuid(charUserUuid);
+    env->ReleaseStringUTFChars(jUserUuid, charUserUuid);
+
+    const char *charRefreshAccessToken = env->GetStringUTFChars(jRefreshAccessToken, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charRefreshAccessToken, "charRefreshAccessToken is null",
+                                    JNI_EXCEPTION);
+    std::string refreshAccessToken(charRefreshAccessToken);
+    env->ReleaseStringUTFChars(jRefreshAccessToken, charRefreshAccessToken);
 
     try
     {
@@ -706,7 +819,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_refreshAccessToke
                                                                   userUuid,
                                                                   refreshAccessToken,
                                                                   jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_refreshAccessToken");
@@ -728,11 +840,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser0
     (JNIEnv *env, jobject thiz, jstring jUserUuid, jobject jListener)
 {
     LOGD("OcAccountManager_searchUser");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onGetListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jUserUuid, "userUuid cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onGetListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -741,18 +851,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser0
         return;
     }
 
-    std::string userUuid;
-    if (jUserUuid)
-    {
-        userUuid = env->GetStringUTFChars(jUserUuid, nullptr);
-    }
+    const char *charUserUuid = env->GetStringUTFChars(jUserUuid, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charUserUuid, "charUserUuid is null", JNI_EXCEPTION);
+    std::string userUuid(charUserUuid);
+    env->ReleaseStringUTFChars(jUserUuid, charUserUuid);
 
     try
     {
         OCStackResult result = accountManager->searchUser(env,
                                                           userUuid,
                                                           jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_searchUser");
@@ -774,16 +882,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser1
     (JNIEnv *env, jobject thiz, jobject jQueryMap, jobject jListener)
 {
     LOGD("OcAccountManager_searchUser");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onGetListener cannot be null");
-        return;
-    }
-    if (!jQueryMap)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "queryMap cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jQueryMap, "queryMap cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onGetListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -800,7 +901,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser1
         OCStackResult result = accountManager->searchUser(env,
                                                           queryMap,
                                                           jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_searchUser");
@@ -816,17 +916,18 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser1
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    deleteDevice0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDevice0
-    (JNIEnv *env, jobject thiz, jstring jDeviceId, jobject jListener)
+    (JNIEnv *env, jobject thiz, jstring jAccessToken, jstring jDeviceId, jobject jListener)
 {
     LOGD("OcAccountManager_deleteDevice");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jAccessToken, "accessToken cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jDeviceId, "deviceId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onDeleteListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -835,18 +936,22 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDevice0
         return;
     }
 
-    std::string deviceId;
-    if (jDeviceId)
-    {
-        deviceId = env->GetStringUTFChars(jDeviceId, nullptr);
-    }
+    const char *charAccessToken = env->GetStringUTFChars(jAccessToken, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charAccessToken, "charAccessToken is null", JNI_EXCEPTION);
+    std::string accessToken(charAccessToken);
+    env->ReleaseStringUTFChars(jAccessToken, charAccessToken);
+
+    const char *charDeviceId = env->GetStringUTFChars(jDeviceId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charDeviceId, "charDeviceId is null", JNI_EXCEPTION);
+    std::string deviceId(charDeviceId);
+    env->ReleaseStringUTFChars(jDeviceId, charDeviceId);
 
     try
     {
         OCStackResult result = accountManager->deleteDevice(env,
+                                                            accessToken,
                                                             deviceId,
                                                             jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_deleteDevice");
@@ -862,17 +967,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDevice0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    createGroup0
-* Signature: (Lorg/iotivity/base/AclGroupType;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup0
-    (JNIEnv *env, jobject thiz, jint groupType, jobject jListener)
+    (JNIEnv *env, jobject thiz, jobject jListener)
 {
     LOGD("OcAccountManager_createGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -884,9 +986,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup0
     try
     {
         OCStackResult result = accountManager->createGroup(env,
-            JniUtils::getAclGroupType(env, static_cast<int>(groupType)),
-            jListener);
-
+                                                           jListener);
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_createGroup");
@@ -901,18 +1001,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    getGroupList0
-* Signature: (Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
+* Method:    createGroup1
+* Signature: (Ljava/util/Map;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupList0
-    (JNIEnv *env, jobject thiz, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup1
+    (JNIEnv *env, jobject thiz, jobject jQueryMap, jobject jListener)
 {
-    LOGD("OcAccountManager_getGroupList");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onGetListener cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_createGroup");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jQueryMap, "queryMap cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -921,14 +1019,17 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupList0
         return;
     }
 
+    QueryParamsMap queryMap;
+    JniUtils::convertJavaMapToQueryParamsMap(env, jQueryMap, queryMap);
+
     try
     {
-        OCStackResult result = accountManager->getGroupList(env,
-                                                            jListener);
-
+        OCStackResult result = accountManager->createGroup(env,
+                                                           queryMap,
+                                                           jListener);
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_getGroupList");
+            ThrowOcException(result, "OcAccountManager_createGroup");
         }
     }
     catch (OCException& e)
@@ -947,11 +1048,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteGroup0
     (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
 {
     LOGD("OcAccountManager_deleteGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onDeleteListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -960,18 +1059,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteGroup0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
 
     try
     {
         OCStackResult result = accountManager->deleteGroup(env,
                                                            groupId,
                                                            jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_deleteGroup");
@@ -986,18 +1083,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteGroup0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    joinGroup0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Method:    getGroupInfoAll0
+* Signature: (Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_joinGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfoAll0
+    (JNIEnv *env, jobject thiz, jobject jListener)
 {
-    LOGD("OcAccountManager_joinGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_getGroupInfoAll");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onGetListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1006,21 +1100,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_joinGroup0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-
     try
     {
-        OCStackResult result = accountManager->joinGroup(env,
-                                                         groupId,
-                                                         jListener);
-
+        OCStackResult result = accountManager->getGroupInfoAll(env,
+                                                               jListener);
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_joinGroup");
+            ThrowOcException(result, "OcAccountManager_getGroupInfoAll");
         }
     }
     catch (OCException& e)
@@ -1032,23 +1118,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_joinGroup0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    addDeviceToGroup0
-* Signature: (Ljava/lang/String;[Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Method:    getGroupInfo0
+* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addDeviceToGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobjectArray jDeviceIdArray, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
+    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
 {
-    LOGD("OcAccountManager_addDeviceToGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
-    if (!jDeviceIdArray)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "deviceId cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_getGroupInfo");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onGetListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1057,25 +1136,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addDeviceToGroup0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-
-    std::vector<std::string> deviceIds;
-    JniUtils::convertJavaStrArrToStrVector(env, jDeviceIdArray, deviceIds);
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
 
     try
     {
-        OCStackResult result = accountManager->addDeviceToGroup(env,
-                                                                groupId,
-                                                                deviceIds,
-                                                                jListener);
-
+        OCStackResult result = accountManager->getGroupInfo(env,
+                                                            groupId,
+                                                            jListener);
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_addDeviceToGroup");
+            ThrowOcException(result, "OcAccountManager_getGroupInfo");
         }
     }
     catch (OCException& e)
@@ -1087,18 +1160,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addDeviceToGroup0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    getGroupInfo0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
+* Method:    addPropertyValueToGroup0
+* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addPropertyValueToGroup0
+    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jPropertyValue, jobject jListener)
 {
-    LOGD("OcAccountManager_getGroupInfo");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onGetListener cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_addPropertyValueToGroup");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jPropertyValue, "propertyValue cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1107,21 +1181,28 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
+    OCRepresentation *propertyValue = JniOcRepresentation::getOCRepresentationPtr(env,
+                                                                                  jPropertyValue);
+    if (!propertyValue)
     {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
+        return;
     }
 
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
+
     try
     {
-        OCStackResult result = accountManager->getGroupInfo(env,
-                                                            groupId,
-                                                            jListener);
+        OCStackResult result = accountManager->addPropertyValueToGroup(env,
+                                                                       groupId,
+                                                                       *propertyValue,
+                                                                       jListener);
 
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_getGroupInfo");
+            ThrowOcException(result, "OcAccountManager_addPropertyValueToGroup");
         }
     }
     catch (OCException& e)
@@ -1133,18 +1214,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    leaveGroup0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+* Method:    deletePropertyValueFromGroup0
+* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_leaveGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deletePropertyValueFromGroup0
+    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jPropertyValue, jobject jListener)
 {
-    LOGD("OcAccountManager_leaveGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_deletePropertyValueFromGroup");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jPropertyValue, "propertyValue cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1153,21 +1235,28 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_leaveGroup0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
+    OCRepresentation *propertyValue = JniOcRepresentation::getOCRepresentationPtr(env,
+                                                                                  jPropertyValue);
+    if (!propertyValue)
     {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
+        return;
     }
 
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
+
     try
     {
-        OCStackResult result = accountManager->leaveGroup(env,
-                                                          groupId,
-                                                          jListener);
+        OCStackResult result = accountManager->deletePropertyValueFromGroup(env,
+                                                                            groupId,
+                                                                            *propertyValue,
+                                                                            jListener);
 
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_leaveGroup");
+            ThrowOcException(result, "OcAccountManager_deletePropertyValueFromGroup");
         }
     }
     catch (OCException& e)
@@ -1179,23 +1268,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_leaveGroup0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    deleteDeviceFromGroup0
-* Signature: (Ljava/lang/String;[Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+* Method:    updatePropertyValueOnGroup0
+* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDeviceFromGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobjectArray jDeviceIdArray, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_updatePropertyValueOnGroup0
+    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jPropertyValue, jobject jListener)
 {
-    LOGD("OcAccountManager_deleteDeviceFromGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
-    if (!jDeviceIdArray)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "deviceId cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_updatePropertyValueOnGroup");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jPropertyValue, "propertyValue cannot be null",
+                                    OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1204,25 +1289,28 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDeviceFromG
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
+    OCRepresentation *propertyValue = JniOcRepresentation::getOCRepresentationPtr(env,
+                                                                                  jPropertyValue);
+    if (!propertyValue)
     {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
+        return;
     }
 
-    std::vector<std::string> deviceIds;
-    JniUtils::convertJavaStrArrToStrVector(env, jDeviceIdArray, deviceIds);
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
 
     try
     {
-        OCStackResult result = accountManager->deleteDeviceFromGroup(env,
-                                                                     groupId,
-                                                                     deviceIds,
-                                                                     jListener);
+        OCStackResult result = accountManager->updatePropertyValueOnGroup(env,
+                                                                          groupId,
+                                                                          *propertyValue,
+                                                                          jListener);
 
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_deleteDeviceFromGroup");
+            ThrowOcException(result, "OcAccountManager_updatePropertyValueOnGroup");
         }
     }
     catch (OCException& e)
@@ -1235,17 +1323,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDeviceFromG
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    observeGroup0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcResource/OnObserveListener;)V
+* Signature: (Lorg/iotivity/base/OcResource/OnObserveListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
+    (JNIEnv *env, jobject thiz, jobject jListener)
 {
     LOGD("OcAccountManager_observeGroup");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onObserveListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onObserveListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1254,18 +1339,10 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeGroup0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-
     try
     {
         OCStackResult result = accountManager->observeGroup(env,
-                                                            groupId,
                                                             jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_observeGroup");
@@ -1281,10 +1358,10 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeGroup0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    cancelObserveGroup0
-* Signature: (Ljava/lang/String;)V
+* Signature: ()V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveGroup0
-    (JNIEnv *env, jobject thiz, jstring jGroupId)
+    (JNIEnv *env, jobject thiz)
 {
     LOGD("OcAccountManager_cancelObserveGroup");
 
@@ -1295,16 +1372,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveGrou
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-
     try
     {
-        OCStackResult result = accountManager->cancelObserveGroup(groupId);
-
+        OCStackResult result = accountManager->cancelObserveGroup();
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_cancelObserveGroup");
@@ -1326,11 +1396,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeInvitation
     (JNIEnv *env, jobject thiz, jobject jListener)
 {
     LOGD("OcAccountManager_observeInvitation");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onObserveListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onObserveListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1343,7 +1410,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeInvitation
     {
         OCStackResult result = accountManager->observeInvitation(env,
                                                                  jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_observeInvitation");
@@ -1376,7 +1442,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveInvi
     try
     {
         OCStackResult result = accountManager->cancelObserveInvitation();
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_cancelObserveInvitation");
@@ -1392,17 +1457,17 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveInvi
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    sendInvitation0
-* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_sendInvitation0
     (JNIEnv *env, jobject thiz, jstring jGroupId, jstring jUserUuid, jobject jListener)
 {
     LOGD("OcAccountManager_sendInvitation");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onPostListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jUserUuid, "userUuid cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onPostListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1411,15 +1476,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_sendInvitation0
         return;
     }
 
-    std::string groupId, userUuid;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-    if (jUserUuid)
-    {
-        userUuid = env->GetStringUTFChars(jUserUuid, nullptr);
-    }
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
+
+    const char *charUserUuid = env->GetStringUTFChars(jUserUuid, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charUserUuid, "charUserUuid is null", JNI_EXCEPTION);
+    std::string userUuid(charUserUuid);
+    env->ReleaseStringUTFChars(jUserUuid, charUserUuid);
 
     try
     {
@@ -1427,7 +1492,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_sendInvitation0
                                                               groupId,
                                                               userUuid,
                                                               jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_sendInvitation");
@@ -1443,17 +1507,17 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_sendInvitation0
 /*
 * Class:     org_iotivity_base_OcAccountManager
 * Method:    cancelInvitation0
-* Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+* Signature: (Ljava/lang/String;Ljava/lang/String;
+*             Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelInvitation0
     (JNIEnv *env, jobject thiz, jstring jGroupId, jstring jUserUuid, jobject jListener)
 {
     LOGD("OcAccountManager_cancelInvitation");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jUserUuid, "userUuid cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onDeleteListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1462,15 +1526,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelInvitation0
         return;
     }
 
-    std::string groupId, userUuid;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
-    if (jUserUuid)
-    {
-        userUuid = env->GetStringUTFChars(jUserUuid, nullptr);
-    }
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
+
+    const char *charUserUuid = env->GetStringUTFChars(jUserUuid, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charUserUuid, "charUserUuid is null", JNI_EXCEPTION);
+    std::string userUuid(charUserUuid);
+    env->ReleaseStringUTFChars(jUserUuid, charUserUuid);
 
     try
     {
@@ -1478,7 +1542,6 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelInvitation0
                                                                 groupId,
                                                                 userUuid,
                                                                 jListener);
-
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "OcAccountManager_cancelInvitation");
@@ -1493,18 +1556,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelInvitation0
 
 /*
 * Class:     org_iotivity_base_OcAccountManager
-* Method:    deleteInvitation0
-* Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+* Method:    replyToInvitation0
+* Signature: (Ljava/lang/String;ZLorg/iotivity/base/OcAccountManager/onDeleteListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteInvitation0
-    (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_replyToInvitation0
+    (JNIEnv *env, jobject thiz, jstring jGroupId, jboolean jAccept, jobject jListener)
 {
-    LOGD("OcAccountManager_deleteInvitation");
-    if (!jListener)
-    {
-        ThrowOcException(OC_STACK_INVALID_PARAM, "onDeleteListener cannot be null");
-        return;
-    }
+    LOGD("OcAccountManager_replyToInvitation");
+    VERIFY_NON_NULL_THROW_EXCEPTION(jGroupId, "groupId cannot be null", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_NULL_THROW_EXCEPTION(jListener, "onDeleteListener cannot be null",
+                                    OC_STACK_INVALID_PARAM);
 
     JniOcAccountManager *accountManager = JniOcAccountManager::getJniOcAccountManagerPtr(env,
                                                                                          thiz);
@@ -1513,21 +1574,20 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteInvitation0
         return;
     }
 
-    std::string groupId;
-    if (jGroupId)
-    {
-        groupId = env->GetStringUTFChars(jGroupId, nullptr);
-    }
+    const char *charGroupId = env->GetStringUTFChars(jGroupId, nullptr);
+    VERIFY_NON_NULL_THROW_EXCEPTION(charGroupId, "charGroupId is null", JNI_EXCEPTION);
+    std::string groupId(charGroupId);
+    env->ReleaseStringUTFChars(jGroupId, charGroupId);
 
     try
     {
-        OCStackResult result = accountManager->deleteInvitation(env,
-                                                                groupId,
-                                                                jListener);
-
+        OCStackResult result = accountManager->replyToInvitation(env,
+                                                                 groupId,
+                                                                 static_cast<bool>(jAccept),
+                                                                 jListener);
         if (OC_STACK_OK != result)
         {
-            ThrowOcException(result, "OcAccountManager_deleteInvitation");
+            ThrowOcException(result, "OcAccountManager_replyToInvitation");
         }
     }
     catch (OCException& e)
index 7ff841e..8aa9a21 100644 (file)
@@ -50,32 +50,34 @@ public:
                          const QueryParamsMap& options, jobject jListener);
     OCStackResult signIn(JNIEnv* env, const std::string& userUuid, const std::string& accessToken,
                          jobject jListener);
-    OCStackResult signOut(JNIEnv* env, jobject jListener);
+    OCStackResult signOut(JNIEnv* env, const std::string& accessToken, jobject jListener);
     OCStackResult refreshAccessToken(JNIEnv* env, const std::string& userUuid,
                                      const std::string& refreshToken, jobject jListener);
     OCStackResult searchUser(JNIEnv* env, const std::string& userUuid, jobject jListener);
     OCStackResult searchUser(JNIEnv* env, const QueryParamsMap& queryMap, jobject jListener);
-    OCStackResult deleteDevice(JNIEnv* env, const std::string& deviceId, jobject jListener);
-    OCStackResult createGroup(JNIEnv* env, AclGroupType groupType, jobject jListener);
-    OCStackResult getGroupList(JNIEnv* env, jobject jListener);
+    OCStackResult deleteDevice(JNIEnv* env, const std::string& accessToken,
+                               const std::string& deviceId, jobject jListener);
+    OCStackResult createGroup(JNIEnv* env, jobject jListener);
+    OCStackResult createGroup(JNIEnv* env, const QueryParamsMap& queryMap, jobject jListener);
     OCStackResult deleteGroup(JNIEnv* env, const std::string& groupId, jobject jListener);
-    OCStackResult joinGroup(JNIEnv* env, const std::string& groupId, jobject jListener);
-    OCStackResult addDeviceToGroup(JNIEnv* env, const std::string& groupId,
-                                   const std::vector<std::string>& deviceId, jobject jListener);
+    OCStackResult getGroupInfoAll(JNIEnv* env, jobject jListener);
     OCStackResult getGroupInfo(JNIEnv* env, const std::string& groupId, jobject jListener);
-    OCStackResult leaveGroup(JNIEnv* env, const std::string& groupId, jobject jListener);
-    OCStackResult deleteDeviceFromGroup(JNIEnv* env, const std::string& groupId,
-                                        const std::vector<std::string>& deviceId,
-                                        jobject jListener);
-    OCStackResult observeGroup(JNIEnv* env, const std::string& groupId, jobject jListener);
-    OCStackResult cancelObserveGroup(const std::string& groupId);
+    OCStackResult addPropertyValueToGroup(JNIEnv* env, const std::string& groupId,
+                                          const OCRepresentation& propertyValue, jobject jListener);
+    OCStackResult deletePropertyValueFromGroup(JNIEnv* env, const std::string& groupId,
+                                               const OCRepresentation& propertyValue, jobject jListener);
+    OCStackResult updatePropertyValueOnGroup(JNIEnv* env, const std::string& groupId,
+                                             const OCRepresentation& propertyValue, jobject jListener);
+    OCStackResult observeGroup(JNIEnv* env, jobject jListener);
+    OCStackResult cancelObserveGroup();
     OCStackResult observeInvitation(JNIEnv* env, jobject jListener);
     OCStackResult cancelObserveInvitation();
     OCStackResult sendInvitation(JNIEnv* env, const std::string& groupId,
                                  const std::string& userUuid, jobject jListener);
     OCStackResult cancelInvitation(JNIEnv* env, const std::string& groupId,
                                    const std::string& userUuid, jobject jListener);
-    OCStackResult deleteInvitation(JNIEnv* env, const std::string& groupId, jobject jListener);
+    OCStackResult replyToInvitation(JNIEnv* env, const std::string& groupId, const bool accept,
+                                    jobject jListener);
 
     JniOnGetListener* addOnGetListener(JNIEnv* env, jobject jListener);
     JniOnPostListener* addOnPostListener(JNIEnv* env, jobject jListener);
@@ -164,7 +166,7 @@ extern "C" {
     * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser0
-        (JNIEnv *env, jobject thiz, jstring juserUuid, jobject jListener);
+        (JNIEnv *, jobject, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -172,7 +174,7 @@ extern "C" {
     * Signature: (Ljava/util/Map;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_searchUser1
-        (JNIEnv *env, jobject thiz, jobject jQueryMap, jobject jListener);
+        (JNIEnv *, jobject, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -180,23 +182,23 @@ extern "C" {
     * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDevice0
-        (JNIEnv *env, jobject thiz, jstring jDeviceId, jobject jListener);
+        (JNIEnv *, jobject, jstring, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
     * Method:    createGroup0
-    * Signature: (Lorg/iotivity/base/AclGroupType;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+    * Signature: (Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup0
-        (JNIEnv *env, jobject thiz, jint groupType, jobject jListener);
+        (JNIEnv *, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    getGroupList0
-    * Signature: (Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
+    * Method:    createGroup1
+    * Signature: (Ljava/util/Map;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupList0
-        (JNIEnv *env, jobject thiz, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_createGroup1
+        (JNIEnv *, jobject, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -204,63 +206,66 @@ extern "C" {
     * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+        (JNIEnv *, jobject, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    joinGroup0
-    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+    * Method:    getGroupInfoAll0
+    * Signature: (Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_joinGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfoAll0
+        (JNIEnv *, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    addDeviceToGroup0
-    * Signature: (Ljava/lang/String;[Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
+    * Method:    getGroupInfo0
+    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addDeviceToGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobjectArray jDeviceIdArray, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
+        (JNIEnv *, jobject, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    getGroupInfo0
-    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnGetListener;)V
+    * Method:    addPropertyValueToGroup0
+    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+    *             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_getGroupInfo0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_addPropertyValueToGroup0
+        (JNIEnv *, jobject, jstring, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    leaveGroup0
-    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+    * Method:    deletePropertyValueFromGroup0
+    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+    *             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_leaveGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deletePropertyValueFromGroup0
+        (JNIEnv *, jobject, jstring, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    deleteDeviceFromGroup0
-    * Signature: (Ljava/lang/String;[Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+    * Method:    updatePropertyValueOnGroup0
+    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;
+    *             Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteDeviceFromGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobjectArray jDeviceIdArray, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_updatePropertyValueOnGroup0
+        (JNIEnv *, jobject, jstring, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
     * Method:    observeGroup0
-    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcResource/OnObserveListener;)V
+    * Signature: (Lorg/iotivity/base/OcResource/OnObserveListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+        (JNIEnv *, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
     * Method:    cancelObserveGroup0
-    * Signature: (Ljava/lang/String;)V
+    * Signature: ()V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveGroup0
-        (JNIEnv *env, jobject thiz, jstring jGroupId);
+        (JNIEnv *, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -268,7 +273,7 @@ extern "C" {
     * Signature: (Lorg/iotivity/base/OcResource/OnObserveListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_observeInvitation0
-        (JNIEnv *env, jobject thiz, jobject jListener);
+        (JNIEnv *, jobject, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -276,7 +281,7 @@ extern "C" {
     * Signature: ()V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelObserveInvitation0
-        (JNIEnv *env, jobject thiz);
+        (JNIEnv *, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -284,7 +289,7 @@ extern "C" {
     * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/OnPostListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_sendInvitation0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jstring jUserUuid, jobject jListener);
+        (JNIEnv *, jobject, jstring, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
@@ -292,15 +297,15 @@ extern "C" {
     * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_cancelInvitation0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jstring jUserUuid, jobject jListener);
+        (JNIEnv *, jobject, jstring, jstring, jobject);
 
     /*
     * Class:     org_iotivity_base_OcAccountManager
-    * Method:    deleteInvitation0
-    * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcAccountManager/onDeleteListener;)V
+    * Method:    replyToInvitation0
+    * Signature: (Ljava/lang/String;ZLorg/iotivity/base/OcAccountManager/onDeleteListener;)V
     */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_deleteInvitation0
-        (JNIEnv *env, jobject thiz, jstring jGroupId, jobject jListener);
+    JNIEXPORT void JNICALL Java_org_iotivity_base_OcAccountManager_replyToInvitation0
+        (JNIEnv *, jobject, jstring, jboolean, jobject);
 
 #ifdef __cplusplus
 }
index 5297293..74e48e6 100644 (file)
@@ -108,21 +108,7 @@ public:
                 return OC::ObserveType::ObserveAll;
         };
     }
-#ifdef WITH_CLOUD
-    static OC::AclGroupType getAclGroupType(JNIEnv *env, int type)
-    {
-        switch (type)
-        {
-            case 0:
-                return OC::AclGroupType::PUBLIC;
-            case 1:
-                return OC::AclGroupType::PRIVATE;
-            default:
-                ThrowOcException(OC_STACK_INVALID_PARAM, "Unexpected acl group type");
-                return OC::AclGroupType::PUBLIC;
-        };
-    }
-#endif
+
     static OCEntityHandlerResult getOCEntityHandlerResult(JNIEnv *env, int type)
     {
         switch (type)
diff --git a/android/android_api/base/src/main/java/org/iotivity/base/AclGroupType.java b/android/android_api/base/src/main/java/org/iotivity/base/AclGroupType.java
deleted file mode 100644 (file)
index abacec9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *******************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- */
-
-package org.iotivity.base;
-
-public enum AclGroupType {
-    PUBLIC(0),
-    PRIVATE(1),;
-
-    private int value;
-
-    private AclGroupType(int value) {
-        this.value = value;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-}
index f2a995b..783f709 100644 (file)
@@ -73,7 +73,7 @@ public final class OcAccountManager {
                                 OnPostListener onPostListener) throws OcException;
 
     /**
-     * overload
+     * Method for account registration to account server
      *
      * @param authProvider   Provider name used for authentication.
      * @param authCode       The authorization code obtained by using an authorization server
@@ -117,15 +117,18 @@ public final class OcAccountManager {
     /**
      * Method for sign-out to account server
      *
+     * @param accessToken    Identifier of the resource obtained by account registration.
      * @param onPostListener event handler The event handler will be invoked with a map of
      *                       attribute name and values.
      * @throws OcException if failure
      */
-    public void signOut(OnPostListener onPostListener) throws OcException {
-        this.signOut0(onPostListener);
+    public void signOut(String accessToken,
+                        OnPostListener onPostListener) throws OcException {
+        this.signOut0(accessToken, onPostListener);
     }
 
-    private native void signOut0(OnPostListener onPostListener) throws OcException;
+    private native void signOut0(String accessToken,
+                                 OnPostListener onPostListener) throws OcException;
 
     /**
      * Method to refresh access token to account server
@@ -151,8 +154,7 @@ public final class OcAccountManager {
      *
      * @param userUuid      Identifier of the user to get information.
      * @param onGetListener The event handler will be invoked with a map of attribute name and
-     *                      values. The event handler will also have the result from this Get
-     *                      operation This will have error codes
+     *                      values. It will also have the result from this Get operation.
      * @throws OcException if failure
      */
     public void searchUser(String userUuid,
@@ -164,13 +166,12 @@ public final class OcAccountManager {
                                     OnGetListener onGetListener) throws OcException;
 
     /**
-     * Overload
+     * Method to get information of the user to account server
      *
      * @param queryMap       Map which can have the query key and value for specific users.
      *                       account server can response information of more than one user.
      * @param onGetListener  The event handler will be invoked with a map of attribute name and
-     *                       values. The event handler will also have the result from this Get
-     *                       operation This will have error codes
+     *                       values. It will also have the result from this Get operation.
      * @throws OcException if failure
      */
     public void searchUser(Map<String, String> queryMap,
@@ -184,56 +185,58 @@ public final class OcAccountManager {
     /**
      * Method to delete the device registered on the account signed-in
      *
+     * @param accessToken      Identifier of the resource obtained by account registration.
      * @param deviceId         Device ID to delete.
      * @param onDeleteListener event handler The event handler will have headerOptionList
      * @throws OcException if failure
      */
-    public void deleteDevice(String deviceId,
+    public void deleteDevice(String accessToken,
+                             String deviceId,
                              OnDeleteListener onDeleteListener) throws OcException {
-        this.deleteDevice0(deviceId, onDeleteListener);
+        this.deleteDevice0(accessToken, deviceId, onDeleteListener);
     }
 
-    private native void deleteDevice0(String deviceId,
+    private native void deleteDevice0(String accessToken,
+                                      String deviceId,
                                       OnDeleteListener onDeleteListener) throws OcException;
 
     /**
      * Method to delete the device registered on the account signed-in
      *
-     * @param groupType      Group type that can be used for referencing default group ACL creation.
      * @param onPostListener event handler The event handler will be invoked with a map of
      *                       attribute name and values.
      * @throws OcException if failure
      */
-    public void createGroup(AclGroupType groupType,
-                            OnPostListener onPostListener) throws OcException {
-        this.createGroup0(groupType.getValue(), onPostListener);
+    public void createGroup(OnPostListener onPostListener) throws OcException {
+        this.createGroup0(onPostListener);
     }
 
-    private native void createGroup0(int groupType,
-                                     OnPostListener onPostListener) throws OcException;
+    private native void createGroup0(OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to get a list of groups joined from account server
-     *
-     * @param onGetListener  The event handler will be invoked with a map of attribute name and
-     *                       values. The event handler will also have the result from this Get
-     *                       operation This will have error codes
+     * Method to delete the device registered on the account signed-in
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @param queryMap       Map that has optional properties and values to create a group.
+     *                       Defined properties on the OCF spec are [gname, parent] so far.
+     *                       (2016/10/19)
+     * @param onPostListener event handler The event handler will be invoked with a map of
+     *                       attribute name and values.
+     * @throws OcException if failure
      */
-    public void getGroupList(OnGetListener onGetListener) throws OcException {
-        this.getGroupList0(onGetListener);
+    public void createGroup(Map<String, String> queryMap,
+                            OnPostListener onPostListener) throws OcException {
+        this.createGroup1(queryMap, onPostListener);
     }
 
-    private native void getGroupList0(OnGetListener onGetListener) throws OcException;
+    private native void createGroup1(Map<String, String> queryMap,
+                                     OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to delete the group from account server
+     * Method to delete the group from account server.
      *
      * @param groupId          Group ID to delete.
      * @param onDeleteListener event handler The event handler will have headerOptionList.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
      */
     public void deleteGroup(String groupId,
                             OnDeleteListener onDeleteListener) throws OcException {
@@ -244,55 +247,27 @@ public final class OcAccountManager {
                                      OnDeleteListener onDeleteListener) throws OcException;
 
     /**
-     * Method to join the group on account server
+     * Method to get infomation of all your group from account server.
      *
-     * @param groupId        Group ID to join
-     * @param onPostListener event handler The event handler will be invoked with a map of
-     *                       attribute name and values.
-     *
-     * @return Returns ::OC_STACK_OK if success
-     */
-    public void joinGroup(String groupId,
-                          OnPostListener onPostListener) throws OcException {
-        this.joinGroup0(groupId, onPostListener);
-    }
-
-    private native void joinGroup0(String groupId,
-                                   OnPostListener onPostListener) throws OcException;
-
-    /**
-     * Method to add devices to the group on account server
-     *
-     * @param groupId        Group ID to add devices.
-     * @param deviceId       List of devices to add.
-     * @param onPostListener event handler The event handler will be invoked with a map of
-     *                       attribute name and values.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * @param onGetListener  The event handler will be invoked with a map of attribute name and
+     *                       values. It will also have the result from this Get operation.
+     * @throws OcException if failure
      */
-    public void addDeviceToGroup(String groupId,
-                                 List<String> deviceId,
-                                 OnPostListener onPostListener) throws OcException {
-        this.addDeviceToGroup0(groupId, deviceId.toArray(new String[deviceId.size()]),
-                               onPostListener);
+    public void getGroupInfoAll(OnGetListener onGetListener) throws OcException {
+        this.getGroupInfoAll0(onGetListener);
     }
 
-    private native void addDeviceToGroup0(String groupId,
-                                          String[] deviceId,
-                                          OnPostListener onPostListener) throws OcException;
+    private native void getGroupInfoAll0(OnGetListener onGetListener) throws OcException;
 
     /**
-     * Method to get information of the group from account server
+     * Method to get information of the specific group from account server.
      *
      * @param groupId        Group ID to get information.
      * @param onGetListener  The event handler will be invoked with a map of attribute name and
-     *                       values. The event handler will also have the result from this Get
-     *                       operation This will have error codes
-     *
-     * @return Returns ::OC_STACK_OK if success
+     *                       values. It will also have the result from this Get operation.
+     * @throws OcException if failure
      */
-    public void getGroupInfo(String groupId,
-                             OnGetListener onGetListener) throws OcException {
+    public void getGroupInfo(String groupId, OnGetListener onGetListener) throws OcException {
         this.getGroupInfo0(groupId, onGetListener);
     }
 
@@ -300,80 +275,106 @@ public final class OcAccountManager {
                                       OnGetListener onGetListener) throws OcException;
 
     /**
-     * Method to leave the group joined on account server
-     *
-     * @param groupId          Group ID to leave.
-     * @param onDeleteListener event handler The event handler will have headerOptionList.
+     * Method to add values for properties to the group on account server.
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @param groupId        Group ID to add property values.
+     * @param propertyValue  OCRepresentation info that has pairs of property and value.
+     *                       Defined properties on the OCF spec are [members, masters, devices,
+     *                       resources, links] so far. (2016/10/19)
+     * @param onPostListener event handler The event handler will be invoked with a map of
+     *                       attribute name and values.
+     * @throws OcException if failure
      */
-    public void leaveGroup(String groupId,
-                           OnDeleteListener onDeleteListener) throws OcException {
-        this.leaveGroup0(groupId, onDeleteListener);
+    public void addPropertyValueToGroup(String groupId,
+                                        OcRepresentation propertyValue,
+                                        OnPostListener onPostListener) throws OcException {
+        this.addPropertyValueToGroup0(groupId, propertyValue, onPostListener);
     }
 
-    private native void leaveGroup0(String groupId,
-                                    OnDeleteListener onDeleteListener) throws OcException;
+    private native void addPropertyValueToGroup0(String groupId,
+                                                 OcRepresentation propertyValue,
+                                                 OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to delete devices from the group on account server
-     *
-     * @param groupId          Group ID to delete devices.
-     * @param deviceId         List of devices to delete.
-     * @param onDeleteListener event handler The event handler will have headerOptionList.
+     * Method to delete values for properties from the group on account server.
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @param groupId        Group ID to add property values.
+     * @param propertyValue  OCRepresentation info that has pairs of property and value.
+     *                       Defined properties on the OCF spec are [members, masters, devices,
+     *                       resources, links] so far. (2016/10/19)
+     * @param onPostListener event handler The event handler will be invoked with a map of
+     *                       attribute name and values.
+     * @throws OcException if failure
      */
-    public void deleteDeviceFromGroup(String groupId,
-                                      List<String> deviceId,
-                                      OnDeleteListener onDeleteListener) throws OcException {
-        this.deleteDeviceFromGroup0(groupId, deviceId.toArray(new String[deviceId.size()]),
-                                    onDeleteListener);
+    public void deletePropertyValueFromGroup(String groupId,
+                                             OcRepresentation propertyValue,
+                                             OnPostListener onPostListener) throws OcException {
+        this.deletePropertyValueFromGroup0(groupId, propertyValue, onPostListener);
     }
 
-    private native void deleteDeviceFromGroup0(String groupId,
-                                               String[] deviceId,
-                                               OnDeleteListener onDeleteListener) throws OcException;
+    private native void deletePropertyValueFromGroup0(String groupId,
+                                                      OcRepresentation propertyValue,
+                                                      OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to register observe to the group on account server
-     * User can receive a notify when the group get changed (eg. new user/device added)
-     *
-     * @param groupId             Group ID to observe.
-     * @param cloudConnectHandler Callback function that will get the result of the operation.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * Method to update values for properties on the group on account server.
+     * It completely replaces existing values for specific properties.
+     *
+     * @param groupId        Group ID to add property values.
+     * @param propertyValue  OCRepresentation info that has pairs of property and value.
+     *                       Defined properties on the OCF spec are [members, gname, owner,
+     *                       masters, devices, resources, latitude, longitude, radius,
+     *                       backgroundImage] so far. (2016/10/19)
+     * @param onPostListener event handler The event handler will be invoked with a map of
+     *                       attribute name and values.
+     * @throws OcException if failure
      */
-    public void observeGroup(String groupId,
-                             OnObserveListener onObserveListener) throws OcException {
-        this.observeGroup0(groupId, onObserveListener);
+    public void updatePropertyValueOnGroup(String groupId,
+                                           OcRepresentation propertyValue,
+                                           OnPostListener onPostListener) throws OcException {
+        this.updatePropertyValueOnGroup0(groupId, propertyValue, onPostListener);
     }
 
-    private native void observeGroup0(String groupId,
-                                      OnObserveListener onObserveListener) throws OcException;
+    private native void updatePropertyValueOnGroup0(String groupId,
+                                                    OcRepresentation propertyValue,
+                                                    OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to cancel observe to the group on account server
-     *
-     * @param groupId Group ID to observe.
+     * Method to register observe to group resource on account server.
+     * You can receive a notification when any value of property get changed in the group you
+     * joined.
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @param onObserveListener event handler The handler method will be invoked with a map
+     *                          of attribute name and values.
+     * @throws OcException if failure
      */
-    public void cancelObserveGroup(String groupId) throws OcException {
-        this.cancelObserveGroup0(groupId);
+    public void observeGroup(OnObserveListener onObserveListener) throws OcException {
+        this.observeGroup0(onObserveListener);
     }
 
-    private native void cancelObserveGroup0(String groupId) throws OcException;
+    private native void observeGroup0(OnObserveListener onObserveListener) throws OcException;
 
     /**
-     * Method to register observe to invitation resource on account server
-     * User can receive a invitation which is including group ID to join
-     * Once receive a invitation, user should call 'deleteInvitation' to delete a invitation
-     * on account server.
-     *
-     * @param cloudConnectHandler Callback function that will get the result of the operation.
+     * Method to cancel observe to group resource on account server.
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
+     */
+    public void cancelObserveGroup() throws OcException {
+        this.cancelObserveGroup0();
+    }
+
+    private native void cancelObserveGroup0() throws OcException;
+
+    /**
+     * Method to register observe to invitation resource on account server.
+     * You can receive a notification when you send or receive a invitation.
+     * Sending a invitation will be notified as 'invite' and Receiving will be as 'invited'.
+     * If you receive a invitation from other user, you should call 'replyToInvitation' to
+     * delete the invitation on account server, otherwise it will remain on the server.
+     *
+     * @param onObserveListener event handler The handler method will be invoked with a map
+     *                          of attribute name and values.
+     * @throws OcException if failure
      */
     public void observeInvitation(OnObserveListener onObserveListener) throws OcException {
         this.observeInvitation0(onObserveListener);
@@ -384,7 +385,7 @@ public final class OcAccountManager {
     /**
      * Method to cancel observe to invitation resource on account server
      *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
      */
     public void cancelObserveInvitation() throws OcException {
         this.cancelObserveInvitation0();
@@ -393,14 +394,13 @@ public final class OcAccountManager {
     private native void cancelObserveInvitation0() throws OcException;
 
     /**
-     * Method to send a invitation to invite a user into a group
+     * Method to send a invitation to invite a user into a group.
      *
      * @param groupId        Group ID for inviting.
      * @param userUuid       Identifier of the user to invite.
      * @param onPostListener event handler The event handler will be invoked with a map of
      *                       attribute name and values.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
      */
     public void sendInvitation(String groupId,
                                String userUuid,
@@ -413,13 +413,13 @@ public final class OcAccountManager {
                                         OnPostListener onPostListener) throws OcException;
 
     /**
-     * Method to cancel a invitation on account server that user has sent
+     * Method to cancel a invitation on account server you has sent before the invited user
+     * replies.
      *
      * @param groupId          Group ID to cancel a invitation.
      * @param userUuid         Identifier of the user to cancel a invitation.
      * @param onDeleteListener event handler The event handler will have headerOptionList.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
      */
     public void cancelInvitation(String groupId,
                                  String userUuid,
@@ -432,20 +432,24 @@ public final class OcAccountManager {
                                           OnDeleteListener onDeleteListener) throws OcException;
 
     /**
-     * Method to delete a invitation on account server that user has received
+     * Method to reply to the invitation that you has received.
+     * If you set accept as true, you will join the group as a member and the invitation will be
+     * deleted on account server. If false, only the invitation will be deleted.
      *
      * @param groupId          Group ID to delete a invitation.
+     * @param accept           boolean whether to join the group or not.
      * @param onDeleteListener event handler The event handler will have headerOptionList.
-     *
-     * @return Returns ::OC_STACK_OK if success
+     * @throws OcException if failure
      */
-    public void deleteInvitation(String groupId,
-                                 OnDeleteListener onDeleteListener) throws OcException {
-        this.deleteInvitation0(groupId, onDeleteListener);
+    public void replyToInvitation(String groupId,
+                                  boolean accept,
+                                  OnDeleteListener onDeleteListener) throws OcException {
+        this.replyToInvitation0(groupId, accept, onDeleteListener);
     }
 
-    private native void deleteInvitation0(String groupId,
-                                          OnDeleteListener onDeleteListener) throws OcException;
+    private native void replyToInvitation0(String groupId,
+                                           boolean accept,
+                                           OnDeleteListener onDeleteListener) throws OcException;
 
     /**
      * An OnGetListener can be registered via the resource get call.
index 3d21bb7..1365353 100644 (file)
@@ -46,7 +46,6 @@ import android.widget.Switch;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import org.iotivity.base.AclGroupType;
 import org.iotivity.base.EntityHandlerResult;
 import org.iotivity.base.ErrorCode;
 import org.iotivity.base.ModeType;
@@ -78,6 +77,7 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.regex.Pattern;
 
 /**
@@ -184,7 +184,7 @@ public class CloudFragment extends Fragment implements
     private void signOut() {
         try {
             msg("signOut");
-            mAccountManager.signOut(onSignOut);
+            mAccountManager.signOut(mAccessToken, onSignOut);
         } catch (OcException e) {
             e.printStackTrace();
         }
@@ -193,12 +193,25 @@ public class CloudFragment extends Fragment implements
     private void createGroup() {
         try {
             msg("createGroup");
-            mAccountManager.createGroup(AclGroupType.PUBLIC, onCreateGroup);
+            mAccountManager.createGroup(onCreateGroup);
         } catch (OcException e) {
             e.printStackTrace();
         }
     }
 
+    private void deleteGroup() {
+        if (mGroupId == null) {
+            msg("there is no any group");
+        } else {
+            try {
+                msg("deleteGroup");
+                mAccountManager.deleteGroup(mGroupId, onDeleteGroup);
+            } catch (OcException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
     private void inviteUser() {
         if (mGroupId == null) {
             msg("there is no any group");
@@ -207,19 +220,29 @@ public class CloudFragment extends Fragment implements
         }
     }
 
-    private void leaveGroup() {
-        try {
-            if (mGroupId == null) {
-                msg("there is no any group");
-            } else {
-                msg("leaveGroup");
-                mAccountManager.leaveGroup(mGroupId, onLeaveGroup);
-            }
-        } catch (OcException e) {
-            e.printStackTrace();
+    private void addPropertyValueToGroup() {
+        if (mGroupId == null) {
+            msg("there is no any group");
+        } else {
+            showPostPropertyValueToGroup(0);
         }
     }
 
+    private void deletePropertyValueFromGroup() {
+        if (mGroupId == null) {
+            msg("there is no any group");
+        } else {
+            showPostPropertyValueToGroup(1);
+        }
+    }
+
+    private void updatePropertyValueOnGroup() {
+        if (mGroupId == null) {
+            msg("there is no any group");
+        } else {
+            showPostPropertyValueToGroup(2);
+        }
+    }
     // FOR WEB-VIEW
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -281,8 +304,10 @@ public class CloudFragment extends Fragment implements
             try {
                 msg("observeInvitation");
                 mAccountManager.observeInvitation(onObserveInvitation);
+                msg("observeGroup");
+                mAccountManager.observeGroup(onObserveGroup);
                 msg("getGroupList");
-                mAccountManager.getGroupList(onGetGroupList);
+                mAccountManager.getGroupInfoAll(onGetGroupInfoAll);
             } catch (OcException e) {
                 Log.e(TAG, e.toString());
             }
@@ -319,20 +344,49 @@ public class CloudFragment extends Fragment implements
         }
     };
 
-    OcAccountManager.OnGetListener onGetGroupList = new OcAccountManager.OnGetListener() {
+    OcAccountManager.OnGetListener onGetGroupInfoAll = new OcAccountManager.OnGetListener() {
         @Override
         public void onGetCompleted(List<OcHeaderOption> list, OcRepresentation ocRepresentation) {
-            msg("getGroupList was successful");
+            msg("getGroupInfoAll was successful");
             try {
-                String[] gidlist = ocRepresentation.getValue("gidlist");
-                if (gidlist == null) {
+
+                OcRepresentation[] gidlist = ocRepresentation.getValue("groups");
+                if (gidlist == null || gidlist.length == 0) {
                     msg("\tgroup list is empty");
                     mGroupId = null;
                 } else {
                     msg("\tgroup list");
-                    for (String group : gidlist) {
-                        msg("\t\t" + group);
-                        mGroupId = group;
+
+                    for (OcRepresentation group : gidlist) {
+                        String gid = group.getValue("gid");
+                        String gname = group.getValue("gname");
+                        String owner = group.getValue("owner");
+
+                        msg("\t\t-GroupID : " + gid);
+                        msg("\t\t Group name : " + gname);
+                        msg("\t\t Owner : " + owner);
+
+                        String[] members = group.getValue("members");
+                        if (members != null && members.length != 0) {
+                            msg("\t\t members :");
+                            for (String member : members) {
+                                msg("\t\t\t" + member);
+                            }
+                        }
+
+                        String[] devices = group.getValue("devices");
+                        if (devices != null && devices.length != 0) {
+                            msg("\t\t devices");
+                            for (String device : devices) {
+                                msg("\t\t\t" + device);
+                            }
+                        }
+
+                        if (group.hasAttribute("parent")) {
+                            msg("\t\t parent group : " + group.getValue("parent"));
+                        }
+
+                        mGroupId = gid;
                     }
                     msg("\tcurrent group is " + mGroupId);
                 }
@@ -343,7 +397,31 @@ public class CloudFragment extends Fragment implements
 
         @Override
         public void onGetFailed(Throwable throwable) {
-            msg("Failed to getGroupList");
+            msg("Failed to getGroupInfoAll");
+            if (throwable instanceof OcException) {
+                OcException ocEx = (OcException) throwable;
+                Log.e(TAG, ocEx.toString());
+                ErrorCode errCode = ocEx.getErrorCode();
+                msg("Error code: " + errCode);
+            }
+        }
+    };
+
+    OcAccountManager.OnGetListener onGetGroupInfo = new OcAccountManager.OnGetListener() {
+        @Override
+        public void onGetCompleted(List<OcHeaderOption> list, OcRepresentation ocRepresentation) {
+            msg("getGroupInfo was successful");
+
+            Map<String, Object> valueMap = ocRepresentation.getValues();
+
+            for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
+                msg("\tproperty: " + entry.getKey() + " value: " + entry.getValue());
+            }
+        }
+
+        @Override
+        public void onGetFailed(Throwable throwable) {
+            msg("Failed to getGroupInfo");
             if (throwable instanceof OcException) {
                 OcException ocEx = (OcException) throwable;
                 Log.e(TAG, ocEx.toString());
@@ -365,7 +443,7 @@ public class CloudFragment extends Fragment implements
 
                             OcRepresentation[] sendInvitationList =
                                     ocRepresentation.getValue("invite");
-                            if (sendInvitationList != null) {
+                            if (sendInvitationList != null && sendInvitationList.length != 0) {
                                 msg("\tList of invitation that I sent");
                                 for (OcRepresentation invitation : sendInvitationList) {
                                     String gid = invitation.getValue("gid");
@@ -377,7 +455,7 @@ public class CloudFragment extends Fragment implements
 
                             OcRepresentation[] receiveInvitationList =
                                     ocRepresentation.getValue("invited");
-                            if (receiveInvitationList != null) {
+                            if (receiveInvitationList != null && receiveInvitationList.length != 0) {
                                 msg("\tList of invitation that I received");
                                 for (OcRepresentation invitation : receiveInvitationList) {
                                     String gid = invitation.getValue("gid");
@@ -391,7 +469,7 @@ public class CloudFragment extends Fragment implements
                         } else {
                             OcRepresentation[] sendInvitationList =
                                     ocRepresentation.getValue("invite");
-                            if (sendInvitationList != null) {
+                            if (sendInvitationList != null && sendInvitationList.length != 0) {
                                 msg("\tList of invitation that I sent");
                                 for (OcRepresentation invitation : sendInvitationList) {
                                     String gid = invitation.getValue("gid");
@@ -403,7 +481,7 @@ public class CloudFragment extends Fragment implements
 
                             OcRepresentation[] receivInvitationList =
                                     ocRepresentation.getValue("invited");
-                            if (receivInvitationList != null) {
+                            if (receivInvitationList != null && receivInvitationList.length != 0) {
                                 msg("\tList of invitation that I received");
                                 for (OcRepresentation invitation : receivInvitationList) {
                                     mGroupId = invitation.getValue("gid");
@@ -470,37 +548,24 @@ public class CloudFragment extends Fragment implements
         }
     };
 
-    OcAccountManager.OnPostListener onJoinGroup = new OcAccountManager.OnPostListener() {
+    OcAccountManager.OnDeleteListener onDeleteGroup = new OcAccountManager.OnDeleteListener() {
         @Override
-        public synchronized void onPostCompleted(List<OcHeaderOption> list,
-                                                 OcRepresentation ocRepresentation) {
-            msg("joinGroup was successful");
-            try {
-                msg("observeGroup");
-                mAccountManager.observeGroup(mGroupId, onObserveGroup);
-            } catch (OcException e) {
-                Log.e(TAG, e.toString());
-            }
+        public void onDeleteCompleted(List<OcHeaderOption> list) {
+            msg("deleteGroup was successful");
         }
 
         @Override
-        public synchronized void onPostFailed(Throwable throwable) {
-            msg("Failed to joinGroup");
-            if (throwable instanceof OcException) {
-                OcException ocEx = (OcException) throwable;
-                Log.e(TAG, ocEx.toString());
-                ErrorCode errCode = ocEx.getErrorCode();
-                msg("Error code: " + errCode);
-            }
+        public void onDeleteFailed(Throwable throwable) {
+            msg("Failed to deleteGroup");
         }
     };
 
-    OcAccountManager.OnDeleteListener onDeleteInvitation = new OcAccountManager.OnDeleteListener() {
+    OcAccountManager.OnDeleteListener onReplyToInvitation = new OcAccountManager.OnDeleteListener() {
         @Override
         public void onDeleteCompleted(List<OcHeaderOption> list) {
-            msg("deleteInvitation was successful");
+            msg("replyToInvitation was successful");
             try {
-                mAccountManager.getGroupList(onGetGroupList);
+                mAccountManager.getGroupInfoAll(onGetGroupInfoAll);
             } catch (OcException e) {
                 e.printStackTrace();
             }
@@ -553,8 +618,8 @@ public class CloudFragment extends Fragment implements
                 mGroupId = ocRepresentation.getValue("gid");
                 msg("\tgroupId: " + mGroupId);
 
-                msg("observeGroup");
-                mAccountManager.observeGroup(mGroupId, onObserveGroup);
+                msg("getGroupInfo");
+                mAccountManager.getGroupInfo(mGroupId, onGetGroupInfo);
             } catch (OcException e) {
                 Log.e(TAG, e.toString());
             }
@@ -590,7 +655,7 @@ public class CloudFragment extends Fragment implements
                     msg("\tGroupMasterID: " + gmid);
 
                     String[] midlist = ocRepresentation.getValue("midlist");
-                    if (midlist == null) {
+                    if (midlist == null || midlist.length == 0) {
                         msg("\tMember List is empty");
                     } else {
                         msg("\tMember List(" + midlist.length + ")");
@@ -600,7 +665,7 @@ public class CloudFragment extends Fragment implements
                     }
 
                     String[] dilist = ocRepresentation.getValue("dilist");
-                    if (dilist == null) {
+                    if (dilist == null || dilist.length == 0) {
                         msg("\tDevice List is empty");
                     } else {
                         msg("\tDevice List(" + dilist.length + ")");
@@ -626,16 +691,16 @@ public class CloudFragment extends Fragment implements
         }
     };
 
-    OcAccountManager.OnPostListener onSendInvitation = new OcAccountManager.OnPostListener() {
+    OcAccountManager.OnPostListener onPostPropertyValue = new OcAccountManager.OnPostListener() {
         @Override
         public synchronized void onPostCompleted(List<OcHeaderOption> list,
                                                  OcRepresentation ocRepresentation) {
-            msg("sendInvitation was successful");
+            msg("Post was successful (changed property value)");
         }
 
         @Override
         public synchronized void onPostFailed(Throwable throwable) {
-            msg("Failed to sendInvitation");
+            msg("Failed to Post (changed property value)");
             if (throwable instanceof OcException) {
                 OcException ocEx = (OcException) throwable;
                 Log.e(TAG, ocEx.toString());
@@ -645,21 +710,22 @@ public class CloudFragment extends Fragment implements
         }
     };
 
-    OcAccountManager.OnDeleteListener onLeaveGroup = new OcAccountManager.OnDeleteListener() {
+    OcAccountManager.OnPostListener onSendInvitation = new OcAccountManager.OnPostListener() {
         @Override
-        public void onDeleteCompleted(List<OcHeaderOption> list) {
-            msg("leaveGroup was successful");
-            try {
-                msg("getGroupList");
-                mAccountManager.getGroupList(onGetGroupList);
-            } catch (OcException e) {
-                e.printStackTrace();
-            }
+        public synchronized void onPostCompleted(List<OcHeaderOption> list,
+                                                 OcRepresentation ocRepresentation) {
+            msg("sendInvitation was successful");
         }
 
         @Override
-        public void onDeleteFailed(Throwable throwable) {
-            msg("Failed to leaveGroup");
+        public synchronized void onPostFailed(Throwable throwable) {
+            msg("Failed to sendInvitation");
+            if (throwable instanceof OcException) {
+                OcException ocEx = (OcException) throwable;
+                Log.e(TAG, ocEx.toString());
+                ErrorCode errCode = ocEx.getErrorCode();
+                msg("Error code: " + errCode);
+            }
         }
     };
 
@@ -1451,6 +1517,65 @@ public class CloudFragment extends Fragment implements
         alert.show();
     }
 
+
+    private void showPostPropertyValueToGroup(int operation) {
+        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
+        View inputView = layoutInflater.inflate(R.layout.input, null);
+        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mActivity);
+        alertDialogBuilder.setView(inputView);
+
+        final int op = operation;
+
+        final TextView textView = (TextView) inputView.getRootView().findViewById(R.id.inputView);
+        final EditText editText = (EditText) inputView.getRootView().findViewById(R.id.inputText);
+        final TextView textView2 = (TextView) inputView.getRootView().findViewById(R.id.inputView2);
+        final EditText editText2 = (EditText) inputView.getRootView().findViewById(R.id.inputText2);
+
+        textView.setText("Please enter property.");
+        textView2.setText("Please enter value(String Array).");
+        textView2.setVisibility(View.VISIBLE);
+        editText2.setVisibility(View.VISIBLE);
+
+
+        alertDialogBuilder
+                .setCancelable(true)
+                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        if (editText.getText().length() != 0 && editText2.getText().length() != 0){
+                            final String property = editText.getText().toString();
+                            final String value = editText2.getText().toString();
+                            String[] values = {value};
+
+                            try {
+                                OcRepresentation propertyValue = new OcRepresentation();
+                                propertyValue.setValue(property, values);
+
+                                if (op == 0) {
+                                    msg("addPropertyValueToGroup");
+                                    mAccountManager.addPropertyValueToGroup(mGroupId, propertyValue, onPostPropertyValue);
+                                } else if (op == 1){
+                                    msg("deletePropertyValueFromGroup");
+                                    mAccountManager.deletePropertyValueFromGroup(mGroupId, propertyValue, onPostPropertyValue);
+                                } else if (op == 2){
+                                    msg("updatePropertyValueOnGroup");
+                                    mAccountManager.updatePropertyValueOnGroup(mGroupId, propertyValue, onPostPropertyValue);
+                                }
+                            } catch (OcException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+                })
+                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        dialog.cancel();
+                    }
+                });
+
+        AlertDialog alert = alertDialogBuilder.create();
+        alert.show();
+    }
+
     private void showInviteMsg(String userID) {
 
         AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mActivity);
@@ -1466,10 +1591,8 @@ public class CloudFragment extends Fragment implements
                 .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface dialog, int id) {
                         try {
-                            msg("joinGroup");
-                            mAccountManager.joinGroup(mGroupId, onJoinGroup);
-                            msg("deleteInvitation");
-                            mAccountManager.deleteInvitation(mGroupId, onDeleteInvitation);
+                            msg("replyToInvitation (accept:yes)");
+                            mAccountManager.replyToInvitation(mGroupId, true, onReplyToInvitation);
                         } catch (OcException e) {
                             e.printStackTrace();
                         }
@@ -1479,9 +1602,8 @@ public class CloudFragment extends Fragment implements
                     public void onClick(DialogInterface dialog, int id) {
                         dialog.cancel();
                         try {
-                            msg("gid: " + mGroupId);
-                            msg("deleteInvitation");
-                            mAccountManager.deleteInvitation(mGroupId, onDeleteInvitation);
+                            msg("replyToInvitation (accept:no)");
+                            mAccountManager.replyToInvitation(mGroupId, false, onReplyToInvitation);
                         } catch (OcException e) {
                             e.printStackTrace();
                         }
@@ -1533,7 +1655,8 @@ public class CloudFragment extends Fragment implements
         int viewID = view.getId();
         if (mAccountManager == null && (viewID == R.id.signin_button
                 || viewID == R.id.signout_button || viewID == R.id.creategroup_button
-                || viewID == R.id.invite_button || viewID == R.id.leavegroup_button)) {
+                || viewID == R.id.invite_button || viewID == R.id.addpropertyvalue_button
+                || viewID == R.id.deletepropertyvalue_button || viewID == R.id.updatepropertyvalue_button)) {
             mActionLog.append("Do 'SignUp' first" + EOL);
             return;
         }
@@ -1560,13 +1683,25 @@ public class CloudFragment extends Fragment implements
                 mActionLog.append("Create Group" + EOL);
                 createGroup();
                 break;
+            case R.id.deletegroup_button:
+                mActionLog.append("Delete Group" + EOL);
+                deleteGroup();
+                break;
             case R.id.invite_button:
                 mActionLog.append("Invite User" + EOL);
                 inviteUser();
                 break;
-            case R.id.leavegroup_button:
-                mActionLog.append("Leave Group" + EOL);
-                leaveGroup();
+            case R.id.addpropertyvalue_button:
+                mActionLog.append("Add Property Value To Group" + EOL);
+                addPropertyValueToGroup();
+                break;
+            case R.id.deletepropertyvalue_button:
+                mActionLog.append("Delete Property Value From Group" + EOL);
+                deletePropertyValueFromGroup();
+                break;
+            case R.id.updatepropertyvalue_button:
+                mActionLog.append("Update Property Value On Group" + EOL);
+                updatePropertyValueOnGroup();
                 break;
 
             // RD
@@ -1652,14 +1787,18 @@ public class CloudFragment extends Fragment implements
         Button signOutButton = (Button) rootView.findViewById(R.id.signout_button);
         Button createGroupButton = (Button) rootView.findViewById(R.id.creategroup_button);
         Button inviteButton = (Button) rootView.findViewById(R.id.invite_button);
-        Button leaveGroupButton = (Button) rootView.findViewById(R.id.leavegroup_button);
+        Button addValueToGroup = (Button) rootView.findViewById(R.id.addpropertyvalue_button);
+        Button deleteValueFromGroup = (Button) rootView.findViewById(R.id.deletepropertyvalue_button);
+        Button updateValueOnGroup = (Button) rootView.findViewById(R.id.updatepropertyvalue_button);
         setIPButton.setOnClickListener(this);
         signUpButton.setOnClickListener(this);
         signInButton.setOnClickListener(this);
         signOutButton.setOnClickListener(this);
         createGroupButton.setOnClickListener(this);
         inviteButton.setOnClickListener(this);
-        leaveGroupButton.setOnClickListener(this);
+        addValueToGroup.setOnClickListener(this);
+        deleteValueFromGroup.setOnClickListener(this);
+        updateValueOnGroup.setOnClickListener(this);
 
         Button rdPubButton = (Button) rootView.findViewById(R.id.rdpub_button);
         Button rdDelButton = (Button) rootView.findViewById(R.id.rddel_button);
index 6610566..b53f873 100644 (file)
                     android:text="CREATE\nGROUP" />
 
                 <Button
+                    android:id="@+id/deletegroup_button"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="DELETE\nGROUP" />
+
+                <Button
                     android:id="@+id/invite_button"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:text="INVITE\nUSER" />
 
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_horizontal"
+                android:layout_marginBottom="2dp"
+                android:gravity="center_horizontal"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/addpropertyvalue_button"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="ADD VALUE\nTO GROUP" />
+
+                <Button
+                    android:id="@+id/deletepropertyvalue_button"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="DELETE VALUE\nFROM GROUP" />
+
                 <Button
-                    android:id="@+id/leavegroup_button"
+                    android:id="@+id/updatepropertyvalue_button"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
-                    android:text="LEAVE\nGROUP" />
+                    android:text="UPDATE VALUE\nON GROUP" />
             </LinearLayout>
         </LinearLayout>
 
index 8b0b553..48aef9a 100755 (executable)
         android:layout_height="wrap_content"
         android:padding="@dimen/activity_vertical_margin" />
 
+    <TextView
+        android:id="@+id/inputView2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="Input Server IP and Port"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:visibility="gone" />
+
+    <EditText
+        android:id="@+id/inputText2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/activity_vertical_margin"
+        android:visibility="gone" />
+
     <CheckBox
         android:id="@+id/secured"
         android:layout_width="match_parent"
index ec85e5e..a05a4c6 100644 (file)
@@ -217,21 +217,20 @@ int main(int argc, char *argv[])
     cout << "     2 - searchUser using email" << endl;
     cout << "     3 - searchUser using phone" << endl;
     cout << "     4 - deleteDevice" << endl;
-    cout << "     5 - createGroup" << endl;
-    cout << "     6 - observeGroup" << endl;
-    cout << "     7 - getGroupList" << endl;
-    cout << "     8 - deleteGroup" << endl;
-    cout << "     9 - joinGroup" << endl;
-    cout << "    10 - addDeviceToGroup" << endl;
-    cout << "    11 - getGroupInfo" << endl;
-    cout << "    12 - leaveGroup" << endl;
-    cout << "    13 - deleteDeviceFromGroup" << endl;
-    cout << "    14 - observeInvitation" << endl;
-    cout << "    15 - sendInvitation" << endl;
-    cout << "    16 - cancelInvitation" << endl;
-    cout << "    17 - deleteInvitation" << endl;
-    cout << "    18 - cancelObserveGroup" << endl;
-    cout << "    19 - cancelObserveInvitation" << endl;
+    cout << "     5 - observeGroup" << endl;
+    cout << "     6 - createGroup" << endl;
+    cout << "     7 - deleteGroup" << endl;
+    cout << "     8 - getGroupInfoAll" << endl;
+    cout << "     9 - getGroupInfo" << endl;
+    cout << "    10 - addPropertyValueToGroup" << endl;
+    cout << "    11 - deletePropertyValueFromGroup" << endl;
+    cout << "    12 - updatePropertyValueOnGroup" << endl;
+    cout << "    13 - observeInvitation" << endl;
+    cout << "    14 - sendInvitation" << endl;
+    cout << "    15 - cancelInvitation" << endl;
+    cout << "    16 - deleteInvitation" << endl;
+    cout << "    17 - cancelObserveGroup" << endl;
+    cout << "    18 - cancelObserveInvitation" << endl;
     cout << "    20 - exit" << endl;
 
     string cmd;
@@ -247,134 +246,196 @@ int main(int argc, char *argv[])
             OCRepresentation rep;
 
             switch (atoi(cmd.c_str()))
+        {
+            case 1:
+                cout << "Put userUUID to search:" << endl;
+                cin >> cmd;
+                result = accountMgr->searchUser(cmd, &ocPost);
+                break;
+
+            case 2:
+                cout << "Put email to search:" << endl;
+                cin >> cmd;
+                query["email"] = cmd;
+                result = accountMgr->searchUser(query, &ocPost);
+                break;
+
+            case 3:
+                cout << "Put phone number to search:" << endl;
+                cin >> cmd;
+                query["phone"] = cmd;
+                result = accountMgr->searchUser(query, &ocPost);
+                break;
+
+            case 4:
             {
-                case 1:
-                    cout << "Put userUUID to search:" << endl;
-                    cin >> cmd;
-                    result = accountMgr->searchUser(cmd, &ocPost);
-                    break;
+                string accessToken, deviceId;
 
-                case 2:
-                    cout << "Put email to search:" << endl;
-                    cin >> cmd;
-                    query["email"] = cmd;
-                    result = accountMgr->searchUser(query, &ocPost);
-                    break;
+                cout << "PUT accessToken:";
+                cin >> accessToken;
 
-                case 3:
-                    cout << "Put phone number to search:" << endl;
-                    cin >> cmd;
-                    query["phone"] = cmd;
-                    result = accountMgr->searchUser(query, &ocPost);
-                    break;
+                cout << "PUT deviceID to delete:";
+                cin >> deviceId;
 
-                case 4:
-                    cout << "PUT deviceID to delete:";
-                    cin >> cmd;
-                    result = accountMgr->deleteDevice(cmd, &onDelete);
-                    break;
+                result = accountMgr->deleteDevice(accessToken, deviceId, &onDelete);
+                break;
+            }
 
-                case 5:
-                    result = accountMgr->createGroup(OC::AclGroupType::PUBLIC, &ocPost);
-                    break;
+            case 5:
+                result = accountMgr->observeGroup(&onObserve);
+                break;
 
-                case 6:
-                    cout << "PUT groupId to observe:";
-                    cin >> cmd;
-                    result = accountMgr->observeGroup(cmd, &onObserve);
-                    break;
+            case 6:
+                result = accountMgr->createGroup(&ocPost);
+                break;
 
-                case 7:
-                    result = accountMgr->getGroupList(&ocPost);
-                    break;
+            case 7:
+                cout << "PUT groupId to delete:";
+                cin >> cmd;
+                result = accountMgr->deleteGroup(cmd, &onDelete);
+                break;
 
-                case 8:
-                    cout << "PUT groupId to delete:";
-                    cin >> cmd;
-                    result = accountMgr->deleteGroup(cmd, &onDelete);
-                    break;
+            case 8:
+                result = accountMgr->getGroupInfoAll(&ocPost);
+                break;
 
-                case 9:
-                    cout << "PUT groupId to join:";
-                    cin >> cmd;
-                    result = accountMgr->joinGroup(cmd, &ocPost);
-                    break;
+            case 9:
+                cout << "PUT groupId to get info:";
+                cin >> cmd;
+                result = accountMgr->getGroupInfo(cmd, &ocPost);
+                break;
 
-                case 10:
-                    cout << "PUT groupId to add device:";
-                    cin >> cmd;
-                    cout << "PUT deviceId to add to group:";
-                    cin >> cmd2;
-                    {
-                        vector<string> deviceIds;
-                        deviceIds.push_back(cmd2);
-                        result = accountMgr->addDeviceToGroup(cmd, deviceIds, &ocPost);
-                    }
-                    break;
+            case 10:
+            {
+                string groupId, property, value;
+                vector<string> values;
+                OCRepresentation propertyValue;
 
-                case 11:
-                    cout << "PUT groupId to get info:";
-                    cin >> cmd;
-                    result = accountMgr->getGroupInfo(cmd, &ocPost);
-                    break;
+                cout << "PUT groupId to add property values:";
+                cin >> groupId;
 
-                case 12:
-                    cout << "PUT groupId to leave:";
-                    cin >> cmd;
-                    result = accountMgr->leaveGroup(cmd, &onDelete);
-                    break;
+                cout << "PUT property name:";
+                cin >> property;
 
-                case 13:
-                    cout << "PUT groupId to remove device:";
-                    cin >> cmd;
-                    cout << "PUT deviceId to remove from group:";
-                    cin >> cmd2;
-                    {
-                        vector<string> deviceIds;
-                        deviceIds.push_back(cmd2);
-                        result = accountMgr->deleteDeviceFromGroup(cmd, deviceIds, &onDelete);
-                    }
-                    break;
+                cout << "PUT value:";
+                cin >> value;
 
-                case 14:
-                    result = accountMgr->observeInvitation(&onObserve);
-                    break;
+                values.push_back(value);
+                propertyValue.setValue<vector<string>>(property, values);
 
-                case 15:
-                    cout << "PUT groupId to invite:";
-                    cin >> cmd;
-                    cout << "PUT userUUID to invite:";
-                    cin >> cmd2;
-                    result = accountMgr->sendInvitation(cmd, cmd2, &ocPost);
-                    break;
+                accountMgr->addPropertyValueToGroup(groupId, propertyValue, &ocPost);
+                break;
+            }
 
-                case 16:
-                    cout << "PUT groupId to cancel invitation:";
-                    cin >> cmd;
-                    cout << "PUT userUUID to cancel invitation:";
-                    cin >> cmd2;
-                    result = accountMgr->cancelInvitation(cmd, cmd2, &onDelete);
-                    break;
+            case 11:
+            {
+                string groupId, property, value;
+                vector<string> values;
+                OCRepresentation propertyValue;
 
-                case 17:
-                    cout << "PUT groupId to delete invitation:";
-                    cin >> cmd;
-                    result = accountMgr->deleteInvitation(cmd, &onDelete);
-                    break;
+                cout << "PUT groupId to delete property values:";
+                cin >> groupId;
 
-                case 18:
-                    cout << "PUT groupId to cancel observe:";
-                    cin >> cmd;
-                    result = accountMgr->cancelObserveGroup(cmd);
-                    break;
+                cout << "PUT property name:";
+                cin >> property;
 
-                case 19:
-                    result = accountMgr->cancelObserveInvitation();
-                    break;
+                cout << "PUT value:";
+                cin >> value;
+
+                values.push_back(value);
+                propertyValue.setValue<vector<string>>(property, values);
+
+                accountMgr->deletePropertyValueFromGroup(groupId, propertyValue, &ocPost);
+                break;
+            }
 
-                case 20:
-                    goto exit;
+            case 12:
+            {
+                string groupId, property, value;
+                OCRepresentation propertyValue;
+
+                cout << "PUT groupId to update property values:";
+                cin >> groupId;
+
+                cout << "PUT property name:";
+                cin >> property;
+
+                int type;
+                cout << "PUT value type(1:string / 2:array):";
+                cin >> type;
+
+                cout << "PUT value:";
+                cin >> value;
+
+                if (1 == type)
+                {
+                    propertyValue.setValue<string>(property, value);
+                }
+                else if (2 == type)
+                {
+                    vector<string> values;
+                    values.push_back(value);
+                    propertyValue.setValue<vector<string>>(property, values);
+                }
+                else
+                {
                     break;
+                }
+
+                accountMgr->updatePropertyValueOnGroup(groupId, propertyValue, &ocPost);
+                break;
+            }
+
+            case 13:
+                result = accountMgr->observeInvitation(&onObserve);
+                break;
+
+            case 14:
+                cout << "PUT groupId to invite:";
+                cin >> cmd;
+                cout << "PUT userUUID to invite:";
+                cin >> cmd2;
+                result = accountMgr->sendInvitation(cmd, cmd2, &ocPost);
+                break;
+
+            case 15:
+                cout << "PUT groupId to cancel invitation:";
+                cin >> cmd;
+                cout << "PUT userUUID to cancel invitation:";
+                cin >> cmd2;
+                result = accountMgr->cancelInvitation(cmd, cmd2, &onDelete);
+                break;
+
+            case 16:
+                cout << "PUT groupId to reply to invitation:";
+                cin >> cmd;
+                cout << "accept to invitation? (1:yes)";
+                cin >> cmd2;
+
+                if (cmd2 == "1")
+                {
+                    result = accountMgr->replyToInvitation(cmd, true, &onDelete);
+                }
+                else
+                {
+                    result = accountMgr->replyToInvitation(cmd, false, &onDelete);
+                }
+                break;
+
+            case 17:
+                result = accountMgr->cancelObserveGroup();
+                break;
+
+            case 18:
+                result = accountMgr->cancelObserveInvitation();
+                break;
+
+            case 20:
+                goto exit;
+                break;
+
+            default:
+                break;
             }
 
             if (result != OC_STACK_OK)
index 0eff3e2..02c223c 100644 (file)
@@ -384,6 +384,7 @@ int main(int argc, char **argv)
     RDClient::Instance().publishResourceToRD(g_host, OCConnectivityType::CT_ADAPTER_TCP, resourceHandles,
             &onPublish);
     g_callbackLock.wait(lock);
+/* TODO: need to modify the below according to the OCAccountManager API changed.
     if (g_option == "owner")
     {
         cout << "Creating group" << endl;
@@ -425,6 +426,6 @@ int main(int argc, char **argv)
 
         cin >> cmd;
     }
-
+*/
     return 0;
 }
index 5338a2e..10ff8a8 100644 (file)
@@ -417,32 +417,32 @@ extern "C" {
 /** Defines user UUID. */
 #define OC_RSRVD_USER_UUID                 "uid"
 
-/** Defines user ID. */
-#define OC_RSRVD_USER_ID                   "userid"
-
 /** Defines group ID. */
 #define OC_RSRVD_GROUP_ID                  "gid"
 
-/** Defines group Master ID. */
-#define OC_RSRVD_GROUP_MASTER_ID           "gmid"
-
-/** Defines group type. */
-#define OC_RSRVD_GROUP_TYPE                "gtype"
-
 /** Defines member of group ID. */
 #define OC_RSRVD_MEMBER_ID                 "mid"
 
-/** Defines device ID list. */
-#define OC_RSRVD_DEVICE_ID_LIST            "dilist"
+/** Defines invite. */
+#define OC_RSRVD_INVITE                    "invite"
+
+/** Defines accept. */
+#define OC_RSRVD_ACCEPT                    "accept"
 
-/** Defines public. */
-#define OC_RSRVD_PUBLIC                    "Public"
+/** Defines operation. */
+#define OC_RSRVD_OPERATION                 "op"
 
-/** Defines private. */
-#define OC_RSRVD_PRIVATE                   "Private"
+/** Defines add. */
+#define OC_RSRVD_ADD                       "add"
 
-/** Defines invite. */
-#define OC_RSRVD_INVITE                    "invite"
+/** Defines delete. */
+#define OC_RSRVD_DELETE                    "delete"
+
+/** Defines owner. */
+#define OC_RSRVD_OWNER                     "owner"
+
+/** Defines members. */
+#define OC_RSRVD_MEMBERS                   "members"
 
 /** To represent grant type with refresh token. */
 #define OC_RSRVD_GRANT_TYPE_REFRESH_TOKEN  "refresh_token"
index 65ea576..c1fb10c 100644 (file)
@@ -44,21 +44,21 @@ namespace OC
         virtual ~OCAccountManager(void);
 
         /**
-        * Function to get the host address of account server
+        * Function to get the host address of account server.
         *
         * @return std::string host address
         */
         std::string host() const;
 
         /**
-        * Function to get the connectivity type for account server
+        * Function to get the connectivity type for account server.
         *
         * @return enum connectivity type (flags and adapter)
         */
         OCConnectivityType connectivityType() const;
 
         /**
-         * Function for account registration to account server
+         * Function for account registration to account server.
          *
          * @param authProvider Provider name used for authentication.
          * @param authCode The authorization code obtained by using an authorization server
@@ -88,7 +88,7 @@ namespace OC
                              PostCallback cloudConnectHandler);
 
         /**
-         * Function for sign-in to account server
+         * Function for sign-in to account server.
          *
          * @param userUuid Identifier of the user obtained by account registration.
          * @param accessToken Identifier of the resource obtained by account registration.
@@ -101,16 +101,18 @@ namespace OC
                              PostCallback cloudConnectHandler);
 
         /**
-         * Function for sign-out to account server
+         * Function for sign-out to account server.
          *
+         * @param accessToken Identifier of the resource obtained by account registration.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult signOut(PostCallback cloudConnectHandler);
+        OCStackResult signOut(const std::string& accessToken,
+                              PostCallback cloudConnectHandler);
 
         /**
-         * Function for refresh access token to account server
+         * Function for refresh access token to account server.
          *
          * @param userUuid Identifier of the user obtained by account registration.
          * @param refreshToken Refresh token used for access token refresh.
@@ -123,7 +125,7 @@ namespace OC
                                          PostCallback cloudConnectHandler);
 
         /**
-         * Function to get information of the user to account server
+         * Function to get information of the user to account server.
          *
          * @param userUuid Identifier of the user to get information.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
@@ -136,8 +138,8 @@ namespace OC
         /**
          * Overload
          *
-         * @param queryParams Map which can have the query key and value for specific users.
-         *                    account server can response information of more than one user.
+         * @param queryParams Map that has a query key and value for specific users.
+         *                    Account server can response information of more than one user.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
@@ -146,38 +148,42 @@ namespace OC
                                  GetCallback cloudConnectHandler);
 
         /**
-         * Function to delete the device registered on the account signed-in
+         * Function to delete the device registered on the account signed-in.
          *
+         * @param accessToken Identifier of the resource obtained by account registration.
          * @param deviceId Device ID to delete.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult deleteDevice(const std::string& deviceId,
+        OCStackResult deleteDevice(const std::string& accessToken,
+                                   const std::string& deviceId,
                                    DeleteCallback cloudConnectHandler);
 
         /**
-         * Function to create a group on account server
+         * Function to create a group on account server.
          *
-         * @param groupType Group type that can be used for referencing default group ACL creation.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult createGroup(AclGroupType groupType,
-                                  PostCallback cloudConnectHandler);
+        OCStackResult createGroup(PostCallback cloudConnectHandler);
 
         /**
-         * Function to get a list of groups joined from account server
+         * Overload
          *
+         * @param queryParams Map that has optional properties and values to create a group.
+         *                    Defined properties on the OCF spec are [gname, parent] so far.
+         *                    (2016/10/19)
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult getGroupList(GetCallback cloudConnectHandler);
+        OCStackResult createGroup(const QueryParamsMap& queryParams,
+                                  PostCallback cloudConnectHandler);
 
         /**
-         * Function to delete the group from account server
+         * Function to delete the group from account server.
          *
          * @param groupId Group ID to delete.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
@@ -188,90 +194,96 @@ namespace OC
                                   DeleteCallback cloudConnectHandler);
 
         /**
-         * Function to join the group on account server
+         * Function to get infomation of all your group from account server.
          *
-         * @param groupId Group ID to join
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult joinGroup(const std::string& groupId,
-                                PostCallback cloudConnectHandler);
+
+        OCStackResult getGroupInfoAll(GetCallback cloudConnectHandler);
 
         /**
-         * Function to add devices to the group on account server
+         * Function to get information of the specific group from account server.
          *
-         * @param groupId Group ID to add devices.
-         * @param deviceId List of devices to add.
+         * @param groupId Group ID to get information.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult addDeviceToGroup(const std::string& groupId,
-                                       const std::vector<std::string>& deviceId,
-                                       PostCallback cloudConnectHandler);
+        OCStackResult getGroupInfo(const std::string& groupId,
+                                   GetCallback cloudConnectHandler);
 
         /**
-         * Function to get information of the group from account server
+         * Function to add values for properties to the group on account server.
          *
-         * @param groupId Group ID to get information.
+         * @param groupId Group ID to add property values.
+         * @param propertyValue OCRepresentation info that has pairs of property and value.
+         *                      Defined properties on the OCF spec are [members, masters, devices,
+         *                      resources, links] so far. (2016/10/19)
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult getGroupInfo(const std::string& groupId,
-                                   GetCallback cloudConnectHandler);
+        OCStackResult addPropertyValueToGroup(const std::string& groupId,
+                                              const OCRepresentation propertyValue,
+                                              PostCallback cloudConnectHandler);
 
         /**
-         * Function to leave the group joined on account server
+         * Function to delete values for properties from the group on account server.
          *
-         * @param groupId Group ID to leave.
+         * @param groupId Group ID to delete information.
+         * @param propertyValue OCRepresentation info that has pairs of property and value.
+         *                      Defined properties on the OCF spec are [members, masters, devices,
+         *                      resources, links] so far. (2016/10/19)
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult leaveGroup(const std::string& groupId,
-                                 DeleteCallback cloudConnectHandler);
+        OCStackResult deletePropertyValueFromGroup(const std::string& groupId,
+                                                   const OCRepresentation propertyValue,
+                                                   PostCallback cloudConnectHandler);
 
         /**
-         * Function to delete devices from the group on account server
+         * Function to update values for properties on the group on account server.
+         * It completely replaces existing values for specific properties.
          *
-         * @param groupId Group ID to delete devices.
-         * @param deviceId List of devices to delete.
+         * @param groupId Group ID to add devices.
+         * @param propertyValue OCRepresentation info that has pairs of property and value.
+         *                      Defined properties on the OCF spec are [members, gname, owner,
+         *                      masters, devices, resources, latitude, longitude, radius,
+         *                      backgroundImage] so far. (2016/10/19)
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult deleteDeviceFromGroup(const std::string& groupId,
-                                            const std::vector<std::string>& deviceId,
-                                            DeleteCallback cloudConnectHandler);
+        OCStackResult updatePropertyValueOnGroup(const std::string& groupId,
+                                                 const OCRepresentation propertyValue,
+                                                 PostCallback cloudConnectHandler);
 
         /**
-         * Function to register observe to the group on account server
-         * User can receive a notify when the group get changed (eg. new user/device added)
+         * Function to register observe to group resource on account server.
+         * You can receive a notify when any value of property get changed in the group you joined.
          *
-         * @param groupId Group ID to observe.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult observeGroup(const std::string& groupId,
-                                   ObserveCallback cloudConnectHandler);
+        OCStackResult observeGroup(ObserveCallback cloudConnectHandler);
 
         /**
-         * Function to cancel observe to the group on account server
-         *
-         * @param groupId Group ID to observe.
+         * Function to cancel observe to group resource on account server.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult cancelObserveGroup(const std::string& groupId);
+        OCStackResult cancelObserveGroup();
 
         /**
-         * Function to register observe to invitation resource on account server
-         * User can receive a invitation which is including group ID to join
-         * Once receive a invitation, user should call 'deleteInvitation' to delete a invitation
-         * on account server.
+         * Function to register observe to invitation resource on account server.
+         * You can receive a notify when you send or receive a invitation.
+         * Sending a invitation will be notified as 'invite' and Receiving will be as 'invited'.
+         * If you receive a invitation from other user, you should call 'replyToInvitation' to
+         * delete the invitation on account server, otherwise it will remain on the server.
          *
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
@@ -280,14 +292,14 @@ namespace OC
         OCStackResult observeInvitation(ObserveCallback cloudConnectHandler);
 
         /**
-         * Function to cancel observe to invitation resource on account server
+         * Function to cancel observe to invitation resource on account server.
          *
          * @return Returns ::OC_STACK_OK if success
          */
         OCStackResult cancelObserveInvitation();
 
         /**
-         * Function to send a invitation to invite a user into a group
+         * Function to send a invitation to invite a user into a group.
          *
          * @param groupId Group ID for inviting.
          * @param userUuid Identifier of the user to invite.
@@ -300,7 +312,8 @@ namespace OC
                                      PostCallback cloudConnectHandler);
 
         /**
-         * Function to cancel a invitation on account server that user has sent
+         * Function to cancel a invitation you has sent on account server before the invited user
+         * replies.
          *
          * @param groupId Group ID to cancel a invitation.
          * @param userUuid Identifier of the user to cancel a invitation.
@@ -313,22 +326,28 @@ namespace OC
                                        DeleteCallback cloudConnectHandler);
 
         /**
-         * Function to delete a invitation on account server that user has received
+         * Function to reply to the invitation that you has received.
+         * If you set accept as true, you will join the group as a member and the invitation
+         * will be deleted on account server.
+         * If false, only the invitation will be deleted.
          *
          * @param groupId Group ID to delete a invitation.
+         * @param accept boolean whether to join the group or not.
          * @param cloudConnectHandler Callback function that will get the result of the operation.
          *
          * @return Returns ::OC_STACK_OK if success
          */
-        OCStackResult deleteInvitation(const std::string& groupId,
-                                       DeleteCallback cloudConnectHandler);
+        OCStackResult replyToInvitation(const std::string& groupId,
+                                        const bool accept,
+                                        DeleteCallback cloudConnectHandler);
 
     private:
         std::weak_ptr<IClientWrapper> m_clientWrapper;
         std::string m_deviceID;
         std::string m_host;
+        std::string m_userUuid;
         OCDoHandle m_invitationObserveHandle;
-        mutable std::map<std::string, OCDoHandle> m_groupObserveHandles;
+        OCDoHandle m_groupObserveHandle;
         OCConnectivityType m_connType;
         QualityOfService m_defaultQos;
 
index 4ab5fdb..ff2d212 100644 (file)
@@ -213,13 +213,7 @@ namespace OC
         Observe,
         ObserveAll
     };
-#ifdef WITH_CLOUD
-    enum class AclGroupType
-    {
-        PUBLIC,
-        PRIVATE
-    };
-#endif
+
     // Typedef for list of resource handles.
     typedef std::vector<OCResourceHandle> ResourceHandles;
 
index 669917f..ad5c899 100644 (file)
 
 #include "ocstack.h"
 
+#define VERIFY_NON_EMPTY(arg, log_message, ret) \
+    if ((arg).empty()) \
+    { \
+        oclog() << log_message << std::flush; \
+        return result_guard(ret); \
+    } \
+
 namespace OC {
 
 using OC::result_guard;
@@ -31,8 +38,8 @@ using OC::checked_guard;
 OCAccountManager::OCAccountManager(std::weak_ptr<IClientWrapper> clientWrapper,
                                    const std::string& host,
                                    OCConnectivityType connectivityType)
- : m_clientWrapper(clientWrapper), m_host(host), m_connType(connectivityType),
-   m_invitationObserveHandle(nullptr)
+ : m_clientWrapper(clientWrapper), m_host(host), m_userUuid(""),
+   m_invitationObserveHandle(nullptr), m_groupObserveHandle(nullptr), m_connType(connectivityType)
 {
     if (m_host.empty() || m_clientWrapper.expired())
     {
@@ -47,7 +54,6 @@ OCAccountManager::OCAccountManager(std::weak_ptr<IClientWrapper> clientWrapper,
     }
 
     m_deviceID.append(di);
-    m_groupObserveHandles = {};
     checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetDefaultQos, m_defaultQos);
 }
 
@@ -77,17 +83,15 @@ OCStackResult OCAccountManager::signUp(const std::string& authProvider,
                                        const QueryParamsMap& options,
                                        PostCallback cloudConnectHandler)
 {
-    if (authProvider.empty() || authCode.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(authProvider, "authProvider cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(authCode, "authCode cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACCOUNT_URI;
 
     OCRepresentation rep;
-    rep.setValue(OC_RSRVD_DEVICE_ID, m_deviceID);
-    rep.setValue(OC_RSRVD_AUTHPROVIDER, authProvider);
-    rep.setValue(OC_RSRVD_AUTHCODE, authCode);
+    rep.setValue<std::string>(OC_RSRVD_DEVICE_ID, m_deviceID);
+    rep.setValue<std::string>(OC_RSRVD_AUTHPROVIDER, authProvider);
+    rep.setValue<std::string>(OC_RSRVD_AUTHCODE, authCode);
 
     if (!options.empty())
     {
@@ -106,17 +110,33 @@ OCStackResult OCAccountManager::signIn(const std::string& userUuid,
                                        const std::string& accessToken,
                                        PostCallback cloudConnectHandler)
 {
-    if (userUuid.empty() || accessToken.empty())
+    VERIFY_NON_EMPTY(userUuid, "userUuid cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(accessToken, "accessToken cannot be empty.", OC_STACK_INVALID_PARAM);
+
+    OCStackResult result = result_guard(signInOut(userUuid, accessToken, true,
+                                                  cloudConnectHandler));
+    if (OC_STACK_OK == result)
     {
-        return result_guard(OC_STACK_INVALID_PARAM);
+        m_userUuid = userUuid;
     }
 
-    return result_guard(signInOut(userUuid, accessToken, true, cloudConnectHandler));
+    return result;
 }
 
-OCStackResult OCAccountManager::signOut(PostCallback cloudConnectHandler)
+OCStackResult OCAccountManager::signOut(const std::string& accessToken,
+                                        PostCallback cloudConnectHandler)
 {
-    return result_guard(signInOut("", "", false, cloudConnectHandler));
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
+    VERIFY_NON_EMPTY(accessToken, "accessToken cannot be empty.", OC_STACK_INVALID_PARAM);
+
+    OCStackResult result = result_guard(signInOut(m_userUuid, accessToken, false,
+                                                  cloudConnectHandler));
+    if (OC_STACK_OK == result)
+    {
+        m_userUuid = "";
+    }
+
+    return result;
 }
 
 OCStackResult OCAccountManager::signInOut(const std::string& userUuid,
@@ -127,13 +147,14 @@ OCStackResult OCAccountManager::signInOut(const std::string& userUuid,
     std::string uri = m_host + OC_RSRVD_ACCOUNT_SESSION_URI;
 
     OCRepresentation rep;
+
     if (isSignIn)
     {
-        rep.setValue(OC_RSRVD_USER_UUID, userUuid);
-        rep.setValue(OC_RSRVD_DEVICE_ID, m_deviceID);
-        rep.setValue(OC_RSRVD_ACCESS_TOKEN, accessToken);
+        rep.setValue<std::string>(OC_RSRVD_USER_UUID, userUuid);
     }
-    rep.setValue(OC_RSRVD_LOGIN, isSignIn);
+    rep.setValue<std::string>(OC_RSRVD_DEVICE_ID, m_deviceID);
+    rep.setValue<std::string>(OC_RSRVD_ACCESS_TOKEN, accessToken);
+    rep.setValue<bool>(OC_RSRVD_LOGIN, isSignIn);
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          OCDevAddr(), uri, rep, QueryParamsMap(), HeaderOptions(),
@@ -144,18 +165,16 @@ OCStackResult OCAccountManager::refreshAccessToken(const std::string& userUuid,
                                                    const std::string& refreshToken,
                                                    PostCallback cloudConnectHandler)
 {
-    if (userUuid.empty() || refreshToken.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(userUuid, "userUuid cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(refreshToken, "refreshToken cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACCOUNT_TOKEN_REFRESH_URI;
 
     OCRepresentation rep;
-    rep.setValue(OC_RSRVD_USER_UUID, userUuid);
-    rep.setValue(OC_RSRVD_DEVICE_ID, m_deviceID);
-    rep.setValue(OC_RSRVD_GRANT_TYPE, std::string(OC_RSRVD_GRANT_TYPE_REFRESH_TOKEN));
-    rep.setValue(OC_RSRVD_REFRESH_TOKEN, refreshToken);
+    rep.setValue<std::string>(OC_RSRVD_USER_UUID, userUuid);
+    rep.setValue<std::string>(OC_RSRVD_DEVICE_ID, m_deviceID);
+    rep.setValue<std::string>(OC_RSRVD_GRANT_TYPE, std::string(OC_RSRVD_GRANT_TYPE_REFRESH_TOKEN));
+    rep.setValue<std::string>(OC_RSRVD_REFRESH_TOKEN, refreshToken);
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          OCDevAddr(), uri, rep, QueryParamsMap(), HeaderOptions(),
@@ -165,10 +184,7 @@ OCStackResult OCAccountManager::refreshAccessToken(const std::string& userUuid,
 OCStackResult OCAccountManager::searchUser(const std::string& userUuid,
                                            GetCallback cloudConnectHandler)
 {
-    if (userUuid.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(userUuid, "userUuid cannot be empty.", OC_STACK_INVALID_PARAM);
 
     return result_guard(searchUser(userUuid, QueryParamsMap(), cloudConnectHandler));
 }
@@ -176,10 +192,7 @@ OCStackResult OCAccountManager::searchUser(const std::string& userUuid,
 OCStackResult OCAccountManager::searchUser(const QueryParamsMap& queryParams,
                                            GetCallback cloudConnectHandler)
 {
-    if (queryParams.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(queryParams, "queryParams cannot be empty.", OC_STACK_INVALID_PARAM);
 
     return result_guard(searchUser("", queryParams, cloudConnectHandler));
 }
@@ -213,211 +226,176 @@ OCStackResult OCAccountManager::searchUser(const std::string& userUuid,
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::deleteDevice(const std::string& deviceId,
+OCStackResult OCAccountManager::deleteDevice(const std::string& accessToken,
+                                             const std::string& deviceId,
                                              DeleteCallback cloudConnectHandler)
 {
-    if (deviceId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(accessToken, "accessToken cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(deviceId, "deviceId cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACCOUNT_URI
-                      + "?" + OC_RSRVD_DEVICE_ID + "=" + deviceId;
+                      + "?" + OC_RSRVD_ACCESS_TOKEN + "=" + accessToken
+                      + ";" + OC_RSRVD_DEVICE_ID + "=" + deviceId;
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
                          OCDevAddr(), uri, HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::createGroup(AclGroupType groupType,
+OCStackResult OCAccountManager::createGroup(PostCallback cloudConnectHandler)
+{
+    return result_guard(createGroup(QueryParamsMap(), cloudConnectHandler));
+}
+
+OCStackResult OCAccountManager::createGroup(const QueryParamsMap& queryParams,
                                             PostCallback cloudConnectHandler)
 {
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
+
     std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI;
 
-    std::string gtype;
-    switch (groupType)
+    std::vector<std::string> members{m_userUuid};
+
+    OCRepresentation rep;
+    rep.setValue<std::string>(OC_RSRVD_OWNER, m_userUuid);
+    rep.setValue<std::vector<std::string>>(OC_RSRVD_MEMBERS, members);
+
+    if (!queryParams.empty())
     {
-        case AclGroupType::PUBLIC:
-            gtype = OC_RSRVD_PUBLIC;
-            break;
-        case AclGroupType::PRIVATE:
-            gtype = OC_RSRVD_PRIVATE;
-            break;
-        default:
-            return result_guard(OC_STACK_INVALID_PARAM);
+        for (auto iter : queryParams)
+        {
+            rep.setValue(iter.first, iter.second);
+        }
     }
-    OCRepresentation rep;
-    rep.setValue(OC_RSRVD_GROUP_TYPE, gtype);
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          OCDevAddr(), uri, rep, QueryParamsMap(), HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::getGroupList(GetCallback cloudConnectHandler)
-{
-    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI;
-
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
-                         OCDevAddr(), uri, QueryParamsMap(), HeaderOptions(),
-                         m_connType, cloudConnectHandler, m_defaultQos);
-}
-
 OCStackResult OCAccountManager::deleteGroup(const std::string& groupId,
                                             DeleteCallback cloudConnectHandler)
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
-    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI
-                      + "?" + OC_RSRVD_GROUP_ID + "=" + groupId;
+    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId
+                      + "?" + OC_RSRVD_OWNER + "=" + m_userUuid;
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
                          OCDevAddr(), uri, HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::joinGroup(const std::string& groupId,
-                                          PostCallback cloudConnectHandler)
-{
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
-
-    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
-
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
-                         OCDevAddr(), uri, OCRepresentation(), QueryParamsMap(), HeaderOptions(),
-                         m_connType, cloudConnectHandler, m_defaultQos);
-}
-
-OCStackResult OCAccountManager::addDeviceToGroup(const std::string& groupId,
-                                                 const std::vector<std::string>& deviceId,
-                                                 PostCallback cloudConnectHandler)
+OCStackResult OCAccountManager::getGroupInfoAll(GetCallback cloudConnectHandler)
 {
-    if (groupId.empty() || deviceId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
 
-    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
+    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI;
 
-    OCRepresentation rep;
-    rep.setValue<std::vector<std::string>>(std::string(OC_RSRVD_DEVICE_ID_LIST), deviceId);
+    QueryParamsMap query = {};
+    query.insert(std::make_pair(OC_RSRVD_MEMBERS, m_userUuid));
 
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
-                         OCDevAddr(), uri, rep, QueryParamsMap(), HeaderOptions(),
-                         m_connType, cloudConnectHandler, m_defaultQos);
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
+                         OCDevAddr(), uri, query, HeaderOptions(), m_connType,
+                         cloudConnectHandler, m_defaultQos);
 }
 
 OCStackResult OCAccountManager::getGroupInfo(const std::string& groupId,
                                              GetCallback cloudConnectHandler)
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
 
+    QueryParamsMap query = {};
+    query.insert(std::make_pair(OC_RSRVD_MEMBERS, m_userUuid));
+
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
-                         OCDevAddr(), uri, QueryParamsMap(), HeaderOptions(),
+                         OCDevAddr(), uri, query, HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::leaveGroup(const std::string& groupId,
-                                           DeleteCallback cloudConnectHandler)
+OCStackResult OCAccountManager::addPropertyValueToGroup(const std::string& groupId,
+                                                        const OCRepresentation propertyValue,
+                                                        PostCallback cloudConnectHandler)
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
 
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
-                         OCDevAddr(), uri, HeaderOptions(),
+    QueryParamsMap query = {};
+    query.insert(std::make_pair(OC_RSRVD_OPERATION, OC_RSRVD_ADD));
+
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
+                         OCDevAddr(), uri, propertyValue, query, HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::deleteDeviceFromGroup(const std::string& groupId,
-                                                      const std::vector<std::string>& deviceId,
-                                                      DeleteCallback cloudConnectHandler)
+OCStackResult OCAccountManager::deletePropertyValueFromGroup(const std::string& groupId,
+                                                             const OCRepresentation propertyValue,
+                                                             PostCallback cloudConnectHandler)
 {
-    if (groupId.empty() || deviceId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
 
+    QueryParamsMap query = {};
+    query.insert(std::make_pair(OC_RSRVD_OPERATION, OC_RSRVD_DELETE));
 
-    uri.append("?");
-    for (auto iter : deviceId)
-    {
-        uri.append((std::string)OC_RSRVD_DEVICE_ID_LIST + "=" + iter + ";");
-    }
-    uri.resize(uri.size() - 1);
-
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
-                         OCDevAddr(), uri, HeaderOptions(),
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
+                         OCDevAddr(), uri, propertyValue, query, HeaderOptions(),
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::observeGroup(const std::string& groupId,
-                                             ObserveCallback cloudConnectHandler)
+OCStackResult OCAccountManager::updatePropertyValueOnGroup(const std::string& groupId,
+                                                           const OCRepresentation propertyValue,
+                                                           PostCallback cloudConnectHandler)
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
 
-    OCDoHandle handle = nullptr;
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
+                         OCDevAddr(), uri, propertyValue, QueryParamsMap(), HeaderOptions(),
+                         m_connType, cloudConnectHandler, m_defaultQos);
+}
 
-    OCStackResult result = checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
-                                         ObserveType::Observe, &handle, OCDevAddr(), uri,
-                                         QueryParamsMap(), HeaderOptions(), cloudConnectHandler,
-                                         m_defaultQos);
+OCStackResult OCAccountManager::observeGroup(ObserveCallback cloudConnectHandler)
+{
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
 
-    if (OC_STACK_OK == result)
-    {
-        m_groupObserveHandles.insert(std::pair<std::string, OCDoHandle>(groupId, handle));
-    }
+    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI;
 
-    return result;
+    QueryParamsMap query = {};
+    query.insert(std::make_pair(OC_RSRVD_MEMBERS, m_userUuid));
 
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
+                         ObserveType::Observe, &m_groupObserveHandle, OCDevAddr(), uri,
+                         query, HeaderOptions(), cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::cancelObserveGroup(const std::string& groupId)
+OCStackResult OCAccountManager::cancelObserveGroup()
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
 
-    auto found = m_groupObserveHandles.find(groupId);
-    if (m_groupObserveHandles.end() == found)
+    if (nullptr == m_groupObserveHandle)
     {
+        oclog() << "observeGroup() has not been done." << std::flush;
         return result_guard(OC_STACK_INVALID_PARAM);
     }
 
-    OCDoHandle handle = found->second;
-
-    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
+    std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI
+                      + "?" + OC_RSRVD_MEMBERS + "=" + m_userUuid;
 
     OCStackResult result = checked_guard(m_clientWrapper.lock(),
-                                         &IClientWrapper::CancelObserveResource, handle,
-                                         (const char*)"", uri, HeaderOptions(), m_defaultQos);
-
+                                         &IClientWrapper::CancelObserveResource,
+                                         m_groupObserveHandle, (const char*)"", uri,
+                                         HeaderOptions(), m_defaultQos);
     if (OC_STACK_OK == result)
     {
-        m_groupObserveHandles.erase(groupId);
-        handle = nullptr;
+        m_groupObserveHandle = nullptr;
     }
 
     return result;
@@ -436,6 +414,7 @@ OCStackResult OCAccountManager::cancelObserveInvitation()
 {
     if (nullptr == m_invitationObserveHandle)
     {
+        oclog() << "observeInvitation() has not been done." << std::flush;
         return result_guard(OC_STACK_INVALID_PARAM);
     }
 
@@ -445,7 +424,6 @@ OCStackResult OCAccountManager::cancelObserveInvitation()
                                          &IClientWrapper::CancelObserveResource,
                                          m_invitationObserveHandle,
                                          (const char*)"", uri, HeaderOptions(), m_defaultQos);
-
     if (OC_STACK_OK == result)
     {
         m_invitationObserveHandle = nullptr;
@@ -458,21 +436,21 @@ OCStackResult OCAccountManager::sendInvitation(const std::string& groupId,
                                                const std::string& userUuid,
                                                PostCallback cloudConnectHandler)
 {
-    if (groupId.empty() || userUuid.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(m_userUuid, "Need to sign-in first.", OC_STACK_ERROR);
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(userUuid, "userUuid cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI;
 
     OCRepresentation invitation;
-    invitation.setValue(OC_RSRVD_GROUP_ID, groupId);
-    invitation.setValue(OC_RSRVD_MEMBER_ID, userUuid);
+    invitation.setValue<std::string>(OC_RSRVD_GROUP_ID, groupId);
+    invitation.setValue<std::string>(OC_RSRVD_MEMBER_ID, userUuid);
 
     std::vector<OCRepresentation> invite{invitation};
 
     OCRepresentation rep;
-    rep.setValue(OC_RSRVD_INVITE, invite);
+    rep.setValue<std::string>(OC_RSRVD_USER_UUID, m_userUuid);
+    rep.setValue<std::vector<OCRepresentation>>(OC_RSRVD_INVITE, invite);
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          OCDevAddr(), uri, rep, QueryParamsMap(), HeaderOptions(),
@@ -483,10 +461,8 @@ OCStackResult OCAccountManager::cancelInvitation(const std::string& groupId,
                                                  const std::string& userUuid,
                                                  DeleteCallback cloudConnectHandler)
 {
-    if (groupId.empty() || userUuid.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
+    VERIFY_NON_EMPTY(userUuid, "userUuid cannot be empty.", OC_STACK_INVALID_PARAM);
 
     std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI + "?" + OC_RSRVD_GROUP_ID + "=" + groupId
                       + ";" + OC_RSRVD_MEMBER_ID + "=" + userUuid;
@@ -496,15 +472,16 @@ OCStackResult OCAccountManager::cancelInvitation(const std::string& groupId,
                          m_connType, cloudConnectHandler, m_defaultQos);
 }
 
-OCStackResult OCAccountManager::deleteInvitation(const std::string& groupId,
-                                                 DeleteCallback cloudConnectHandler)
+OCStackResult OCAccountManager::replyToInvitation(const std::string& groupId,
+                                                  const bool accept,
+                                                  DeleteCallback cloudConnectHandler)
 {
-    if (groupId.empty())
-    {
-        return result_guard(OC_STACK_INVALID_PARAM);
-    }
+    VERIFY_NON_EMPTY(groupId, "groupId cannot be empty.", OC_STACK_INVALID_PARAM);
 
-    std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI + "?" + OC_RSRVD_GROUP_ID + "=" + groupId;
+    std::string isAccept = accept ? "1" : "0";
+
+    std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI + "?" + OC_RSRVD_GROUP_ID + "=" + groupId
+                      + ";" + OC_RSRVD_ACCEPT + "=" + isAccept;
 
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
                          OCDevAddr(), uri, HeaderOptions(),
index 76acecf..aa27b08 100644 (file)
@@ -132,17 +132,19 @@ namespace OCAccountManagerTest
     TEST(SignOutTest, DISABLED_SignOutForValid)
     {
         std::string host("coap://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->signOut(&accountHandler));
+        EXPECT_EQ(OC_STACK_OK, accountManager->signOut(accessToken, &accountHandler));
     }
 
     TEST(SignOutTest, SignOutWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->signOut(nullptr));
+        EXPECT_ANY_THROW(accountManager->signOut(accessToken, nullptr));
     }
 
     // RefreshAccessToken Test
@@ -202,19 +204,22 @@ namespace OCAccountManagerTest
     TEST(DeleteDeviceTest, DISABLED_DeleteDeviceForValid)
     {
         std::string host("coap://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
         std::string deviceId("AnyDeviceId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->deleteDevice(deviceId, &deleteHandler));
+        EXPECT_EQ(OC_STACK_OK, accountManager->deleteDevice(accessToken, deviceId,
+                                                            &deleteHandler));
     }
 
     TEST(DeleteDeviceTest, DeleteDeviceWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
         std::string deviceId("AnyDeviceId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->deleteDevice(deviceId, nullptr));
+        EXPECT_ANY_THROW(accountManager->deleteDevice(accessToken, deviceId, nullptr));
     }
 
     // CreateGroup Test
@@ -223,32 +228,27 @@ namespace OCAccountManagerTest
         std::string host("coap://192.168.1.2:5000");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->createGroup(AclGroupType::PUBLIC, &accountHandler));
-    }
-
-    TEST(CreateGroupTest, CreateGroupWithNullCallback)
-    {
-        std::string host("coap://192.168.1.2:5000");
-        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
-        EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->createGroup(AclGroupType::PUBLIC, nullptr));
+        EXPECT_EQ(OC_STACK_OK, accountManager->createGroup(&accountHandler));
     }
 
-    // GetGroupList Test
-    TEST(GetGroupListTest, DISABLED_GetGroupListForValid)
+    TEST(CreateGroupTest, DISABLED_CreateGroupWithOptionForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupList(&accountHandler));
+        std::string property("AnyProperty");
+        std::string value("AnyValue");
+        QueryParamsMap query = {};
+        query.insert(std::pair<std::string, std::string>(property, value));
+        EXPECT_EQ(OC_STACK_OK, accountManager->createGroup(query, &accountHandler));
     }
 
-    TEST(GetGroupListTest, GetGroupListWithNullCallback)
+    TEST(CreateGroupTest, CreateGroupWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->getGroupList(nullptr));
+        EXPECT_ANY_THROW(accountManager->createGroup(nullptr));
     }
 
     // DeleteGroup Test
@@ -270,136 +270,124 @@ namespace OCAccountManagerTest
         EXPECT_ANY_THROW(accountManager->deleteGroup(groupId, nullptr));
     }
 
-    // JoinGroup Test
-    TEST(JoinGroupTest, DISABLED_JoinGroupForValid)
+    // GetGroupInfoAll Test
+    TEST(GetGroupInfoAllTest, DISABLED_GetGroupInfoAllForValid)
     {
         std::string host("coap://192.168.1.2:5000");
-        std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->joinGroup(groupId, &accountHandler));
+        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupInfoAll(&accountHandler));
     }
 
-    TEST(JoinGroupTest, JoinGroupWithNullCallback)
+    TEST(GetGroupInfoAllTest, GetGroupInfoAllWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
-        std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->joinGroup(groupId, nullptr));
+        EXPECT_ANY_THROW(accountManager->getGroupInfoAll(nullptr));
     }
 
-    // AddDeviceToGroup Test
-    TEST(AddDeviceToGroupTest, DISABLED_AddDeviceToGroupForValid)
-    {
-        std::string host("coap://192.168.1.2:5000");
-        std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {"AnyDevideId"};
-        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
-        EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->addDeviceToGroup(groupId, deviceId,
-                                                                &accountHandler));
-    }
-
-    TEST(AddDeviceToGroupTest, AddDeviceToGroupWithNullCallback)
-    {
-        std::string host("coap://192.168.1.2:5000");
-        std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {"AnyDevideId"};
-        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
-        EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->addDeviceToGroup(groupId, deviceId, nullptr));
-    }
-
-    TEST(AddDeviceToGroupTest, AddDeviceToGroupWithEmptyDeviceID)
+    // GetGroupInfo Test
+    TEST(GetGroupInfoTest, DISABLED_GetGroupInfoForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {};
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->addDeviceToGroup(groupId, deviceId, &accountHandler));
+        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupInfo(groupId, &accountHandler));
     }
 
-    // GetGroupInfo Test
-    TEST(GetGroupInfoTest, DISABLED_GetGroupInfoForValid)
+    TEST(GetGroupInfoTest, GetGroupInfoWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupInfo(groupId, &accountHandler));
+        EXPECT_ANY_THROW(accountManager->getGroupInfo(groupId, nullptr));
     }
 
-    TEST(GetGroupInfoTest, GetGroupInfoWithNullCallback)
+    // AddPropertyValueToGroup Test
+    TEST(AddPropertyValueToGroupTest, DISABLED_AddPropertyValueToGroupForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->getGroupInfo(groupId, nullptr));
+        EXPECT_EQ(OC_STACK_OK, accountManager->addPropertyValueToGroup(groupId, propertyValue,
+                                                                       &accountHandler));
     }
 
-    // LeaveGroup Test
-    TEST(LeaveGroupTest, DISABLED_LeaveGroupForValid)
+    TEST(AddPropertyValueToGroupTest, AddPropertyValueToGroupWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->leaveGroup(groupId, &deleteHandler));
+        EXPECT_ANY_THROW(accountManager->addPropertyValueToGroup(groupId, propertyValue,
+                                                                 nullptr));
     }
 
-    TEST(LeaveGroupTest, LeaveGroupWithNullCallback)
+    // DeletePropertyValueFromGroup Test
+    TEST(DeletePropertyValueFromGroupTest, DISABLED_DeletePropertyValueFromGroupForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->leaveGroup(groupId, nullptr));
+        EXPECT_EQ(OC_STACK_OK, accountManager->deletePropertyValueFromGroup(groupId, propertyValue,
+                                                                            &accountHandler));
     }
 
-    // DeleteDeviceFromGroup Test
-    TEST(DeleteDeviceFromGroupTest, DISABLED_DeleteDeviceFromGroupForValid)
+    TEST(DeletePropertyValueFromGroupTest, DeletePropertyValueFromGroupWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {"AnyDevideId"};
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->deleteDeviceFromGroup(groupId, deviceId,
-                                                                     &deleteHandler));
+        EXPECT_ANY_THROW(accountManager->deletePropertyValueFromGroup(groupId, propertyValue,
+                                                                      nullptr));
     }
 
-    TEST(DeleteDeviceFromGroupTest, DeleteDeviceFromGroupWithNullCallback)
+    // UpdatePropertyValueOnGroup Test
+    TEST(UpdatePropertyValueOnGroupTest, DISABLED_UpdatePropertyValueOnGroupForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {"AnyDevideId"};
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->deleteDeviceFromGroup(groupId, deviceId, nullptr));
+        EXPECT_EQ(OC_STACK_OK, accountManager->updatePropertyValueOnGroup(groupId, propertyValue,
+                                                                       &accountHandler));
     }
 
-    TEST(DeleteDeviceFromGroupTest, DeleteDeviceFromGroupEmptyDeviceID)
+    TEST(UpdatePropertyValueOnGroupTest, UpdatePropertyValueOnGroupWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
-        std::vector<std::string> deviceId = {};
+        OCRepresentation propertyValue;
+        propertyValue.setValue("AnyProperty", "AnyValue");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->deleteDeviceFromGroup(groupId, deviceId,
-                                                               &deleteHandler));
+        EXPECT_ANY_THROW(accountManager->updatePropertyValueOnGroup(groupId, propertyValue,
+                                                                 nullptr));
     }
 
     // ObserveGroup Test
     TEST(ObserveGroupTest, DISABLED_ObserveGroupForValid)
     {
         std::string host("coap://192.168.1.2:5000");
-        std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(groupId, &onObserve));
+        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(&onObserve));
     }
 
     TEST(ObserveGroupTest, ObserveGroupWithNullCallback)
@@ -408,7 +396,7 @@ namespace OCAccountManagerTest
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->observeGroup(groupId, nullptr));
+        EXPECT_ANY_THROW(accountManager->observeGroup(nullptr));
     }
 
     // CancelObserveGroup Test
@@ -418,8 +406,8 @@ namespace OCAccountManagerTest
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(groupId, &onObserve));
-        EXPECT_EQ(OC_STACK_OK, accountManager->cancelObserveGroup(groupId));
+        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(&onObserve));
+        EXPECT_EQ(OC_STACK_OK, accountManager->cancelObserveGroup());
     }
 
     TEST(CancelObserveGroupTest, CancelObserveGroupWithoutObserve)
@@ -428,7 +416,7 @@ namespace OCAccountManagerTest
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->cancelObserveGroup(groupId));
+        EXPECT_ANY_THROW(accountManager->cancelObserveGroup());
     }
 
     // ObserveInvitation Test
@@ -508,22 +496,22 @@ namespace OCAccountManagerTest
         EXPECT_ANY_THROW(accountManager->cancelInvitation(groupId, userId, nullptr));
     }
 
-    // DeleteInvitation Test
-    TEST(DeleteInvitationTest, DISABLED_DeleteInvitationForValid)
+    // ReplyToInvitation Test
+    TEST(ReplyToInvitationTest, DISABLED_ReplyToInvitationForValid)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_EQ(OC_STACK_OK, accountManager->deleteInvitation(groupId, &deleteHandler));
+        EXPECT_EQ(OC_STACK_OK, accountManager->replyToInvitation(groupId, true, &deleteHandler));
     }
 
-    TEST(DeleteInvitationTest, DeleteInvitationWithNullCallback)
+    TEST(ReplyToInvitationTest, ReplyToInvitationWithNullCallback)
     {
         std::string host("coap://192.168.1.2:5000");
         std::string groupId("AnyGroupId");
         OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
         EXPECT_TRUE(NULL != accountManager);
-        EXPECT_ANY_THROW(accountManager->deleteInvitation(groupId, nullptr));
+        EXPECT_ANY_THROW(accountManager->replyToInvitation(groupId, true, nullptr));
     }
 }