Removed easy-setup sources that was taken from iotivity 1.2.1
authorAndriy Gudz <a.gudz@samsung.com>
Wed, 21 Jun 2017 11:19:43 +0000 (14:19 +0300)
committerAndriy Gudz <a.gudz@samsung.com>
Wed, 21 Jun 2017 11:19:43 +0000 (14:19 +0300)
22 files changed:
device_core/iotivity_lib/CMakeLists.txt
device_core/iotivity_lib/easy-setup/enrollee/CMakeLists.txt [deleted file]
device_core/iotivity_lib/easy-setup/enrollee/inc/ESEnrolleeCommon.h [deleted file]
device_core/iotivity_lib/easy-setup/enrollee/inc/easysetup.h [deleted file]
device_core/iotivity_lib/easy-setup/enrollee/src/easysetup.c [deleted file]
device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.c [deleted file]
device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.h [deleted file]
device_core/iotivity_lib/easy-setup/inc/escommon.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/CMakeLists.txt [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/ESRichCommon.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/EasySetup.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.cpp [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.cpp [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EasySetup.cpp [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h [deleted file]
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp [deleted file]

index 4dbe2a2..0ce8951 100644 (file)
@@ -12,8 +12,6 @@ include_directories(
 
 SET (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fPIC ")
 
-#add_subdirectory(easy-setup/mediator/richsdk)
-
 FILE(GLOB IOTIVITY_SRCS src/*.cpp)
 
 SET( LIB_SOURCES 
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/CMakeLists.txt b/device_core/iotivity_lib/easy-setup/enrollee/CMakeLists.txt
deleted file mode 100644 (file)
index ae5d65e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_minimum_required (VERSION 2.8)
-get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-project(${ProjectId})
-
-FILE(GLOB SRCS src/*.c)
-
-SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-implicit-function-declaration -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-int-conversion")
-
-add_library(${PROJECT_NAME} ${SRCS})
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/inc/ESEnrolleeCommon.h b/device_core/iotivity_lib/easy-setup/enrollee/inc/ESEnrolleeCommon.h
deleted file mode 100644 (file)
index 41f1902..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-//******************************************************************
-//
-// Copyright 2016 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef ES_ENROLLEE_COMMON_H_
-#define ES_ENROLLEE_COMMON_H_
-
-#include "ocstack.h"
-#include "octypes.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/**
- * @brief Data structure delivered from mediator, which provides WiFi information
- */
-typedef struct
-{
-    char ssid[OIC_STRING_MAX_VALUE];         /**< Ssid of the Enroller**/
-    char pwd[OIC_STRING_MAX_VALUE];          /**< Pwd of the Enroller**/
-    WIFI_AUTHTYPE authtype;         /**< Auth type of the Enroller**/
-    WIFI_ENCTYPE enctype;           /**< Encryption type of the Enroller**/
-    void *userdata;                 /**< Vender-specific data**/
-} ESWiFiProvData;
-
-/**
- * @brief Data structure delivered from mediator, which provides device configuration information
- */
-typedef struct
-{
-    char location[OIC_STRING_MAX_VALUE];    /**< GPS information of device. Longitude and latitude in json format **/
-    char language[OIC_STRING_MAX_VALUE];    /**< IETF language tag using ISO 639X **/
-    char country[OIC_STRING_MAX_VALUE];     /**< ISO Country Code (ISO 3166-1 Alpha-2) **/
-    void *userdata;                         /**< Vender-specific data**/
-} ESDevConfProvData;
-
-/**
- * @brief Data structure delivered from mediator, which provides Cloud server information
- */
-typedef struct
-{
-    char authCode[OIC_STRING_MAX_VALUE];        /**< Auth code issued by OAuth2.0-compatible account server **/
-    char authProvider[OIC_STRING_MAX_VALUE];    /**< Auth provider ID **/
-    char ciServer[OIC_STRING_MAX_VALUE];        /**< Cloud interface server URL which an Enrollee is going to registered **/
-    void *userdata;                             /**< Vender-specific data**/
-} ESCloudProvData;
-
-/**
- * @brief Data structure stored for Device property which includes a WiFi and device configuration.
- */
-typedef struct
-{
-    /**
-     * @brief Data structure indicating WiFi configuration of Enrollee
-     */
-    struct
-    {
-        WIFI_MODE mode[NUM_WIFIMODE];
-        WIFI_FREQ freq;
-    } WiFi;
-
-    /**
-     * @brief Data structure indicating device configuration of Enrollee
-     */
-    struct
-    {
-        char deviceName[OIC_STRING_MAX_VALUE];
-        char modelNumber[OIC_STRING_MAX_VALUE];
-    } DevConf;
-} ESDeviceProperty;
-
-/**
- * A set of functions pointers for callback functions which are called after provisioning data is
- * received from Mediator.
- */
-typedef struct
-{
-    void (*WiFiProvCb) (ESWiFiProvData *);
-    void (*DevConfProvCb) (ESDevConfProvData *);
-    void (*CloudDataProvCb) (ESCloudProvData *);
-} ESProvisioningCallbacks;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //ES_ENROLLEE_COMMON_H_
-
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/inc/easysetup.h b/device_core/iotivity_lib/easy-setup/enrollee/inc/easysetup.h
deleted file mode 100644 (file)
index 5c993cc..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-#ifndef EASYSETUP_ENROLLEE_H__
-#define EASYSETUP_ENROLLEE_H__
-
-#include "escommon.h"
-#include "ESEnrolleeCommon.h"
-
-/**
- * @file
- *
- * This file contains Enrollee APIs
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- * A function pointer for registering a user-defined function to set user-specific properties to a
- * response going back to a client.
- * @param payload Represents a response. You can set a specific value with specific property key
- * to the payload. If a client receives the response and know the property key, then it can
- * extract the value.
- * @param resourceType Used to distinguish which resource the received property belongs to.
- */
-typedef void (*ESWriteUserdataCb)(OCRepPayload* payload, char* resourceType);
-
-/**
- * A function pointer for registering a user-defined function to parse user-specific properties from
- * received POST request.
- * @param payload Represents a received POST request. If you know user-specific property key,
- * then you can extract a corresponding value if it exists.
- * @param resourceType Used to distinguish which resource the received property belongs to
- * @param userdata User-specific data you want to deliver to desired users, i.e. application.
- * The user should know a data structure of passed userdata.
- */
-typedef void (*ESReadUserdataCb)(OCRepPayload* payload, char* resourceType, void** userdata);
-
-/**
- * This function Initializes the EasySetup. This API must be called prior to invoking any other API
- *
- * @param isSecured         True if the Enrollee is operating in secured mode.
- * @param resourceMask      Provisining Resource Type which application wants to make.
- *                          ES_WIFI_RESOURCE = 0x01,
- *                          ES_CLOUD_RESOURCE = 0x02,
- *                          ES_DEVCONF_RESOURCE = 0x04
- * @param callbacks         ESProvisioningCallbacks for updating Provisioning Resources' data to the application
- * @return ::ES_OK on success, some other value upon failure.
- */
-ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvisioningCallbacks callbacks);
-
-
-/**
- * This function Sets Device Information.
- *
- * @param deviceProperty   Contains device information composed of WiFi Structure & DevConf Structure
- * @return ::ES_OK on success, some other value upon failure.
- *
- * @see ESDeviceProperty
- */
-ESResult ESSetDeviceProperty(ESDeviceProperty *deviceProperty);
-
-
-/**
- * This function Sets Enrollee's State.
- *
- * @param esState   Contains current enrollee's state.
- * @return ::ES_OK on success, some other value upon failure.
- *
- * @see ESEnrolleeState
- */
-ESResult ESSetState(ESEnrolleeState esState);
-
-
-/**
- * This function Sets Enrollee's Error Code.
- *
- * @param esErrCode   Contains enrollee's error code.
- * @return ::ES_OK on success, some other value upon failure.
- *
- * @see ESErrorCode
- */
-ESResult ESSetErrorCode(ESErrorCode esErrCode);
-
-/**
- * This function performs termination of Provisioning and Network resources.
- * Also terminates the IoTivity core stack.
- *
- * @return ::ES_OK on success, some other value upon failure.
- */
-ESResult ESTerminateEnrollee();
-
-/**
- * This function is to set two function pointer to handle user-specific properties in in-comming
- * POST request and to out-going response for GET or POST request.
- * If you register certain functions with this API, you have to handle OCRepPayload structure to
- * set and get properties you want.
- *
- * @param readCb a callback for parsing properties from POST request
- * @param writeCb a callback for putting properties to a response to be sent
- *
- * @return ::ES_OK on success, some other value upon failure.
- *
- * @see ESReadUserdataCb
- * @see ESWriteUserdataCb
- */
-ESResult ESSetCallbackForUserdata(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb);
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-
-#endif /* EASYSETUP_ENROLLEE_H__ */
-
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/src/easysetup.c b/device_core/iotivity_lib/easy-setup/enrollee/src/easysetup.c
deleted file mode 100644 (file)
index 1452fa6..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 implementation for EasySetup Enrollee device
- */
-
-#include "easysetup.h"
-#include "logger.h"
-#include "resourcehandler.h"
-//#include "oic_string.h"
-
-/**
- * @var ES_ENROLLEE_TAG
- * @brief Logging tag for module name.
- */
-#define ES_ENROLLEE_TAG "ES"
-
-//-----------------------------------------------------------------------------
-// Private variables
-//-----------------------------------------------------------------------------
-
-static bool gIsSecured = false;
-
-static ESProvisioningCallbacks gESProvisioningCb;
-static ESDeviceProperty gESDeviceProperty;
-
-void ESWiFiRsrcCallback(ESResult esResult, ESWiFiProvData *eventData)
-{
-    OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESWiFiRsrcCallback IN");
-
-    if(esResult != ES_OK)
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESWiFiRsrcCallback Error Occured");
-        return;
-    }
-
-    // deliver data to ESProvisioningCallbacks
-    if(gESProvisioningCb.WiFiProvCb != NULL)
-    {
-        gESProvisioningCb.WiFiProvCb(eventData);
-    }
-    else
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "WiFiProvCb is NULL");
-        return;
-    }
-}
-
-void ESCloudRsrcCallback(ESResult esResult, ESCloudProvData *eventData)
-{
-    OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESCloudRsrcCallback IN");
-
-    if(esResult != ES_OK)
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESCloudRsrcCallback Error Occured");
-        return;
-    }
-
-    if(gESProvisioningCb.CloudDataProvCb != NULL)
-    {
-        gESProvisioningCb.CloudDataProvCb(eventData);
-    }
-    else
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "CloudDataProvCb is NULL");
-        return;
-    }
-}
-
-void ESDevconfRsrcallback(ESResult esResult, ESDevConfProvData *eventData)
-{
-    OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESDevconfRsrcallback IN");
-
-    if(esResult != ES_OK)
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESDevconfRsrcallback Error Occured");
-        return;
-    }
-
-    if(gESProvisioningCb.DevConfProvCb != NULL)
-    {
-        gESProvisioningCb.DevConfProvCb(eventData);
-    }
-    else
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "DevConfProvCb is NULL");
-        return;
-    }
-}
-
-ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvisioningCallbacks callbacks)
-{
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee IN");
-
-    gIsSecured = isSecured;
-
-    if((resourceMask & ES_WIFI_RESOURCE) == ES_WIFI_RESOURCE)
-    {
-        if(callbacks.WiFiProvCb != NULL)
-        {
-            gESProvisioningCb.WiFiProvCb = callbacks.WiFiProvCb;
-            RegisterWifiRsrcEventCallBack(ESWiFiRsrcCallback);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_ENROLLEE_TAG, "WiFiProvCb NULL");
-            return ES_ERROR;
-        }
-    }
-    if((resourceMask & ES_DEVCONF_RESOURCE) == ES_DEVCONF_RESOURCE)
-    {
-        if(callbacks.DevConfProvCb != NULL)
-        {
-            gESProvisioningCb.DevConfProvCb = callbacks.DevConfProvCb;
-            RegisterDevConfRsrcEventCallBack(ESDevconfRsrcallback);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_ENROLLEE_TAG, "DevConfProvCb NULL");
-            return ES_ERROR;
-        }
-    }
-    if((resourceMask & ES_CLOUD_RESOURCE) == ES_CLOUD_RESOURCE)
-    {
-        if(callbacks.CloudDataProvCb != NULL)
-        {
-            gESProvisioningCb.CloudDataProvCb = callbacks.CloudDataProvCb;
-            RegisterCloudRsrcEventCallBack(ESCloudRsrcCallback);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CloudDataProvCb NULL");
-            return ES_ERROR;
-        }
-    }
-
-    if(CreateEasySetupResources(gIsSecured, resourceMask) != OC_STACK_OK)
-    {
-        UnRegisterResourceEventCallBack();
-
-        if (DeleteEasySetupResources() != OC_STACK_OK)
-        {
-            OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
-        }
-
-        return ES_ERROR;
-    }
-
-
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee OUT");
-    return ES_OK;
-}
-
-ESResult ESSetDeviceProperty(ESDeviceProperty *deviceProperty)
-{
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetDeviceProperty IN");
-
-    if(SetDeviceProperty(deviceProperty) != OC_STACK_OK)
-    {
-        OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESSetDeviceProperty Error");
-        return ES_ERROR;
-    }
-
-    int modeIdx = 0;
-    while((deviceProperty->WiFi).mode[modeIdx] != WiFi_EOF)
-    {
-        (gESDeviceProperty.WiFi).mode[modeIdx] = (deviceProperty->WiFi).mode[modeIdx];
-        OIC_LOG_V(INFO, ES_ENROLLEE_TAG, "WiFi Mode : %d", (gESDeviceProperty.WiFi).mode[modeIdx]);
-        modeIdx ++;
-    }
-    (gESDeviceProperty.WiFi).freq = (deviceProperty->WiFi).freq;
-    OIC_LOG_V(INFO, ES_ENROLLEE_TAG, "WiFi Freq : %d", (gESDeviceProperty.WiFi).freq);
-
-    OICStrcpy((gESDeviceProperty.DevConf).deviceName, OIC_STRING_MAX_VALUE, (deviceProperty->DevConf).deviceName);
-    OIC_LOG_V(INFO, ES_ENROLLEE_TAG, "Device Name : %s", (gESDeviceProperty.DevConf).deviceName);
-
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetDeviceProperty OUT");
-    return ES_OK;
-}
-
-ESResult ESSetState(ESEnrolleeState esState)
-{
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetState IN");
-
-    if(esState < ES_STATE_INIT || esState > ES_STATE_EOF)
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "Invalid ESEnrolleeState : %d", esState);
-        return ES_ERROR;
-    }
-
-    if(SetEnrolleeState(esState) != OC_STACK_OK)
-    {
-        OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESSetState ES_ERROR");
-        return ES_ERROR;
-    }
-
-    OIC_LOG_V(INFO, ES_ENROLLEE_TAG, "Set ESState succesfully : %d", esState);
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetState OUT");
-    return ES_OK;
-}
-
-ESResult ESSetErrorCode(ESErrorCode esErrCode)
-{
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetErrorCode IN");
-
-    if(esErrCode < ES_ERRCODE_NO_ERROR || esErrCode > ES_ERRCODE_UNKNOWN)
-    {
-        OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "Invalid ESSetErrorCode : %d", esErrCode);
-            return ES_ERROR;
-    }
-
-    if(SetEnrolleeErrCode(esErrCode) != OC_STACK_OK)
-    {
-        OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESSetErrorCode ES_ERROR");
-        return ES_ERROR;
-    }
-
-    OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Set ESErrorCode succesfully : %d", esErrCode);
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESSetErrorCode OUT");
-    return ES_OK;
-}
-
-ESResult ESTerminateEnrollee()
-{
-    OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESTerminateEnrollee IN");
-
-    UnRegisterResourceEventCallBack();
-
-    //Delete Prov resource
-    if (DeleteEasySetupResources() != OC_STACK_OK)
-    {
-        OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
-        return ES_ERROR;
-    }
-
-    OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESTerminateEnrollee success");
-    return ES_OK;
-}
-
-ESResult ESSetCallbackForUserdata(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb)
-{
-    if(!readCb && !writeCb)
-    {
-        OIC_LOG(INFO, ES_ENROLLEE_TAG, "Both of callbacks for user data are null");
-        return ES_ERROR;
-    }
-
-    SetCallbackForUserData(readCb, writeCb);
-    return ES_OK;
-}
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.c b/device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.c
deleted file mode 100644 (file)
index 1d03720..0000000
+++ /dev/null
@@ -1,1568 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 "resourcehandler.h"
-
-#include "ocpayload.h"
-//#include "oic_string.h"
-//#include "oic_malloc.h"
-//#include "cautilinterface.h"
-
-/**
- * @var ES_RH_TAG
- * @brief Logging tag for module name.
- */
-#define ES_RH_TAG "ES_RH"
-//-----------------------------------------------------------------------------
-// Private variables
-//-----------------------------------------------------------------------------
-
-/**
- * @var gProvResource
- * @brief Structure for holding the Provisioning status and target information required to
- * connect to the target network
- */
-static ProvResource gProvResource;
-static WiFiResource gWiFiResource;
-static CloudResource gCloudResource;
-static DevConfResource gDevConfResource;
-
-//-----------------------------------------------------------------------------
-// Private internal function prototypes
-//-----------------------------------------------------------------------------
-OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandlerRequest *ehRequest,
-        void *callback);
-OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
-OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
-OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
-void updateProvResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input);
-void updateWiFiResource(OCRepPayload* input);
-void updateCloudResource(OCRepPayload* input);
-void updateDevConfResource(OCRepPayload* input);
-const char *getResult(OCStackResult result);
-
-ESWiFiCB gWifiRsrcEvtCb = NULL;
-ESCloudCB gCloudRsrcEvtCb = NULL;
-ESDevConfCB gDevConfRsrcEvtCb = NULL;
-
-ESReadUserdataCb gReadUserdataCb = NULL;
-ESWriteUserdataCb gWriteUserdataCb = NULL;
-
-bool CompareResourceInterface(char *from, char *iface)
-{
-    char *str = OICStrdup(from);
-    char *ptr = strtok(str, ";");
-
-    if(ptr == NULL)
-    {
-        return false;
-    }
-
-    do
-    {
-        if(strstr(ptr, ".if."))
-        {
-            char *if_ptr = NULL;
-            if_ptr = strtok(ptr, "=");
-            if_ptr = strtok(NULL, "=");
-
-            if(!strcmp(if_ptr, iface))
-            {
-                return true;
-            }
-        }
-
-    } while ((ptr = strtok(NULL, ";")));
-
-    return false;
-}
-
-ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb)
-{
-    if(!readCb && !writeCb)
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Both of callbacks for user data are null");
-        return ES_ERROR;
-    }
-    gReadUserdataCb = readCb;
-    gWriteUserdataCb = writeCb;
-    return ES_OK;
-}
-
-void RegisterWifiRsrcEventCallBack(ESWiFiCB cb)
-{
-    gWifiRsrcEvtCb = cb;
-}
-
-void RegisterCloudRsrcEventCallBack(ESCloudCB cb)
-{
-    gCloudRsrcEvtCb = cb;
-}
-
-void RegisterDevConfRsrcEventCallBack(ESDevConfCB cb)
-{
-    gDevConfRsrcEvtCb = cb;
-}
-
-void UnRegisterResourceEventCallBack()
-{
-    if (gWifiRsrcEvtCb)
-    {
-        gWifiRsrcEvtCb = NULL;
-    }
-    if (gCloudRsrcEvtCb)
-    {
-        gCloudRsrcEvtCb = NULL;
-    }
-    if (gDevConfRsrcEvtCb)
-    {
-        gDevConfRsrcEvtCb = NULL;
-    }
-}
-
-OCStackResult initProvResource(bool isSecured)
-{
-    gProvResource.status = ES_STATE_INIT;
-    gProvResource.lastErrCode = ES_ERRCODE_NO_ERROR;
-
-    OCStackResult res = OC_STACK_ERROR;
-    if (isSecured)
-    {
-        res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_RES_TYPE_PROV,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
-    }else
-    {
-        res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_RES_TYPE_PROV,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-    }
-    if(res)
-    {
-        OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
-        return res;
-    }
-
-    res = OCBindResourceTypeToResource(gProvResource.handle, OC_RSRVD_ES_RES_TYPE_COL);
-    if(res)
-    {
-        OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource type with result: %s", getResult(res));
-        return res;
-    }
-
-    res = OCBindResourceInterfaceToResource(gProvResource.handle, OC_RSRVD_INTERFACE_LL);
-    if(res)
-    {
-        OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res));
-        return res;
-    }
-    res = OCBindResourceInterfaceToResource(gProvResource.handle, OC_RSRVD_INTERFACE_BATCH);
-    if(res)
-    {
-        OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res));
-        return res;
-    }
-
-    OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
-    return res;
-}
-
-OCStackResult initWiFiResource(bool isSecured)
-{
-    OCStackResult res = OC_STACK_ERROR;
-
-    gWiFiResource.supportedFreq = WIFI_BOTH;
-    gWiFiResource.supportedMode[0] = WIFI_11A;
-    gWiFiResource.supportedMode[1] = WIFI_11B;
-    gWiFiResource.supportedMode[2] = WIFI_11G;
-    gWiFiResource.supportedMode[3] = WIFI_11N;
-    gWiFiResource.numMode = 4;
-    gWiFiResource.authType = NONE_AUTH;
-    gWiFiResource.encType = NONE_ENC;
-    OICStrcpy(gWiFiResource.ssid, sizeof(gWiFiResource.ssid), "");
-    OICStrcpy(gWiFiResource.cred, sizeof(gWiFiResource.cred), "");
-
-    if (isSecured)
-    {
-        res = OCCreateResource(&gWiFiResource.handle, OC_RSRVD_ES_RES_TYPE_WIFI,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_WIFI, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
-    }else
-    {
-        res = OCCreateResource(&gWiFiResource.handle, OC_RSRVD_ES_RES_TYPE_WIFI,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_WIFI, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-    }
-
-    OIC_LOG_V(INFO, ES_RH_TAG, "Created WiFi resource with result: %s", getResult(res));
-    return res;
-
-}
-
-OCStackResult initCloudServerResource(bool isSecured)
-{
-    OCStackResult res = OC_STACK_ERROR;
-
-    OICStrcpy(gCloudResource.authCode, sizeof(gCloudResource.authCode), "");
-    OICStrcpy(gCloudResource.authProvider, sizeof(gCloudResource.authProvider), "");
-    OICStrcpy(gCloudResource.ciServer, sizeof(gCloudResource.ciServer), "");
-
-    if (isSecured)
-    {
-        res = OCCreateResource(&gCloudResource.handle, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_CLOUDSERVER, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
-    }else
-    {
-        res = OCCreateResource(&gCloudResource.handle, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_CLOUDSERVER, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-    }
-
-    OIC_LOG_V(INFO, ES_RH_TAG, "Created CloudServer resource with result: %s", getResult(res));
-    return res;
-
-}
-
-OCStackResult initDevConfResource(bool isSecured)
-{
-    OCStackResult res = OC_STACK_ERROR;
-
-    OICStrcpy(gDevConfResource.devName, sizeof(gDevConfResource.devName), "");
-    OICStrcpy(gDevConfResource.modelNumber, sizeof(gDevConfResource.modelNumber), "");
-    OICStrcpy(gDevConfResource.location, sizeof(gDevConfResource.location), "");
-    OICStrcpy(gDevConfResource.country, sizeof(gDevConfResource.country), "");
-    OICStrcpy(gDevConfResource.language, sizeof(gDevConfResource.language), "");
-
-    if (isSecured)
-    {
-        res = OCCreateResource(&gDevConfResource.handle, OC_RSRVD_ES_RES_TYPE_DEVCONF,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_DEVCONF, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
-    }else
-    {
-        res = OCCreateResource(&gDevConfResource.handle, OC_RSRVD_ES_RES_TYPE_DEVCONF,
-        OC_RSRVD_INTERFACE_DEFAULT,
-        OC_RSRVD_ES_URI_DEVCONF, OCEntityHandlerCb,
-        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
-    }
-
-    OIC_LOG_V(INFO, ES_RH_TAG, "Created DevConf resource with result: %s", getResult(res));
-    return res;
-
-}
-
-void updateProvResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input)
-{
-    OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.status %d", gProvResource.status);
-
-    if(ehRequest->query)
-    {
-        if(CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH))
-        {
-            // When Provisioning resource has a POST with BatchInterface
-            updateCloudResource(input);
-            updateWiFiResource(input);
-            updateDevConfResource(input);
-        }
-    }
-}
-
-void updateWiFiResource(OCRepPayload* input)
-{
-    ESWiFiProvData* wiFiData = (ESWiFiProvData*)OICMalloc(sizeof(ESWiFiProvData));
-
-    if(wiFiData == NULL)
-    {
-        OIC_LOG(DEBUG, ES_RH_TAG, "OICMalloc is failed");
-        return ;
-    }
-
-    memset(wiFiData->ssid, 0, OIC_STRING_MAX_VALUE);
-    memset(wiFiData->pwd, 0, OIC_STRING_MAX_VALUE);
-    wiFiData->authtype = NONE_AUTH;
-    wiFiData->enctype = NONE_AUTH;
-    wiFiData->userdata = NULL;
-
-    char* ssid = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_SSID, &ssid))
-    {
-        OICStrcpy(gWiFiResource.ssid, sizeof(gWiFiResource.ssid), ssid);
-        OICStrcpy(wiFiData->ssid, sizeof(wiFiData->ssid), ssid);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gWiFiResource.ssid : %s", gWiFiResource.ssid);
-    }
-
-    char* cred = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CRED, &cred))
-    {
-        OICStrcpy(gWiFiResource.cred, sizeof(gWiFiResource.cred), cred);
-        OICStrcpy(wiFiData->pwd, sizeof(wiFiData->pwd), cred);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gWiFiResource.cred %s", gWiFiResource.cred);
-    }
-
-    int64_t authType = -1;
-    if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_AUTHTYPE, &authType))
-    {
-        gWiFiResource.authType = authType;
-        wiFiData->authtype = gWiFiResource.authType;
-        OIC_LOG_V(INFO, ES_RH_TAG, "gWiFiResource.authType %u", gWiFiResource.authType);
-    }
-
-    int64_t encType = -1;
-    if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_ENCTYPE, &encType))
-    {
-        gWiFiResource.encType = encType;
-        wiFiData->enctype = gWiFiResource.encType;
-        OIC_LOG_V(INFO, ES_RH_TAG, "gWiFiResource.encType %u", gWiFiResource.encType);
-    }
-
-    if(gReadUserdataCb)
-    {
-        gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_WIFI, &wiFiData->userdata);
-    }
-
-    if(ssid || cred || authType!= -1 || encType != -1)
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Send WiFiRsrc Callback To ES");
-
-        // TODO : Need to check appropriateness of gWiFiData
-        if(gWifiRsrcEvtCb != NULL)
-        {
-            gWifiRsrcEvtCb(ES_OK, wiFiData);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "gWifiRsrcEvtCb is NULL");
-        }
-    }
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gWiFiResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Enrollee doesn't have any observers.");
-    }
-
-    OICFree(wiFiData);
-}
-
-void updateCloudResource(OCRepPayload* input)
-{
-    ESCloudProvData* cloudData = (ESCloudProvData*)OICMalloc(sizeof(ESCloudProvData));
-
-    if(cloudData == NULL)
-    {
-        OIC_LOG(DEBUG, ES_RH_TAG, "OICMalloc is failed");
-        return;
-    }
-
-    memset(cloudData->authCode, 0, OIC_STRING_MAX_VALUE);
-    memset(cloudData->authProvider, 0, OIC_STRING_MAX_VALUE);
-    memset(cloudData->ciServer, 0, OIC_STRING_MAX_VALUE);
-    cloudData->userdata = NULL;
-
-    char *authCode = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_AUTHCODE, &authCode))
-    {
-        OICStrcpy(gCloudResource.authCode, sizeof(gCloudResource.authCode), authCode);
-        OICStrcpy(cloudData->authCode, sizeof(cloudData->authCode), authCode);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gCloudResource.authCode %s", gCloudResource.authCode);
-    }
-
-    char *authProvider = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_AUTHPROVIDER, &authProvider))
-    {
-        OICStrcpy(gCloudResource.authProvider, sizeof(gCloudResource.authProvider), authProvider);
-        OICStrcpy(cloudData->authProvider, sizeof(cloudData->authProvider), authProvider);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gCloudResource.authServerUrl %s", gCloudResource.authProvider);
-    }
-
-    char *ciServer = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CISERVER, &ciServer))
-    {
-        OICStrcpy(gCloudResource.ciServer, sizeof(gCloudResource.ciServer), ciServer);
-        OICStrcpy(cloudData->ciServer, sizeof(cloudData->ciServer), ciServer);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gCloudResource.ciServer %s", gCloudResource.ciServer);
-    }
-
-    if(gReadUserdataCb)
-    {
-        gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER, &cloudData->userdata);
-    }
-
-    if(authCode || authProvider || ciServer)
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Send CloudRsrc Callback To ES");
-
-        // TODO : Need to check appropriateness of gCloudData
-        if(gCloudRsrcEvtCb != NULL)
-        {
-            gCloudRsrcEvtCb(ES_OK, cloudData);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "gCloudRsrcEvtCb is NULL");
-        }
-    }
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gCloudResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "cloudResource doesn't have any observers.");
-    }
-
-    OICFree(cloudData);
-}
-
-void updateDevConfResource(OCRepPayload* input)
-{
-    ESDevConfProvData* devConfData = (ESDevConfProvData*)OICMalloc(sizeof(ESDevConfProvData));
-
-    if(devConfData == NULL)
-    {
-        OIC_LOG(DEBUG, ES_RH_TAG, "OICMalloc is failed");
-        return;
-    }
-    memset(devConfData->language, 0, OIC_STRING_MAX_VALUE);
-    memset(devConfData->country, 0, OIC_STRING_MAX_VALUE);
-    devConfData->userdata = NULL;
-
-    char *location = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_LOCATION, &location))
-    {
-        OICStrcpy(gDevConfResource.location, sizeof(gDevConfResource.location), location);
-        OICStrcpy(devConfData->location, sizeof(devConfData->location), location);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gDevConfResource.location %s", gDevConfResource.location);
-    }
-
-    char *country = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_COUNTRY, &country))
-    {
-        OICStrcpy(gDevConfResource.country, sizeof(gDevConfResource.country), country);
-        OICStrcpy(devConfData->country, sizeof(devConfData->country), country);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gDevConfResource.country %s", gDevConfResource.country);
-    }
-
-    char *language = NULL;
-    if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_LANGUAGE, &language))
-    {
-        OICStrcpy(gDevConfResource.language, sizeof(gDevConfResource.language), language);
-        OICStrcpy(devConfData->language, sizeof(devConfData->language), language);
-        OIC_LOG_V(INFO, ES_RH_TAG, "gDevConfResource.language %s", gDevConfResource.language);
-    }
-
-    if(gReadUserdataCb)
-    {
-        gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_DEVCONF, &devConfData->userdata);
-    }
-
-    if(country || language)
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Send DevConfRsrc Callback To ES");
-
-        // TODO : Need to check appropriateness of gDevConfData
-        if(gDevConfRsrcEvtCb != NULL)
-        {
-            gDevConfRsrcEvtCb(ES_OK, devConfData);
-        }
-        else
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "gDevConfRsrcEvtCb is NULL");
-        }
-    }
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gDevConfResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observers.");
-    }
-
-    OICFree(devConfData);
-}
-
-OCRepPayload* constructResponseOfWiFi(char *interface)
-{
-    int i;
-    OCRepPayload* payload = OCRepPayloadCreate();
-    if (!payload)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-        return NULL;
-    }
-
-    if(gWiFiResource.handle == NULL)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "WiFi resource is not created");
-        return NULL;
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "constructResponse wifi res");
-    OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_WIFI);
-
-    OCRepPayload* repPayload = NULL;
-    OCRepPayload* tempPayload = NULL;
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        repPayload = OCRepPayloadCreate();
-        if (!repPayload)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-            return NULL;
-        }
-
-        tempPayload = payload;
-        payload = repPayload;
-
-        size_t interfacesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **interfaces = (char **)OICMalloc(3 * sizeof(char*));
-
-        interfaces[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_INTERFACE, (char **)interfaces, interfacesDimensions);
-
-        size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*));
-
-        resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFI);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions);
-    }
-    else
-    {
-        OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-        OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_WIFI);
-    }
-
-    size_t dimensions[MAX_REP_ARRAY_DEPTH] = {gWiFiResource.numMode, 0, 0};
-    int64_t *modes_64 = (int64_t *)OICMalloc(gWiFiResource.numMode * sizeof(int64_t));
-    for(i = 0 ; i < gWiFiResource.numMode ; ++i)
-    {
-        modes_64[i] = gWiFiResource.supportedMode[i];
-    }
-    OCRepPayloadSetIntArray(payload, OC_RSRVD_ES_SUPPORTEDWIFIMODE, (int64_t *)modes_64, dimensions);
-
-    OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_SUPPORTEDWIFIFREQ, gWiFiResource.supportedFreq);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_SSID, gWiFiResource.ssid);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CRED, gWiFiResource.cred);
-    OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_AUTHTYPE, (int) gWiFiResource.authType);
-    OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_ENCTYPE, (int) gWiFiResource.encType);
-
-    if(gWriteUserdataCb)
-    {
-        gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_WIFI);
-    }
-
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        payload = tempPayload;
-        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
-    }
-
-    return payload;
-}
-
-OCRepPayload* constructResponseOfCloud(char *interface)
-{
-    OCRepPayload* payload = OCRepPayloadCreate();
-    if (!payload)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-        return NULL;
-    }
-
-    if(gCloudResource.handle == NULL)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "CloudServer resource is not created");
-        return NULL;
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "constructResponse cloudserver res");
-    OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_CLOUDSERVER);
-
-    OCRepPayload* repPayload = NULL;
-    OCRepPayload* tempPayload = NULL;
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        repPayload = OCRepPayloadCreate();
-        if (!repPayload)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-            return NULL;
-        }
-
-        tempPayload = payload;
-        payload = repPayload;
-
-        size_t interfacesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **interfaces = (char **)OICMalloc(3 * sizeof(char*));
-
-        interfaces[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_INTERFACE, (char **)interfaces, interfacesDimensions);
-
-        size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*));
-
-        resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions);
-    }
-    else
-    {
-        OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-        OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER);
-    }
-
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHCODE, gCloudResource.authCode);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHPROVIDER, gCloudResource.authProvider);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CISERVER, gCloudResource.ciServer);
-
-    if(gWriteUserdataCb)
-    {
-        gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER);
-    }
-
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        payload = tempPayload;
-        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
-    }
-
-    return payload;
-}
-
-OCRepPayload* constructResponseOfDevConf(char *interface)
-{
-    OCRepPayload* payload = OCRepPayloadCreate();
-    if (!payload)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-        return NULL;
-    }
-
-    if(gDevConfResource.handle == NULL)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "DevConf resource is not created");
-        return NULL;
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "constructResponse devconf res");
-    OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_DEVCONF);
-
-    OCRepPayload* repPayload = NULL;
-    OCRepPayload* tempPayload = NULL;
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        repPayload = OCRepPayloadCreate();
-        if (!repPayload)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-            return NULL;
-        }
-
-        tempPayload = payload;
-        payload = repPayload;
-
-        size_t interfacesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **interfaces = (char **)OICMalloc(3 * sizeof(char*));
-
-        interfaces[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_INTERFACE, (char **)interfaces, interfacesDimensions);
-
-        size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-        char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*));
-
-        resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_DEVCONF);
-
-        OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions);
-    }
-    else
-    {
-        OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-        OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_DEVCONF);
-    }
-
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_DEVNAME, gDevConfResource.devName);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_MODELNUMBER, gDevConfResource.modelNumber);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_LOCATION, gDevConfResource.location);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_LANGUAGE, gDevConfResource.language);
-    OCRepPayloadSetPropString(payload, OC_RSRVD_ES_COUNTRY, gDevConfResource.country);
-
-    if(gWriteUserdataCb)
-    {
-        gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_DEVCONF);
-    }
-
-    if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH))
-    {
-        payload = tempPayload;
-        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
-    }
-
-    return payload;
-}
-
-OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest)
-{
-    OCRepPayload* payload = OCRepPayloadCreate();
-    if (!payload)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-        return NULL;
-    }
-
-    // Requested interface is Link list interface
-    //if(ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL))
-    if(!ehRequest->query ||
-        (ehRequest->query && !strcmp(ehRequest->query, "")) ||
-        (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL)) ||
-        (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT)))
-    {
-        const OCRepPayload *arrayPayload[3] = {NULL};
-
-        int childResCnt = 0;
-
-        if(gWiFiResource.handle != NULL)
-        {
-            OCRepPayload *add = OCRepPayloadCreate();
-            if(!add)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            size_t dimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-            char **resourceType = NULL;
-            resourceType = (char **)OICMalloc(sizeof(char *) * 1);
-            char **resourceInterface = NULL;
-            resourceInterface = (char **)OICMalloc(sizeof(char *) * 1);
-
-            if(!resourceType || !resourceInterface)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFI);
-            resourceInterface[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-            add->base.type = PAYLOAD_TYPE_REPRESENTATION;
-            OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_WIFI);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_RESOURCE_TYPE,
-                                            (const char **)resourceType, dimensions);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_INTERFACE,
-                                            (const char **)resourceInterface, dimensions);
-
-            OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)gWiFiResource.handle);
-            OCRepPayload *policy = OCRepPayloadCreate();
-            if (!policy)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            OCRepPayloadSetPropInt(policy, OC_RSRVD_BITMAP,
-                                    ((p & OC_DISCOVERABLE) | (p & OC_OBSERVABLE)));
-            if (p & OC_SECURE)
-            {
-                OCRepPayloadSetPropBool(policy, OC_RSRVD_SECURE, p & OC_SECURE);
-                uint16_t securePort = CAGetAssignedPortNumber(ehRequest->devAddr.adapter,
-                                                                    ehRequest->devAddr.flags);
-                OCRepPayloadSetPropInt(policy, OC_RSRVD_HOSTING_PORT, securePort);
-            }
-
-            OCRepPayloadSetPropObject(add, OC_RSRVD_POLICY, policy);
-
-            arrayPayload[childResCnt++] = add;
-        }
-
-        if(gDevConfResource.handle != NULL)
-        {
-            OCRepPayload *add = OCRepPayloadCreate();
-            if(!add)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            size_t dimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-            char **resourceType = NULL;
-            resourceType = (char **)OICMalloc(sizeof(char *) * 1);
-            char **resourceInterface = NULL;
-            resourceInterface = (char **)OICMalloc(sizeof(char *) * 1);
-
-            if(!resourceType || !resourceInterface)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_DEVCONF);
-            resourceInterface[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-            add->base.type = PAYLOAD_TYPE_REPRESENTATION;
-            OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_DEVCONF);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_RESOURCE_TYPE,
-                                            (const char **)resourceType, dimensions);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_INTERFACE,
-                                            (const char **)resourceInterface, dimensions);
-
-            OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)gDevConfResource.handle);
-            OCRepPayload *policy = OCRepPayloadCreate();
-            if (!policy)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            OCRepPayloadSetPropInt(policy, OC_RSRVD_BITMAP,
-                                    ((p & OC_DISCOVERABLE) | (p & OC_OBSERVABLE)));
-            if (p & OC_SECURE)
-            {
-                OCRepPayloadSetPropBool(policy, OC_RSRVD_SECURE, p & OC_SECURE);
-                uint16_t securePort = CAGetAssignedPortNumber(ehRequest->devAddr.adapter,
-                                                                    ehRequest->devAddr.flags);
-                OCRepPayloadSetPropInt(policy, OC_RSRVD_HOSTING_PORT, securePort);
-            }
-
-            OCRepPayloadSetPropObject(add, OC_RSRVD_POLICY, policy);
-
-            arrayPayload[childResCnt++] = add;
-        }
-
-        if(gCloudResource.handle != NULL)
-        {
-            OCRepPayload *add = OCRepPayloadCreate();
-            if(!add)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            size_t dimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0};
-            char **resourceType = NULL;
-            resourceType = (char **)OICMalloc(sizeof(char *) * 1);
-            char **resourceInterface = NULL;
-            resourceInterface = (char **)OICMalloc(sizeof(char *) * 1);
-
-            if(!resourceType || !resourceInterface)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER);
-            resourceInterface[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-
-            add->base.type = PAYLOAD_TYPE_REPRESENTATION;
-            OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_CLOUDSERVER);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_RESOURCE_TYPE,
-                                            (const char **)resourceType, dimensions);
-            OCRepPayloadSetStringArray(add, OC_RSRVD_INTERFACE,
-                                            (const char **)resourceInterface, dimensions);
-
-            OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)gCloudResource.handle);
-            OCRepPayload *policy = OCRepPayloadCreate();
-            if (!policy)
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-                return NULL;
-            }
-
-            OCRepPayloadSetPropInt(policy, OC_RSRVD_BITMAP,
-                                    ((p & OC_DISCOVERABLE) | (p & OC_OBSERVABLE)));
-            if (p & OC_SECURE)
-            {
-                OCRepPayloadSetPropBool(policy, OC_RSRVD_SECURE, p & OC_SECURE);
-                uint16_t securePort = CAGetAssignedPortNumber(ehRequest->devAddr.adapter,
-                                                                    ehRequest->devAddr.flags);
-                OCRepPayloadSetPropInt(policy, OC_RSRVD_HOSTING_PORT, securePort);
-            }
-
-            OCRepPayloadSetPropObject(add, OC_RSRVD_POLICY, policy);
-
-            arrayPayload[childResCnt++] = add;
-        }
-
-        size_t dimensions[MAX_REP_ARRAY_DEPTH] = {childResCnt, 0, 0};
-
-        if(!ehRequest->query ||
-            (ehRequest->query && !strcmp(ehRequest->query, "")) ||
-            (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT)))
-        {
-            OIC_LOG(INFO, ES_RH_TAG, "constructResponse prov res");
-            OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_PROV);
-            OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-            OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_LL);
-            OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_BATCH);
-            OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_PROV);
-            OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_COL);
-
-            OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_PROVSTATUS, gProvResource.status);
-            OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_LAST_ERRORCODE, gProvResource.lastErrCode);
-
-            OCRepPayloadSetPropObjectArray(payload, OC_RSRVD_ES_LINKS, arrayPayload, dimensions);
-        }
-        else    // link list interface
-        {
-            OCRepPayloadSetPropObjectArray(payload, OC_RSRVD_ES_LINKS, arrayPayload, dimensions);
-        }
-    } else if (
-        ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH))
-
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "constructResponse prov res");
-        OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_PROV);
-
-        OCRepPayload* repPayload = NULL;
-
-        repPayload = OCRepPayloadCreate();
-        if (!repPayload)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
-            return NULL;
-        }
-
-        size_t interfacesDimensions[MAX_REP_ARRAY_DEPTH] = {3, 0, 0};
-        char **interfaces = (char **)OICMalloc(3 * sizeof(char*));
-
-        interfaces[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT);
-        interfaces[1] = OICStrdup(OC_RSRVD_INTERFACE_LL);
-        interfaces[2] = OICStrdup(OC_RSRVD_INTERFACE_BATCH);
-
-        OCRepPayloadSetStringArray(repPayload, OC_RSRVD_ES_INTERFACE, (char **)interfaces, interfacesDimensions);
-
-        size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {2, 0, 0};
-        char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*));
-
-        resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_PROV);
-        resourceTypes[1] = OICStrdup(OC_RSRVD_ES_RES_TYPE_COL);
-
-        OCRepPayloadSetStringArray(repPayload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions);
-
-        OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_PROVSTATUS, gProvResource.status);
-        OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_LAST_ERRORCODE, gProvResource.lastErrCode);
-
-        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
-    }
-
-    if(gWriteUserdataCb)
-    {
-        gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_PROV);
-    }
-
-    if(ehRequest->query)
-    {
-        if(CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH))
-        {// When Provisioning resource has a GET with BatchInterface
-            OCRepPayload* head = payload;
-            OCRepPayload* nextPayload = NULL;
-
-            nextPayload = constructResponseOfWiFi(OC_RSRVD_INTERFACE_BATCH);
-            if(nextPayload != NULL)
-            {
-                payload->next = nextPayload;
-                payload = payload->next;
-            }
-
-            nextPayload = constructResponseOfCloud(OC_RSRVD_INTERFACE_BATCH);
-            if(nextPayload != NULL)
-            {
-                payload->next = nextPayload;
-                payload = payload->next;
-            }
-
-            nextPayload = constructResponseOfDevConf(OC_RSRVD_INTERFACE_BATCH);
-            if(nextPayload != NULL)
-            {
-                payload->next = nextPayload;
-            }
-
-            payload = head;
-        }
-    }
-
-    return payload;
-}
-
-
-OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMask)
-{
-    OCStackResult res = OC_STACK_ERROR;
-    bool maskFlag = false;
-
-    res = initProvResource(isSecured);
-    if(res != OC_STACK_OK)
-    {
-        // TODO: destroy logic will be added
-        OIC_LOG_V(ERROR, ES_RH_TAG, "initProvResource result: %s", getResult(res));
-
-        return res;
-    }
-
-    if((resourceMask & ES_WIFI_RESOURCE) == ES_WIFI_RESOURCE)
-    {
-        maskFlag = true;
-        res = initWiFiResource(isSecured);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "initWiFiResource result: %s", getResult(res));
-            return res;
-        }
-
-        res = OCBindResource(gProvResource.handle, gWiFiResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Bind WiFiResource result: %s", getResult(res));
-            return res;
-        }
-
-    }
-
-    if((resourceMask & ES_CLOUD_RESOURCE) == ES_CLOUD_RESOURCE)
-    {
-        maskFlag = true;
-        res = initCloudServerResource(isSecured);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "initCloudResource result: %s", getResult(res));
-            return res;
-        }
-
-        res = OCBindResource(gProvResource.handle, gCloudResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Bind CloudResource result: %s", getResult(res));
-            return res;
-        }
-    }
-
-    if((resourceMask & ES_DEVCONF_RESOURCE) == ES_DEVCONF_RESOURCE)
-    {
-        maskFlag = true;
-        res = initDevConfResource(isSecured);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "initDevConf result: %s", getResult(res));
-            return res;
-        }
-
-        res = OCBindResource(gProvResource.handle, gDevConfResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Bind DevConfResource result: %s", getResult(res));
-            return res;
-        }
-    }
-
-
-    if(maskFlag == false)
-    {
-        OIC_LOG_V(ERROR, ES_RH_TAG, "Invalid ResourceMask");
-        return OC_STACK_ERROR;
-
-    }
-
-    OIC_LOG_V(INFO, ES_RH_TAG, "Created all resources with result: %s", getResult(res));
-
-    return res;
-}
-
-OCStackResult DeleteProvisioningResource()
-{
-    OCStackResult res = OCDeleteResource(gProvResource.handle);
-    if (res != OC_STACK_OK)
-    {
-        OIC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
-    }
-
-    return res;
-}
-
-OCStackResult DeleteEasySetupResources()
-{
-    OCStackResult res = OC_STACK_ERROR;
-    if (gWiFiResource.handle != NULL)
-    {
-        res = OCUnBindResource(gProvResource.handle, gWiFiResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind WiFi resource error with result: %s", getResult(res));
-        }
-    }
-    if (gCloudResource.handle != NULL)
-    {
-        res = OCUnBindResource(gProvResource.handle, gCloudResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind CloudServer resource error with result: %s", getResult(res));
-        }
-    }
-    if (gDevConfResource.handle != NULL)
-    {
-        res = OCUnBindResource(gProvResource.handle, gDevConfResource.handle);
-        if(res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind DevConf resource error with result: %s", getResult(res));
-        }
-    }
-
-    if (gWiFiResource.handle != NULL)
-    {
-        res = OCDeleteResource(gWiFiResource.handle);
-        if (res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting WiFi resource error with result: %s", getResult(res));
-        }
-    }
-
-    if(gCloudResource.handle != NULL)
-    {
-        res = OCDeleteResource(gCloudResource.handle);
-        if (res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting CloudServer resource error with result: %s", getResult(res));
-        }
-    }
-
-    if(gDevConfResource.handle != NULL)
-    {
-        res = OCDeleteResource(gDevConfResource.handle);
-        if (res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting DevConf resource error with result: %s", getResult(res));
-        }
-    }
-
-    if(gProvResource.handle != NULL)
-    {
-        res = OCDeleteResource(gProvResource.handle);
-        if (res != OC_STACK_OK)
-        {
-            OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
-        }
-    }
-
-    return res;
-}
-
-OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload **payload)
-{
-    OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    if (!ehRequest)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Request is Null");
-        return ehResult;
-    }
-    if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
-        return ehResult;
-    }
-
-    OCRepPayload *getResp = NULL;
-    *payload = NULL;
-
-    if(ehRequest->resource == gProvResource.handle)
-    {
-        if(ehRequest->query &&
-            strcmp(ehRequest->query, "") &&
-            !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL) &&
-            !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH) &&
-            !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            getResp = constructResponseOfProv(ehRequest);
-        }
-    }
-    else if(ehRequest->resource == gWiFiResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            getResp = constructResponseOfWiFi(OC_RSRVD_INTERFACE_DEFAULT);
-        }
-    }
-    else if(ehRequest->resource == gCloudResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            getResp = constructResponseOfCloud(OC_RSRVD_INTERFACE_DEFAULT);
-        }
-    }
-    else if(ehRequest->resource == gDevConfResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            getResp = constructResponseOfDevConf(OC_RSRVD_INTERFACE_DEFAULT);
-        }
-    }
-
-    if (!getResp)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
-        return OC_EH_ERROR;
-    }
-
-    *payload = getResp;
-    ehResult = OC_EH_OK;
-
-    return ehResult;
-}
-
-OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload)
-{
-    OIC_LOG(INFO, ES_RH_TAG, "ProcessPostRequest enter");
-    OCEntityHandlerResult ehResult = OC_EH_ERROR;
-    if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
-        return ehResult;
-    }
-
-    OCRepPayload* input = (OCRepPayload*) (ehRequest->payload);
-    if (!input)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
-        return ehResult;
-    }
-
-    if(ehRequest->resource == gProvResource.handle)
-    {
-        if(ehRequest->query &&
-            strcmp(ehRequest->query, "") &&
-            !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH) &&
-            !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            updateProvResource(ehRequest, input);
-        }
-    }
-    else if(ehRequest->resource == gWiFiResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            updateWiFiResource(input);
-        }
-    }
-    else if(ehRequest->resource == gCloudResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            updateCloudResource(input);
-        }
-    }
-    else if(ehRequest->resource == gDevConfResource.handle)
-    {
-        if(CheckEhRequestPayload(ehRequest) != OC_EH_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-            return OC_EH_BAD_REQ;
-        }
-        else
-        {
-            updateDevConfResource(input);
-        }
-    }
-
-    OCRepPayload *getResp = NULL;
-    if(ehRequest->resource == gProvResource.handle)
-    {
-        getResp = constructResponseOfProv(ehRequest);
-    }
-    else if(ehRequest->resource == gWiFiResource.handle)
-    {
-        getResp = constructResponseOfWiFi(OC_RSRVD_INTERFACE_DEFAULT);
-    }
-    else if(ehRequest->resource == gCloudResource.handle)
-    {
-        getResp = constructResponseOfCloud(OC_RSRVD_INTERFACE_DEFAULT);
-    }
-    else if(ehRequest->resource == gDevConfResource.handle)
-    {
-        getResp = constructResponseOfDevConf(OC_RSRVD_INTERFACE_DEFAULT);
-    }
-
-    if (!getResp)
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
-        return OC_EH_ERROR;
-    }
-
-    *payload = getResp;
-    ehResult = OC_EH_OK;
-
-    return ehResult;
-}
-
-OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest * ehRequest,
-        OCRepPayload** payload)
-{
-    (void) ehRequest;
-    (void) payload;
-    OCEntityHandlerResult ehResult = OC_EH_BAD_REQ;
-
-    return ehResult;
-}
-/**
- * This is the entity handler for the registered resource.
- * This is invoked by OCStack whenever it recevies a request for this resource.
- */
-OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest* entityHandlerRequest, void *callback)
-{
-    (void) callback;
-    OCEntityHandlerResult ehRet = OC_EH_OK;
-    OCEntityHandlerResponse response =
-    { 0, 0, OC_EH_ERROR, 0, 0,
-    { },
-    { 0 }, false };
-    OCRepPayload* payload = NULL;
-
-    if (entityHandlerRequest && (flag & OC_REQUEST_FLAG))
-    {
-        if (OC_REST_GET == entityHandlerRequest->method)
-        {
-            OIC_LOG(INFO, ES_RH_TAG, "Received GET request");
-            ehRet = ProcessGetRequest(entityHandlerRequest, &payload);
-        }
-        else if (OC_REST_PUT == entityHandlerRequest->method)
-        {
-            OIC_LOG(INFO, ES_RH_TAG, "Received PUT request");
-
-            //PUT request will be handled in the internal implementation
-            if (gProvResource.handle != NULL)
-            {
-                ehRet = ProcessPutRequest(entityHandlerRequest, &payload);
-            }
-            else
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Cannot process put");
-                ehRet = OC_EH_ERROR;
-            }
-        }
-        else if (OC_REST_POST == entityHandlerRequest->method)
-        {
-            OIC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client");
-            if (gProvResource.handle != NULL)
-            {
-                ehRet = ProcessPostRequest(entityHandlerRequest, &payload);
-            }
-            else
-            {
-                OIC_LOG(ERROR, ES_RH_TAG, "Cannot process put");
-                ehRet = OC_EH_ERROR;
-            }
-        }
-
-        // Format the response.  Note this requires some info about the request
-        response.requestHandle = entityHandlerRequest->requestHandle;
-        response.resourceHandle = entityHandlerRequest->resource;
-        response.ehResult = ehRet;
-        //response uses OCPaylod while all get,put methodes use OCRepPayload
-        response.payload = (OCPayload*) (payload);
-        response.numSendVendorSpecificHeaderOptions = 0;
-        memset(response.sendVendorSpecificHeaderOptions, 0,
-                sizeof(response.sendVendorSpecificHeaderOptions));
-        memset(response.resourceUri, 0, sizeof(response.resourceUri));
-        // Indicate that response is NOT in a persistent buffer
-        response.persistentBufferFlag = 0;
-
-        // Send the response
-        if (OCDoResponse(&response) != OC_STACK_OK)
-        {
-            OIC_LOG(ERROR, ES_RH_TAG, "Error sending response");
-            ehRet = OC_EH_ERROR;
-        }
-    }
-    if (entityHandlerRequest && (flag & OC_OBSERVE_FLAG))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "Flag includes OC_OBSERVE_FLAG");
-
-        if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action)
-        {
-            OIC_LOG (INFO, ES_RH_TAG, "Received OC_OBSERVE_REGISTER from Mediator");
-        }
-        else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action)
-        {
-            OIC_LOG (INFO, ES_RH_TAG, "Received OC_OBSERVE_DEREGISTER from Mediator");
-        }
-    }
-    return ehRet;
-}
-
-OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty)
-{
-    OIC_LOG(INFO, ES_RH_TAG, "SetDeviceProperty IN");
-
-    gWiFiResource.supportedFreq = (deviceProperty->WiFi).freq;
-    OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Freq : %d", gWiFiResource.supportedFreq);
-
-    int modeIdx = 0;
-    while((deviceProperty->WiFi).mode[modeIdx] != WiFi_EOF)
-    {
-        gWiFiResource.supportedMode[modeIdx] = (deviceProperty->WiFi).mode[modeIdx];
-        OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Mode : %d", gWiFiResource.supportedMode[modeIdx]);
-        modeIdx ++;
-    }
-    gWiFiResource.numMode = modeIdx;
-
-    OICStrcpy(gDevConfResource.devName, OIC_STRING_MAX_VALUE, (deviceProperty->DevConf).deviceName);
-    OIC_LOG_V(INFO, ES_RH_TAG, "Device Name : %s", gDevConfResource.devName);
-
-    OICStrcpy(gDevConfResource.modelNumber, OIC_STRING_MAX_VALUE,
-                                                            (deviceProperty->DevConf).modelNumber);
-    OIC_LOG_V(INFO, ES_RH_TAG, "Model Number : %s", gDevConfResource.modelNumber);
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gWiFiResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "wifiResource doesn't have any observers.");
-    }
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gDevConfResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observers.");
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "SetDeviceProperty OUT");
-    return OC_STACK_OK;
-}
-
-OCStackResult SetEnrolleeState(ESEnrolleeState esState)
-{
-    OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeState IN");
-
-    gProvResource.status = esState;
-    OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee Status : %d", gProvResource.status);
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gProvResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers.");
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeState OUT");
-    return OC_STACK_OK;
-}
-
-OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode)
-{
-    OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeErrCode IN");
-
-    gProvResource.lastErrCode = esErrCode;
-    OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee ErrorCode : %d", gProvResource.lastErrCode);
-
-    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gProvResource.handle, OC_HIGH_QOS))
-    {
-        OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers.");
-    }
-
-    OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeErrCode OUT");
-    return OC_STACK_OK;
-}
-
-OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest)
-{
-    if( !(ehRequest->query) ||
-                (ehRequest->query &&
-                (strcmp(ehRequest->query, "") && !CompareResourceInterface(ehRequest->query,
-                                                                        OC_RSRVD_INTERFACE_DEFAULT))))
-    {
-        OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
-        return OC_EH_BAD_REQ;
-    }
-    return OC_EH_OK;
-}
-
-const char *getResult(OCStackResult result)
-{
-    switch (result)
-    {
-        case OC_STACK_OK:
-            return "OC_STACK_OK";
-        case OC_STACK_INVALID_URI:
-            return "OC_STACK_INVALID_URI";
-        case OC_STACK_INVALID_QUERY:
-            return "OC_STACK_INVALID_QUERY";
-        case OC_STACK_INVALID_IP:
-            return "OC_STACK_INVALID_IP";
-        case OC_STACK_INVALID_PORT:
-            return "OC_STACK_INVALID_PORT";
-        case OC_STACK_INVALID_CALLBACK:
-            return "OC_STACK_INVALID_CALLBACK";
-        case OC_STACK_INVALID_METHOD:
-            return "OC_STACK_INVALID_METHOD";
-        case OC_STACK_NO_MEMORY:
-            return "OC_STACK_NO_MEMORY";
-        case OC_STACK_COMM_ERROR:
-            return "OC_STACK_COMM_ERROR";
-        case OC_STACK_INVALID_PARAM:
-            return "OC_STACK_INVALID_PARAM";
-        case OC_STACK_NOTIMPL:
-            return "OC_STACK_NOTIMPL";
-        case OC_STACK_NO_RESOURCE:
-            return "OC_STACK_NO_RESOURCE";
-        case OC_STACK_RESOURCE_ERROR:
-            return "OC_STACK_RESOURCE_ERROR";
-        case OC_STACK_SLOW_RESOURCE:
-            return "OC_STACK_SLOW_RESOURCE";
-        case OC_STACK_NO_OBSERVERS:
-            return "OC_STACK_NO_OBSERVERS";
-        case OC_STACK_ERROR:
-            return "OC_STACK_ERROR";
-        default:
-            return "UNKNOWN";
-    }
-}
diff --git a/device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.h b/device_core/iotivity_lib/easy-setup/enrollee/src/resourcehandler.h
deleted file mode 100644 (file)
index 03a6a05..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// Do not remove the include below
-
-#include <string.h>
-#include "logger.h"
-#include "ocstack.h"
-#include "escommon.h"
-#include "ESEnrolleeCommon.h"
-#include "octypes.h"
-
-#ifndef ES_RESOURCE_HANDLER_H_
-#define ES_RESOURCE_HANDLER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*ESWiFiCB) (ESResult, ESWiFiProvData *);
-typedef void (*ESCloudCB) (ESResult, ESCloudProvData *);
-typedef void (*ESDevConfCB) (ESResult, ESDevConfProvData *);
-
-typedef void (*ESWriteUserdataCb)(OCRepPayload* payload, char* resourceType);
-typedef void (*ESReadUserdataCb)(OCRepPayload* payload, char* resourceType, void** userdata);
-
-/* Structure to represent a Light resource */
-typedef struct PROVRESOURCE
-{
-    OCResourceHandle handle;
-    ProvStatus status; // provisiong status
-    ESErrorCode lastErrCode;
-} ProvResource;
-
-typedef struct
-{
-    OCResourceHandle handle;
-    WIFI_MODE supportedMode[NUM_WIFIMODE];
-    uint8_t numMode;        // the number of device's supported wifi modes
-    WIFI_FREQ supportedFreq;
-    char ssid[OIC_STRING_MAX_VALUE]; // SSID
-    char cred[OIC_STRING_MAX_VALUE]; // credential information.
-    WIFI_AUTHTYPE authType;
-    WIFI_ENCTYPE encType;
-} WiFiResource;
-
-typedef struct
-{
-    OCResourceHandle handle;
-    char authCode[OIC_STRING_MAX_VALUE];
-    char authProvider[OIC_STRING_MAX_VALUE];
-    char ciServer[OIC_STRING_MAX_VALUE];
-} CloudResource;
-
-typedef struct
-{
-    OCResourceHandle handle;
-    char devName[OIC_STRING_MAX_VALUE];
-    char modelNumber[OIC_STRING_MAX_VALUE];
-    char location[OIC_STRING_MAX_VALUE];
-    char language[OIC_STRING_MAX_VALUE];
-    char country[OIC_STRING_MAX_VALUE];
-} DevConfResource;
-
-OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMask);
-OCStackResult DeleteEasySetupResources();
-
-OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty);
-OCStackResult SetEnrolleeState(ESEnrolleeState esState);
-OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode);
-OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest);
-
-void RegisterWifiRsrcEventCallBack(ESWiFiCB);
-void RegisterCloudRsrcEventCallBack(ESCloudCB);
-void RegisterDevConfRsrcEventCallBack(ESDevConfCB);
-void UnRegisterResourceEventCallBack(void);
-ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //ES_RESOURCE_HANDLER_H_
diff --git a/device_core/iotivity_lib/easy-setup/inc/escommon.h b/device_core/iotivity_lib/easy-setup/inc/escommon.h
deleted file mode 100644 (file)
index c350109..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef ES_COMMON_H_
-#define ES_COMMON_H_
-
-#include "ocstack.h"
-#include "octypes.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-// Defines
-#define OC_RSRVD_ES_RES_TYPE_COL          "oic.wk.col"
-#define OC_RSRVD_ES_INTERFACE             "if"
-#define OC_RSRVD_ES_RES_TYPE              "rt"
-
-
-
-#define OIC_STRING_MAX_VALUE    64
-#define MAX_WEBLINKLEN          3
-#define NUM_WIFIMODE            5
-
-/**
- * Attributes used to form a proper easysetup conforming JSON message.
- */
-#define OC_RSRVD_ES_PROVSTATUS             "ps"
-#define OC_RSRVD_ES_LAST_ERRORCODE         "lec"
-#define OC_RSRVD_ES_LINKS                  "links"
-#define OC_RSRVD_ES_SUPPORTEDWIFIMODE      "swmt"
-#define OC_RSRVD_ES_SUPPORTEDWIFIFREQ      "swf"
-#define OC_RSRVD_ES_SSID                   "tnn"
-#define OC_RSRVD_ES_CRED                   "cd"
-#define OC_RSRVD_ES_AUTHTYPE               "wat"
-#define OC_RSRVD_ES_ENCTYPE                "wet"
-#define OC_RSRVD_ES_AUTHCODE               "ac"
-#define OC_RSRVD_ES_AUTHPROVIDER           "apn"
-#define OC_RSRVD_ES_CISERVER               "cis"
-#define OC_RSRVD_ES_SERVERID               "sid"
-#define OC_RSRVD_ES_DEVNAME                "dn"
-#define OC_RSRVD_ES_LANGUAGE               "lang"
-#define OC_RSRVD_ES_COUNTRY                "ctry"
-#define OC_RSRVD_ES_MODELNUMBER            "mnmo"
-#define OC_RSRVD_ES_LOCATION               "loc"
-#define OC_RSRVD_ES_HREF                   "href"
-
-/**
- * Easysetup defined resoruce types and uris.
- */
-#define OC_RSRVD_ES_RES_TYPE_PROV         "oic.wk.prov"
-#define OC_RSRVD_ES_URI_PROV              "/ProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_WIFI         "oic.wk.wifi"
-#define OC_RSRVD_ES_URI_WIFI              "/WiFiProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER  "oic.wk.cloudserver"
-#define OC_RSRVD_ES_URI_CLOUDSERVER       "/CloudServerProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_DEVCONF      "oic.wk.devconf"
-#define OC_RSRVD_ES_URI_DEVCONF           "/DevConfProvisioningResURI"
-
-
-/**
- * @brief  Supported WIFI frequency like 2.4G and 5G
- */
-typedef enum
-{
-    WIFI_24G = 0,       /**< 2.4G **/
-    WIFI_5G,            /**< 5G **/
-    WIFI_BOTH,          /**< 2.4G and 5G **/
-    WIFI_FREQ_NONE      /**< EOF **/
-} WIFI_FREQ;
-
-/**
- * @brief  Supported WIFI mode like 802.11g and 802.11n
- */
-typedef enum
-{
-    WIFI_11A = 0,       /**< 802.11a **/
-    WIFI_11B,           /**< 802.11b **/
-    WIFI_11G,           /**< 802.11g **/
-    WIFI_11N,           /**< 802.11n **/
-    WIFI_11AC,          /**< 802.11ac **/
-    WiFi_EOF = 999
-} WIFI_MODE;
-
-
-/**
- * @brief  WIFI Authentication tlype of the Enroller
- */
-typedef enum
-{
-    NONE_AUTH = 0,      /**< NO authentication **/
-    WEP,                /**< WEP **/
-    WPA_PSK,            /**< WPA-PSK **/
-    WPA2_PSK            /**< WPA2-PSK **/
-} WIFI_AUTHTYPE;
-
-/**
- * @brief  WIFI encryption type of the Enroller
- */
-typedef enum
-{
-    NONE_ENC = 0,       /**< NO encryption **/
-    WEP_64,             /**< WEP-64 **/
-    WEP_128,            /**< WEP-128**/
-    TKIP,               /**< TKIP **/
-    AES,                /**< AES **/
-    TKIP_AES            /**< TKIP-AES **/
-} WIFI_ENCTYPE;
-
-/**
- * @brief A result of Easy Setup
- */
-typedef enum
-{
-    /**
-     * Provisioning succeeds.
-     */
-    ES_OK = 0,
-
-    /**
-     * Enrollee discovery fails in cloud provisioning
-     */
-    ES_ENROLLEE_DISCOVERY_FAILURE = 11,
-
-    /**
-     * Valid GET or POST request fails for some reason.
-     * This failure may happen when it failed to receive any response from Enrollee by a timeout threshold
-     */
-    ES_COMMUNICATION_ERROR,
-
-    /**
-     * Security opertion is not supported because Mediator is built as unsecured mode.
-     */
-    ES_SEC_OPERATION_IS_NOT_SUPPORTED = 20,
-
-    /**
-     * Security resource discovery fails due to loss of discovery packet or absence of the resource in a network
-     */
-    ES_SECURE_RESOURCE_DISCOVERY_FAILURE,
-
-    /**
-     * Ownership transfer fails because DTLS handshake failure happens
-     */
-    ES_OWNERSHIP_TRANSFER_FAILURE,
-
-    /**
-     * ACL provisioning fails in cloud provisioning.
-     * It could be that UUID format of cloud server is wrong.
-     * Or any response for the provisioning request is not arrived at Mediator
-     */
-    ES_ACL_PROVISIONING_FAILURE,
-
-    /**
-     * Cert. provisioning fails in cloud provisioning.
-     * It could be that you put a wrong cred ID of which the corresponding certificate does not exist in SVR DB.
-     * Or any response for the provisioning request is not arrived at Mediator
-     */
-    ES_CERT_PROVISIONING_FAILURE,
-
-    /**
-     * Provisioning fails for some reason.
-     */
-    ES_ERROR = 255
-} ESResult;
-
-/**
- * @brief Indicate which resource is created in Enrollee
- */
-typedef enum
-{
-    ES_WIFI_RESOURCE = 0x01,
-    ES_CLOUD_RESOURCE = 0x02,
-    ES_DEVCONF_RESOURCE = 0x04
-} ESResourceMask;
-
-/**
- * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning
- *        status" property in provisioning resource.
- */
-typedef enum
-{
-    /**
-     * Default state of the device
-     */
-    ES_STATE_INIT = 0,
-
-    /**
-     * Status indicating being connecting to target network
-     */
-    ES_STATE_CONNECTING_TO_ENROLLER,
-
-    /**
-     * Status indicating successful conection to target network
-     */
-    ES_STATE_CONNECTED_TO_ENROLLER,
-
-    /**
-     * Status indicating connection failure to target network
-     */
-    ES_STATE_FAILED_TO_CONNECT_TO_ENROLLER,
-
-    /**
-     * Status indicating being registering to cloud
-     */
-    ES_STATE_REGISTERING_TO_CLOUD,
-
-    /**
-     * Status indicating successful registration to cloud
-     */
-    ES_STATE_REGISTERED_TO_CLOUD,
-
-    /**
-     * Status indicating registeration failure to cloud
-     */
-    ES_STATE_FAILED_TO_REGISTER_TO_CLOUD,
-
-    /**
-     * Status indicating being publishing resources to cloud
-     */
-    ES_STATE_PUBLISHING_RESOURCES_TO_CLOUD,
-
-    /**
-     * Status indicating successful resource publish to cloud
-     */
-    ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD,
-
-    /**
-     * Status indicating resource publish failure to cloud
-     */
-    ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD,
-
-    /**
-     * End of Easy setup status
-     */
-    ES_STATE_EOF = 255
-} ESEnrolleeState, ProvStatus;
-
-/**
- * @brief Indicate last error code to describe a reason of error during easy setup.
- */
-typedef enum
-{
-    /**
-     * Init Error Code
-     */
-    ES_ERRCODE_NO_ERROR = 0,
-
-    /**
-     * Error Code that given WiFi's SSID is not found
-     */
-    ES_ERRCODE_SSID_NOT_FOUND,
-
-    /**
-     * Error Code that given WiFi's Password is wrong
-     */
-    ES_ERRCODE_PW_WRONG,
-
-    /**
-     * Error Code that IP address is not allocated
-     */
-    ES_ERRCODE_IP_NOT_ALLOCATED,
-
-    /**
-     * Error Code that there is no Internet connection
-     */
-    ES_ERRCODE_NO_INTERNETCONNECTION,
-
-    /**
-     * Error Code that Timeout occured
-     */
-    ES_ERRCODE_TIMEOUT,
-
-    /**
-     * Error Code that cloud server is not reachable due to wrong URL of cloud server, for example.
-     */
-    ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER,
-
-    /**
-     * Error Code that no response is arrived from cloud server
-     */
-    ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER,
-
-    /**
-     * Error Code that a delivered authcode is not valid.
-     */
-    ES_ERRCODE_INVALID_AUTHCODE,
-
-    /**
-     * Error Code that a given access token is not valid due to its expiration, for example.
-     */
-    ES_ERRCODE_INVALID_ACCESSTOKEN,
-
-    /**
-     * Error Code that a refresh of expired access token is failed due to some reasons.
-     */
-    ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN,
-
-    /**
-     * Error Code that a target device is not discovered in cloud server
-     */
-    ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD,
-
-    /**
-     * Error Code that a target user does not exist in cloud server.
-     */
-    ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD,
-
-    /**
-     * Error Code that Unknown error occured
-     */
-    ES_ERRCODE_UNKNOWN = 255
-} ESErrorCode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //ES_COMMON_H_
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/CMakeLists.txt b/device_core/iotivity_lib/easy-setup/mediator/richsdk/CMakeLists.txt
deleted file mode 100644 (file)
index 040f045..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required (VERSION 2.8)
-get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-project(${ProjectId})
-
-include_directories(../../inc inc)
-SET (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fPIC ")
-
-FILE(GLOB SRCS
-       src/RemoteEnrollee.cpp
-       src/EnrolleeResource.cpp
-       src/CloudResource.cpp
-       src/EasySetup.cpp
-       src/ESException.cpp
-
-       # SECURED=1
-       # src/EnrolleeSecurity.cpp
-)
-
-add_library(${PROJECT_NAME} ${SRCS})
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/ESRichCommon.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/ESRichCommon.h
deleted file mode 100644 (file)
index 41fc10c..0000000
+++ /dev/null
@@ -1,896 +0,0 @@
-//******************************************************************
-//
-// Copyright 2016 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef ES_COMMON_RICH_H_
-#define ES_COMMON_RICH_H_
-
-#include <iostream>
-#include <string>
-#ifndef WITH_ARDUINO
-#include <memory>
-#include <vector>
-#endif
-
-#include "OCPlatform.h"
-#include "ocstack.h"
-#include "octypes.h"
-
-#include "escommon.h"
-
-using namespace OC;
-using namespace std;
-
-#ifndef WITH_ARDUINO
-namespace OIC
-{
-    namespace Service
-    {
-        /**
-         * @brief Properties of provisioning resource. It includes a provisioning status and last
-         *        error code.
-         */
-        class EnrolleeStatus
-        {
-        public:
-
-            /**
-             * Constructor
-             */
-            EnrolleeStatus(const OCRepresentation& rep)
-            {
-                m_rep = rep;
-            }
-
-            EnrolleeStatus(const EnrolleeStatus& enrolleeStatus) :
-                m_rep(enrolleeStatus.getRepresentation())
-            {
-            }
-
-            EnrolleeStatus(const EnrolleeStatus&& enrolleeStatus) :
-                m_rep(std::move(enrolleeStatus.getRepresentation()))
-            {
-            }
-
-            /**
-             * Get a provisioning status property of Enrollee.
-             *
-             * @return a provisioning status property of Enrollee
-             */
-            ProvStatus getProvStatus()
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_PROVSTATUS))
-                {
-                    return static_cast<ProvStatus>(
-                                        m_rep.getValue<int>(OC_RSRVD_ES_PROVSTATUS));
-                }
-                return ES_STATE_INIT;
-            }
-
-            /**
-             * Get a last error code property of Enrollee.
-             *
-             * @return a last error code property of Enrollee.
-             */
-            ESErrorCode getLastErrCode()
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_LAST_ERRORCODE))
-                {
-                    return static_cast<ESErrorCode>(
-                                        m_rep.getValue<int>(OC_RSRVD_ES_LAST_ERRORCODE));
-                }
-                return ES_ERRCODE_NO_ERROR;
-            }
-
-            /**
-             * Get OCRepresentation object
-             *
-             * @return OCRepresentation object
-             */
-            const OCRepresentation& getRepresentation() const
-            {
-                return m_rep;
-            }
-        protected:
-            OCRepresentation m_rep;
-        };
-
-        /**
-         * @brief Data class stored for Cloud server property provisioning
-         */
-        class CloudProp
-        {
-        public:
-
-            /**
-             * Constructor
-             */
-            CloudProp()
-            {
-                m_cloudID = "";
-                m_credID = 0;
-            }
-
-            CloudProp(const CloudProp& cloudProp) :
-                                            m_rep(cloudProp.toOCRepresentation()),
-                                            m_cloudID(cloudProp.getCloudID()),
-                                            m_credID(cloudProp.getCredID())
-            {
-            }
-
-            CloudProp(const CloudProp&& cloudProp) :
-                                            m_rep(std::move(cloudProp.toOCRepresentation())),
-                                            m_cloudID(cloudProp.getCloudID()),
-                                            m_credID(cloudProp.getCredID())
-            {
-            }
-
-            /**
-             * Constructor with OCRepresentation object. This is used for JNI communication.
-             */
-            CloudProp(const OCRepresentation &rep)
-            {
-                m_rep = rep;
-                m_cloudID = "";
-                m_credID = 0;
-            }
-
-            /**
-             * Set CloudServer resource properties to be delivered to Enrollee
-             *
-             * @param authCode  Auth code issued by OAuth2.0-compatible account server
-             * @param authProvider Auth provider ID
-             * @param ciServer Cloud interface server URL which an Enrollee is going to registered
-             */
-            void setCloudProp(string authCode, string authProvider, string ciServer)
-            {
-                m_rep.setValue(OC_RSRVD_ES_AUTHCODE, authCode);
-                m_rep.setValue(OC_RSRVD_ES_AUTHPROVIDER, authProvider);
-                m_rep.setValue(OC_RSRVD_ES_CISERVER, ciServer);
-            }
-
-            /**
-             * Set CloudServer's UUID
-             *
-             * @param cloudID Cloud Interface server's UUID
-             */
-            void setCloudID(string cloudID)
-            {
-                m_cloudID = cloudID;
-            }
-
-            /**
-             * Set CloudServer's credential ID of certificate
-             *
-             * @param credID Cloud Interface server's credential ID of certificate
-             */
-            void setCredID(int credID)
-            {
-                m_credID = credID;
-            }
-
-            /**
-             * Get an auth code to be delivered.
-             *
-             * @return an auth code to be delivered.
-             */
-            std::string getAuthCode() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHCODE))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHCODE);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get an auth provider which issued an auth code
-             *
-             * @return an auth provider which issued an auth code
-             */
-            std::string getAuthProvider() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHPROVIDER))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHPROVIDER);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a CI server to be delivered
-             *
-             * @return a CI server to be delivered
-             */
-            std::string getCiServer() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_CISERVER))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_CISERVER);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a CI server's Uuid to be delivered
-             *
-             * @return a CI server's Uuid to be delivered
-             */
-            std::string getCloudID() const
-            {
-                return m_cloudID;
-            }
-
-            /**
-             * Get a CI server's credential ID of certificate
-             *
-             * @return a CI server's credential ID of certificated
-             */
-            int getCredID() const
-            {
-                return m_credID;
-            }
-
-            /**
-             * Get OCRepresentation object
-             *
-             * @return OCRepresentation object
-             */
-            const OCRepresentation &toOCRepresentation() const
-            {
-                return m_rep;
-            }
-        protected:
-            OCRepresentation m_rep;
-            std::string m_cloudID;
-            int m_credID;
-        };
-
-        /**
-         * @brief Data class stored for Device property provisioning which includes a WiFi
-         *        and device configuration provisioning
-         */
-        class DeviceProp
-        {
-        public:
-
-            /**
-             * Constructor
-             */
-            DeviceProp()
-            {
-            }
-
-            DeviceProp(const DeviceProp& deviceProp) :
-                m_rep(deviceProp.toOCRepresentation())
-            {
-            }
-
-            DeviceProp(const DeviceProp&& deviceProp) :
-                m_rep(std::move(deviceProp.toOCRepresentation()))
-            {
-            }
-
-            /**
-             * Constructor with OCRepresentation object. This is used for JNI communication.
-             */
-            DeviceProp(const OCRepresentation &rep)
-            {
-                m_rep = rep;
-            }
-
-            /**
-             * Set WiFi resource properties to be delivered to Enrollee
-             *
-             * @param ssid Ssid of the Enroller
-             * @param pwd Pwd of the Enrolle
-             * @param authtype Auth type of the Enroller
-             * @param enctype Encryption type of the Enroller
-             *
-             * @see WIFI_AUTHTYPE
-             * @see WIFI_ENCTYPE
-             */
-            void setWiFiProp(string ssid, string pwd, WIFI_AUTHTYPE authtype, WIFI_ENCTYPE enctype)
-            {
-                m_rep.setValue(OC_RSRVD_ES_SSID, ssid);
-                m_rep.setValue(OC_RSRVD_ES_CRED, pwd);
-                m_rep.setValue(OC_RSRVD_ES_AUTHTYPE, authtype);
-                m_rep.setValue(OC_RSRVD_ES_ENCTYPE, enctype);
-            }
-
-            /**
-             * Set DevConf resource properties to be delivered to Enrollee
-             *
-             * @param language IETF language tag using ISO 639X
-             * @param country ISO Country Code (ISO 3166-1 Alpha-2)
-             */
-            void setDevConfProp(string language, string country, string location)
-            {
-                m_rep.setValue(OC_RSRVD_ES_LANGUAGE, language);
-                m_rep.setValue(OC_RSRVD_ES_COUNTRY, country);
-                m_rep.setValue(OC_RSRVD_ES_LOCATION, location);
-            }
-
-            /**
-             * Get a SSID of Enroller
-             *
-             * @return a SSID of enroller
-             */
-            std::string getSsid() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_SSID))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_SSID);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a password of Enroller
-             *
-             * @return a password of enroller
-             */
-            std::string getPassword() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_CRED))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_CRED);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get an auth type of Enroller
-             *
-             * @return an auth type of enroller
-             *
-             * @see WIFI_AUTHTYPE
-             */
-            WIFI_AUTHTYPE getAuthType() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHTYPE))
-                {
-                    return static_cast<WIFI_AUTHTYPE>(m_rep.getValue<int>(OC_RSRVD_ES_AUTHTYPE));
-                }
-                return NONE_AUTH;
-            }
-
-            /**
-             * Get an encryption type of Enroller
-             *
-             * @return an encryption type of enroller
-             *
-             * @see WIFI_ENCTYPE
-             */
-            WIFI_ENCTYPE getEncType() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_ENCTYPE))
-                {
-                    return static_cast<WIFI_ENCTYPE>(m_rep.getValue<int>(OC_RSRVD_ES_ENCTYPE));
-                }
-                return NONE_ENC;
-            }
-
-            /**
-             * Get a language to be set. A language is expressed in IETF language tag
-             * using ISO 639X.
-             *
-             * @return a language to be set
-             */
-            std::string getLanguage() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_LANGUAGE))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_LANGUAGE);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a country to be set. A country is expressed in ISO Country Code
-             * (ISO 3166-1 Alpha-2)
-             *
-             * @return a country to be set
-             */
-            std::string getCountry() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_COUNTRY))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_COUNTRY);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a location to be set. A location is GPS information
-             *
-             * @return a country to be set
-             */
-            std::string getLocation() const
-            {
-                if(m_rep.hasAttribute(OC_RSRVD_ES_LOCATION))
-                {
-                    return m_rep.getValue<std::string>(OC_RSRVD_ES_LOCATION);
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get OCRepresentation object
-             *
-             * @return OCRepresentation object
-             */
-            const OCRepresentation &toOCRepresentation() const
-            {
-                return m_rep;
-            }
-
-        protected:
-            OCRepresentation m_rep;
-        };
-
-        /**
-         * Security Provisioning Status
-         */
-        class SecProvisioningStatus
-        {
-        public:
-            SecProvisioningStatus(string deviceUUID, ESResult result) :
-                m_devUUID(deviceUUID), m_result(result)
-            {
-            }
-
-            const string getDeviceUUID()
-            {
-                return m_devUUID;
-            }
-
-            /**
-             * Get a result for about security provisioning is success or not.
-             *
-             * @return ::ES_OK\n
-             *         ::ES_SEC_OPERATION_IS_NOT_SUPPORTED\n
-             *         ::ES_SECURE_RESOURCE_DISCOVERY_FAILURE\n
-             *         ::ES_OWNERSHIP_TRANSFER_FAILURE\n
-             *         ::ES_ERROR\n
-             */
-            ESResult getESResult()
-            {
-                return m_result;
-            }
-        private:
-            string m_devUUID;
-            ESResult m_result;
-        };
-
-        /**
-         * @breif This provide a set of getter APIs from received response for getConfiguration().
-         *        Received information includes a device name, WiFi supported mode, and frequency.
-         *        Additionally, you can know if Enrollee can be access to cloud server with this
-         *        object.
-         */
-        class EnrolleeConf
-        {
-        public:
-            /**
-             * Constructor
-             * The expected OCRepresentation is one for collection resource and has several child
-             * OCRepresentation object corresponding to WiFi, DevConf, and CloudServer resource's
-             * representation.
-             */
-            EnrolleeConf(const OCRepresentation& rep) :
-                m_ProvRep(rep)
-            {
-            }
-
-            EnrolleeConf(const EnrolleeConf& enrolleeConf) :
-                m_ProvRep(enrolleeConf.getProvResRep())
-            {
-            }
-
-            EnrolleeConf(const EnrolleeConf&& enrolleeConf) :
-                m_ProvRep(std::move(enrolleeConf.getProvResRep()))
-            {
-            }
-
-            /**
-             * Get a device name of Enrollee. It is Device's human-friendly name like device model
-             * name.
-             *
-             * @return a device name of Enrollee
-             */
-            std::string getDeviceName() const
-            {
-                std::vector<OCRepresentation> children = m_ProvRep.getChildren();
-                for(auto child = children.begin(); child != children.end(); ++child)
-                {
-                    if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
-                    {
-                        OCRepresentation rep;
-                        if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
-                        {
-                            rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
-                        }
-                        else
-                        {
-                            return std::string("");
-                        }
-
-                        if(rep.hasAttribute(OC_RSRVD_ES_DEVNAME))
-                        {
-                            return rep.getValue<std::string>(OC_RSRVD_ES_DEVNAME);
-                        }
-                    }
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a model number of Enrollee.
-             *
-             * @return a model number of Enrollee
-             */
-            std::string getModelNumber() const
-            {
-                std::vector<OCRepresentation> children = m_ProvRep.getChildren();
-                for(auto child = children.begin(); child != children.end(); ++child)
-                {
-                    if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
-                    {
-                        OCRepresentation rep;
-                        if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
-                        {
-                            rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
-                        }
-                        else
-                        {
-                            return std::string("");
-                        }
-
-                        if(rep.hasAttribute(OC_RSRVD_ES_MODELNUMBER))
-                        {
-                            return rep.getValue<std::string>(OC_RSRVD_ES_MODELNUMBER);
-                        }
-                    }
-                }
-                return std::string("");
-            }
-
-            /**
-             * Get a set of WiFi supported modes of Enrollee
-             *
-             * @return a set of WiFi supported modes of Enrollee
-             *
-             * @see WIFI_MODE
-             */
-            vector<WIFI_MODE> getWiFiModes() const
-            {
-                vector<WIFI_MODE> modes;
-                modes.clear();
-
-                std::vector<OCRepresentation> children = m_ProvRep.getChildren();
-                for(auto child = children.begin(); child != children.end(); ++child)
-                {
-                    if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos)
-                    {
-                        OCRepresentation rep;
-                        if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
-                        {
-                            rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
-                        }
-                        else
-                        {
-                            return modes;
-                        }
-
-                        if(rep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
-                        {
-                            for(auto it : rep.getValue
-                                        <std::vector<int>>(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
-                            {
-                                modes.push_back(static_cast<WIFI_MODE>(it));
-                            }
-                        }
-                    }
-                }
-                return modes;
-            }
-
-            /**
-             * Get a WiFi supported frequency of Enrollee
-             *
-             * @return a WiFi supported frequency of Enrollee
-             *
-             * @see WIFI_FREQ
-             */
-            WIFI_FREQ getWiFiFreq() const
-            {
-                std::vector<OCRepresentation> children = m_ProvRep.getChildren();
-                for(auto child = children.begin(); child != children.end(); ++child)
-                {
-                    if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos)
-                    {
-                        OCRepresentation rep;
-                        if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
-                        {
-                            rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
-                        }
-                        else
-                        {
-                            return WIFI_FREQ_NONE;
-                        }
-
-                        if(rep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIFREQ))
-                        {
-                            return static_cast<WIFI_FREQ>(
-                                        rep.getValue<int>(OC_RSRVD_ES_SUPPORTEDWIFIFREQ));
-                        }
-                    }
-                }
-                return WIFI_FREQ_NONE;
-            }
-
-            /**
-             * Get an accessibility to cloud server of an Enrollee
-             *
-             * @return an accessibility to cloud server of an Enrollee
-             */
-            bool isCloudAccessible() const
-            {
-                std::vector<OCRepresentation> children = m_ProvRep.getChildren();
-                for(auto child = children.begin(); child != children.end(); ++child)
-                {
-                    for(auto rt : child->getResourceTypes())
-                    {
-                        if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER))
-                        {
-                            return true;
-                        }
-                    }
-                }
-                return false;
-            }
-
-            /**
-             * Get OCRepresentation object
-             *
-             * @return OCRepresentation object
-             */
-            const OCRepresentation& getProvResRep() const
-            {
-                return m_ProvRep;
-            }
-
-        protected:
-            OCRepresentation m_ProvRep;
-        };
-
-        /**
-         * Status object for getStatus API. This object is given to application
-         * when a response for GET request to provisioning resource at Enrollee is arrived.
-         * It returns a result of the API and requested data delivered in the response which includes
-         * a provisioning status and last error code stored in Enrollee.
-         *
-         * @see EnrolleeStatus
-         */
-        class GetEnrolleeStatus
-        {
-        public:
-            /**
-             * Constructor
-             */
-            GetEnrolleeStatus(ESResult result, const EnrolleeStatus& status) :
-                m_result(result), m_enrolleeStatus(status)
-            {
-            }
-
-            /**
-             * Get a result of getting provisioning status and last error code of Enrollee
-             *
-             * @return ::ES_OK\n
-             *         ::ES_COMMUNICATION_ERROR\n
-             *         ::ES_ERROR\n
-             * @see ESResult
-             */
-            ESResult getESResult()
-            {
-                return m_result;
-            }
-
-            /**
-             * Get Enrollee's status and last error code properties
-             *
-             * @return Enrollee's status and last error code properties
-             *
-             * @see EnrolleeStatus
-             */
-            const EnrolleeStatus& getEnrolleeStatus()
-            {
-                return m_enrolleeStatus;
-            }
-
-        private:
-            ESResult m_result;
-            EnrolleeStatus m_enrolleeStatus;
-        };
-
-        /**
-         * Status object for getConfiguration API. This object is given to application
-         * when a response for GET request to provisioning resource at Enrollee is arrived.
-         * It returns a result of the API and requested data delivered in the response which includes
-         * WiFi configuration and device configuration stored in Enrollee.
-         *
-         * @see EnrolleeConf
-         */
-        class GetConfigurationStatus
-        {
-        public:
-            /**
-             * Constructor
-             */
-            GetConfigurationStatus(ESResult result, const EnrolleeConf& conf) :
-                    m_result(result), m_enrolleeConf(conf)
-            {
-            }
-
-            /**
-             * Get a result of getting preconfiguration of Enrollee
-             *
-             * @return ::ES_OK\n
-             *         ::ES_COMMUNICATION_ERROR\n
-             *         ::ES_ERROR\n
-             *
-             * @see ESResult
-             */
-            ESResult getESResult()
-            {
-                return m_result;
-            }
-
-            /**
-             * Get Enrollee's pre-configuration properties
-             *
-             * @return Enrollee's pre-configuration properties
-             *
-             * @see EnrolleeConf
-             */
-            EnrolleeConf& getEnrolleeConf()
-            {
-                return m_enrolleeConf;
-            }
-
-        private:
-            ESResult m_result;
-            EnrolleeConf m_enrolleeConf;
-        };
-
-        /**
-         * Status object for provisionDeviceProperties API. This object is given to application
-         * when a response for GET request to provisioning resource at Enrollee is arrived.
-         * It returns a result of the request.
-         */
-        class DevicePropProvisioningStatus
-        {
-        public:
-            /**
-             * Constructor
-             */
-            DevicePropProvisioningStatus(ESResult result) :
-                    m_result(result)
-            {
-            }
-
-            /**
-             * Get a result of Device property provisioning
-             *
-             * @return ::ES_OK\n
-             *         ::ES_COMMUNICATION_ERROR\n
-             *         ::ES_ERROR\n
-             *
-             * @see ESResult
-             */
-            ESResult getESResult()
-            {
-                return m_result;
-            }
-
-        private:
-            ESResult m_result;
-        };
-
-        /**
-         * Status object for provisionCloudProperties API. This object is given to application
-         * when a response for GET request to provisioning resource at Enrollee is arrived.
-         * It returns a result of the request and status of this provisioning. The status provides
-         * an information if the enrollee is found in a given network and the provisioning is
-         * successfully done.
-         */
-        class CloudPropProvisioningStatus
-        {
-        public:
-            /**
-             * Constructor
-             */
-            CloudPropProvisioningStatus(ESResult result) :
-                    m_result(result)
-            {
-            }
-
-            /**
-             * Get a result of Cloud property provisioning
-             *
-             * @return ::ES_OK\n
-             *         ::ES_ENROLLEE_DISCOVERY_FAILURE\n
-             *         ::ES_SECURE_RESOURCE_DISCOVERY_FAILURE\n
-             *         ::ES_ACL_PROVISIONING_FAILURE\n
-             *         ::ES_CERT_PROVISIONING_FAILURE\n
-             *         ::ES_COMMUNICATION_ERROR\n
-             *         ::ES_ERROR\n
-             *
-             * @see ESResult
-             */
-            ESResult getESResult()
-            {
-                return m_result;
-            }
-
-        private:
-            ESResult m_result;
-        };
-
-        /**
-         * Callback function definition for providing Enrollee status
-         */
-        typedef function< void(shared_ptr< GetEnrolleeStatus >) > GetStatusCb;
-
-        /**
-         * Callback function definition for providing Enrollee configuration status
-         */
-        typedef function< void(shared_ptr< GetConfigurationStatus >) > GetConfigurationStatusCb;
-
-        /**
-         * Callback function definition for providing Enrollee device property provisioning status
-         */
-        typedef function< void(shared_ptr< DevicePropProvisioningStatus >) > DevicePropProvStatusCb;
-
-        /**
-         * Callback function definition for providing Enrollee cloud property provisioning status
-         */
-        typedef function< void(shared_ptr< CloudPropProvisioningStatus >) > CloudPropProvStatusCb;
-
-        /**
-         * Callback function definition for providing Enrollee security provisioning status
-         */
-        typedef function< void(shared_ptr<SecProvisioningStatus>) > SecurityProvStatusCb;
-
-        /**
-         * Callback definition to be invoked when the security stack expects a pin from application
-         */
-        typedef function< void(string&) > SecurityPinCb;
-
-        /**
-         * Callback definition to be invoked when the stack expects a db path
-         */
-        typedef function< void(string&) > SecProvisioningDbPathCb;
-
-    }
-}
-#endif //WITH_ARDUINO
-
-#endif //ES_COMMON_RICH_H_
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/EasySetup.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/EasySetup.h
deleted file mode 100644 (file)
index 531971d..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef EASYSETUP_H_
-#define EASYSETUP_H_
-
-#include <memory>
-#include <vector>
-
-#include "ESRichCommon.h"
-#include "RemoteEnrollee.h"
-
-using namespace OC;
-namespace OIC
-{
-    namespace Service
-    {
-        class RemoteEnrollee;
-
-        /**
-         * This provides an API to instanciate a new RemoteEnrollee object correspondent to Enrollee
-         * Device to be setup.
-         */
-        class EasySetup
-        {
-        public:
-            /**
-             * API for getting the instance of EasySetup singleton class.
-             * @return EasySetup instance.
-             */
-            static EasySetup* getInstance();
-
-            /**
-             * This API is used for creating a remote Enrollee instance.
-             *
-             * @param enrolleeResource an OCResource object corresponding to enrollee resource
-             *        discovered in a network. The OCResource object can be obtained by calling
-             *        OCPlatform.findResource() API. What resource you have to discover with
-             *        the OCPlatform.findResource() API is a "provisioning" resource with a certain
-             *        resource type, i.e. oic.wk.prov
-             *
-             * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same
-             *         provisioning information.
-             *
-             * @return Pointer to RemoteEnrollee instance.
-             */
-            std::shared_ptr<RemoteEnrollee> createRemoteEnrollee(
-                                        std::shared_ptr< OC::OCResource > enrolleeResource);
-
-        private:
-            EasySetup();
-            ~EasySetup();
-
-        private:
-            std::shared_ptr< OC::OCResource > m_ocResource;
-            static EasySetup *s_instance;
-        };
-    }
-}
-
-#endif /* EASYSETUP_H_ */
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h
deleted file mode 100644 (file)
index 30ef55c..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef REMOTE_ENROLLEE_H_
-#define REMOTE_ENROLLEE_H_
-
-#include <memory>
-#include <iostream>
-#include <condition_variable>
-
-#include "ESRichCommon.h"
-#include "OCApi.h"
-
-using namespace OC;
-
-namespace OIC
-{
-    namespace Service
-    {
-        class OCResource;
-        class EnrolleeResource;
-        class CloudResource;
-        class EnrolleeSecurity;
-
-        typedef std::function<void(const std::shared_ptr<OC::OCResource> resource)>  onDeviceDiscoveredCb;
-
-        /**
-         * This class represents Remote Enrollee device instance. What operation the class provides:
-         * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee
-         * devices.
-         * 2) Provision WiFi AP information used for which Enrollee is going to connect to the AP
-         * 3) Provision Device confiruation setting, i.e. language, country, and etc
-         * 4) Provision Cloud information used for which Enrollee is going to register to the cloud
-         */
-        class RemoteEnrollee : public std::enable_shared_from_this<RemoteEnrollee>
-        {
-        public:
-            ~RemoteEnrollee() = default;
-
-            /**
-             * Get an Enrollee's status which includes provisioning status and last error code
-             *
-             * @param callback will give the requested status
-             *
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
-             *
-             * @see GetStatusCb
-             */
-            void getStatus(const GetStatusCb callback);
-
-            /**
-             * Get an Enrollee's configuration which includes WiFi supported frequency and device name
-             *
-             * @param callback will give the requested configuration
-             *
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
-             *
-             * @see GetConfigurationStatusCb
-             */
-            void getConfiguration(const GetConfigurationStatusCb callback);
-
-             /**
-             * Do security provisioning such as ownership tranfer to Enrollee.
-             *
-             * @param callback will give the result if the security provisioning succeeds or fails for some reasons
-             *
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
-             *
-             * @see SecurityProvStatusCb
-             */
-            void provisionSecurity(const SecurityProvStatusCb callback);
-
-            /**
-             * Provision WiFi AP information and device configuration to Enrollee
-             * 1. WiFi AP information includes a SSID, password, auth type, and encryption type.
-             * 2. Device configuration includes a language (IETF language tags) and country (ISO 3166-1 Alpha-2)
-             *
-             * @param devProp a data structure storing the above information to be delivered
-             * @param callback will give the result if the provisioning succeeds or fails
-             *
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
-             *
-             * @see DeviceProp
-             * @see DevicePropProvStatusCb
-             */
-            void provisionDeviceProperties(const DeviceProp& devProp,
-                                               const DevicePropProvStatusCb callback);
-
-            /**
-             * Provision Cloud information to Enrollee, which includes Auth code, auth provider,
-             * Cloud interface server URL, and etc.
-             * In this function, Discovery for the Enrollee will happen again in a given network.
-             * Because, this function is expected to call *AFTER* the Enrollee disconnects its Soft AP
-             * and successfully connects to the certain WiFi AP. In that case, Mediator should discover
-             * the Enrollee with a certain Device ID in the network.
-             *
-             * @param cloudProp a data structure storing the above information to be delivered
-             * @param callback will give the result if the provisioning succeeds or fails
-             *
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
-             *
-             * @see CloudProp
-             * @see CloudPropProvStatusCb
-             */
-            void provisionCloudProperties(const CloudProp& cloudProp,
-                                              const CloudPropProvStatusCb callback);
-
-        private:
-            RemoteEnrollee(const std::shared_ptr< OC::OCResource > resource);
-
-            ESResult discoverResource();
-
-            static void onDiscoveredCallback(const std::shared_ptr<OC::OCResource> resource,
-            std::weak_ptr<RemoteEnrollee> this_ptr);
-
-            void onDeviceDiscovered(const std::shared_ptr<OC::OCResource> resource);
-            void initCloudResource();
-
-            void getStatusHandler
-                (const std::shared_ptr< GetEnrolleeStatus > status) const;
-            void getConfigurationStatusHandler
-                (const std::shared_ptr< GetConfigurationStatus > status) const;
-            void devicePropProvisioningStatusHandler
-                (const std::shared_ptr< DevicePropProvisioningStatus > status) const;
-            void cloudPropProvisioningStatusHandler
-                (const std::shared_ptr< CloudPropProvisioningStatus > status) const;
-            void securityStatusHandler
-                (const std::shared_ptr< SecProvisioningStatus > status) const;
-
-        private:
-            std::shared_ptr< OC::OCResource > m_ocResource;
-            std::shared_ptr< EnrolleeResource > m_enrolleeResource;
-            std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity;
-            std::shared_ptr< CloudResource > m_cloudResource;
-
-            std::string  m_deviceId;
-            bool m_discoveryResponse;
-
-            std::mutex m_discoverymtx;
-            std::condition_variable m_cond;
-
-            SecurityProvStatusCb m_securityProvStatusCb;
-            GetStatusCb m_getStatusCb;
-            GetConfigurationStatusCb m_getConfigurationStatusCb;
-            SecurityPinCb m_securityPinCb;
-            SecProvisioningDbPathCb m_secProvisioningDbPathCb;
-            DevicePropProvStatusCb m_devicePropProvStatusCb;
-            CloudPropProvStatusCb m_cloudPropProvStatusCb;
-
-            friend class EasySetup;
-        };
-    }
-}
-
-#endif //REMOTE_ENROLLEE_H_
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.cpp
deleted file mode 100644 (file)
index ea760ee..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 <functional>
-
-#include "CloudResource.h"
-
-#include "OCPlatform.h"
-#include "ESException.h"
-#include "OCResource.h"
-#include "logger.h"
-
-namespace OIC
-{
-    namespace Service
-    {
-        #define ES_CLOUD_RES_TAG "ES_CLOUD_RESOURCE"
-
-        static const char ES_BASE_RES_URI[] = "/oic/res";
-
-        CloudResource::CloudResource(std::shared_ptr< OC::OCResource > resource)
-        {
-            m_ocResource = resource;
-        }
-
-        void CloudResource::provisionProperties(const CloudProp& cloudProp)
-        {
-            OIC_LOG (DEBUG, ES_CLOUD_RES_TAG, "provisionProperties IN");
-
-            OCRepresentation provisioningRepresentation = cloudProp.toOCRepresentation();
-
-            m_ocResource->post(OC_RSRVD_ES_RES_TYPE_PROV, BATCH_INTERFACE,
-                        provisioningRepresentation, QueryParamsMap(),
-                        std::function<
-                                void(const HeaderOptions& headerOptions,
-                                        const OCRepresentation& rep, const int eCode) >(
-                        std::bind(&CloudResource::onCloudProvResponse, this,
-                        std::placeholders::_1, std::placeholders::_2,
-                        std::placeholders::_3)), OC::QualityOfService::HighQos);
-
-            OIC_LOG (DEBUG, ES_CLOUD_RES_TAG, "provisionProperties OUT");
-        }
-
-        void CloudResource::onCloudProvResponse(const HeaderOptions& /*headerOptions*/,
-                const OCRepresentation& /*rep*/, const int eCode)
-        {
-            OIC_LOG_V (DEBUG, ES_CLOUD_RES_TAG, "onCloudProvResponse : eCode = %d",
-                        eCode);
-
-            if (eCode > OCStackResult::OC_STACK_RESOURCE_CHANGED)
-            {
-                ESResult result = ESResult::ES_ERROR;
-
-                OIC_LOG(DEBUG, ES_CLOUD_RES_TAG,"onCloudProvResponse : onCloudProvResponse is failed ");
-
-                if(eCode == OCStackResult::OC_STACK_COMM_ERROR)
-                {
-                    OIC_LOG_V (DEBUG, ES_CLOUD_RES_TAG,
-                            "can't receive any response from Enrollee by a timeout threshold.");
-                    result = ESResult::ES_COMMUNICATION_ERROR;
-                }
-
-                std::shared_ptr< CloudPropProvisioningStatus > provStatus = std::make_shared<
-                        CloudPropProvisioningStatus >(result);
-                m_cloudPropProvStatusCb(provStatus);
-            }
-            else
-            {
-                OIC_LOG(DEBUG, ES_CLOUD_RES_TAG,"onCloudProvResponse : onCloudProvResponse is success ");
-                std::shared_ptr< CloudPropProvisioningStatus > provStatus =
-                    std::make_shared<CloudPropProvisioningStatus >(ESResult::ES_OK);
-                m_cloudPropProvStatusCb(provStatus);
-            }
-        }
-
-        void CloudResource::registerCloudPropProvisioningStatusCallback(
-            const CloudPropProvStatusCb callback)
-        {
-            m_cloudPropProvStatusCb = callback;
-        }
-    }
-}
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/CloudResource.h
deleted file mode 100644 (file)
index 6a0c5bd..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//******************************************************************
-//
-// Copyright 2016 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef CLOUD_RESOURCE_H_
-#define CLOUD_RESOURCE_H_
-
-#include <mutex>
-#include <memory>
-
-#include "ESRichCommon.h"
-
-#include "OCApi.h"
-
-using namespace OC;
-
-namespace OIC
-{
-    namespace Service
-    {
-        class OCResource;
-        /**
-         * This class contains the resource discovery methods.
-         *
-         * @see CloudResource
-         */
-        class CloudResource
-        {
-        public:
-            CloudResource(std::shared_ptr< OC::OCResource > resource);
-            ~CloudResource() = default;
-
-            void registerCloudPropProvisioningStatusCallback(
-                    const CloudPropProvStatusCb callback);
-            void provisionProperties(const CloudProp& CloudProp);
-
-        private:
-            void onCloudProvResponse(const HeaderOptions& headerOptions,
-                                                const OCRepresentation& rep,
-                                                const int eCode);
-
-        private:
-            std::shared_ptr< OC::OCResource > m_ocResource;
-            CloudPropProvStatusCb m_cloudPropProvStatusCb;
-        };
-    }
-}
-#endif
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.cpp
deleted file mode 100644 (file)
index 9551a5a..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 "ESException.h"
-
-#include "OCException.h"
-
-namespace OIC
-{
-    namespace Service
-    {
-
-        ESException::ESException()
-        {
-        }
-
-        ESException::ESException(const std::string& what) :
-                m_what{ what }
-        {
-        }
-
-        ESException::ESException(std::string&& what) :
-                m_what{ std::move(what) }
-        {
-        }
-
-        ESException::~ESException() noexcept
-        {
-        }
-
-        const char* ESException::what() const noexcept
-        {
-            return m_what.c_str();
-        }
-
-
-        ESPlatformException::ESPlatformException(OCStackResult reason) :
-                ESException{ "Failed : " + OC::OCException::reason(reason) },
-                m_reason { reason }
-        {
-        }
-
-        OCStackResult ESPlatformException::getReasonCode() const
-        {
-            return m_reason;
-        }
-
-        std::string ESPlatformException::getReason() const
-        {
-            return  OC::OCException::reason(m_reason);
-        }
-
-
-        ESBadRequestException::ESBadRequestException(const std::string& what) :
-                ESException{ what }
-        {
-        }
-
-        ESBadRequestException::ESBadRequestException(std::string&& what) :
-                ESException{ std::move(what) }
-        {
-        }
-
-
-        ESInvalidParameterException::ESInvalidParameterException(const std::string& what) :
-                ESException{ what }
-        {
-        }
-
-        ESInvalidParameterException::ESInvalidParameterException(std::string&& what) :
-                ESException{ std::move(what) }
-        {
-        }
-
-
-        ESBadGetException::ESBadGetException(const std::string& what) :
-                ESException{ what }
-        {
-        }
-
-        ESBadGetException::ESBadGetException(std::string&& what) :
-                ESException{ std::move(what) }
-        {
-        }
-
-
-        ESInvalidKeyException::ESInvalidKeyException(const std::string& what) :
-                ESException{ what }
-        {
-        }
-
-        ESInvalidKeyException::ESInvalidKeyException(std::string&& what) :
-                ESException{ std::move(what) }
-        {
-        }
-    }
-}
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/ESException.h
deleted file mode 100644 (file)
index d5096bf..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-#ifndef EASY_SETUP_EXCEPTION_H
-#define EASY_SETUP_EXCEPTION_H
-
-#include <string>
-#include <octypes.h>
-/**
- * @file
- *
- * This file contains the declaration of exception classes for easy setup
- */
-namespace OIC
-{
-    namespace Service
-    {
-
-        /**
-         * The base exception class for resource encapsulation.
-         *
-         */
-        class ESException: public std::exception
-        {
-        public:
-
-            /**
-             * Constructs an exception with an empty description.
-             */
-            ESException();
-
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param what The description for the error.
-             */
-            explicit ESException(const std::string &what);
-
-            /**
-             * @overload
-             */
-            explicit ESException(std::string &&what);
-
-            virtual ~ESException() noexcept;
-
-            /**
-             * Returns the exception description.
-             *
-             */
-            virtual const char *what() const noexcept;
-
-        private:
-            /**
-             *  Exception description
-             */
-            const std::string m_what;
-        };
-
-        /**
-         * Thrown when OC layer returns an error.
-         *
-         */
-        class ESPlatformException: public ESException
-        {
-        public:
-
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param OCStackResult The description for the error.
-             */
-            explicit ESPlatformException(OCStackResult reason);
-
-            /**
-             * Returns the reason.
-             *
-             */
-            OCStackResult getReasonCode() const;
-
-            /**
-             * This function returns description of the exception.
-             *
-             */
-            std::string getReason() const;
-
-        private:
-            OCStackResult m_reason;
-        };
-
-        /**
-         * Thrown when a request is not acceptable.
-         *
-         */
-        class ESBadRequestException: public ESException
-        {
-        public:
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param OCStackResult The description for the error.
-             */
-            explicit ESBadRequestException(const std::string& what);
-            /**
-             * @overload
-             */
-            explicit ESBadRequestException(std::string&& what);
-        };
-
-        /**
-         * Thrown when a parameter is not valid.
-         *
-         */
-        class ESInvalidParameterException: public ESException
-        {
-        public:
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param OCStackResult The description for the error.
-             */
-            explicit ESInvalidParameterException(const std::string& what);
-         /**
-             * @overload
-             */
-            explicit ESInvalidParameterException(std::string&& what);
-        };
-
-        /**
-         * Thrown when getting value with wrong template parameter.
-         */
-        class ESBadGetException: public ESException
-        {
-        public:
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param OCStackResult The description for the error.
-             */
-            explicit ESBadGetException(const std::string& what);
-           /**
-             * @overload
-             */
-            explicit ESBadGetException(std::string&& what);
-        };
-
-        /**
-         * Thrown when a key is invalid.
-         *
-         */
-        class ESInvalidKeyException: public ESException
-        {
-        public:
-            /**
-             * Constructs an exception with a description.
-             *
-             * @param OCStackResult The description for the error.
-             */
-            explicit ESInvalidKeyException(const std::string& what);
-             /**
-             * @overload
-             */
-            explicit ESInvalidKeyException(std::string&& what);
-        };
-    }
-}
-
-#endif // EASY_SETUP_EXCEPTION_H
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EasySetup.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EasySetup.cpp
deleted file mode 100644 (file)
index 4e74b76..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 "EasySetup.h"
-
-#include "OCPlatform.h"
-#include "logger.h"
-#include "ESException.h"
-#include "RemoteEnrollee.h"
-
-using namespace OC;
-
-namespace OIC
-{
-    namespace Service
-    {
-        #define EASYSETUP_TAG "EASY_SETUP"
-
-        EasySetup * EasySetup::s_instance = nullptr;
-
-        EasySetup::EasySetup()
-        {
-        }
-
-        EasySetup* EasySetup::getInstance ()
-        {
-            if (s_instance == nullptr)
-            {
-                s_instance = new EasySetup ();
-            }
-            return s_instance;
-        }
-
-        std::shared_ptr<RemoteEnrollee> EasySetup::createRemoteEnrollee (std::shared_ptr< OC::OCResource > resource)
-        {
-            OIC_LOG(DEBUG, EASYSETUP_TAG, "createRemoteEnrollee IN");
-
-            if(resource)
-            {
-                if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_PROV ||
-                   (resource->connectivityType() & CT_ADAPTER_TCP))
-                {
-                    OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is not valid due to wrong rt or conntype");
-                    return nullptr;
-                }
-
-                auto interfaces = resource->getResourceInterfaces();
-                for(auto interface : interfaces)
-                {
-                    if(interface.compare(BATCH_INTERFACE) == 0)
-                    {
-                        OIC_LOG (DEBUG, EASYSETUP_TAG, "RemoteEnrollee object is succeessfully created");
-                        OIC_LOG_V (DEBUG, EASYSETUP_TAG, "HOST: %s", resource->host().c_str());
-                        OIC_LOG_V (DEBUG, EASYSETUP_TAG, "URI: %s", resource->uri().c_str());
-                        OIC_LOG_V (DEBUG, EASYSETUP_TAG, "SID: %s", resource->sid().c_str());
-                        return std::shared_ptr< RemoteEnrollee > (new RemoteEnrollee(resource));
-                    }
-                }
-            }
-
-            OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is NULL");
-            return nullptr;
-        }
-    }
-}
-
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp
deleted file mode 100644 (file)
index 17862a1..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 <functional>
-
-#include "EnrolleeResource.h"
-
-#include "OCPlatform.h"
-#include "ESException.h"
-#include "OCResource.h"
-#include "logger.h"
-
-namespace OIC
-{
-    namespace Service
-    {
-        #define ES_REMOTE_ENROLLEE_RES_TAG "ES_ENROLLEE_RESOURCE"
-
-        EnrolleeResource::EnrolleeResource(std::shared_ptr< OC::OCResource > resource)
-        {
-            m_ocResource = resource;
-        }
-
-        void EnrolleeResource::onProvisioningResponse(const HeaderOptions& /*headerOptions*/,
-                const OCRepresentation& /*rep*/, const int eCode)
-        {
-            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onProvisioningResponse : eCode = %d",
-                        eCode);
-
-            if (eCode > OCStackResult::OC_STACK_RESOURCE_CHANGED)
-            {
-                ESResult result = ESResult::ES_ERROR;
-
-                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                            "onProvisioningResponse : Provisioning is failed ");
-
-                if(eCode == OCStackResult::OC_STACK_COMM_ERROR)
-                {
-                    OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                        "can't receive any response from Enrollee by a timeout threshold.");
-                    result = ESResult::ES_COMMUNICATION_ERROR;
-                }
-
-                std::shared_ptr< DevicePropProvisioningStatus > provStatus = std::make_shared<
-                        DevicePropProvisioningStatus >(result);
-                m_devicePropProvStatusCb(provStatus);
-                return;
-            }
-
-            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                    "onProvisioningResponse : Provisioning is success. ");
-
-            std::shared_ptr< DevicePropProvisioningStatus > provStatus = std::make_shared<
-                    DevicePropProvisioningStatus >(ESResult::ES_OK);
-            m_devicePropProvStatusCb(provStatus);
-        }
-
-        void EnrolleeResource::onGetStatusResponse(const HeaderOptions& /*headerOptions*/,
-                const OCRepresentation& rep, const int eCode)
-        {
-            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onGetStatusResponse : eCode = %d",
-                        eCode);
-
-            if (eCode > OCStackResult::OC_STACK_RESOURCE_CHANGED)
-            {
-                ESResult result = ESResult::ES_ERROR;
-
-                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                            "onGetStatusResponse : onGetStatusResponse is failed ");
-
-                if(eCode == OCStackResult::OC_STACK_COMM_ERROR)
-                {
-                    OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                        "can't receive any response from Enrollee by a timeout threshold.");
-                    result = ESResult::ES_COMMUNICATION_ERROR;
-                }
-
-                EnrolleeStatus enrolleeStatus(rep);
-                std::shared_ptr< GetEnrolleeStatus > getEnrolleeStatus = std::make_shared<
-                        GetEnrolleeStatus >(result, enrolleeStatus);
-
-                m_getStatusCb(getEnrolleeStatus);
-            }
-            else
-            {
-                EnrolleeStatus enrolleeStatus(rep);
-                std::shared_ptr< GetEnrolleeStatus > getEnrolleeStatus = std::make_shared<
-                        GetEnrolleeStatus >(ESResult::ES_OK, enrolleeStatus);
-
-                m_getStatusCb(getEnrolleeStatus);
-            }
-        }
-
-        void EnrolleeResource::onGetConfigurationResponse(const HeaderOptions& /*headerOptions*/,
-                const OCRepresentation& rep, const int eCode)
-        {
-            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onGetConfigurationResponse : eCode = %d",
-                        eCode);
-
-            if (eCode > OCStackResult::OC_STACK_RESOURCE_CHANGED)
-            {
-                ESResult result = ESResult::ES_ERROR;
-
-                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                            "onGetConfigurationResponse : onGetConfigurationResponse is failed ");
-
-                if(eCode == OCStackResult::OC_STACK_COMM_ERROR)
-                {
-                    OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
-                        "can't receive any response from Enrollee by a timeout threshold.");
-                    result = ESResult::ES_COMMUNICATION_ERROR;
-                }
-
-                EnrolleeConf enrolleeConf(rep);
-                std::shared_ptr< GetConfigurationStatus > getConfigurationStatus = std::make_shared<
-                        GetConfigurationStatus >(result, enrolleeConf);
-                m_getConfigurationStatusCb(getConfigurationStatus);
-            }
-            else
-            {
-                EnrolleeConf enrolleeConf(rep);
-
-                std::shared_ptr< GetConfigurationStatus > getConfigurationStatus = std::make_shared<
-                        GetConfigurationStatus >(ESResult::ES_OK, enrolleeConf);
-                m_getConfigurationStatusCb(getConfigurationStatus);
-            }
-        }
-
-        void EnrolleeResource::registerGetStatusCallback(
-            const GetStatusCb callback)
-        {
-            m_getStatusCb = callback;
-        }
-
-        void EnrolleeResource::registerGetConfigurationStatusCallback(
-            const GetConfigurationStatusCb callback)
-        {
-            m_getConfigurationStatusCb = callback;
-        }
-
-        void EnrolleeResource::registerDevicePropProvStatusCallback(
-            const DevicePropProvStatusCb callback)
-        {
-            m_devicePropProvStatusCb = callback;
-        }
-
-        void EnrolleeResource::getStatus()
-        {
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getStatus IN");
-
-            if (m_ocResource == nullptr)
-            {
-                throw ESBadRequestException("Resource is not initialized");
-            }
-
-            OC::QueryParamsMap query;
-            OC::OCRepresentation rep;
-
-            std::function< OCStackResult(void) > getStatus = [&]
-            {
-                return m_ocResource->get(m_ocResource->getResourceTypes().at(0),
-                        DEFAULT_INTERFACE, query, std::function<void(const HeaderOptions& headerOptions,
-                        const OCRepresentation& rep, const int eCode) >(
-                                std::bind(&EnrolleeResource::onGetStatusResponse, this,
-                                        std::placeholders::_1, std::placeholders::_2,
-                                        std::placeholders::_3)), OC::QualityOfService::HighQos);
-            };
-
-            OCStackResult result = getStatus();
-
-            if (result != OCStackResult::OC_STACK_OK)
-            {
-                EnrolleeStatus enrolleeStatus(rep);// = {ES_STATE_INIT, ES_ERRCODE_NO_ERROR};
-                std::shared_ptr< GetEnrolleeStatus > getEnrolleeStatus = std::make_shared<
-                        GetEnrolleeStatus >(ESResult::ES_ERROR, enrolleeStatus);
-
-                m_getStatusCb(getEnrolleeStatus);
-
-                return;
-            }
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getStatus OUT");
-        }
-
-        void EnrolleeResource::getConfiguration()
-        {
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getConfiguration IN");
-
-            if (m_ocResource == nullptr)
-            {
-                throw ESBadRequestException("Resource is not initialized");
-            }
-
-            OC::QueryParamsMap query;
-            OC::OCRepresentation rep;
-
-            std::function< OCStackResult(void) > getConfigurationStatus = [&]
-            {
-                return m_ocResource->get(m_ocResource->getResourceTypes().at(0),
-                        BATCH_INTERFACE, query, std::function<void(const HeaderOptions& headerOptions,
-                        const OCRepresentation& rep, const int eCode) >(
-                                std::bind(&EnrolleeResource::onGetConfigurationResponse, this,
-                                        std::placeholders::_1, std::placeholders::_2,
-                                        std::placeholders::_3)), OC::QualityOfService::HighQos);
-            };
-
-            OCStackResult result = getConfigurationStatus();
-
-            if (result != OCStackResult::OC_STACK_OK)
-            {
-                EnrolleeConf enrolleeConf(rep);
-                std::shared_ptr< GetConfigurationStatus > getConfigurationStatus = std::make_shared<
-                        GetConfigurationStatus >(ESResult::ES_ERROR, enrolleeConf);
-                m_getConfigurationStatusCb(getConfigurationStatus);
-                return;
-            }
-
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getConfiguration OUT");
-        }
-
-        void EnrolleeResource::provisionProperties(const DeviceProp& deviceProp)
-        {
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "provisionProperties IN");
-            if (m_ocResource == nullptr)
-            {
-                throw ESBadRequestException("Resource is not initialized");
-            }
-
-            OC::QueryParamsMap query;
-            OC::OCRepresentation provisioningRepresentation = deviceProp.toOCRepresentation();
-
-            m_ocResource->post(OC_RSRVD_ES_RES_TYPE_PROV, BATCH_INTERFACE,
-                    provisioningRepresentation, QueryParamsMap(),
-                    std::function<
-                            void(const HeaderOptions& headerOptions,
-                                    const OCRepresentation& rep, const int eCode) >(
-                    std::bind(&EnrolleeResource::onProvisioningResponse, this,
-                    std::placeholders::_1, std::placeholders::_2,
-                    std::placeholders::_3)), OC::QualityOfService::HighQos);
-
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "provisionProperties OUT");
-        }
-    }
-}
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeResource.h
deleted file mode 100644 (file)
index f194b45..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef ENROLLEE_RESOURCE_H_
-#define ENROLLEE_RESOURCE_H_
-
-#include <mutex>
-#include <memory>
-
-#include "ESRichCommon.h"
-
-#include "OCApi.h"
-
-using namespace OC;
-
-namespace OIC
-{
-    namespace Service
-    {
-        class OCResource;
-        class EnrolleeSecurity;
-
-        /**
-         * This class contains the resource discovery methods.
-         *
-         * @see EnrolleeResource
-         */
-        class EnrolleeResource
-        {
-            friend class EnrolleeSecurity;
-
-        public:
-            EnrolleeResource(std::shared_ptr< OC::OCResource > resource);
-
-            ~EnrolleeResource() = default;
-
-            void registerGetStatusCallback(const GetStatusCb callback);
-            void registerGetConfigurationStatusCallback(
-                const GetConfigurationStatusCb callback);
-            void registerDevicePropProvStatusCallback(
-                const DevicePropProvStatusCb callback);
-
-            void getConfiguration();
-            void getStatus();
-
-            void provisionProperties(const DeviceProp& deviceProp);
-
-        private:
-            std::shared_ptr< OC::OCResource > m_ocResource;
-
-            GetStatusCb m_getStatusCb;
-            GetConfigurationStatusCb m_getConfigurationStatusCb;
-            DevicePropProvStatusCb m_devicePropProvStatusCb;
-
-        private:
-            void onGetStatusResponse(const HeaderOptions& headerOptions,
-                                                const OCRepresentation& rep,
-                                                const int eCode);
-            void onGetConfigurationResponse(const HeaderOptions& headerOptions,
-                                                           const OCRepresentation& rep,
-                                                           const int eCode);
-            void onProvisioningResponse(const HeaderOptions& headerOptions,
-                                                    const OCRepresentation& rep,
-                                                    const int eCode);
-        };
-    }
-}
-#endif
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp
deleted file mode 100644 (file)
index a266426..0000000
+++ /dev/null
@@ -1,597 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 "base64.h"
-
-#include "EnrolleeSecurity.h"
-#include "oxmjustworks.h"
-#include "oxmrandompin.h"
-#include "EnrolleeResource.h"
-#include "logger.h"
-#include "ESException.h"
-#include "oic_malloc.h"
-#include "provisioningdatabasemanager.h"
-#include "oic_string.h"
-#include "utlist.h"
-#include "srmutility.h"
-
-namespace OIC
-{
-    namespace Service
-    {
-        #define MAX_PERMISSION_LENGTH (5)
-        #define CREATE (1)
-        #define READ (2)
-        #define UPDATE (4)
-        #define DELETE (8)
-        #define NOTIFY (16)
-        #define DASH '-'
-
-        // TODO : Currently discovery timeout for owned and unowned devices is fixed as 5
-        // The value should be accepted from the application as a parameter during ocplatform
-        // config call
-        #define ES_SEC_DISCOVERY_TIMEOUT 5
-
-        EnrolleeSecurity::EnrolleeSecurity(
-            std::shared_ptr< OC::OCResource > resource,
-            const std::string secDbPath)
-        {
-            (void) secDbPath;
-            m_ocResource = resource;
-        }
-
-        void EnrolleeSecurity::convertUUIDToString(const uint8_t uuid[UUID_SIZE],
-                                                              std::string& uuidString)
-        {
-            char uuidArray[UUID_STRING_SIZE] = {'\0',};
-            int ret = snprintf(uuidArray, UUID_STRING_SIZE,
-                    "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                    uuid[0], uuid[1], uuid[2], uuid[3],
-                    uuid[4], uuid[5], uuid[6], uuid[7],
-                    uuid[8], uuid[9], uuid[10], uuid[11],
-                    uuid[12], uuid[13], uuid[14], uuid[15]
-                    );
-
-            if (ret != UUID_STRING_SIZE - 1)
-            {
-                return;
-            }
-
-            uuidString = uuidArray;
-        }
-
-        void EnrolleeSecurity::ownershipTransferCb(OC::PMResultList_t *result, int hasError)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "ownershipTransferCb IN");
-            if (hasError)
-            {
-                OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "OwnershipTransfer is failed with code(%d)", hasError);
-                OTMResult = false;
-            }
-            else
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "OwnershipTransfer is succeeded");
-                for (unsigned int i = 0; i < result->size(); i++)
-                {
-                    OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d for device", result->at(i).res);
-                }
-                delete result;
-                OTMResult = true;
-            }
-            m_cond.notify_all();
-        }
-
-        ESResult EnrolleeSecurity::provisionOwnership()
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "provisionOwnership IN");
-
-            ESResult res = ESResult::ES_ERROR;
-
-            OCStackResult result = OC_STACK_ERROR;
-            OicUuid_t uuid;
-            if(OC_STACK_OK != ConvertStrToUuid(m_ocResource->sid().c_str(), &uuid))
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Convert to uuid from deviceID failed.");
-                return res;
-            }
-
-            result = OCSecure::discoverSingleDevice(ES_SEC_DISCOVERY_TIMEOUT,
-                                                    &uuid,
-                                                    m_securedResource);
-            if (result != OC_STACK_OK)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Secure Resource Discovery failed.");
-                res = ESResult:: ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-                return res;
-            }
-            else if (m_securedResource)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Secured resource is found.");
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "HOST: %s", m_securedResource->getDevAddr().c_str());
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "SID: %s", m_securedResource->getDeviceID().c_str());
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Owned status: %d", m_securedResource->getOwnedStatus());
-
-                if (m_securedResource->getOwnedStatus()) // owned check logic
-                {
-                    if(isOwnedDeviceRegisteredInSVRDB())
-                    {
-                        OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG,
-                                "The found device is already owned by Mediator.(SUCCESS)");
-                        res = ESResult::ES_OK;
-                    }
-                    else
-                    {
-                        OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "The found device is not one in SVR DB");
-                        res = ESResult::ES_ERROR;
-                    }
-                    return res;
-                }
-                else // unowned check logic
-                {
-                    if(isOwnedDeviceRegisteredInSVRDB())
-                    {
-                        OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG,
-                            "Found Unowned device's DevID at DB of ownedDevices list");
-
-                        OC::ResultCallBack removeDeviceWithUuidCB = std::bind(
-                                &EnrolleeSecurity::removeDeviceWithUuidCB,
-                                this, std::placeholders::_1, std::placeholders::_2);
-
-                        result = OCSecure::removeDeviceWithUuid(ES_SEC_DISCOVERY_TIMEOUT,
-                                                                m_ocResource->sid(),
-                                                                removeDeviceWithUuidCB);
-                        if(result != OC_STACK_OK)
-                        {
-                            OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "removeDeviceWithUuid failed. (%d)", result);
-                            res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
-                            return res;
-                        }
-
-                        std::unique_lock<std::mutex> lck(m_mtx);
-                        m_cond.wait_for(lck, std::chrono::seconds(ES_SEC_DISCOVERY_TIMEOUT));
-
-                        if(!removeDeviceResult)
-                        {
-                            OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Removing device is failed.");
-                            res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
-                            return res;
-                        }
-                        OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Removing device is succeeded.");
-                    }
-
-                    res = performOwnershipTransfer();
-
-                    if(res != ESResult::ES_OK)
-                    {
-                        OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "Ownership-Transfer failed. (%d)", res);
-                        res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
-                        return res;
-                    }
-
-                    std::unique_lock<std::mutex> lck(m_mtx);
-                    m_cond.wait(lck);
-
-                    if(!OTMResult)
-                    {
-                        OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Ownership-Transfer failed.");
-                        res = ESResult::ES_OWNERSHIP_TRANSFER_FAILURE;
-                    }
-                }
-            }
-            else
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No secure resource is found.");
-                res = ESResult:: ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-            }
-            return res;
-        }
-
-        ESResult EnrolleeSecurity::performOwnershipTransfer()
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "performOwnershipTransfer IN.");
-
-            OCStackResult result = OC_STACK_ERROR;
-
-            OTMCallbackData_t justWorksCBData;
-            justWorksCBData.loadSecretCB = LoadSecretJustWorksCallback;
-            justWorksCBData.createSecureSessionCB = CreateSecureSessionJustWorksCallback;
-            justWorksCBData.createSelectOxmPayloadCB = CreateJustWorksSelectOxmPayload;
-            justWorksCBData.createOwnerTransferPayloadCB =
-                    CreateJustWorksOwnerTransferPayload;
-            OCSecure::setOwnerTransferCallbackData(OIC_JUST_WORKS, &justWorksCBData, NULL);
-
-            OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Transfering ownership for : %s ",
-                    m_securedResource->getDeviceID().c_str());
-
-            OC::ResultCallBack ownershipTransferCb = std::bind(
-                    &EnrolleeSecurity::ownershipTransferCb, this, std::placeholders::_1,
-                    std::placeholders::_2);
-
-            result = m_securedResource->doOwnershipTransfer(ownershipTransferCb);
-            if (result != OC_STACK_OK)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "doOwnershipTransfer is failed");
-                return ESResult::ES_ERROR;
-            }
-            return ESResult::ES_OK;
-        }
-
-        void EnrolleeSecurity::removeDeviceWithUuidCB(OC::PMResultList_t *result, int hasError)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "removeDeviceWithUuidCB IN");
-
-            if (hasError)
-            {
-               OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "removeDeviceWithUuid is failed with code (%d)", hasError);
-               removeDeviceResult = false;
-            }
-
-            else
-            {
-               OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "removeDeviceWithUuid is succeeded");
-
-               for (unsigned int i = 0; i < result->size(); i++)
-               {
-                    std::string uuid;
-                    convertUUIDToString(result->at(i).deviceId.id, uuid);
-
-                    OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG,
-                        "Result is = %d for device %s",  result->at(i).res, uuid.c_str());
-               }
-               removeDeviceResult = true;
-            }
-            m_cond.notify_all();
-        }
-
-        bool EnrolleeSecurity::isOwnedDeviceRegisteredInSVRDB()
-        {
-            OCStackResult res = OC_STACK_ERROR;
-
-            OCUuidList_t *uuidList = NULL;
-            size_t numOfDevices = 0;
-
-            res = PDMGetOwnedDevices(&uuidList, &numOfDevices);
-            if (OC_STACK_OK != res)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while getting info from DB");
-                return false;
-            }
-
-            OCUuidList_t *pUuidList = uuidList;
-            while (pUuidList)
-            {
-                std::string uuid;
-                convertUUIDToString(pUuidList->dev.id, uuid);
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG,
-                    "m_ocResource->sid(): %s, cur DB UUID %s",
-                    m_ocResource->sid().c_str(), uuid.c_str());
-                if(m_ocResource->sid() == uuid.c_str())
-                {
-                    OICFree(uuidList);
-                    return true;
-                }
-                pUuidList = pUuidList->next;
-            }
-            OICFree(uuidList);
-            return false;
-        }
-
-
-        std::string EnrolleeSecurity::getUUID() const
-        {
-            return m_ocResource->sid();
-        };
-
-#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-        ESResult EnrolleeSecurity::provisionSecurityForCloudServer(
-            std::string cloudUuid, int credId)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "provisionSecurityForCloudServer IN");
-
-            ESResult res = ESResult::ES_ERROR;
-
-            // Need to discover Owned device in a given network, again
-            std::shared_ptr< OC::OCSecureResource > ownedDevice = NULL;
-
-            OCStackResult result;
-            OicUuid_t uuid;
-            if(OC_STACK_OK != ConvertStrToUuid(m_ocResource->sid().c_str(), &uuid))
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Convert to uuid from deviceID failed.");
-                return res;
-            }
-
-
-            result = OCSecure::discoverSingleDevice(ES_SEC_DISCOVERY_TIMEOUT,
-                                                    &uuid,
-                                                    ownedDevice);
-            if (result != OC_STACK_OK)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "secureResource Discovery failed.");
-                res = ESResult::ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-                return res;
-            }
-            else if (ownedDevice)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Secured resource is found.");
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "HOST: %s", ownedDevice->getDevAddr().c_str());
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "SID: %s", ownedDevice->getDeviceID().c_str());
-                OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Owned status: %d", ownedDevice->getOwnedStatus());
-
-                if (ownedDevice->getOwnedStatus())
-                {
-                    if(!isOwnedDeviceRegisteredInSVRDB())
-                    {
-                        OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "The found device is not one in SVR DB");
-                        res = ESResult::ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-                        return res;
-                    }
-                }
-                else
-                {
-                    OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "The found device is unowned.");
-                    OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Ownerthip transfer is required.");
-
-                    res = ESResult::ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-                    return res;
-                }
-            }
-            else
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No secure resource is found");
-                res = ESResult::ES_SECURE_RESOURCE_DISCOVERY_FAILURE;
-                return res;
-            }
-
-            if(cloudUuid.empty())
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG,
-                         "ACL provisioning is skipped due to empty UUID of cloud server");
-            }
-            else
-            {
-                res = performACLProvisioningForCloudServer(ownedDevice, cloudUuid);
-                if(res != ESResult::ES_OK)
-                {
-                    OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "error performACLProvisioningForCloudServer");
-                    return res;
-                }
-            }
-
-            if(credId < 1)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG,
-                         "Cert. provisioning is skipped due to wrong cred ID (<1)");
-            }
-            else
-            {
-                res = performCertProvisioningForCloudServer(ownedDevice, credId);
-                if(res != ESResult::ES_OK)
-                {
-                    OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "error performCertProvisioningForCloudServer");
-                    return res;
-                }
-            }
-
-            return res;
-        }
-
-        ESResult EnrolleeSecurity::performCertProvisioningForCloudServer(
-            std::shared_ptr< OC::OCSecureResource > ownedDevice, int credId)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "performCertProvisioningForCloudServer IN");
-
-            ESResult res = ESResult::ES_CERT_PROVISIONING_FAILURE;
-
-            if(!ownedDevice)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Given ownedDevice is null");
-                return res;
-            }
-
-            OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Given CredId: %d", credId);
-
-            OC::ResultCallBack CertProvisioningCb = std::bind(
-                            &EnrolleeSecurity::CertProvisioningCb, this, std::placeholders::_1,
-                            std::placeholders::_2);
-            OCStackResult rst = ownedDevice->provisionTrustCertChain(SIGNED_ASYMMETRIC_KEY,
-                                                                    static_cast<uint16_t>(credId),
-                                                                    CertProvisioningCb);
-            if(OC_STACK_OK != rst)
-            {
-                OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "provisionTrustCertChain error: %d", rst);
-                return res;
-            }
-
-            std::unique_lock<std::mutex> lck(m_mtx);
-            m_cond.wait(lck);
-
-            if(certResult)
-            {
-                res = ESResult::ES_OK;
-            }
-
-            return res;
-        }
-
-        ESResult EnrolleeSecurity::performACLProvisioningForCloudServer(
-            std::shared_ptr< OC::OCSecureResource > ownedDevice, std::string& cloudUuid)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "performACLProvisioningForCloudServer IN");
-
-            ESResult res = ESResult::ES_ACL_PROVISIONING_FAILURE;
-
-            if(!ownedDevice)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Given ownedDevice is null");
-                return res;
-            }
-
-            OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Given cloudUuid: %s", cloudUuid.c_str());
-
-            OicUuid_t uuid;
-            if(OC_STACK_OK != ConvertStrToUuid(cloudUuid.c_str(), &uuid))
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Convert to uuid from deviceID failed.");
-                return res;
-            }
-
-
-            // Create Acl for Cloud Server to be provisioned to Enrollee
-            OicSecAcl_t* acl = createAcl(uuid);
-            if(!acl)
-            {
-                OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "createAcl error return");
-                return res;
-            }
-
-            OC::ResultCallBack aclProvisioningCb = std::bind(
-                            &EnrolleeSecurity::ACLProvisioningCb, this, std::placeholders::_1,
-                            std::placeholders::_2);
-            // ACL provisioning to Enrollee
-            OCStackResult rst = ownedDevice->provisionACL(acl, aclProvisioningCb);
-            if(OC_STACK_OK != rst)
-            {
-                OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "OCProvisionACL API error: %d", rst);
-                return res;
-            }
-
-            std::unique_lock<std::mutex> lck(m_mtx);
-            m_cond.wait(lck);
-
-            if(aclResult)
-            {
-                res = ESResult::ES_OK;
-            }
-
-            return res;
-        }
-
-        OicSecAcl_t* EnrolleeSecurity::createAcl(const OicUuid_t cloudUuid)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "creatAcl IN");
-
-            // allocate memory for |acl| struct
-            OicSecAcl_t* acl = (OicSecAcl_t*) OICCalloc(1, sizeof(OicSecAcl_t));
-            if(!acl)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
-                return NULL;  // not need to 'goto' |ERROR| before allocating |acl|
-            }
-            OicSecAce_t* ace = (OicSecAce_t*) OICCalloc(1, sizeof(OicSecAce_t));
-            if(!ace)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG,  "createAcl: OICCalloc error return");
-                return NULL;  // not need to 'goto' |ERROR| before allocating |acl|
-            }
-            LL_APPEND(acl->aces, ace);
-
-            memcpy(&ace->subjectuuid, &cloudUuid, UUID_LENGTH);
-
-            OicSecRsrc_t* rsrc = (OicSecRsrc_t*)OICCalloc(1, sizeof(OicSecRsrc_t));
-            if(!rsrc)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
-                OCDeleteACLList(acl);
-                return NULL;
-            }
-
-            char href[] = "*";
-            size_t len = strlen(href)+1;  // '1' for null termination
-            rsrc->href = (char*) OICCalloc(len, sizeof(char));
-            if(!rsrc->href)
-            {
-                OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG,  "createAcl: OICCalloc error return");
-                OCDeleteACLList(acl);
-                return NULL;
-            }
-            OICStrcpy(rsrc->href, len, href);
-
-            size_t arrLen = 1;
-            rsrc->typeLen = arrLen;
-            rsrc->types = (char**)OICCalloc(arrLen, sizeof(char*));
-            rsrc->interfaceLen = 1;
-            rsrc->interfaces = (char**)OICCalloc(arrLen, sizeof(char*));
-            rsrc->types[0] = OICStrdup("rt");   // ignore
-            rsrc->interfaces[0] = OICStrdup("if");  // ignore
-
-            LL_APPEND(ace->resources, rsrc);
-
-            ace->permission = 31;   // R/W/U/D
-
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "creatAcl OUT");
-
-            return acl;
-        }
-
-        void EnrolleeSecurity::ACLProvisioningCb(PMResultList_t *result, int hasError)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "ACLProvisioningCb IN");
-
-            if (hasError)
-            {
-               OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "ACL provisioning is failed with code (%d)", hasError);
-               aclResult = false;
-            }
-            else
-            {
-               OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Received ACL provisioning results: ");
-
-               std::string devUuid;
-               for (unsigned int i = 0; i < result->size(); i++)
-               {
-                   convertUUIDToString(result->at(i).deviceId.id, devUuid);
-                   OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d  for device %s",
-                                                           result->at(i).res, devUuid.c_str());
-               }
-               delete result;
-               aclResult = true;
-            }
-            m_cond.notify_all();
-        }
-
-        void EnrolleeSecurity::CertProvisioningCb(PMResultList_t *result, int hasError)
-        {
-            OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "CertProvisioningCb IN");
-
-            if (hasError)
-            {
-               OIC_LOG_V(ERROR, ENROLEE_SECURITY_TAG, "Cert provisioning is failed with code (%d)", hasError);
-               certResult = false;
-            }
-            else
-            {
-               OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "Received Cert. provisioning results: ");
-
-               std::string devUuid;
-               for (unsigned int i = 0; i < result->size(); i++)
-               {
-                   convertUUIDToString(result->at(i).deviceId.id, devUuid);
-                   OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d  for device %s",
-                                                           result->at(i).res, devUuid.c_str());
-               }
-               delete result;
-               certResult= true;
-            }
-            m_cond.notify_all();
-        }
-#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-    }
-}
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h
deleted file mode 100644 (file)
index 2e9b3fa..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef ENROLLEE_SECURITY_H_
-#define ENROLLEE_SECURITY_H_
-
-#include <functional>
-#include <atomic>
-#include <condition_variable>
-
-#include "ESRichCommon.h"
-#include "OCProvisioningManager.hpp"
-
-namespace OIC
-{
-    namespace Service
-    {
-        #define ENROLEE_SECURITY_TAG "ES_ENROLLEE_SECURITY"
-        #define UUID_SIZE (16)
-        #define UUID_STRING_SIZE (37)
-
-
-        class EnrolleeResource;
-        class OCSecureResource;
-
-        typedef std::vector<OCProvisionResult_t> PMResultList_t;
-
-        /**
-         * This class contains the methods needed for security  layer interaction.
-         *
-         * @see EnrolleeSecurity
-         */
-        class EnrolleeSecurity
-        {
-        public:
-            EnrolleeSecurity(std::shared_ptr< OC::OCResource > resource,
-            const std::string secDbPath);
-            ESResult provisionOwnership();
-            std::string getUUID() const;
-
-        private:
-            std::shared_ptr< OC::OCResource > m_ocResource;
-            SecurityProvStatusCb m_securityProvStatusCb;
-            SecurityPinCb m_securityPinCb;
-            SecProvisioningDbPathCb m_secProvisioningDbPathCb;
-
-            std::mutex m_mtx;
-            std::condition_variable m_cond;
-            std::atomic<bool> OTMResult;
-            std::atomic<bool> removeDeviceResult;
-            std::atomic<bool> aclResult;
-            std::atomic<bool> certResult;
-
-            std::shared_ptr< OC::OCSecureResource > m_securedResource;
-
-            ESResult performOwnershipTransfer();
-            bool isOwnedDeviceRegisteredInSVRDB();
-            void removeDeviceWithUuidCB(OC::PMResultList_t *result, int hasError);
-            void ownershipTransferCb(OC::PMResultList_t *result, int hasError);
-            void convertUUIDToString(const uint8_t uuid[UUID_SIZE],
-                                                std::string& uuidString);
-
-#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-        public:
-            ESResult provisionSecurityForCloudServer(
-                std::string cloudUuid, int credId);
-        private:
-            ESResult performCertProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                int credId);
-            ESResult performACLProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                std::string& cloudUuid);
-            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
-            void ACLProvisioningCb(PMResultList_t *result, int hasError);
-            void CertProvisioningCb(PMResultList_t *result, int hasError);
-#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-        };
-    }
-}
-
-#endif /* ENROLLEE_SECURITY_H_*/
-
diff --git a/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp b/device_core/iotivity_lib/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp
deleted file mode 100644 (file)
index 15dbf43..0000000
+++ /dev/null
@@ -1,449 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 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 "RemoteEnrollee.h"
-#include "EnrolleeResource.h"
-#include "CloudResource.h"
-#include "OCPlatform.h"
-#include "ESException.h"
-#include "logger.h"
-#include "OCResource.h"
-#ifdef __WITH_DTLS__
-#include "EnrolleeSecurity.h"
-#include "base64.h"
-#include "oic_malloc.h"
-#endif //__WITH_DTLS
-
-namespace OIC
-{
-    namespace Service
-    {
-        static const char ES_BASE_RES_URI[] = "/oic/res";
-        #define ES_REMOTE_ENROLLEE_TAG "ES_REMOTE_ENROLLEE"
-        #define DISCOVERY_TIMEOUT 1
-
-        RemoteEnrollee::RemoteEnrollee(const std::shared_ptr< OC::OCResource > resource)
-        {
-            m_ocResource = resource;
-            m_enrolleeResource = std::make_shared<EnrolleeResource>(m_ocResource);
-            m_securityProvStatusCb = nullptr;
-            m_getConfigurationStatusCb = nullptr;
-            m_securityPinCb = nullptr;
-            m_secProvisioningDbPathCb = nullptr;
-            m_devicePropProvStatusCb = nullptr;
-            m_cloudPropProvStatusCb = nullptr;
-
-            m_deviceId = resource->sid();
-        }
-
-        void RemoteEnrollee::securityStatusHandler(
-                const std::shared_ptr< SecProvisioningStatus > status) const
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "securityStatusHandlr IN");
-            OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "UUID = %s, ESResult = %d",
-                    status->getDeviceUUID().c_str(), status->getESResult());
-
-            if(status->getESResult() == ES_OK)
-            {
-                OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership transfer is successfully done.");
-                m_securityProvStatusCb(status);
-            }
-            else
-            {
-                OIC_LOG(ERROR, ES_REMOTE_ENROLLEE_TAG, "Ownership transfer is failed.");
-                m_securityProvStatusCb(status);
-            }
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "securityStatusHandlr OUT");
-        }
-
-        void RemoteEnrollee::getStatusHandler(
-                const std::shared_ptr< GetEnrolleeStatus > status) const
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getStatusHandler IN");
-
-            OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getStatusHandler = %d",
-                                                    status->getESResult());
-            m_getStatusCb(status);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getStatusHandler OUT");
-        }
-
-        void RemoteEnrollee::getConfigurationStatusHandler (
-                const std::shared_ptr< GetConfigurationStatus > status) const
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getConfigurationStatusHandler IN");
-
-            OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,"GetConfigurationStatus = %d",
-                                                    status->getESResult());
-            m_getConfigurationStatusCb(status);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getConfigurationStatusHandler OUT");
-        }
-
-        void RemoteEnrollee::devicePropProvisioningStatusHandler(
-                const std::shared_ptr< DevicePropProvisioningStatus > status) const
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "devicePropProvisioningStatusHandler IN");
-
-            OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "ProvStatus = %d", status->getESResult());
-            m_devicePropProvStatusCb(status);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "devicePropProvisioningStatusHandler OUT");
-        }
-
-        void RemoteEnrollee::cloudPropProvisioningStatusHandler (
-                const std::shared_ptr< CloudPropProvisioningStatus > status) const
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "cloudPropProvisioningStatusHandler IN");
-
-            OIC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"CloudProvStatus = %d",
-                                                    status->getESResult());
-            m_cloudPropProvStatusCb(status);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "cloudPropProvisioningStatusHandler OUT");
-        }
-
-        void RemoteEnrollee::onDiscoveredCallback(const std::shared_ptr<OC::OCResource> resource,
-            std::weak_ptr<RemoteEnrollee> this_ptr)
-        {
-            OIC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"onDiscoveredCallback()");
-            std::shared_ptr<RemoteEnrollee> Ptr = this_ptr.lock();
-            if(Ptr)
-            {
-                Ptr->onDeviceDiscovered(resource);
-            }
-        }
-
-        void RemoteEnrollee::onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource)
-        {
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_TAG, "onDeviceDiscovered IN");
-
-            try
-            {
-                if(resource)
-                {
-                    if(!(resource->connectivityType() & CT_ADAPTER_TCP))
-                    {
-                        std::string resourceURI;
-                        std::string hostAddress;
-                        std::string hostDeviceID;
-
-                        // Get the resource URI
-                        resourceURI = resource->uri();
-                        OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG,
-                                "URI of the resource: %s", resourceURI.c_str());
-
-                        // Get the resource host address
-                        hostAddress = resource->host();
-                        OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG,
-                                "Host address of the resource: %s", hostAddress.c_str());
-
-                        hostDeviceID = resource->sid();
-                        OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG,
-                                "Host DeviceID of the resource: %s", hostDeviceID.c_str());
-
-                        if(!m_deviceId.empty() && m_deviceId == hostDeviceID)
-                        {
-                            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_TAG, "Find matched resource for cloud provisioning");
-                            m_ocResource = resource;
-                            m_discoveryResponse = true;
-                            m_cond.notify_all();
-                        }
-                    }
-                }
-            }
-            catch(std::exception& e)
-            {
-                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG,
-                        "Exception in foundResource: %s", e.what());
-            }
-
-            OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_TAG, "onDeviceDiscovered OUT");
-        }
-
-        ESResult RemoteEnrollee::discoverResource()
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "discoverResource IN");
-
-            std::string query("");
-            query.append(ES_BASE_RES_URI);
-            query.append("?rt=");
-            query.append(OC_RSRVD_ES_RES_TYPE_PROV);
-
-            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG, "query = %s", query.c_str());
-
-            m_discoveryResponse = false;
-
-            onDeviceDiscoveredCb cb = std::bind(&RemoteEnrollee::onDiscoveredCallback,
-                                                std::placeholders::_1,
-                                                shared_from_this());
-
-            OCStackResult result = OC::OCPlatform::findResource("", query, CT_DEFAULT, cb);
-
-            if (result != OCStackResult::OC_STACK_OK)
-            {
-                OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
-                        "Failed discoverResource");
-                return ES_ERROR;
-            }
-
-            std::unique_lock<std::mutex> lck(m_discoverymtx);
-            m_cond.wait_for(lck, std::chrono::seconds(DISCOVERY_TIMEOUT));
-
-            if (!m_discoveryResponse)
-            {
-                OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
-                        "Failed discoverResource because timeout");
-                return ES_ERROR;
-            }
-
-            return ES_OK;
-        }
-
-        void RemoteEnrollee::provisionSecurity(const SecurityProvStatusCb callback)
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionSecurity IN");
-#ifdef __WITH_DTLS__
-            ESResult res = ESResult::ES_ERROR;
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-            m_securityProvStatusCb = callback;
-
-            SecurityProvStatusCb securityProvStatusCb = std::bind(
-                    &RemoteEnrollee::securityStatusHandler,
-                    this,
-                    std::placeholders::_1);
-            //TODO : DBPath is passed empty as of now. Need to take dbpath from application.
-            if(!m_enrolleeSecurity.get())
-            {
-                m_enrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource, "");
-            }
-
-            res = m_enrolleeSecurity->provisionOwnership();
-
-            std::shared_ptr< SecProvisioningStatus > securityProvisioningStatus =
-                            std::make_shared< SecProvisioningStatus >(m_enrolleeSecurity->getUUID(), res);
-            securityProvStatusCb(securityProvisioningStatus);
-            m_enrolleeSecurity.reset();
-#else
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG,"Mediator is unsecured built.");
-
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-            std::shared_ptr< SecProvisioningStatus > securityProvisioningStatus =
-                     std::make_shared< SecProvisioningStatus >
-                                   ("", ESResult::ES_SEC_OPERATION_IS_NOT_SUPPORTED);
-            callback(securityProvisioningStatus);
-#endif
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionSecurity OUT");
-        }
-
-        void RemoteEnrollee::getStatus(const GetStatusCb callback)
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getStatus IN");
-
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-
-            if (m_enrolleeResource == nullptr)
-            {
-                throw ESBadRequestException ("Device not created");
-            }
-
-            m_getStatusCb = callback;
-
-            GetStatusCb getStatusCb = std::bind(
-                &RemoteEnrollee::getStatusHandler, this, std::placeholders::_1);
-            m_enrolleeResource->registerGetStatusCallback(getStatusCb);
-            m_enrolleeResource->getStatus();
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getStatus OUT");
-        }
-
-        void RemoteEnrollee::getConfiguration(const GetConfigurationStatusCb callback)
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getConfiguration IN");
-
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-
-            if (m_enrolleeResource == nullptr)
-            {
-                throw ESBadRequestException ("Device not created");
-            }
-
-            m_getConfigurationStatusCb = callback;
-
-            GetConfigurationStatusCb getConfigurationStatusCb = std::bind(
-                    &RemoteEnrollee::getConfigurationStatusHandler, this, std::placeholders::_1);
-            m_enrolleeResource->registerGetConfigurationStatusCallback(getConfigurationStatusCb);
-            m_enrolleeResource->getConfiguration();
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "getConfiguration OUT");
-        }
-
-        void RemoteEnrollee::provisionDeviceProperties(const DeviceProp& deviceProp,
-                                                            const DevicePropProvStatusCb callback)
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionDeviceProperties IN");
-
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-
-            m_devicePropProvStatusCb = callback;
-
-            if (m_enrolleeResource == nullptr)
-            {
-                throw ESBadRequestException ("Device not created");
-            }
-
-            if(deviceProp.getSsid().empty())
-            {
-                throw ESBadRequestException ("Invalid Provisiong Data.");
-            }
-
-            DevicePropProvStatusCb devicePropProvStatusCb = std::bind(
-                    &RemoteEnrollee::devicePropProvisioningStatusHandler,
-                    this, std::placeholders::_1);
-
-            m_enrolleeResource->registerDevicePropProvStatusCallback(devicePropProvStatusCb);
-            m_enrolleeResource->provisionProperties(deviceProp);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionDeviceProperties OUT");
-        }
-
-        void RemoteEnrollee::initCloudResource()
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "initCloudResource IN");
-
-            ESResult result = ES_ERROR;
-
-            result = discoverResource();
-
-            if (result == ES_ERROR)
-            {
-                OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
-                                    "Failed to create resource object using discoverResource");
-                throw ESBadRequestException ("Resource object not created");
-            }
-
-            else
-            {
-                if(m_ocResource != nullptr)
-                {
-                    m_cloudResource = std::make_shared<CloudResource>(m_ocResource);
-                }
-                else
-                {
-                    throw ESBadGetException ("Resource handle is invalid");
-                }
-            }
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "initCloudResource OUT");
-        }
-
-        void RemoteEnrollee::provisionCloudProperties(const CloudProp& cloudProp,
-                                                            const CloudPropProvStatusCb callback)
-        {
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionCloudProperties IN");
-
-            if(!callback)
-            {
-                throw ESInvalidParameterException("Callback is empty");
-            }
-
-            m_cloudPropProvStatusCb = callback;
-
-            if(cloudProp.getAuthCode().empty() ||
-                cloudProp.getAuthProvider().empty() ||
-                cloudProp.getCiServer().empty())
-            {
-                throw ESBadRequestException ("Invalid Cloud Provisiong Info.");
-            }
-
-            try
-            {
-                initCloudResource();
-            }
-
-            catch (const std::exception& e)
-            {
-                OIC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_TAG,
-                    "Exception caught in provisionCloudProperties = %s", e.what());
-
-                std::shared_ptr< CloudPropProvisioningStatus > provStatus = std::make_shared<
-                        CloudPropProvisioningStatus >(ESResult::ES_ENROLLEE_DISCOVERY_FAILURE);
-                m_cloudPropProvStatusCb(provStatus);
-                return;
-            }
-#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-            if(!(cloudProp.getCloudID().empty() && cloudProp.getCredID() <= 0))
-            {
-                ESResult res = ESResult::ES_ERROR;
-                if(!m_enrolleeSecurity.get())
-                {
-                    m_enrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_ocResource, "");
-                }
-
-
-                res = m_enrolleeSecurity->provisionSecurityForCloudServer(cloudProp.getCloudID(),
-                                                                          cloudProp.getCredID());
-                m_enrolleeSecurity.reset();
-                if(res != ESResult::ES_OK)
-                {
-                    m_cloudResource = nullptr;
-                    std::shared_ptr< CloudPropProvisioningStatus > provStatus = std::make_shared<
-                            CloudPropProvisioningStatus >(res);
-                    m_cloudPropProvStatusCb(provStatus);
-                    return;
-                }
-            }
-            else
-            {
-                OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "ACL and Cert. provisioning are skipped.");
-            }
-#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
-
-            if (m_cloudResource == nullptr)
-            {
-                throw ESBadRequestException ("Cloud Resource not created");
-            }
-
-            CloudPropProvStatusCb cloudPropProvStatusCb = std::bind(
-                    &RemoteEnrollee::cloudPropProvisioningStatusHandler,
-                                    this, std::placeholders::_1);
-
-            m_cloudResource->registerCloudPropProvisioningStatusCallback(cloudPropProvStatusCb);
-            m_cloudResource->provisionProperties(cloudProp);
-
-            OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "provisionCloudProperties OUT");
-        }
-    }
-}