Remove GroupSynchronization class in things manager
authorJihun Ha <jihun.ha@samsung.com>
Fri, 18 Sep 2015 04:31:13 +0000 (13:31 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 18 Sep 2015 06:01:20 +0000 (06:01 +0000)
We've decided to remove the GroupSynchronization class because the current
implementation of the class is not clear to be used and does not provide
any useful functionalities to developers.
We will re-design this features more concretely and re-summit it in the future.

For Android and Tizen platform, we will summit patchsets soon.

Change-Id: Icd8116c69f9078af275aa91216c0f28db4378d32
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2661
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/things-manager/sampleapp/linux/groupsyncaction/SConscript [deleted file]
service/things-manager/sampleapp/linux/groupsyncaction/group.cpp [deleted file]
service/things-manager/sampleapp/linux/groupsyncaction/musicplayer.cpp [deleted file]
service/things-manager/sampleapp/linux/groupsyncaction/phone.cpp [deleted file]
service/things-manager/sampleapp/linux/groupsyncaction/speaker.cpp [deleted file]
service/things-manager/sdk/inc/GroupSynchronization.h [deleted file]
service/things-manager/sdk/src/GroupSynchronization.cpp [deleted file]

diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/SConscript b/service/things-manager/sampleapp/linux/groupsyncaction/SConscript
deleted file mode 100644 (file)
index 159a99c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-##
-# linux sample app  build script
-##
-
-Import('env')
-
-# Add third party libraries
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
-linux_sample_env = lib_env.Clone()
-
-######################################################################
-# Build flags
-######################################################################
-linux_sample_env.AppendUnique(CPPPATH = ['include'])
-linux_sample_env.AppendUnique(CPPPATH = ['../../../../../extlibs/timer'])
-linux_sample_env.AppendUnique(CPPPATH = ['../../../sdk/inc'])
-linux_sample_env.AppendUnique(CPPPATH = ['../../../sdk/src'])
-linux_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-DLINUX', '-pthread'])
-linux_sample_env.AppendUnique(CPPDEFINES = ['LINUX'])
-linux_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-linux_sample_env.AppendUnique(LIBS = ['libTGMSDKLibrary', 'oc', 'octbstack',
-                                      'connectivity_abstraction',
-                                      'libcoap', 'liboc_logger', 'dl', 'pthread'])
-if env.get('SECURED') == '1':
-    linux_sample_env.AppendUnique(LIBS = ['tinydtls'])
-
-# On some platforms link order can miss functions so librt needs to be
-# re-scanned at the end if present. gcc 4.6 is one with this issue.
-if 'rt' in linux_sample_env.get('LIBS'):
-    linux_sample_env.Append(LIBS = ['rt'])
-
-######################################################################
-#build sampleapp
-######################################################################
-group = linux_sample_env.Program('group', 'group.cpp')
-musicplayer = linux_sample_env.Program('musicplayer', 'musicplayer.cpp')
-phone = linux_sample_env.Program('phone', 'phone.cpp')
-speaker = linux_sample_env.Program('speaker', 'speaker.cpp')
-Alias("GroupApp", group)
-Alias("MusicplayerApp", musicplayer)
-Alias("PhoneApp", phone)
-Alias("SpeakerApp", speaker)
-env.AppendTarget('GroupApp')
-env.AppendTarget('MusicplayerApp')
-env.AppendTarget('PhoneApp')
-env.AppendTarget('SpeakerApp')
diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/group.cpp b/service/things-manager/sampleapp/linux/groupsyncaction/group.cpp
deleted file mode 100755 (executable)
index b7f4eff..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <string>
-#include <cstdlib>
-#include <pthread.h>
-#include <string.h>
-#include "OCPlatform.h"
-#include "OCApi.h"
-#include "GroupSynchronization.h"
-
-using namespace OC;
-using namespace OIC;
-using namespace std;
-
-static GroupSynchronization* gGroupSynchronization = NULL;
-
-static std::vector< OCResourceHandle > gResourceHandleList;
-
-static std::string collectionResourceType = "core.group";
-
-void onFindResource(std::shared_ptr< OCResource > resource)
-{
-    cout << "onFindResource" << endl;
-
-    try
-    {
-        if (resource)
-        {
-            OCResourceHandle resourceHandle;
-            OCStackResult result = OCPlatform::registerResource(resourceHandle, resource);
-            if (OC_STACK_OK == result)
-            {
-                cout << "onFindResource : Resource creation was successful\n";
-            }
-            else
-            {
-                cout << "onFindResource : Resource creation was unsuccessful\n";
-                return;
-            }
-
-            result = gGroupSynchronization->joinGroup(collectionResourceType, resourceHandle);
-            if (OC_STACK_OK == result)
-            {
-                cout << "onFindResource : Joining group was successful\n";
-            }
-            else
-            {
-                cout << "onFindResource : Joining group was unsuccessful\n";
-
-                OCPlatform::unregisterResource(resourceHandle);
-                return;
-            }
-
-            gResourceHandleList.push_back(resourceHandle);
-        }
-        else
-        {
-            cout << "onFindResource : There is no found resource." << endl;
-        }
-    }catch (std::exception& e)
-    {
-        std::cout << "Exception: " << e.what() << std::endl;
-    }
-}
-
-int main(int argc, char* argv[])
-{
-    // Create PlatformConfig object
-    PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Both/*OC::ModeType::Server*/, "0.0.0.0", 0,
-            OC::QualityOfService::LowQos };
-
-    OCPlatform::Configure(cfg);
-    gGroupSynchronization = new GroupSynchronization();
-
-    int selectedMenu;
-    OCStackResult result;
-
-    try
-    {
-        while (true)
-        {
-            // some operations
-            cout << "(1) CREATE GROUP " << endl;
-            cout << "(11) FIND MUSIC PLAYER & JOIN GROUP | (12) FIND SPEAKER & JOIN GROUP" << endl;
-            cout << "(21) LEAVE GROUP - MUSIC PLAYER  | (22) LEAVE GROUP - SPEAKER" << endl;
-            cout << "(31) DELETE GROUP " << endl;
-
-            std::cin >> selectedMenu;
-
-            if (selectedMenu == 1)
-            {
-                result = gGroupSynchronization->createGroup(collectionResourceType);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Group creation was successful\n";
-                }
-                else
-                {
-                    cout << "Group creation was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 11)
-            {
-                ostringstream query;
-                query << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.musicplayer";
-
-                cout << query.str() << endl;
-                result = OCPlatform::findResource("",
-                            query.str(),
-                            CT_DEFAULT,
-                            onFindResource);
-
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Finding music player was successful\n";
-                }
-                else
-                {
-                    cout << "Finding music player was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 12)
-            {
-                ostringstream query;
-                query << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.speaker";
-                result = OCPlatform::findResource("",
-                            query.str(),
-                            CT_DEFAULT,
-                            onFindResource);
-
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Finding speaker was successful\n";
-                }
-                else
-                {
-                    cout << "Finding speaker was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 21)
-            {
-                std::vector< OCResourceHandle >::iterator It;
-                OCResourceHandle resourceHandle;
-                for (It = gResourceHandleList.begin(); It != gResourceHandleList.end(); ++It)
-                {
-                    resourceHandle = (*It);
-                    std::string mpType = "core.musicplayer";
-                    std::string type = OCGetResourceTypeName(resourceHandle, 0);
-                    if (0 == mpType.compare(type))
-                    {
-                        result = gGroupSynchronization->leaveGroup(collectionResourceType, resourceHandle);
-                        if (OC_STACK_OK == result)
-                        {
-                            cout << "Leaving group of music player was successful\n";
-                        }
-                        else
-                        {
-                            cout << "Leaving group of music player was unsuccessful\n";
-                        }
-                        break;
-                    }
-                }
-
-                if(It == gResourceHandleList.end())
-                    continue;
-
-                gResourceHandleList.erase(It);
-                result = OCPlatform::unregisterResource(resourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Unregistering music player was successful\n";
-                }
-                else
-                {
-                    cout << "Unregistering music player was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 22)
-            {
-                std::vector< OCResourceHandle >::iterator It;
-                OCResourceHandle resourceHandle;
-                for (It = gResourceHandleList.begin(); It != gResourceHandleList.end(); ++It)
-                {
-                    resourceHandle = (*It);
-                    std::string mpType = "core.speaker";
-                    std::string type = OCGetResourceTypeName(resourceHandle, 0);
-                    if (0 == mpType.compare(type))
-                    {
-                        result = gGroupSynchronization->leaveGroup(collectionResourceType, resourceHandle);
-                        if (OC_STACK_OK == result)
-                        {
-                            cout << "Leaving group of speaker was successful\n";
-                        }
-                        else
-                        {
-                            cout << "Leaving group of speaker was unsuccessful\n";
-                        }
-                        break;
-                    }
-                }
-
-                if(It == gResourceHandleList.end())
-                    continue;
-
-                gResourceHandleList.erase(It);
-                result = OCPlatform::unregisterResource(resourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Unregistering speaker was successful\n";
-                }
-                else
-                {
-                    cout << "Unregistering speaker was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 31)
-            {
-                gGroupSynchronization->deleteGroup(collectionResourceType);
-            }
-        }
-    }
-    catch (OCException& e)
-    {
-        std::cout << "Exception: " << e.what() << std::endl;
-    }
-
-    return 0;
-}
-
diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/musicplayer.cpp b/service/things-manager/sampleapp/linux/groupsyncaction/musicplayer.cpp
deleted file mode 100755 (executable)
index 6e8dc79..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <string>
-#include <cstdlib>
-#include <pthread.h>
-#include <string.h>
-#include "OCPlatform.h"
-#include "OCApi.h"
-
-using namespace OC;
-using namespace std;
-
-OCEntityHandlerResult mpEntityHandler(const std::shared_ptr< OCResourceRequest > request)
-{
-    cout << "mpEntityHandler:\n";
-
-    if (request)
-    {
-        // Get the request type and request flag
-        std::string requestType = request->getRequestType();
-        int requestFlag = request->getRequestHandlerFlag();
-        std::string action;
-
-        if (requestFlag == RequestHandlerFlag::RequestFlag)
-        {
-            cout << "\trequestFlag : Request\n";
-
-            OCRepresentation rp = request->getResourceRepresentation();
-
-            // If the request type is GET
-            if (requestType == "GET")
-            {
-                cout << "\t\trequestType : GET\n";
-            }
-            else if (requestType == "PUT")
-            {
-                cout << "\t\trequestType : PUT\n";
-
-                action = rp.getValue< std::string >("play");
-                cout << "\t\t\tplay : " << action << endl;
-            }
-            else if (requestType == "POST")
-            {
-                cout << "\t\trequestType : POST\n";
-            }
-            else if (requestType == "DELETE")
-            {
-                cout << "\t\trequestType : DELETE\n";
-            }
-        }
-        else if (requestFlag == RequestHandlerFlag::ObserverFlag)
-        {
-            cout << "\trequestFlag : Observer\n";
-        }
-    }
-    else
-    {
-        cout << "Request invalid" << endl;
-    }
-
-    return OC_EH_OK;
-}
-
-int main(int argc, char* argv[])
-{
-    // Create PlatformConfig object
-    PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
-
-    OCPlatform::Configure(cfg);
-
-    OCPlatform::startPresence(30);
-
-    int selectedMenu;
-    OCStackResult result;
-    OCResourceHandle mpResourceHandle = NULL;
-
-    try
-    {
-        while (true)
-        {
-            // some operations
-            cout << "(1) CREATE MUSIC PLAYER | (2) DELETE MUSIC PLAYER" << endl;
-
-            std::cin >> selectedMenu;
-
-            if (selectedMenu == 1)
-            {
-                if (mpResourceHandle)
-                {
-                    cout << "Music player resource is registered already." << endl;
-                    continue;
-                }
-
-                std::string resourceURi = "/core/musicplayer";
-                std::string resourceTypeName = "core.musicplayer";
-                std::string resourceInterface = DEFAULT_INTERFACE;
-
-                result = OCPlatform::registerResource(mpResourceHandle, resourceURi,
-                        resourceTypeName, resourceInterface, mpEntityHandler,
-                        OC_DISCOVERABLE | OC_OBSERVABLE);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To register music player resource was successful\n";
-                }
-                else
-                {
-                    cout << "To register music player resource was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 2)
-            {
-                if (NULL == mpResourceHandle)
-                {
-                    cout
-                            << "Error! No resource to unregister. Register resource first!"
-                            << endl;
-                    continue;
-                }
-
-                result = OCPlatform::unregisterResource(mpResourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To unregister music player resource was successful\n";
-                }
-                else
-                {
-                    cout << "To unregister music player resource was unsuccessful\n";
-                }
-
-                mpResourceHandle = NULL;
-            }
-        }
-    }
-    catch (OCException& e)
-    {
-        std::cout << "Exception: " << e.what() << std::endl;
-    }
-
-    return 0;
-}
-
diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/phone.cpp b/service/things-manager/sampleapp/linux/groupsyncaction/phone.cpp
deleted file mode 100755 (executable)
index 17c4796..0000000
+++ /dev/null
@@ -1,494 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <string>
-#include <cstdlib>
-#include <pthread.h>
-#include "OCPlatform.h"
-#include "OCApi.h"
-#include "GroupManager.h"
-#include "GroupSynchronization.h"
-
-using namespace OC;
-using namespace OIC;
-using namespace std;
-
-static GroupManager* gGroupManager = NULL;
-static GroupSynchronization* gGroupSynchronization = NULL;
-
-static OCResourceHandle gPhoneResourceHandle = NULL;
-
-static std::shared_ptr< OCResource > gFindGroup = NULL;
-
-static std::string collectionResourceType = "core.group";
-
-static ActionSet* gPlayStart;
-
-static ActionSet* gPlayStop;
-
-void presenceCallback(std::string msg, OCStackResult res)
-{
-    std::cout << "Presence Callback: " << msg << "(" << res << ")" << std::endl;
-}
-
-void onFindGroup(std::shared_ptr< OCResource > resource)
-{
-    if (resource)
-    {
-        if (NULL == gPhoneResourceHandle)
-        {
-            cout
-                    << "onFindGroup : Error! No resource to join group. Register resource first!"
-                    << endl;
-            return;
-        }
-
-        if (gFindGroup)
-        {
-            cout << "onFindGroup : Found group is already saved." << endl;
-        }
-        else
-        {
-            cout << "onFindGroup : Found group is saved now." << endl;
-            gFindGroup = resource;
-            {
-                OCStackResult res;
-                res = gGroupManager->subscribeCollectionPresence( resource, &presenceCallback);
-
-                std::cout << "Return Value: " << res << std::endl;
-            }
-        }
-
-        gGroupSynchronization->joinGroup(gFindGroup, gPhoneResourceHandle);
-    }
-    else
-    {
-        cout << "onFindGroup : Resource is invalid. So a new Group Resource has to be created."
-                << endl;
-    }
-}
-
-void onAction(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode)
-{
-    if (eCode == OC_STACK_OK)
-    {
-        cout << "onAction" << endl;
-    }
-    else
-    {
-        cout << "onAction : error - " << eCode << endl;
-    }
-}
-
-void onGetChild(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode)
-{
-    if (eCode == OC_STACK_OK)
-    {
-        gPlayStart = new ActionSet();
-        gPlayStop = new ActionSet();
-
-        gPlayStart->actionsetName = "playstart";
-        gPlayStop->actionsetName = "playstop";
-
-        std::vector< OCRepresentation > childList = rep.getChildren();
-        OCRepresentation child;
-        std::string resourceURI;
-
-        QueryParamsMap query;
-        std::string playStart;
-        std::string playStop;
-
-        std::vector< std::string > types;
-        std::string resType;
-
-        OCStackResult result;
-
-        for (unsigned int i = 0; i < childList.size(); ++i)
-        {
-//            cout << "\n\tchild resource - " << i + 1 << endl;
-
-            child = childList.at(i);
-            resourceURI = child.getUri();
-
-//            cout << "\t\tURI of the resource: " << resourceURI << endl;
-
-//            cout << "\t\tList of resource types: " << endl;
-
-            types = child.getResourceTypes();
-
-            for (unsigned int j = 0; j < types.size(); ++j)
-            {
-                resType = types.at(j);
-//                cout << "\t\t\t" << resType << endl;
-
-                if (std::string::npos != resType.find("musicplayer"))
-                {
-                    Capability *pStartCapa = new Capability;
-                    pStartCapa->capability = "play";
-                    pStartCapa->status = "on";
-
-                    Action* pPlayStart = new Action();
-                    pPlayStart->target = resourceURI;
-                    pPlayStart->listOfCapability.push_back(pStartCapa);
-
-                    gPlayStart->listOfAction.push_back(pPlayStart);
-
-                    Capability *pStopCapa = new Capability;
-                    pStopCapa->capability = "play";
-                    pStopCapa->status = "off";
-
-                    Action* pPlayStop = new Action();
-                    pPlayStop->target = resourceURI;
-                    pPlayStop->listOfCapability.push_back(pStopCapa);
-
-                    gPlayStop->listOfAction.push_back(pPlayStop);
-                }
-                else if (std::string::npos != resType.find("speaker"))
-                {
-                    Capability *pStartCapa = new Capability;
-                    pStartCapa->capability = "volume";
-                    pStartCapa->status = "50";
-
-                    Action* pPlayStart = new Action();
-                    pPlayStart->target = resourceURI;
-                    pPlayStart->listOfCapability.push_back(pStartCapa);
-
-                    gPlayStart->listOfAction.push_back(pPlayStart);
-
-                    Capability *pStopCapa = new Capability;
-                    pStopCapa->capability = "volume";
-                    pStopCapa->status = "0";
-
-                    Action* pPlayStop = new Action();
-                    pPlayStop->target = resourceURI;
-                    pPlayStop->listOfCapability.push_back(pStopCapa);
-
-                    gPlayStop->listOfAction.push_back(pPlayStop);
-                }
-            }
-        }
-
-//        std::string temp = gThingManager->getStringFromActionSet (gPlayStart);
-//        cout << "play start - " << temp << endl;
-
-//        temp  = gThingManager->getStringFromActionSet (gPlayStop);
-//        cout << "play stop - " << temp << endl;
-
-        if (0 == gPlayStart->listOfAction.empty())
-        {
-            result = gGroupManager->addActionSet(gFindGroup, gPlayStart, onAction);
-            if (OC_STACK_OK == result)
-            {
-                cout << "addActionSet(gPlayStart) was successful\n";
-            }
-            else
-            {
-                cout << "addActionSet(gPlayStart) was unsuccessful. result = " << result << endl;
-            }
-        }
-
-        if (0 == gPlayStop->listOfAction.empty())
-        {
-            result = gGroupManager->addActionSet(gFindGroup, gPlayStop, onAction);
-            if (OC_STACK_OK == result)
-            {
-                cout << "addActionSet(gPlayStop) was successful\n";
-            }
-            else
-            {
-                cout << "addActionSet(gPlayStop) was unsuccessful. result = " << result << endl;
-            }
-        }
-    }
-    else
-    {
-        cout << "onGetChild : error - " << eCode << endl;
-    }
-}
-
-int main(int argc, char* argv[])
-{
-    // Create PlatformConfig object
-    PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
-
-    OCPlatform::Configure(cfg);
-    gGroupManager = new GroupManager();
-    gGroupSynchronization = new GroupSynchronization();
-
-    int selectedMenu;
-    OCStackResult result;
-
-    try
-    {
-        while (true)
-        {
-            // some operations
-            cout << "(1) CREATE PHONE" << endl;
-            cout
-                    << "(11) FIND & JOIN GROUP | (12) ADD GROUP ACTION | (13) PLAY START"
-                    << " | (14) PLAY STOP"<< endl;
-            cout << "(15) DELETE GROUP ACTION | (16) LEAVE GROUP" << endl;
-            cout << "(21) DELETE PHONE" << endl;
-
-            std::cin >> selectedMenu;
-
-            if (selectedMenu == 1)
-            {
-                if (gPhoneResourceHandle)
-                {
-                    cout << "Phone resource is registered already." << endl;
-                    continue;
-                }
-
-                std::string resourceURi = "/core/phone";
-                std::string resourceTypeName = "core.phone";
-                std::string resourceInterface = DEFAULT_INTERFACE;
-
-                result = OCPlatform::registerResource(gPhoneResourceHandle, resourceURi,
-                        resourceTypeName, resourceInterface,
-                        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To register phone resource was successful\n";
-                }
-                else
-                {
-                    cout << "To register phone resource was unsuccessful. result = " << result
-                            << endl;
-                }
-            }
-            else if (selectedMenu == 11)
-            {
-                std::vector< std::string > types;
-                types.clear();
-                types.push_back(collectionResourceType);
-
-                result = gGroupSynchronization->findGroup(types, &onFindGroup);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Finding group was successful\n";
-                }
-                else
-                {
-                    cout << "Finding group was unsuccessful. result = " << result << endl;
-                }
-            }
-            else if (selectedMenu == 12)
-            {
-                if (!gFindGroup)
-                {
-                    cout << "gFindGroup is NULL. Please process step 1 and step 11 first." << endl;
-                    continue;
-                }
-
-                QueryParamsMap queryParamsMap;
-                result = gFindGroup->get("", DEFAULT_INTERFACE, queryParamsMap, onGetChild);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "gFindGroup->get was successful\n";
-                }
-                else
-                {
-                    cout << "gFindGroup->get was unsuccessful. result = " << result << endl;
-                }
-            }
-            else if (selectedMenu == 13)
-            {
-                if (!gFindGroup)
-                {
-                    cout << "gFindGroup is NULL. Please process step 1 and step 11 first." << endl;
-                    continue;
-                }
-
-                if (!gPlayStart)
-                {
-                    cout << "gPlayStart is NULL. Please process step 12 first." << endl;
-                    continue;
-                }
-
-                result = gGroupManager->executeActionSet(gFindGroup, "playstart", onAction);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "DoAction(playstart) was successful\n";
-                }
-                else
-                {
-                    cout << "DoAction(playstart) was unsuccessful. result = " << result << endl;
-                }
-            }
-            else if (selectedMenu == 14)
-            {
-                if (!gFindGroup)
-                {
-                    cout << "gFindGroup is NULL. Please process step 1 and step 11 first." << endl;
-                    continue;
-                }
-
-                if (!gPlayStop)
-                {
-                    cout << "gPlayStop is NULL. Please process step 12 first." << endl;
-                    continue;
-                }
-
-                result = gGroupManager->executeActionSet(gFindGroup, "playstop", onAction);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "DoAction(playstop) was successful\n";
-                }
-                else
-                {
-                    cout << "DoAction(playstop) was unsuccessful. result = " << result << endl;
-                }
-            }
-            else if (selectedMenu == 15)
-            {
-                if (!gFindGroup)
-                {
-                    cout << "gFindGroup is NULL. Please process step 1 and step 11 first." << endl;
-                    continue;
-                }
-
-                if (!gPlayStart)
-                {
-                    cout << "gPlayStart is NULL. Please process step 12 first." << endl;
-                    continue;
-                }
-
-                if (!gPlayStop)
-                {
-                    cout << "gPlayStop is NULL. Please process step 12 first." << endl;
-                    continue;
-                }
-
-                result = gGroupManager->deleteActionSet(gFindGroup, "playstart", onAction);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Delete Action(playstart) was successful\n";
-                }
-                else
-                {
-                    cout << "Delete Action(playstart) was unsuccessful. result = " << result
-                            << endl;
-                }
-
-                result = gGroupManager->deleteActionSet(gFindGroup, "playstop", onAction);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Delete Action(playstop) was successful\n";
-                }
-                else
-                {
-                    cout << "Delete Action(playstop) was unsuccessful. result = " << result << endl;
-                }
-
-                Action* a;
-                Capability* c;
-
-                for (auto actionIter = gPlayStart->listOfAction.begin();
-                        actionIter != gPlayStart->listOfAction.end(); ++actionIter)
-                {
-                    a = (*actionIter);
-
-                    for (auto capaIter = a->listOfCapability.begin();
-                            capaIter != a->listOfCapability.end(); ++capaIter)
-                    {
-                        c = (*capaIter);
-                        delete c;
-                    }
-
-                    delete a;
-                }
-
-                delete gPlayStart;
-                gPlayStart = NULL;
-
-                for (auto actionIter = gPlayStop->listOfAction.begin();
-                        actionIter != gPlayStop->listOfAction.end(); ++actionIter)
-                {
-                    a = (*actionIter);
-
-                    for (auto capaIter = a->listOfCapability.begin();
-                            capaIter != a->listOfCapability.end(); ++capaIter)
-                    {
-                        c = (*capaIter);
-                        delete c;
-                    }
-
-                    delete a;
-                }
-
-                delete gPlayStop;
-                gPlayStop = NULL;
-            }
-            else if (selectedMenu == 16)
-            {
-                if (NULL == gPhoneResourceHandle)
-                {
-                    cout
-                            << "Error! No resource to leave group. Register resource first!"
-                            << endl;
-                    continue;
-                }
-
-                result = gGroupSynchronization->leaveGroup(gFindGroup, collectionResourceType,  gPhoneResourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "Leaving group was successful\n";
-                }
-                else
-                {
-                    cout << "Leaving group was unsuccessful. result = " << result << endl;
-                }
-            }
-            else if (selectedMenu == 21)
-            {
-                if (NULL == gPhoneResourceHandle)
-                {
-                    cout
-                            << "Error! No resource to unregister. Register resource first!"
-                            << endl;
-                    continue;
-                }
-
-                result = OCPlatform::unregisterResource(gPhoneResourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To unregister phone resource was successful\n";
-                }
-                else
-                {
-                    cout << "To unregister phone resource was unsuccessful. result = " << result
-                            << endl;
-                }
-                gPhoneResourceHandle = NULL;
-            }
-        }
-
-    }
-    catch (OCException& e)
-    {
-        std::cout << "Exception: " << e.what() << std::endl;
-    }
-
-    return 0;
-}
-
diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/speaker.cpp b/service/things-manager/sampleapp/linux/groupsyncaction/speaker.cpp
deleted file mode 100755 (executable)
index cc7bbcf..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <string>
-#include <cstdlib>
-#include <pthread.h>
-#include <string.h>
-#include "OCPlatform.h"
-#include "OCApi.h"
-
-using namespace OC;
-using namespace std;
-
-OCEntityHandlerResult speakerEntityHandler(const std::shared_ptr< OCResourceRequest > request)
-{
-    cout << "speakerEntityHandler:\n";
-
-    if (request)
-    {
-        // Get the request type and request flag
-        std::string requestType = request->getRequestType();
-        int requestFlag = request->getRequestHandlerFlag();
-        std::string action;
-
-        if (requestFlag == RequestHandlerFlag::RequestFlag)
-        {
-            cout << "\trequestFlag : Request\n";
-
-            OCRepresentation rp = request->getResourceRepresentation();
-
-            // If the request type is GET
-            if (requestType == "GET")
-            {
-                cout << "\t\trequestType : GET\n";
-            }
-            else if (requestType == "PUT")
-            {
-                cout << "\t\trequestType : PUT\n";
-
-                action = rp.getValue< std::string >("volume");
-                cout << "\t\t\tvolume : " << action << endl;
-            }
-            else if (requestType == "POST")
-            {
-                cout << "\t\trequestType : POST\n";
-            }
-            else if (requestType == "DELETE")
-            {
-                cout << "\t\trequestType : DELETE\n";
-            }
-        }
-        else if (requestFlag == RequestHandlerFlag::ObserverFlag)
-        {
-            cout << "\trequestFlag : Observer\n";
-        }
-    }
-    else
-    {
-        cout << "Request invalid" << endl;
-    }
-
-    return OC_EH_OK;
-}
-
-int main(int argc, char* argv[])
-{
-
-    // Create PlatformConfig object
-    PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
-
-    OCPlatform::Configure(cfg);
-
-    OCPlatform::startPresence(30);
-
-    int selectedMenu;
-    OCStackResult result;
-    OCResourceHandle speakerResourceHandle = NULL;
-
-    try
-    {
-        while (true)
-        {
-            // some operations
-            cout << "(1) CREATE SPEAKER | (2) DELETE SPEAKER" << endl;
-
-            std::cin >> selectedMenu;
-
-            if (selectedMenu == 1)
-            {
-                if (speakerResourceHandle)
-                {
-                    cout << "Speaker resource is registered already." << endl;
-                    continue;
-                }
-
-                std::string resourceURi = "/core/speaker";
-                std::string resourceTypeName = "core.speaker";
-
-                std::string resourceInterface = DEFAULT_INTERFACE;
-
-                result = OCPlatform::registerResource(speakerResourceHandle, resourceURi,
-                        resourceTypeName, resourceInterface, speakerEntityHandler,
-                        OC_DISCOVERABLE | OC_OBSERVABLE);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To register speaker resource was successful\n";
-                }
-                else
-                {
-                    cout << "To register speaker resource was unsuccessful\n";
-                }
-            }
-            else if (selectedMenu == 2)
-            {
-                if (NULL == speakerResourceHandle)
-                {
-                    cout
-                            << "Error! No resource to unregister. Register resource first!"
-                            << endl;
-                    continue;
-                }
-
-                result = OCPlatform::unregisterResource(speakerResourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    cout << "To unregister speaker resource was successful\n";
-                }
-                else
-                {
-                    cout << "To unregister speaker resource was unsuccessful\n";
-                }
-
-                speakerResourceHandle = NULL;
-            }
-        }
-    }
-    catch (OCException& e)
-    {
-         std::cout << "Exception: " << e.what() << std::endl;
-    }
-
-    return 0;
-}
-
diff --git a/service/things-manager/sdk/inc/GroupSynchronization.h b/service/things-manager/sdk/inc/GroupSynchronization.h
deleted file mode 100644 (file)
index d18f814..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-/**
- * @file
- *
- * This file contains the declaration of classes and its members related to
- * GroupSynchronization.
- */
-
-#ifndef __OC_GROUPSYNCHRONIZATION__
-#define __OC_GROUPSYNCHRONIZATION__
-
-#include <string>
-#include <vector>
-#include <map>
-#include <cstdlib>
-#include "OCPlatform.h"
-#include "OCApi.h"
-
-using namespace OC;
-
-namespace OIC
-{
-    class GroupSynchronization
-    {
-    private:
-
-        std::map< std::string, OCResourceHandle > collectionResourceHandleList;
-        // collection resource handle list
-        std::map< OCResourceHandle, std::vector< OCResourceHandle > > childResourceHandleList;
-
-        std::map< std::string, OCResourceHandle > groupSyncResourceHandleList;
-        // group sync resource handle list
-        std::map< std::string, std::shared_ptr< OCResource > > groupSyncResourceList;
-        // remote group sync resource list
-
-        std::vector< OCResourceHandle > deviceResourceHandleList; // these cannot be removed.
-        OCResourceHandle deviceResourceHandle;
-
-        OCResourceHandle collectionResourceHandle; // collection handle
-        std::shared_ptr< OCResource > remoteCollectionResource;
-
-        FindCallback findCallback;
-
-        std::vector< std::shared_ptr< OCResource > > foundGroupResourceList;
-
-        std::mutex foundGroupMutex;
-    //    std::mutex groupSyncMutex;
-
-        std::shared_ptr< OCResourceRequest > resourceRequest; // this is used for slow response
-
-        static GroupSynchronization* groupSyncnstance;
-        static bool bIsFinding;
-
-    public:
-
-        GroupSynchronization()
-        {
-            collectionResourceHandleList.clear();
-            childResourceHandleList.clear();
-            groupSyncResourceHandleList.clear();
-            groupSyncResourceList.clear();
-            deviceResourceHandleList.clear();
-
-            deviceResourceHandle = NULL;
-            collectionResourceHandle = NULL;
-            remoteCollectionResource = NULL;
-            findCallback = NULL;
-        }
-        ;
-
-        ~GroupSynchronization()
-        {
-            std::map< std::string, OCResourceHandle >::iterator handleIt;
-            for (handleIt = collectionResourceHandleList.begin();
-                    handleIt != collectionResourceHandleList.end(); ++handleIt)
-            {
-                deleteGroup(handleIt->first);
-            }
-        }
-        ;
-
-        // TODO: deprecated
-        static GroupSynchronization* getInstance();
-        void deleteInstance();
-
-        /**
-         * API for finding a specific remote group when a resource tries to join a group.
-         * Callback is called when a group is found or not.
-         *
-         * @param collectionResourceTypes resource types of a group to find and join
-         * @param callback callback. It has OCResource param.
-         *                    If a group is found, OCResource has the group resource.
-         *                    Otherwise, OCResource is NULL.
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         * @note It returns OC_STACK ERROR when it is already finding a group.
-         *       You should call this api after the group finding process has stopped.
-         *       OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult findGroup(std::vector< std::string > collectionResourceTypes,
-                FindCallback callback);
-
-        /**
-         * API for creating a new group.
-         *
-         * @param collectionResourceType resource type of a group to create
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         * @note OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult createGroup(std::string collectionResourceType);
-
-        /**
-         * API for joining a group. This API is used when a resource that has a group tries
-         * to find a specific remote resource and makes it join a group
-         *
-         * @param collectionResourceType resource type of a group to join.
-         * @param resourceHandle resource handle to join a group.
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         *
-         * @note If you want to join the resource in the remote(other) process,
-         *       use joinGroup(const std::shared_ptr< OCResource >, OCResourceHandle)
-         *       instead of this.
-         *       OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult joinGroup(std::string collectionResourceTyps,
-                OCResourceHandle resourceHandle);
-
-        /**
-         * API for joining a group. This API is used when a resource that
-         * doesn't have a group tries to find and join a specific remote group.
-         *
-         * @param resource group resource pointer to join.
-         *                   It can be the callback result of findGroup().
-         * @param resourceHandle resource handle to join a group.
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         * @note If you want to join the resource in the same process,
-         *       use joinGroup(std::string, OCResourceHandle)
-         *       instead of this.
-         *       OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult joinGroup(const std::shared_ptr< OCResource > resource,
-                OCResourceHandle resourceHandle);
-
-        /**
-         * API for leaving a joined group.
-         *
-         * @param collectionResourceType resource type of a group to leave.
-         * @param resourceHandle resource handle to leave a group.
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         * @note OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult leaveGroup(std::string collectionResourceType,
-                OCResourceHandle resourceHandle);
-
-        /**
-         * API for leaving a joined group.
-         *
-         * @param resource group resource pointer to join.
-         *                   It can be the callback result of findGroup().
-         *
-         * @param collectionResourceType resource type of a group to leave.
-         * @param resourceHandle resource handle to leave a group.
-         *
-         * @return Returns ::OC_STACK_OK if success.
-         *
-         * @note OCStackResult is defined in ocstack.h.
-         */
-        OCStackResult leaveGroup(const std::shared_ptr< OCResource > resource,
-                    std::string collectionResourceType,
-                    OCResourceHandle resourceHandle);
-
-        /**
-         * API for deleting a group.
-         *
-         * @param collectionResourceType resource type of a group to delete.
-         *
-         * @return void
-         */
-        void deleteGroup(std::string collectionResourceType);
-
-        /**
-         * API for getting a list of joined groups.
-         *
-         * @return std::map return value of this API.
-         *                  It returns group resource type and group resource handle as a map type.
-         */
-        std::map< std::string, OCResourceHandle > getGroupList();
-
-    private:
-
-        OCEntityHandlerResult groupEntityHandler(
-                const std::shared_ptr< OCResourceRequest > request);
-
-        void onFindGroup(std::shared_ptr< OCResource > resource);
-        void onJoinGroup(const HeaderOptions& headerOptions, const OCRepresentation& rep,
-                const int eCode);
-        void onFindResource(std::shared_ptr< OCResource > resource);
-        void onGetJoinedRemoteChild(const HeaderOptions& headerOptions, const OCRepresentation& rep,
-                const int eCode);
-        void onLeaveGroup(const HeaderOptions& headerOptions, const OCRepresentation& rep,
-                const int eCode);
-        void checkFindGroup(void);
-        bool IsSameGroup(std::shared_ptr< OCResource > resource);
-        void saveGroup(std::shared_ptr< OCResource > resource);
-
-        void debugGroupSync(void);
-
-    };
-}
-#endif    // __OC_GROUPSYNCHRONIZATION__
diff --git a/service/things-manager/sdk/src/GroupSynchronization.cpp b/service/things-manager/sdk/src/GroupSynchronization.cpp
deleted file mode 100644 (file)
index d8c3e9b..0000000
+++ /dev/null
@@ -1,1328 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include "GroupSynchronization.h"
-#include "logger.h"
-
-using namespace OC;
-using namespace std;
-
-#define TAG "GROUP_SYNC"
-
-namespace OIC
-{
-    GroupSynchronization* GroupSynchronization::groupSyncnstance = NULL;
-    bool GroupSynchronization::bIsFinding = false;
-
-    GroupSynchronization* GroupSynchronization::getInstance()
-    {
-        if (groupSyncnstance == NULL)
-        {
-            groupSyncnstance = new GroupSynchronization();
-        }
-        return groupSyncnstance;
-    }
-
-    void GroupSynchronization::deleteInstance()
-    {
-        if (groupSyncnstance)
-        {
-            delete groupSyncnstance;
-            groupSyncnstance = NULL;
-        }
-    }
-
-    OCStackResult GroupSynchronization::findGroup(
-            std::vector< std::string > collectionResourceTypes, FindCallback callback)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::findGroup");
-
-        if(bIsFinding)
-        {
-            OC_LOG(DEBUG, TAG, "It was searching already.");
-            return OC_STACK_ERROR;
-        }
-
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-        foundGroupResourceList.clear();
-        findCallback = callback;
-
-        if (findCallback == NULL)
-        {
-            OC_LOG(DEBUG, TAG, "Find callback is NULL.");
-            return OC_STACK_ERROR;
-        }
-
-        for (unsigned int i = 0; i < collectionResourceTypes.size(); ++i)
-        {
-
-            std::string query = OC_RSRVD_WELL_KNOWN_URI;
-            query.append("?rt=");
-            query.append(collectionResourceTypes.at(i));
-
-            OCPlatform::findResource("", query,
-                    CT_DEFAULT,
-                    std::bind(&GroupSynchronization::onFindGroup, this,
-                        std::placeholders::_1));
-        }
-
-        bIsFinding = true;
-
-        // thread to check if GroupSynchronization::onFoundGroup is called or not.
-        std::thread t(std::bind(&GroupSynchronization::checkFindGroup, this));
-        t.detach();
-
-        return OC_STACK_OK;
-    }
-
-    OCStackResult GroupSynchronization::createGroup(std::string collectionResourceType)
-    {
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-        foundGroupResourceList.clear();
-
-        OCResourceHandle collectionResHandle = NULL;
-        OCResourceHandle groupSyncResHandle = NULL;
-
-        if (0 == collectionResourceType.length())
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::createGroup : Error! Input params are wrong.");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::createGroup - The created group is added.");
-
-        OCStackResult result;
-
-        // creating master collection resource
-        std::string collectionUri = "/" + collectionResourceType;
-        std::size_t i;
-        while ((i = collectionUri.find(".")) != std::string::npos)
-        {
-            collectionUri.replace(i, 1, "/");
-        }
-
-        OC_LOG_V(DEBUG, TAG, "GroupSynchronization::createGroup : collection uri - %s, type - %s",
-            collectionUri.c_str(), collectionResourceType.c_str());
-
-        std::string resourceInterface = DEFAULT_INTERFACE;
-
-        result = OCPlatform::registerResource(collectionResHandle, collectionUri,
-                collectionResourceType, resourceInterface, NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-        if (result != OC_STACK_OK)
-        {
-            OC_LOG_V(DEBUG, TAG, "To register resource (%s) was unsuccessful. result - %d",
-                collectionUri.c_str(), result);
-            goto Error;
-        }
-
-        {
-            OCPlatform::bindInterfaceToResource(collectionResHandle, GROUP_INTERFACE);
-            if (result != OC_STACK_OK)
-            {
-                OC_LOG_V(DEBUG, TAG,
-                    "To bind Interface (collection) was unsuccessful. result - %d",
-                    result);
-            }
-
-            collectionResourceHandleList[collectionResourceType] = collectionResHandle;
-
-            // creating master group sync resource
-            std::string groupSyncUri = collectionUri + "/groupsync";
-            std::string groupSyncResType = collectionResourceType + ".groupsync";
-
-            result = OCPlatform::registerResource(groupSyncResHandle, groupSyncUri,
-                    groupSyncResType, resourceInterface,
-                    std::bind(&GroupSynchronization::groupEntityHandler, this,
-                            std::placeholders::_1), OC_DISCOVERABLE | OC_OBSERVABLE);
-            if (result != OC_STACK_OK)
-            {
-                OC_LOG_V(DEBUG, TAG,
-                    "To register resource (groupsync) was unsuccessful. result - %d", result);
-                goto Error;
-            }
-
-            groupSyncResourceHandleList[collectionResourceType] = groupSyncResHandle;
-
-            return OC_STACK_OK;
-        }
-        Error:
-
-        if (collectionResHandle)
-        {
-            OCPlatform::unregisterResource(collectionResHandle);
-            auto iterator = collectionResourceHandleList.find(collectionResourceType);
-            if (iterator != collectionResourceHandleList.end())
-            {
-                collectionResourceHandleList.erase(iterator);
-            }
-        }
-
-        if (groupSyncResHandle)
-        {
-            OCPlatform::unregisterResource(groupSyncResHandle);
-            auto iterator = groupSyncResourceHandleList.find(collectionResourceType);
-            if (iterator != groupSyncResourceHandleList.end())
-            {
-                groupSyncResourceHandleList.erase(iterator);
-            }
-        }
-
-        return OC_STACK_NO_RESOURCE;
-    }
-
-    OCStackResult GroupSynchronization::joinGroup(std::string collectionResourceType,
-            OCResourceHandle resourceHandle)
-    {
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-        if ((0 == collectionResourceType.length()) || (!resourceHandle))
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::joinGroup : Error! input params are wrong.");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        auto resIt = collectionResourceHandleList.find(collectionResourceType);
-        if (resIt == collectionResourceHandleList.end())
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::joinGroup : error! There is no collection to join");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OCResourceHandle collectionResHandle = resIt->second;
-        try{
-            OCStackResult result = OCPlatform::bindResource(collectionResHandle, resourceHandle);
-            if (result != OC_STACK_OK)
-            {
-                OC_LOG_V(DEBUG, TAG,
-                    "GroupSynchronization::joinGroup : To bind resource was unsuccessful." \
-                    " result - %d", result);
-                return OC_STACK_ERROR;
-            }
-        } catch(OCException &e) {
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OC_LOG(DEBUG, TAG,
-            "GroupSynchronization::joinGroup : To bind collectionResHandle and resourceHandle");
-
-        std::vector< OCResourceHandle > childHandleList;
-
-        auto childIt = childResourceHandleList.find(collectionResHandle);
-        if (childIt != childResourceHandleList.end())
-        {
-            childHandleList = childIt->second;
-        }
-
-        childHandleList.push_back(resourceHandle);
-        childResourceHandleList[collectionResHandle] = childHandleList;
-
-        deviceResourceHandleList.push_back(resourceHandle);
-
-        debugGroupSync();
-
-        return OC_STACK_OK;
-    }
-
-    OCStackResult GroupSynchronization::joinGroup(const std::shared_ptr< OCResource > resource,
-            OCResourceHandle resourceHandle)
-    {
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-        if ((!resource) || (!resourceHandle))
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::joinGroup : Error! Input params are wrong.");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::joinGroup");
-
-        // making representation to join group
-        std::string method = "joinGroup";
-        std::vector< std::string > type = resource->getResourceTypes();
-        std::string resourceType;
-        resourceType.append(OCGetResourceTypeName(resourceHandle, 0));
-
-        OCRepresentation rep;
-        rep.setValue("method", method);
-        rep.setValue("collectionResourceType", type[0]);
-        rep.setValue("resourceType", resourceType);
-
-        OC_LOG_V(DEBUG, TAG, "\tmethod - %s", method.c_str());
-        OC_LOG_V(DEBUG, TAG, "\tcollectionResourceType - %s", type[0].c_str());
-        OC_LOG_V(DEBUG, TAG, "\tresourceType - %s", resourceType.c_str());
-
-        // creating group sync resource with the received collection resource.
-        // entity handler of group sync is used to join group.
-        std::string host = resource->host();
-        std::string uri = resource->uri() + "/groupsync";
-
-        std::vector< std::string > resourceTypes;
-        std::string temp;
-        for (unsigned int i = 0; i < type.size(); ++i)
-        {
-            temp = type[0] + ".groupsync";
-            resourceTypes.push_back(temp);
-        }
-
-        std::vector< std::string > resourceInterface;
-        resourceInterface.push_back(DEFAULT_INTERFACE);
-
-        OCResource::Ptr groupSyncResource =
-                        OCPlatform::constructResourceObject(host, uri,
-
-                            CT_DEFAULT, false,
-                            resourceTypes, resourceInterface);
-
-        // OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri,
-        //         OC_WIFI, false, resourceTypes, resourceInterface);
-
-        groupSyncResourceList[type[0]] = groupSyncResource;
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::joinGroup : creating groupSyncResource.");
-
-        // Create QueryParameters Map and add query params (if any)
-        QueryParamsMap queryParamsMap;
-
-        // request to join group to the remote group sync resource
-        OCStackResult result = groupSyncResource->put(rep, queryParamsMap,
-                std::bind(&GroupSynchronization::onJoinGroup, this, std::placeholders::_1,
-                        std::placeholders::_2, std::placeholders::_3));
-        if (OC_STACK_OK == result)
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::joinGroup : groupSyncResource->put was successful.");
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG,
-                "GroupSynchronization::joinGroup : groupSyncResource->put was unsuccessful." \
-                "result - %d", result);
-        }
-
-        // saving the remote collection resource.
-        // It is used in onJoinGroup() and onGetJoinedRemoteChild().
-        remoteCollectionResource = resource;
-
-        // saving the resource handle to join. It is used in onGetJoinedRemoteChild()
-        deviceResourceHandle = resourceHandle;
-
-        return OC_STACK_OK;
-    }
-
-    OCStackResult GroupSynchronization::leaveGroup(std::string collectionResourceType,
-            OCResourceHandle resourceHandle)
-    {
-        if ((0 == collectionResourceType.length()) || (!resourceHandle))
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::leaveGroup : Error! Input params are wrong.");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OC_LOG_V(DEBUG, TAG,
-            "GroupSynchronization::leaveGroup : collectionResourceType - %s",
-            collectionResourceType.c_str());
-
-        OCResourceHandle collectionResHandle;
-        auto handleIt = groupSyncResourceHandleList.find(collectionResourceType);
-
-        // if groupSyncResourceHandleList has resourceType,
-        // this app created collection resource handle.
-        if (handleIt != groupSyncResourceHandleList.end())
-        {
-            handleIt = collectionResourceHandleList.find(collectionResourceType);
-            if (handleIt == collectionResourceHandleList.end())
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::leaveGroup : Error!" \
-                    "There is no collection resource handle to leave.");
-                return OC_STACK_INVALID_PARAM;
-            }
-
-            collectionResHandle = handleIt->second;
-            if(collectionResHandle == NULL)
-                return OC_STACK_INVALID_PARAM;
-
-            OCStackResult result;
-            try
-            {
-                result = OCPlatform::unbindResource(collectionResHandle, resourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    OC_LOG(DEBUG, TAG,
-                        "GroupSynchronization::leaveGroup : To unbind resource was successful.");
-                }
-                else
-                {
-                    OC_LOG_V(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                            "To unbind resource was unsuccessful. result - %d", result);
-                    return result;
-                }
-            } catch(OCException &e) {
-                OC_LOG_V(DEBUG, TAG, "ERROR : %s", e.reason().c_str());
-                return OC_STACK_NO_RESOURCE;
-            }
-
-            auto It = std::find(deviceResourceHandleList.begin(), deviceResourceHandleList.end(),
-                    resourceHandle);
-            if (It == deviceResourceHandleList.end()) // there is no resource handle to find
-            {
-                try
-                {
-                    result = OCPlatform::unregisterResource(resourceHandle);
-                    if (OC_STACK_OK == result)
-                    {
-                        OC_LOG(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                                "To unregister resource was successful.");
-                    }
-                    else
-                    {
-                        OC_LOG_V(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                            "To unregister resource was unsuccessful. result - %d", result);
-                        return result;
-                    }
-                } catch(OCException &e)
-                {
-                    OC_LOG_V(DEBUG, TAG, "ERROR : %s", e.reason().c_str());
-                    return OC_STACK_NO_RESOURCE;
-                }
-            }
-            else
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                    "This resource cannot be unregistered.");
-                deviceResourceHandleList.erase(It);
-            }
-
-            auto handleListIt = childResourceHandleList.find(collectionResHandle);
-            if (handleListIt == childResourceHandleList.end())
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                    "Error! There is no child resource list to delete.");
-                return OC_STACK_INVALID_PARAM;
-            }
-
-            std::vector< OCResourceHandle > childList = handleListIt->second;
-            auto childIt = std::find(childList.begin(), childList.end(), resourceHandle);
-            if (childIt != childList.end())
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::groupEntityHandler : " \
-                    "Found! The resource to leave is found.");
-                childList.erase(childIt);
-            }
-
-            childResourceHandleList[collectionResHandle] = childList;
-
-            debugGroupSync();
-        }
-
-        return OC_STACK_OK;
-    }
-
-OCStackResult GroupSynchronization::leaveGroup(
-        const std::shared_ptr<OCResource> resource,
-        std::string collectionResourceType, OCResourceHandle resourceHandle)
-    {
-        if ((!resource) || (!resourceHandle))
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::joinGroup : Error! Input params are wrong.");
-            return OC_STACK_INVALID_PARAM;
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::joinGroup");
-
-        // making representation to join group
-        std::vector< std::string > type = resource->getResourceTypes();
-        std::string host = resource->host();
-        std::string uri = resource->uri() + "/groupsync";
-
-        std::vector< std::string > resourceTypes;
-        std::string temp;
-        for (unsigned int i = 0; i < type.size(); ++i)
-        {
-            temp = type[0] + ".groupsync";
-            resourceTypes.push_back(temp);
-        }
-
-        std::vector< std::string > resourceInterface;
-        resourceInterface.push_back(DEFAULT_INTERFACE);
-
-        OCResource::Ptr groupSyncResource;
-        groupSyncResource = OCPlatform::constructResourceObject(host, uri,
-                CT_DEFAULT, false,
-                resourceTypes, resourceInterface);
-        // groupSyncResource = OCPlatform::constructResourceObject(host, uri,
-        //         OC_WIFI, false, resourceTypes, resourceInterface);
-
-        // making representation to leave group
-        std::string method = "leaveGroup";
-//        std::string type = OCGetResourceTypeName(collectionResourceType, 0);
-        std::string resourceType;
-        resourceType.append(OCGetResourceTypeName(resourceHandle, 0));
-
-        OCRepresentation rep;
-        rep.setValue("method", method);
-        rep.setValue("collectionResourceType", collectionResourceType);
-        rep.setValue("resourceType", resourceType);
-
-        OC_LOG_V(DEBUG, TAG, "\tmethod - %s", method.c_str());
-        OC_LOG_V(DEBUG, TAG, "\tcollectionResourceType - %s", collectionResourceType.c_str());
-        OC_LOG_V(DEBUG, TAG, "\tresourceType - %s", resourceType.c_str());
-
-        QueryParamsMap queryParamsMap;
-
-        // request to leave group to the remote group sync resource
-        OCStackResult result = groupSyncResource->put(rep, queryParamsMap,
-                std::bind(&GroupSynchronization::onLeaveGroup, this, std::placeholders::_1,
-                        std::placeholders::_2, std::placeholders::_3));
-        if (OC_STACK_OK == result)
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                "groupSyncResource->put was successful.");
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::leaveGroup : " \
-                "groupSyncResource->put was unsuccessful. result - %d", result);
-        }
-        return result;
-    }
-
-    void GroupSynchronization::deleteGroup(std::string collectionResourceType)
-    {
-        if (0 == collectionResourceType.length())
-        {
-            OC_LOG(DEBUG, TAG,
-                "GroupSynchronization::deleteGroup : Error! Input params are wrong.");
-            return;
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup");
-
-        OCStackResult result;
-        OCResourceHandle resourceHandle;
-
-        auto handleIt = groupSyncResourceHandleList.find(collectionResourceType);
-
-        // if groupSyncResourceHandleList has resourceType,
-        // group sync of this app created collection resource.
-        if (handleIt != groupSyncResourceHandleList.end())
-        {
-            resourceHandle = handleIt->second; // group sync resource handle
-            result = OCPlatform::unregisterResource(resourceHandle);
-            if (OC_STACK_OK == result)
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                    "To unregister group sync resource handle was successful.");
-            }
-            else
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                        "To unregister group sync resource handle was unsuccessful. " \
-                        "result - %d", result);
-            }
-
-            groupSyncResourceHandleList.erase(handleIt);
-        }
-
-        auto resourceIt = groupSyncResourceList.find(collectionResourceType);
-        if (resourceIt != groupSyncResourceList.end())
-        {
-            groupSyncResourceList.erase(resourceIt);
-        }
-
-        handleIt = collectionResourceHandleList.find(collectionResourceType);
-        if (handleIt == collectionResourceHandleList.end())
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                "Error! There is no collection resource handle to delete.");
-            return;
-        }
-        OCResourceHandle collectionResHandle = handleIt->second;
-
-        collectionResourceHandleList.erase(handleIt);
-
-        auto handleListIt = childResourceHandleList.find(collectionResHandle);
-        if (handleListIt == childResourceHandleList.end())
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                "There is no child resource list to delete.");
-
-            result = OCPlatform::unregisterResource(collectionResHandle);
-            if (result == OC_STACK_OK)
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                     "To unregister collection resource handle was successful.");
-            }
-            else
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                    " To unregister collection resource handle was unsuccessful. result - %d",
-                    result);
-            }
-
-            debugGroupSync();
-            return;
-        }
-
-        std::vector< OCResourceHandle > childList = handleListIt->second;
-
-        childResourceHandleList.erase(handleListIt);
-
-        result = OCPlatform::unbindResources(collectionResHandle, childList);
-        if (OC_STACK_OK == result)
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                "To unbind resources was successful.");
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                "To unbind resources was unsuccessful. result - %d", result);
-        }
-
-        result = OCPlatform::unregisterResource(collectionResHandle);
-        if (result == OC_STACK_OK)
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                "To unregister collection resource handle was successful.");
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::deleteGroup : " \
-                " To unregister collection resource handle was unsuccessful. result - %d",
-                result);
-        }
-
-        std::vector< OCResourceHandle >::iterator It;
-
-        for (unsigned int i = 0; i < childList.size(); i++)
-        {
-            resourceHandle = childList.at(i);
-
-            It = std::find(deviceResourceHandleList.begin(), deviceResourceHandleList.end(),
-                    resourceHandle);
-            if (It != deviceResourceHandleList.end()) // find !!
-            {
-                deviceResourceHandleList.erase(It);
-            }
-            else
-            {
-                result = OCPlatform::unregisterResource(resourceHandle);
-                if (OC_STACK_OK == result)
-                {
-                    OC_LOG_V(DEBUG, TAG,
-                        "GroupSynchronization::deleteGroup : UnregisterResource(%d)" \
-                        " was successful.", i + 1);
-                }
-                else
-                {
-                    OC_LOG_V(DEBUG, TAG,
-                        "GroupSynchronization::deleteGroup : UnregisterResource(%d)" \
-                        " was unsuccessful. result - ", i + 1, result);
-                }
-            }
-        }
-
-        debugGroupSync();
-    }
-
-    std::map< std::string, OCResourceHandle > GroupSynchronization::getGroupList()
-    {
-        return collectionResourceHandleList;
-    }
-
-    OCEntityHandlerResult GroupSynchronization::groupEntityHandler(
-            const std::shared_ptr< OCResourceRequest > request)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::groupEntityHandler");
-
-        if (request)
-        {
-            // Get the request type and request flag
-            std::string requestType = request->getRequestType();
-            int requestFlag = request->getRequestHandlerFlag();
-
-            if (requestFlag == RequestHandlerFlag::RequestFlag)
-            {
-                OC_LOG(DEBUG, TAG, "\trequestFlag : Request");
-
-                // If the request type is GET
-                if (requestType == "GET")
-                {
-                    OC_LOG(DEBUG, TAG, "\t\trequestType : GET");
-                }
-                else if (requestType == "PUT")
-                {
-                    OC_LOG(DEBUG, TAG, "\t\trequestType : PUT");
-
-                    //get method name, group resource type and resource type to join group
-                    OCRepresentation rp = request->getResourceRepresentation();
-                    std::string methodType = rp.getValue< std::string >("method");
-                    std::string collectionResourceType = rp.getValue< std::string >(
-                            "collectionResourceType");
-                    std::string resourceType = rp.getValue< std::string >("resourceType");
-
-                    OC_LOG_V(DEBUG, TAG, "\t\t\tmethod : %s", methodType.c_str());
-                    OC_LOG_V(DEBUG, TAG, "\t\t\tcollection resourceType : %s",
-                        collectionResourceType.c_str());
-                    OC_LOG_V(DEBUG, TAG, "\t\t\tresourceType : %s", resourceType.c_str());
-
-                    auto handleIt = collectionResourceHandleList.find(collectionResourceType);
-                    if (handleIt == collectionResourceHandleList.end())
-                    {
-                        OC_LOG(DEBUG, TAG, "GroupSynchronization::groupEntityHandler : " \
-                            "Error! There is no collection resource handle to delete.");
-                        return OC_EH_ERROR;
-                    }
-                    collectionResourceHandle = handleIt->second;
-                    // in case of join group it is used in onFindResource()
-
-                    if (methodType == "joinGroup")
-                    {
-                        std::string resourceName = OC_RSRVD_WELL_KNOWN_URI;
-                        resourceName.append("?rt=");
-                        resourceName.append(resourceType);
-                        OC_LOG_V(DEBUG, TAG, "\t\t\tresourceName : %s", resourceName.c_str());
-
-                        resourceRequest = request;
-
-                        OCPlatform::findResource("", resourceName,
-                            CT_DEFAULT,
-                            std::bind(&GroupSynchronization::onFindResource, this,
-                                std::placeholders::_1));
-
-                        return OC_EH_SLOW;
-                    }
-                    else if (methodType == "leaveGroup")
-                    {
-                        auto it = childResourceHandleList.find(collectionResourceHandle);
-                        if (it == childResourceHandleList.end())
-                        {
-                            OC_LOG(DEBUG, TAG, "GroupSynchronization::groupEntityHandler : " \
-                                "Error! There is no child resource list.");
-                            return OC_EH_ERROR;
-                        }
-
-                        std::vector< OCResourceHandle > childList = it->second;
-                        OCResourceHandle resourceHandle;
-                        for (auto childIt = childList.begin(); childIt != childList.end();)
-                        {
-                            resourceHandle = (*childIt);
-                            char* type = (char*) OCGetResourceTypeName(resourceHandle, 0);
-
-                            if (0 == resourceType.compare(type))
-                            {
-                                OC_LOG_V(DEBUG, TAG,
-                                    "GroupSynchronization::groupEntityHandler : " \
-                                    "Found! The resource to leave is found. - %s", type);
-
-                                childIt = childList.erase(childIt++);
-
-                                OCStackResult result = OCPlatform::unbindResource(
-                                        collectionResourceHandle, resourceHandle);
-                                if (OC_STACK_OK == result)
-                                {
-                                    OC_LOG(DEBUG, TAG,
-                                        "GroupSynchronization::groupEntityHandler : " \
-                                        "To unbind resource was successful.");
-                                }
-                                else
-                                {
-                                    OC_LOG_V(DEBUG, TAG,
-                                        "GroupSynchronization::groupEntityHandler : " \
-                                        "To unbind resource was unsuccessful. result - %d",
-                                        result);
-                                }
-
-                                result = OCPlatform::unregisterResource(resourceHandle);
-                                if (OC_STACK_OK == result)
-                                {
-                                    OC_LOG(DEBUG, TAG,
-                                        "GroupSynchronization::groupEntityHandler : " \
-                                        "To unregister resource was successful.");
-                                }
-                                else
-                                {
-                                    OC_LOG_V(DEBUG, TAG,
-                                        "GroupSynchronization::groupEntityHandler : "
-                                        "To unregister resource was unsuccessful. result - %d",
-                                        result);
-                                }
-                            }
-                            else
-                            {
-                                ++childIt;
-                            }
-
-                        }
-
-                        childResourceHandleList[collectionResourceHandle] = childList;
-
-                        debugGroupSync();
-
-                        auto pResponse = std::make_shared< OC::OCResourceResponse >();
-                        pResponse->setRequestHandle(request->getRequestHandle());
-                        pResponse->setResourceHandle(request->getResourceHandle());
-                        pResponse->setErrorCode(200);
-                        pResponse->setResponseResult(OC_EH_OK);
-
-                        OCRepresentation rep = request->getResourceRepresentation();
-                        pResponse->setResourceRepresentation(rep, DEFAULT_INTERFACE);
-                        if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
-                        {
-                            OC_LOG(DEBUG, TAG, "GroupSynchronization::groupEntityHandler : " \
-                                "sendResponse is successful.");
-                        }
-                    }
-
-                    if (methodType != "") //TODO: Check groupmethodtype NULL
-                    {
-                    }
-                }
-                else if (requestType == "POST")
-                {
-                    // POST request operations
-                }
-                else if (requestType == "DELETE")
-                {
-                    // DELETE request operations
-                }
-            }
-            else if (requestFlag == RequestHandlerFlag::ObserverFlag)
-            {
-                OC_LOG(DEBUG, TAG, "\trequestFlag : Observer");
-            }
-        }
-        else
-        {
-            OC_LOG(DEBUG, TAG, "Request invalid");
-        }
-
-        return OC_EH_OK;
-    }
-
-    void GroupSynchronization::onFindGroup(std::shared_ptr< OCResource > resource)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::onFindGroup");
-
-        try
-        {
-            if (resource)
-            {
-                // Debugging
-                std::string resourceURI;
-                std::string hostAddress;
-
-                // Get the resource URI
-                resourceURI = resource->uri();
-                OC_LOG_V(DEBUG, TAG, "\tURI of the resource: %s", resourceURI.c_str());
-
-                // Get the resource host address
-                hostAddress = resource->host();
-                OC_LOG_V(DEBUG, TAG, "\tHost address of the resource: %s", hostAddress.c_str());
-
-                hostAddress.append(resourceURI);
-
-#ifndef NDEBUG
-                // Get the resource types
-                OC_LOG(DEBUG, TAG, "\tList of resource types: ");
-                for (auto &resourceTypes : resource->getResourceTypes())
-                {
-                    OC_LOG_V(DEBUG, TAG, "\t\t", resourceTypes.c_str());
-                }
-
-                // Get the resource interfaces
-                OC_LOG(DEBUG, TAG, "\tList of resource interfaces: ");
-                for (auto &resourceInterfaces : resource->getResourceInterfaces())
-                {
-                    OC_LOG_V(DEBUG, TAG, "\t\t", resourceInterfaces.c_str());
-                }
-#endif
-
-                if (false == IsSameGroup(resource))
-                {
-                    saveGroup(resource);
-                    findCallback(resource);
-                }
-            }
-            else
-            {
-                // Resource is invalid
-                OC_LOG(DEBUG, TAG, "Resource is invalid");
-                findCallback(NULL);
-            }
-
-            bIsFinding = false;
-        }
-        catch (std::exception& e)
-        {
-            //log(e.what());
-        }
-    }
-
-    void GroupSynchronization::checkFindGroup(void)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::checkFindGroup");
-
-        for (int i = 0; i < 15; i++)
-        {
-            std::chrono::milliseconds workTime(300);
-            std::this_thread::sleep_for(workTime);
-
-            std::lock_guard < std::mutex > guard(foundGroupMutex);
-
-            if (false == foundGroupResourceList.empty())
-            {
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::checkFoundGroup : " \
-                    "Some group is received.");
-                return;
-            }
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::checkFoundGroup : " \
-            "It is failed to find resource within 3s.");
-
-        onFindGroup(NULL);
-        return;
-    }
-
-    bool GroupSynchronization::IsSameGroup(std::shared_ptr< OCResource > resource)
-    {
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-
-        if (true == foundGroupResourceList.empty())
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::IsSameGroup : There is no found group.");
-            return false;
-        }
-
-        std::string foundHostAddress, savedHostAddress;
-        std::string foundHostUri, savedHostUri;
-        foundHostAddress = resource->host();
-        foundHostUri = resource->uri();
-
-        for (unsigned int i = 0; i < foundGroupResourceList.size(); ++i)
-        {
-            savedHostAddress = (foundGroupResourceList.at(i))->host();
-            savedHostUri = (foundGroupResourceList.at(i))->uri();
-
-            if (0 == foundHostAddress.compare(savedHostAddress.c_str()))
-            {
-                if( 0 == foundHostUri.compare(savedHostAddress) )
-                {
-                    OC_LOG(DEBUG, TAG,
-                        "GroupSynchronization::IsSameGroup : Found! The same group is found.");
-                    return true;
-                }
-            }
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::IsSameGroup :  There is no same group.");
-        return false;
-    }
-
-    void GroupSynchronization::saveGroup(std::shared_ptr< OCResource > resource)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::saveGroup");
-
-        std::lock_guard < std::mutex > guard(foundGroupMutex);
-
-        foundGroupResourceList.push_back(resource);
-    }
-
-    void GroupSynchronization::onJoinGroup(const HeaderOptions& headerOptions,
-            const OCRepresentation& rep, const int eCode)
-    {
-        if (eCode != OC_STACK_OK)
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onJoinGroup : error - %d", eCode);
-            return;
-        }
-    }
-
-    void GroupSynchronization::onFindResource(std::shared_ptr< OCResource > resource)
-    {
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::onFindResource");
-
-        if (resource)
-        {
-            if(NULL == collectionResourceHandle)
-                return;
-
-            // start of debugging
-            std::string resourceURI;
-            std::string hostAddress;
-
-            // Get the resource URI
-            resourceURI = resource->uri();
-            OC_LOG_V(DEBUG, TAG, "\tURI of the resource: %s", resourceURI.c_str());
-
-            // Get the resource host address
-            hostAddress = resource->host();
-            OC_LOG_V(DEBUG, TAG, "\tHost address of the resource: %s", hostAddress.c_str());
-
-            hostAddress.append(resourceURI);
-
-#ifndef NDEBUG
-            // Get the resource types
-            OC_LOG(DEBUG, TAG, "\tList of resource types: ");
-            for (auto &resourceTypes : resource->getResourceTypes())
-            {
-                OC_LOG_V(DEBUG, TAG, "\t\t%s", resourceTypes.c_str());
-            }
-
-            // Get the resource interfaces
-            OC_LOG(DEBUG, TAG, "\tList of resource interfaces: ");
-            for (auto &resourceInterfaces : resource->getResourceInterfaces())
-            {
-                OC_LOG_V(DEBUG, TAG, "\t\t%s", resourceInterfaces.c_str());
-            }
-            // end of debugging
-#endif
-
-            OCResourceHandle resourceHandle;
-            OCStackResult result = OCPlatform::registerResource(resourceHandle, resource);
-            if (result != OC_STACK_OK)
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::" \
-                    "onFindResource - Resource to join creation was unsuccessful. result - %d",
-                    result);
-                return;
-            }
-
-            result = OCPlatform::bindResource(collectionResourceHandle, resourceHandle);
-            if (result != OC_STACK_OK)
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onFindResource : " \
-                    "To bind resource was unsuccessful. result - %d", result);
-                return;
-            }
-
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::onFindResource : " \
-                    "To bind joinGroupHandle and resourceHandle was successful.");
-
-            auto it = childResourceHandleList.find(collectionResourceHandle);
-            std::vector< OCResourceHandle > childHandleList;
-            if (it != childResourceHandleList.end())
-            {
-                childHandleList = it->second;
-            }
-
-            childHandleList.push_back(resourceHandle);
-            childResourceHandleList[collectionResourceHandle] = childHandleList;
-
-            auto pResponse = std::make_shared< OC::OCResourceResponse >();
-            pResponse->setRequestHandle(resourceRequest->getRequestHandle());
-            pResponse->setResourceHandle(resourceRequest->getResourceHandle());
-            pResponse->setErrorCode(200);
-            pResponse->setResponseResult(OC_EH_OK);
-
-            OCRepresentation rep = resourceRequest->getResourceRepresentation();
-            pResponse->setResourceRepresentation(rep);
-            try{
-                if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
-                {
-                    OC_LOG(DEBUG, TAG,
-                        "GroupSynchronization::onFindResource : sendResponse is successful.");
-                }
-            }
-            catch( OCException &e )
-            {
-                // OC_LOG(DEBUG, TAG, e.what);
-                return;
-            }
-        }
-        else
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::onFindResource : " \
-                "Resource is invalid. So a new Group Resource has to be created.");
-        }
-
-        debugGroupSync();
-    }
-
-    void GroupSynchronization::onGetJoinedRemoteChild(const HeaderOptions& headerOptions,
-            const OCRepresentation& rep, const int eCode)
-    {
-        if (eCode != OC_STACK_OK)
-        {
-            OC_LOG_V(DEBUG, TAG,
-                "GroupSynchronization::onGetJoinedRemoteChild : error - %d", eCode);
-            return;
-        }
-
-        std::string resourceURI;
-        std::vector< OCRepresentation > childList;
-        OCRepresentation child;
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild");
-#ifndef NDEBUG
-        // debugging
-        // Get the resource URI
-        resourceURI = rep.getUri();
-        OC_LOG_V(DEBUG, TAG, "\tURI of the resource: %s", resourceURI.c_str());
-
-        // Get the resource types
-        OC_LOG(DEBUG, TAG, "\tList of resource types: ");
-
-        for (auto &resourceTypes : rep.getResourceTypes())
-        {
-            OC_LOG_V(DEBUG, TAG, "\t\t%s", resourceTypes.c_str());
-        }
-
-        // Get the resource interfaces
-        OC_LOG(DEBUG, TAG, "\tList of resource interfaces: ");
-        for (auto &resourceInterfaces : rep.getResourceInterfaces())
-        {
-            OC_LOG_V(DEBUG, TAG, "\t\t%s", resourceInterfaces.c_str());
-        }
-
-        childList = rep.getChildren();
-        for (unsigned int i = 0; i < childList.size(); ++i)
-        {
-            OC_LOG_V(DEBUG, TAG, "\tchild resource - %d", i + 1);
-
-            child = childList.at(i);
-            resourceURI = child.getUri();
-            OC_LOG_V(DEBUG, TAG, "\t\tURI of the resource: %s", resourceURI.c_str());
-
-            OC_LOG_V(DEBUG, TAG, "\t\tList of resource types: ");
-            for (auto &types : child.getResourceTypes())
-            {
-                OC_LOG_V(DEBUG, TAG, "\t\t\t%s", types.c_str());
-            }
-
-            OC_LOG(DEBUG, TAG, "\tList of resource interfaces: ");
-            for (auto &interfaces : child.getResourceInterfaces())
-            {
-                OC_LOG_V(DEBUG, TAG, "\t\t\t%s", interfaces.c_str());
-            }
-        }
-#endif
-
-        // creating remote collection resource handle
-        OCResourceHandle remoteCollectionResourceHandle;
-        resourceURI = remoteCollectionResource->uri();
-        std::vector< std::string > types = remoteCollectionResource->getResourceTypes();
-        std::vector< std::string > interfaces = remoteCollectionResource->getResourceInterfaces();
-
-        OCStackResult result = OCPlatform::registerResource(remoteCollectionResourceHandle,
-                resourceURI, types[0], interfaces[0], NULL, OC_OBSERVABLE);
-        if (result != OC_STACK_OK)
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild - " \
-                "To register remoteCollectionResourceHandle" \
-                " was unsuccessful. result - %d", result);
-            return;
-        }
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild : " \
-                "To register remoteCollectionResourceHandle was successful.");
-
-        // binding remote collection resource handle and resource handle to join
-        collectionResourceHandleList[types[0]] = remoteCollectionResourceHandle;
-
-        result = OCPlatform::bindResource(remoteCollectionResourceHandle, deviceResourceHandle);
-        if (OC_STACK_OK == result)
-        {
-            OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild : " \
-                "binding remoteCollectionResourceHandle and deviceResourceHandle");
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild - " \
-                "To bind remoteCollectionResourceHandle and deviceResourceHandle " \
-                "was unsuccessful. result - %d", result);
-        }
-
-        std::vector< OCResourceHandle > childHandleList;
-        childHandleList.push_back(deviceResourceHandle);
-        deviceResourceHandleList.push_back(deviceResourceHandle);
-
-        // binding copied remote collection resource handle and copied remote resource
-        OCResourceHandle resourceHandle;
-        for (unsigned int i = 0; i < childList.size(); ++i)
-        {
-            OC_LOG_V(DEBUG, TAG, "\tremote resource - %d", i + 1);
-
-            child = childList.at(i);
-            resourceURI = child.getUri();
-            types = child.getResourceTypes();
-            interfaces = child.getResourceInterfaces();
-
-            if (0 == types[0].compare(OCGetResourceTypeName(deviceResourceHandle, 0)))
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild : %s" \
-                    " is bind already.", types[0].c_str());
-                continue;
-            }
-
-            result = OCPlatform::registerResource(resourceHandle, resourceURI, types[0],
-                    interfaces[0], NULL, OC_OBSERVABLE);
-            if (OC_STACK_OK == result)
-            {
-                result = OCPlatform::bindResource(remoteCollectionResourceHandle, resourceHandle);
-                if (result != OC_STACK_OK)
-                {
-                    OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild - " \
-                        "binding remoteCollectionResourceHandle and resourceHandle " \
-                        "was unsuccessful. result - %d", result);
-                    OCPlatform::unregisterResource(resourceHandle);
-                }
-
-                childHandleList.push_back(resourceHandle);
-                OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild : " \
-                    "binding remoteCollectionResourceHandle and resourceHandle");
-            }
-            else
-            {
-                OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild - " \
-                    "To register remoteCollectionResourceHandle was unsuccessful." \
-                    " result - %d", result);
-            }
-        }
-
-        childResourceHandleList[remoteCollectionResourceHandle] = childHandleList;
-        // this handle list is used to leave group
-
-        debugGroupSync();
-    }
-
-    void GroupSynchronization::onLeaveGroup(const HeaderOptions& headerOptions,
-            const OCRepresentation& rep, const int eCode)
-    {
-        if (eCode != OC_STACK_OK)
-        {
-            OC_LOG_V(DEBUG, TAG, "GroupSynchronization::onLeaveGroup : error - %d", eCode);
-            return;
-        }
-
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::onLeaveGroup");
-        debugGroupSync();
-    }
-
-    void GroupSynchronization::debugGroupSync(void)
-    {
-#ifndef NDEBUG
-        OC_LOG(DEBUG, TAG, "GroupSynchronization::debugGroupSync");
-
-        unsigned int i;
-        std::map< std::string, OCResourceHandle >::iterator handleIt;
-        std::map< OCResourceHandle, std::vector< OCResourceHandle > >::iterator childIt;
-        std::string type;
-        OCResourceHandle resourceHandle;
-        std::vector< OCResourceHandle > handleList;
-        std::shared_ptr< OCResource > resource;
-
-        OC_LOG(DEBUG, TAG, "Resource Handle Created by App");
-        for (i = 0; i < deviceResourceHandleList.size(); i++)
-        {
-            resourceHandle = deviceResourceHandleList.at(i);
-
-            OC_LOG_V(DEBUG, TAG, "%d. details", i + 1);
-            OC_LOG_V(DEBUG, TAG, "\turi - %s", OCGetResourceUri(resourceHandle));
-            OC_LOG_V(DEBUG, TAG, "\tresource type - %s",
-                OCGetResourceTypeName(resourceHandle, 0));
-            OC_LOG_V(DEBUG, TAG, "\tresource interface - %s",
-                OCGetResourceInterfaceName(resourceHandle, 0));
-        }
-
-        OC_LOG_V(DEBUG, TAG, "Group Sync Resource Handle List. The number is %d",
-            groupSyncResourceHandleList.size());
-
-        i = 1;
-        for (handleIt = groupSyncResourceHandleList.begin();
-                handleIt != groupSyncResourceHandleList.end(); ++handleIt)
-        {
-            type = handleIt->first;
-            OC_LOG_V(DEBUG, TAG, "\t%d. group sync resource type - %s", i, type.c_str());
-            OC_LOG(DEBUG, TAG, "\tdetails");
-
-            resourceHandle = handleIt->second;
-            OC_LOG_V(DEBUG, TAG, "\turi - %s",
-                OCGetResourceUri(resourceHandle));
-            OC_LOG_V(DEBUG, TAG, "\tresource type - %s",
-                OCGetResourceTypeName(resourceHandle, 0));
-            OC_LOG_V(DEBUG, TAG, "\tresource interface - %s",
-                OCGetResourceInterfaceName(resourceHandle, 0));
-
-            i++;
-        }
-
-        OC_LOG_V(DEBUG, TAG, "Copied Remote Group Sync Resource List. The number is %d",
-            groupSyncResourceList.size());
-        std::vector< std::string > list;
-        i = 1;
-        for (auto resourceIt = groupSyncResourceList.begin();
-                resourceIt != groupSyncResourceList.end(); ++resourceIt)
-        {
-            type = resourceIt->first;
-            OC_LOG_V(DEBUG, TAG, "\t%d. group sync resource type - %s", i, type.c_str());
-            OC_LOG(DEBUG, TAG, "\tdetails");
-
-            resource = resourceIt->second;
-            OC_LOG_V(DEBUG, TAG, "\thost - %s", resource->host().c_str());
-            OC_LOG_V(DEBUG, TAG, "\turi - %s", resource->uri().c_str());
-            list = resource->getResourceTypes();
-            OC_LOG_V(DEBUG, TAG, "\tresource type - %s", list[0].c_str());
-            list = resource->getResourceInterfaces();
-            OC_LOG_V(DEBUG, TAG, "\tresource interface - %s", list[0].c_str());
-            i++;
-        }
-
-        OC_LOG(DEBUG, TAG, "Collection Resource Handle List");
-        i = 1;
-        for (handleIt = collectionResourceHandleList.begin();
-                handleIt != collectionResourceHandleList.end(); ++handleIt)
-        {
-            type = handleIt->first;
-            OC_LOG_V(DEBUG, TAG, "\t%d. collection resource type - %s", i, type.c_str());
-            OC_LOG(DEBUG, TAG, "\tdetails");
-
-            resourceHandle = handleIt->second;
-            OC_LOG_V(DEBUG, TAG, "\turi - %s", OCGetResourceUri(resourceHandle));
-            OC_LOG_V(DEBUG, TAG, "\tresource type - %s",
-                OCGetResourceTypeName(resourceHandle, 0));
-            OC_LOG_V(DEBUG, TAG, "\tresource interface - %s",
-                OCGetResourceInterfaceName(resourceHandle, 0));
-
-            childIt = childResourceHandleList.find(resourceHandle);
-            if (childIt != childResourceHandleList.end())
-            {
-                handleList = childIt->second;
-                for (unsigned int j = 0; j < handleList.size(); j++)
-                {
-
-                    OC_LOG_V(DEBUG, TAG, "\t\t%d. child resource details", j + 1);
-
-                    resourceHandle = handleList.at(j);
-                    OC_LOG_V(DEBUG, TAG, "\t\turi - %s",
-                        OCGetResourceUri(resourceHandle));
-                    OC_LOG_V(DEBUG, TAG, "\t\tresource type - %s",
-                        OCGetResourceTypeName(resourceHandle, 0));
-                    OC_LOG_V(DEBUG, TAG, "\t\tresource interface - %s",
-                        OCGetResourceInterfaceName(resourceHandle, 0));
-                }
-            }
-            i++;
-        }
-#endif
-    }
-}